diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000000000000000000000000000000000000..99483af14e1e7d9904bc061eafc8cb61a0a23b28 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,7 @@ +node_modules +dist +downloads +.git +*.rar +.env +.DS_Store diff --git a/.gitattributes b/.gitattributes index a6344aac8c09253b3b630fb776ae94478aa0275b..5334f03a45d4821c06446cdfda65142040d7e303 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,35 +1,51 @@ -*.7z filter=lfs diff=lfs merge=lfs -text -*.arrow filter=lfs diff=lfs merge=lfs -text -*.bin filter=lfs diff=lfs merge=lfs -text -*.bz2 filter=lfs diff=lfs merge=lfs -text -*.ckpt filter=lfs diff=lfs merge=lfs -text -*.ftz filter=lfs diff=lfs merge=lfs -text -*.gz filter=lfs diff=lfs merge=lfs -text -*.h5 filter=lfs diff=lfs merge=lfs -text -*.joblib filter=lfs diff=lfs merge=lfs -text -*.lfs.* filter=lfs diff=lfs merge=lfs -text -*.mlmodel filter=lfs diff=lfs merge=lfs -text -*.model filter=lfs diff=lfs merge=lfs -text -*.msgpack filter=lfs diff=lfs merge=lfs -text -*.npy filter=lfs diff=lfs merge=lfs -text -*.npz filter=lfs diff=lfs merge=lfs -text -*.onnx filter=lfs diff=lfs merge=lfs -text -*.ot filter=lfs diff=lfs merge=lfs -text -*.parquet filter=lfs diff=lfs merge=lfs -text -*.pb filter=lfs diff=lfs merge=lfs -text -*.pickle filter=lfs diff=lfs merge=lfs -text -*.pkl filter=lfs diff=lfs merge=lfs -text -*.pt filter=lfs diff=lfs merge=lfs -text -*.pth filter=lfs diff=lfs merge=lfs -text -*.rar filter=lfs diff=lfs merge=lfs -text -*.safetensors filter=lfs diff=lfs merge=lfs -text -saved_model/**/* filter=lfs diff=lfs merge=lfs -text -*.tar.* filter=lfs diff=lfs merge=lfs -text -*.tar filter=lfs diff=lfs merge=lfs -text -*.tflite filter=lfs diff=lfs merge=lfs -text -*.tgz filter=lfs diff=lfs merge=lfs -text -*.wasm filter=lfs diff=lfs merge=lfs -text -*.xz filter=lfs diff=lfs merge=lfs -text -*.zip filter=lfs diff=lfs merge=lfs -text -*.zst filter=lfs diff=lfs merge=lfs -text -*tfevents* filter=lfs diff=lfs merge=lfs -text +*.7z filter=lfs diff=lfs merge=lfs -text +*.arrow filter=lfs diff=lfs merge=lfs -text +*.bin filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.ckpt filter=lfs diff=lfs merge=lfs -text +*.ftz filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.h5 filter=lfs diff=lfs merge=lfs -text +*.joblib filter=lfs diff=lfs merge=lfs -text +*.lfs.* filter=lfs diff=lfs merge=lfs -text +*.mlmodel filter=lfs diff=lfs merge=lfs -text +*.model filter=lfs diff=lfs merge=lfs -text +*.msgpack filter=lfs diff=lfs merge=lfs -text +*.npy filter=lfs diff=lfs merge=lfs -text +*.npz filter=lfs diff=lfs merge=lfs -text +*.onnx filter=lfs diff=lfs merge=lfs -text +*.ot filter=lfs diff=lfs merge=lfs -text +*.parquet filter=lfs diff=lfs merge=lfs -text +*.pb filter=lfs diff=lfs merge=lfs -text +*.pickle filter=lfs diff=lfs merge=lfs -text +*.pkl filter=lfs diff=lfs merge=lfs -text +*.pt filter=lfs diff=lfs merge=lfs -text +*.pth filter=lfs diff=lfs merge=lfs -text +*.rar filter=lfs diff=lfs merge=lfs -text +*.safetensors filter=lfs diff=lfs merge=lfs -text +saved_model/**/* filter=lfs diff=lfs merge=lfs -text +*.tar.* filter=lfs diff=lfs merge=lfs -text +*.tar filter=lfs diff=lfs merge=lfs -text +*.tflite filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.wasm filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text +*tfevents* filter=lfs diff=lfs merge=lfs -text +public/icons/@twistedbrody[[:space:]]dowload.png filter=lfs diff=lfs merge=lfs -text +public/icons/@twistedbrody.png filter=lfs diff=lfs merge=lfs -text +public/icons/1.png filter=lfs diff=lfs merge=lfs -text +public/icons/2.png filter=lfs diff=lfs merge=lfs -text +public/icons/3.png filter=lfs diff=lfs merge=lfs -text +public/icons/4.png filter=lfs diff=lfs merge=lfs -text +public/icons/icones.png filter=lfs diff=lfs merge=lfs -text +public/icons/logo.png filter=lfs diff=lfs merge=lfs -text +dist/icons/@twistedbrody[[:space:]]dowload.png filter=lfs diff=lfs merge=lfs -text +dist/icons/@twistedbrody.png filter=lfs diff=lfs merge=lfs -text +dist/icons/1.png filter=lfs diff=lfs merge=lfs -text +dist/icons/2.png filter=lfs diff=lfs merge=lfs -text +dist/icons/3.png filter=lfs diff=lfs merge=lfs -text +dist/icons/4.png filter=lfs diff=lfs merge=lfs -text +dist/icons/icones.png filter=lfs diff=lfs merge=lfs -text +dist/icons/logo.png filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..f5698f82ba73fe4d3e9efe6e185f904020ff192a --- /dev/null +++ b/.gitignore @@ -0,0 +1,23 @@ +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +dist +dist-ssr +*.local + +.vscode/* +!.vscode/extensions.json +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? +.env diff --git a/App.tsx b/App.tsx new file mode 100644 index 0000000000000000000000000000000000000000..c402a1b35e9b0562e6ec27076634975d17a7487b --- /dev/null +++ b/App.tsx @@ -0,0 +1,615 @@ + +import { Plus, Settings, Layers, User, Copy } from 'lucide-react'; +import { useState, useEffect, useMemo } from 'react'; +import { HDComicViewer } from './components/HDComicViewer'; +import { NewMangaModal } from './components/NewMangaModal'; +import { SettingsModal } from './components/SettingsModal'; +import { AnnouncementBanner } from './components/AnnouncementBanner'; +import { ComicDetail } from './components/ComicDetail'; +import { ChapterReader } from './components/ChapterReader'; +import { InfoPage } from './components/InfoPage'; +import { BulkCategoryModal } from './components/BulkCategoryModal'; +import { CategoryFilterModal } from './components/CategoryFilterModal'; +import { Category } from './types/manga'; + +import { SearchBar } from './components/SearchBar'; +import { SearchResults } from './components/SearchResults'; +import { Toaster, toast } from 'sonner'; +import { getAllMangas, deleteManga } from './services/manga'; +import { Manga, Chapter } from './types/manga'; +import { searchItems } from './utils/searchUtils'; +import { GlobalFooter } from './components/GlobalFooter'; + +type SortType = 'random' | 'name' | 'date' | 'pages' | 'modified' | 'views'; +type SortDirection = 'asc' | 'desc'; + +function App() { + const [showModal, setShowModal] = useState(false); + const [showSettingsModal, setShowSettingsModal] = useState(false); + const [showFilterModal, setShowFilterModal] = useState(false); + const [isAdmin, setIsAdmin] = useState(false); + const [editingManga, setEditingManga] = useState(null); + const [isCategoryPlusEnabled, setIsCategoryPlusEnabled] = useState(false); + const [isCopyIdsEnabled, setIsCopyIdsEnabled] = useState(false); + const [selectedMangaIds, setSelectedMangaIds] = useState([]); + const [showBulkModal, setShowBulkModal] = useState(false); + const [selectedComicId, setSelectedComicId] = useState(null); + const [navigationHistory, setNavigationHistory] = useState([]); + const [selectedChapter, setSelectedChapter] = useState<{ manga: Manga; chapter: Chapter } | null>(null); + const [mangas, setMangas] = useState([]); + const [showHD, setShowHD] = useState(false); + const [showInfo, setShowInfo] = useState(false); + const [loading, setLoading] = useState(true); + const [searchTerm, setSearchTerm] = useState(''); + const [selectedCategories, setSelectedCategories] = useState([]); + const [selectedAuthors, setSelectedAuthors] = useState([]); + const [sortType, setSortType] = useState(() => + (localStorage.getItem('sortType') as SortType) || 'modified' + ); + const [sortDirection, setSortDirection] = useState(() => + (localStorage.getItem('sortDirection') as SortDirection) || 'desc' + ); + + useEffect(() => { + // Check for admin mode via URL query parameter + const searchParams = new URLSearchParams(window.location.search); + const isAdminMode = searchParams.get('admin') === 'true'; + setIsAdmin(isAdminMode); + }, []); + + useEffect(() => { + localStorage.setItem('sortType', sortType); + }, [sortType]); + + useEffect(() => { + localStorage.setItem('sortDirection', sortDirection); + }, [sortDirection]); + + useEffect(() => { + // Initialize Telegram Web App + // @ts-expect-error Window interface is extended in vite-env.d.ts + if (window.Telegram?.WebApp) { + // @ts-expect-error Window interface is extended in vite-env.d.ts + window.Telegram.WebApp.ready(); + } + loadMangas(); + + const hash = window.location.hash.slice(1); + if (hash && hash.startsWith('manga/')) { + if (hash.endsWith('/hd')) { + const mangaId = hash.replace('manga/', '').replace('/hd', ''); + setSelectedComicId(mangaId); + setShowHD(true); + } else { + const mangaId = hash.replace('manga/', ''); + setSelectedComicId(mangaId); + setShowHD(false); + } + } else if (hash === 'info') { + setShowInfo(true); + } + + const handleHashChange = () => { + const hash = window.location.hash.slice(1); + if (!hash) { + setSelectedComicId(null); + setSelectedChapter(null); + setShowInfo(false); + setShowHD(false); + } else if (hash.startsWith('manga/')) { + if (hash.endsWith('/hd')) { + const mangaId = hash.replace('manga/', '').replace('/hd', ''); + setSelectedComicId(mangaId); + setShowHD(true); + } else { + const mangaId = hash.replace('manga/', ''); + setSelectedComicId(mangaId); + setShowHD(false); + } + setSelectedChapter(null); + setShowInfo(false); + } else if (hash === 'info') { + setShowInfo(true); + setSelectedComicId(null); + setSelectedChapter(null); + } + }; + + window.addEventListener('hashchange', handleHashChange); + return () => window.removeEventListener('hashchange', handleHashChange); + }, []); + + useEffect(() => { + if (!isCategoryPlusEnabled && !isCopyIdsEnabled) { + setSelectedMangaIds([]); + } + }, [isCategoryPlusEnabled, isCopyIdsEnabled]); + + async function loadMangas() { + try { + setLoading(true); + const data = await getAllMangas(); + setMangas(data); + } catch (error) { + console.error('Error loading mangas:', error); + } finally { + setLoading(false); + } + } + + const allCategories = useMemo(() => { + const categoriesMap = new Map(); + mangas.forEach(manga => { + manga.categories?.forEach(cat => { + if (!categoriesMap.has(cat.id)) { + categoriesMap.set(cat.id, cat); + } + }); + }); + return Array.from(categoriesMap.values()); + }, [mangas]); + + const searchResult = useMemo(() => { + if (!searchTerm.trim()) { + return { items: mangas, query: '', resultCount: mangas.length }; + } + return searchItems( + mangas.map(m => ({ + id: m.id, + title: m.title, + author: m.author, + categories: m.categories ? m.categories.map(c => c.name) : [] + })), + searchTerm, + { fuzzyMatch: true, minChars: 1 } + ); + }, [mangas, searchTerm]); + + const filteredMangas = useMemo(() => { + let items = searchResult.items.length > 0 + ? searchResult.items.map(item => mangas.find(m => m.id === item.id)).filter(Boolean) as Manga[] + : []; + + if (selectedCategories.length > 0) { + items = items.filter(m => + selectedCategories.some(selCat => m.categories?.some(c => c.name === selCat)) + ); + } + + if (selectedAuthors.length > 0) { + items = items.filter(m => + selectedAuthors.includes(m.author) + ); + } + + const sorted = [...items]; + + if (sortType === 'random') { + return sorted.sort(() => Math.random() - 0.5); + } + + sorted.sort((a, b) => { + let compareValue = 0; + + if (sortType === 'name') { + compareValue = a.title.localeCompare(b.title); + } else if (sortType === 'date') { + const dateA = new Date(a.created_at || 0).getTime(); + const dateB = new Date(b.created_at || 0).getTime(); + compareValue = dateA - dateB; + } else if (sortType === 'modified') { + const dateA = new Date(a.updated_at || a.created_at || 0).getTime(); + const dateB = new Date(b.updated_at || b.created_at || 0).getTime(); + compareValue = dateA - dateB; + } else if (sortType === 'pages') { + const pagesA = a.chapters?.reduce((sum: number, ch: any) => sum + (ch.pages?.length || 0), 0) || 0; + const pagesB = b.chapters?.reduce((sum: number, ch: any) => sum + (ch.pages?.length || 0), 0) || 0; + compareValue = pagesA - pagesB; + } else if (sortType === 'views') { + compareValue = (a.views || 0) - (b.views || 0); + } + + return sortDirection === 'asc' ? compareValue : -compareValue; + }); + + return sorted; + }, [mangas, searchTerm, searchResult.items, sortType, sortDirection, selectedCategories, selectedAuthors]); + + const handleEditManga = (manga: Manga) => { + setEditingManga(manga); + setShowModal(true); + }; + + const handleDeleteManga = async (mangaId: string) => { + try { + await deleteManga(mangaId); + await loadMangas(); + } catch (error) { + console.error('Error deleting manga:', error); + alert('Error al eliminar el manga. Por favor intenta de nuevo.'); + } + }; + + const toggleSelectManga = (id: string, forceSelect?: boolean) => { + setSelectedMangaIds(prev => { + const isSelected = prev.includes(id); + const shouldSelect = forceSelect !== undefined ? forceSelect : !isSelected; + if (shouldSelect) { + return isSelected ? prev : [...prev, id]; + } else { + return prev.filter(mId => mId !== id); + } + }); + }; + + const handleSelectComic = (mangaId: string) => { + if (isCategoryPlusEnabled || isCopyIdsEnabled) { + toggleSelectManga(mangaId); + return; + } + window.location.hash = `manga/${mangaId}`; + setSelectedComicId(mangaId); + setShowHD(false); + }; + + const handleBackToHome = () => { + window.location.hash = ''; + setSelectedComicId(null); + setShowInfo(false); + setShowHD(false); + window.scrollTo({ top: 0, behavior: 'smooth' }); + }; + + const handleNavigateToManga = (newMangaId: string) => { + if (selectedComicId) { + setNavigationHistory([...navigationHistory, selectedComicId]); + } + window.location.hash = `manga/${newMangaId}`; + setSelectedComicId(newMangaId); + }; + + const handleSelectCategory = (category: string) => { + setSelectedCategories(prev => { + if (prev.includes(category)) { + return prev.filter(c => c !== category); + } + return [...prev, category]; + }); + handleBackToHome(); + }; + + const handleRemoveCategory = (category: string) => { + setSelectedCategories(prev => prev.filter(c => c !== category)); + }; + + const handleSelectAuthor = (author: string) => { + setSelectedAuthors(prev => { + if (prev.includes(author)) { + return prev.filter(c => c !== author); + } + return [...prev, author]; + }); + handleBackToHome(); + }; + + const handleRemoveAuthor = (author: string) => { + setSelectedAuthors(prev => prev.filter(c => c !== author)); + }; + + const mangaItems = useMemo(() => filteredMangas.map(manga => { + const chapterCount = manga.chapters?.length || 0; + const totalPages = manga.chapters?.reduce((sum: number, ch: any) => sum + (ch.pages?.length || 0), 0) || 0; + return { + id: manga.id, + title: manga.title, + author: manga.author, + chapterCount, + pageCount: totalPages, + thumbnail: manga.cover_url || manga.thumbnail_url || undefined, + manga, + }; + }), [filteredMangas]); + + if (selectedChapter) { + return ( + setSelectedChapter(null)} + /> + ); + } + + if (showInfo) { + return ; + } + + if (selectedComicId !== null) { + let currentManga = mangas.find(m => m.id === selectedComicId); + + if (showHD && currentManga) { + return ( + { + window.history.back(); + // Fallback if history back doesn't work or we want explicit control: + // window.location.hash = `manga/${selectedComicId}`; + }} + /> + ); + } + + return ( + { + if (navigationHistory.length > 0) { + const previousId = navigationHistory[navigationHistory.length - 1]; + setNavigationHistory(navigationHistory.slice(0, -1)); + window.location.hash = `manga/${previousId}`; + setSelectedComicId(previousId); + } else { + handleBackToHome(); + } + }} + onReadChapter={(chapter) => { + if (currentManga) { + setSelectedChapter({ manga: currentManga, chapter }); + } + }} + onMangaLoaded={(loadedManga) => { + if (!currentManga) { + currentManga = loadedManga; + } + }} + onNavigateToManga={handleNavigateToManga} + onSelectCategory={handleSelectCategory} + onSelectAuthor={handleSelectAuthor} + isAdmin={isAdmin} + searchTerm={searchTerm} + onSearchChange={(val) => { + setSearchTerm(val); + if (val && val.trim() !== '') { + // Force return to home to show results + handleBackToHome(); + } + }} + /> + ); + } + + return ( +
+
+
+
+ Twisted Brody Logo +

+ Twisted Brody MangaFlow +

+
+
+ {(isCategoryPlusEnabled || isCopyIdsEnabled) && ( +
+ + + {isCopyIdsEnabled ? 'Modo Copiar Activo' : 'Modo Plus Activo'} + + + {selectedMangaIds.length} + +
+ )} + {isAdmin && ( + <> + + + + )} +
+
+
+ +
+ + +
+ setShowFilterModal(true)} + /> + {searchTerm && ( +
+ {searchResult.resultCount} resultado{searchResult.resultCount !== 1 ? 's' : ''} encontrado{searchResult.resultCount !== 1 ? 's' : ''} +
+ )} + + {(selectedCategories.length > 0 || selectedAuthors.length > 0) && ( +
+ Filtrado por: + {selectedCategories.map(cat => ( + + ))} + {selectedAuthors.map(auth => ( + + ))} + {(selectedCategories.length > 0 || selectedAuthors.length > 0) && ( + + )} +
+ )} +
+ +
+ {false ? ( +
+ ) : ( + <> + + + + )} +
+
+ + {/* Bulk Action Bar */} + {(isCategoryPlusEnabled || isCopyIdsEnabled) && selectedMangaIds.length > 0 && ( +
+
+
+ {selectedMangaIds.length} seleccionados + Listos para acción +
+
+ +
+ {isCategoryPlusEnabled && ( + + )} + {isCopyIdsEnabled && ( + + )} +
+
+
+ )} + + + + { + setShowModal(false); + setEditingManga(null); + }} + editingManga={editingManga} + onMangaCreated={(mangaId) => { + loadMangas(); + setEditingManga(null); + if (mangaId && !editingManga) { + setTimeout(() => { + handleSelectComic(mangaId); + }, 500); + } + }} + onDelete={isAdmin ? handleDeleteManga : undefined} + /> + + setShowBulkModal(false)} + selectedMangaIds={selectedMangaIds} + onSaveComplete={() => { + loadMangas(); + setSelectedMangaIds([]); + }} + /> + + setShowSettingsModal(false)} + isAdmin={isAdmin} + onAdminChange={setIsAdmin} + isCategoryPlusEnabled={isCategoryPlusEnabled} + onCategoryPlusChange={setIsCategoryPlusEnabled} + isCopyIdsEnabled={isCopyIdsEnabled} + onCopyIdsChange={setIsCopyIdsEnabled} + /> + + setShowFilterModal(false)} + categories={allCategories} + selectedCategories={selectedCategories} + onToggleCategory={handleSelectCategory} + onClearFilters={() => setSelectedCategories([])} + /> + +
+ ); +} + +export default App; + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..e73f0dd48b93e7f938f2b70883c141e0162abebf --- /dev/null +++ b/Dockerfile @@ -0,0 +1,42 @@ +# 1. Usar Node 20 +FROM node:20-slim + +# 2. Instalar Python, pip y dependencias de sistema para PDF/Imágenes +RUN apt-get update && apt-get install -y \ + python3 \ + python3-pip \ + python3-full \ + build-essential \ + libvips-dev \ + && rm -rf /var/lib/apt/lists/* + +WORKDIR /app + +# 3. Copiar archivos de dependencias primero (para cache) +COPY package.json package-lock.json* ./ +COPY requirements.txt ./ + +# 4. Instalar dependencias de Node (incluyendo devDeps para el build) +RUN npm install + +# 5. Instalar dependencias de Python +# Usamos --break-system-packages porque en imágenes nuevas de Debian/Ubuntu es necesario +RUN pip3 install --no-cache-dir --break-system-packages -r requirements.txt + +# 6. Copiar todo el código +COPY . . + +# 7. IMPORTANTE: Construir el Frontend +# Si tienes errores de TypeScript, podrías usar: RUN npm run build || true (solo para debug) +RUN npm run build + +# 8. Permisos para carpetas de descargas +RUN mkdir -p downloads && chmod 777 downloads + +# 9. Hugging Face usa el puerto 7860 por defecto +ENV PORT=7860 +EXPOSE 7860 + +# 10. Comando para arrancar el servidor de Node +# Asegúrate de que tu server.js escuche en el puerto process.env.PORT +CMD ["node", "server.js"] diff --git a/README.md b/README.md index eb4aa23981900ff171e133378c9af86861fc1463..fa67447fba1fc75107a2f498c22a3b21ecd0c854 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,11 @@ ---- -title: TwistedStreamingBrody -emoji: 🚀 -colorFrom: purple -colorTo: red -sdk: docker -pinned: false ---- - -Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference +--- +title: Twisted Streaming Brody +emoji: 🏢 +colorFrom: pink +colorTo: blue +sdk: docker +pinned: false +--- +# Twisted Streaming Brody + +Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference diff --git a/add_grok.js b/add_grok.js new file mode 100644 index 0000000000000000000000000000000000000000..e9bb34fe0996ca6dbe2914b1e63ccc29ebe80b9c --- /dev/null +++ b/add_grok.js @@ -0,0 +1,28 @@ +import fs from 'fs'; + +const files = [ + 'src/types/manga.ts', + 'src/services/manga.ts', + 'src/components/SettingsModal.tsx', + 'src/components/SearchResults.tsx', + 'src/components/NewMangaModal.tsx', + 'src/components/NavigationDrawer.tsx', + 'src/components/MoveSectionModal.tsx', + 'src/components/CreateFolderModal.tsx', + 'src/components/MangaCard.tsx', + 'src/App.tsx' +]; + +files.forEach(f => { + let content = fs.readFileSync(f, 'utf8'); + // Type change + content = content.replace(/'flow' \| 'patreon' \| 'onlyfans'/g, "'flow' | 'patreon' | 'onlyfans' | 'grok'"); + + if (f === 'src/App.tsx') { + content = content.replace(/sec === 'flow' \|\| sec === 'patreon' \|\| sec === 'onlyfans'/g, "sec === 'flow' || sec === 'patreon' || sec === 'onlyfans' || sec === 'grok'"); + } + + fs.writeFileSync(f, content); +}); + +console.log('done replace types'); diff --git a/check_db.js b/check_db.js new file mode 100644 index 0000000000000000000000000000000000000000..85029563a8a66b913e9a2b57712c4855d406e387 --- /dev/null +++ b/check_db.js @@ -0,0 +1,28 @@ +import { initializeApp } from 'firebase/app'; +import { getFirestore, collection, getDocs } from 'firebase/firestore'; + +const firebaseConfig = { + apiKey: "AIzaSyAH3jvbe0_QLzIuuv5kTMK8246HNvohvfE", + authDomain: "twistedbrody-9d163.firebaseapp.com", + projectId: "twistedbrody-9d163", + storageBucket: "twistedbrody-9d163.firebasestorage.app", + messagingSenderId: "733213514129", + appId: "1:733213514129:web:e9694684f5c3994ed06230", + measurementId: "G-N8TQ7MY42W" +}; + +const app = initializeApp(firebaseConfig); +const db = getFirestore(app); + +async function run() { + const q = collection(db, "chapters"); + const snapshot = await getDocs(q); + if (!snapshot.empty) { + const doc = snapshot.docs[0]; + const data = doc.data(); + console.log("Manga ID:", data.manga_id || data.mangaId); + console.log("Original Pages:", data.original_pages?.slice(0, 2)); + console.log("Pages:", data.pages?.slice(0, 2)); + } +} +run(); diff --git a/check_db.ts b/check_db.ts new file mode 100644 index 0000000000000000000000000000000000000000..7f6b908812ca346b3ce2628015970449a669b230 --- /dev/null +++ b/check_db.ts @@ -0,0 +1,44 @@ +import { initializeApp } from 'firebase/app'; +import { getFirestore, collection, getDocs, query, orderBy, limit } from 'firebase/firestore'; + +const firebaseConfig = { + apiKey: "AIzaSyAH3jvbe0_QLzIuuv5kTMK8246HNvohvfE", + authDomain: "twistedbrody-9d163.firebaseapp.com", + projectId: "twistedbrody-9d163", + storageBucket: "twistedbrody-9d163.firebasestorage.app", + messagingSenderId: "733213514129", + appId: "1:733213514129:web:e9694684f5c3994ed06230", + measurementId: "G-N8TQ7MY42W" +}; + +const app = initializeApp(firebaseConfig); +const db = getFirestore(app); + +async function check() { + console.log("Fetching mangas from DB..."); + const q = query(collection(db, 'mangas'), orderBy('created_at', 'desc'), limit(3)); + const snap = await getDocs(q); + + if (snap.empty) { + console.log("NO MANGAS IN DB!"); + } else { + snap.forEach(doc => { + console.log(`Manga ${doc.id}: ${doc.data().title}`); + console.log(JSON.stringify(doc.data(), null, 2)); + }); + } + + console.log("\nFetching chapters..."); + const q2 = query(collection(db, 'chapters'), orderBy('created_at', 'desc'), limit(3)); + const snap2 = await getDocs(q2); + if (snap2.empty) { + console.log("NO CHAPTERS IN DB!"); + } else { + snap2.forEach(doc => { + console.log(`Chapter ${doc.id}: ${doc.data().title}`); + console.log(JSON.stringify(doc.data(), null, 2)); + }); + } +} + +check().catch(console.error).finally(() => process.exit(0)); diff --git a/converter.py b/converter.py new file mode 100644 index 0000000000000000000000000000000000000000..2c32b70aca63ad66c1dbeec70a1a85341cce2b27 --- /dev/null +++ b/converter.py @@ -0,0 +1,50 @@ +import img2pdf +import requests +import sys +import json +import os +from concurrent.futures import ThreadPoolExecutor + +def download_image(args): + url, index, total = args + try: + response = requests.get(url, timeout=15, headers={'User-Agent': 'Mozilla/5.0'}) + if response.status_code == 200: + # Imprimimos progreso para Node.js + print(f"PROGRESS:IMAGE_DONE", flush=True) + return index, response.content + except Exception as e: + print(f"DEBUG: Error en imagen {index}: {e}", flush=True) + return index, None + +def create_pdf(urls, output_name): + total = len(urls) + print(f"DEBUG: Iniciando descarga paralela de {total} imágenes...", flush=True) + + # Descarga en paralelo (50 hilos a la vez para saturar la conexión) + # Esto es lo que lo hace igual de rápido que el ZIP + with ThreadPoolExecutor(max_workers=50) as executor: + results = list(executor.map(download_image, [(url, i, total) for i, url in enumerate(urls)])) + + # Ordenamos las imágenes por su índice original para que el manga no esté desordenado + results.sort(key=lambda x: x[0]) + img_data = [data for index, data in results if data is not None] + + if img_data: + print("DEBUG: Empaquetando PDF...", flush=True) + with open(output_name, "wb") as f: + # img2pdf es ultra rápido porque no re-comprime + f.write(img2pdf.convert(img_data)) + print("STATUS:SUCCESS", flush=True) + else: + print("STATUS:ERROR", flush=True) + +if __name__ == "__main__": + try: + input_data = sys.stdin.read() + if not input_data: + sys.exit(1) + data = json.loads(input_data) + create_pdf(data['urls'], data['output']) + except Exception as e: + print(f"DEBUG: Error crítico: {e}", flush=True) diff --git a/debug_firestore.ts b/debug_firestore.ts new file mode 100644 index 0000000000000000000000000000000000000000..e0ae7e16f5e436c50136184b8cc8b607ee3fdc6c --- /dev/null +++ b/debug_firestore.ts @@ -0,0 +1,46 @@ + +import { initializeApp } from "firebase/app"; +import { getFirestore, collection, getDocs, orderBy, query } from "firebase/firestore"; + +const firebaseConfig = { + apiKey: "AIzaSyAH3jvbe0_QLzIuuv5kTMK8246HNvohvfE", + authDomain: "twistedbrody-9d163.firebaseapp.com", + projectId: "twistedbrody-9d163", + storageBucket: "twistedbrody-9d163.firebasestorage.app", + messagingSenderId: "733213514129", + appId: "1:733213514129:web:e9694684f5c3994ed06230", + measurementId: "G-N8TQ7MY42W" +}; + +const app = initializeApp(firebaseConfig); +const db = getFirestore(app); + +async function checkDB() { + console.log("--- DEBUGGING FIRESTORE ---"); + try { + const mangasRef = collection(db, 'mangas'); + + // 1. Count Total (Raw) + const snapshotRaw = await getDocs(mangasRef); + console.log(`[RAW CHECK] Total Documents in 'mangas': ${snapshotRaw.size}`); + + if (snapshotRaw.size > 0) { + console.log("Sample ID:", snapshotRaw.docs[0].id); + console.log("Sample Data:", snapshotRaw.docs[0].data()); + } + + // 2. Count with Query (orderBy) + try { + const q = query(mangasRef, orderBy('created_at', 'desc')); + const snapshotQuery = await getDocs(q); + console.log(`[QUERY CHECK] Documents with orderBy('created_at'): ${snapshotQuery.size}`); + } catch (e) { + console.error("[QUERY FAIL] orderBy failed. Likely missing index or field:", e.message); + } + + } catch (error) { + console.error("CRITICAL ERROR:", error); + } +} + +checkDB(); diff --git a/deploy_git.bat b/deploy_git.bat new file mode 100644 index 0000000000000000000000000000000000000000..5d04582fc4b16d8d9c8dfc49cb0d2f34e81660b9 --- /dev/null +++ b/deploy_git.bat @@ -0,0 +1,17 @@ +@echo off +echo Inicializando repositorio... +git init +echo Configurando usuario... +git config user.name "CodeByDante" +git config user.email "codebydante@users.noreply.github.com" +echo Añadiendo archivos... +git add . +echo Committing... +git commit -m "feat: Update Project via Agent" +echo Configurando rama y remote... +git branch -M main +git remote remove origin +git remote add origin https://github.com/CodeByDante/twisted-brody-MangaFlow.git +echo Intentando push (puede requerir autenticacion)... +git push -u origin main --force +pause diff --git a/dist/assets/index-B6p1GwGs.js b/dist/assets/index-B6p1GwGs.js new file mode 100644 index 0000000000000000000000000000000000000000..b3e849f2011d0b67f8f8be44fab415bc82e6160b --- /dev/null +++ b/dist/assets/index-B6p1GwGs.js @@ -0,0 +1,3562 @@ +(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();var qu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function zc(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var bw={exports:{}},Bc={},Ew={exports:{}},Ve={};/** + * @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 ml=Symbol.for("react.element"),NS=Symbol.for("react.portal"),AS=Symbol.for("react.fragment"),PS=Symbol.for("react.strict_mode"),RS=Symbol.for("react.profiler"),DS=Symbol.for("react.provider"),jS=Symbol.for("react.context"),LS=Symbol.for("react.forward_ref"),OS=Symbol.for("react.suspense"),MS=Symbol.for("react.memo"),VS=Symbol.for("react.lazy"),Ry=Symbol.iterator;function FS(t){return t===null||typeof t!="object"?null:(t=Ry&&t[Ry]||t["@@iterator"],typeof t=="function"?t:null)}var Iw={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Sw=Object.assign,Tw={};function jo(t,e,n){this.props=t,this.context=e,this.refs=Tw,this.updater=n||Iw}jo.prototype.isReactComponent={};jo.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=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,t,e,"setState")};jo.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function kw(){}kw.prototype=jo.prototype;function Dp(t,e,n){this.props=t,this.context=e,this.refs=Tw,this.updater=n||Iw}var jp=Dp.prototype=new kw;jp.constructor=Dp;Sw(jp,jo.prototype);jp.isPureReactComponent=!0;var Dy=Array.isArray,Cw=Object.prototype.hasOwnProperty,Lp={current:null},Nw={key:!0,ref:!0,__self:!0,__source:!0};function Aw(t,e,n){var r,i={},s=null,o=null;if(e!=null)for(r in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(s=""+e.key),e)Cw.call(e,r)&&!Nw.hasOwnProperty(r)&&(i[r]=e[r]);var a=arguments.length-2;if(a===1)i.children=n;else if(1>>1,ye=K[fe];if(0>>1;fei(J,N))tei(Ie,J)?(K[fe]=Ie,K[te]=N,fe=te):(K[fe]=J,K[H]=N,fe=H);else if(tei(Ie,N))K[fe]=Ie,K[te]=N,fe=te;else break e}}return ie}function i(K,ie){var N=K.sortIndex-ie.sortIndex;return N!==0?N:K.id-ie.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();t.unstable_now=function(){return o.now()-a}}var u=[],c=[],f=1,h=null,p=3,m=!1,b=!1,S=!1,P=typeof setTimeout=="function"?setTimeout:null,y=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function T(K){for(var ie=n(c);ie!==null;){if(ie.callback===null)r(c);else if(ie.startTime<=K)r(c),ie.sortIndex=ie.expirationTime,e(u,ie);else break;ie=n(c)}}function L(K){if(S=!1,T(K),!b)if(n(u)!==null)b=!0,le(F);else{var ie=n(c);ie!==null&&ve(L,ie.startTime-K)}}function F(K,ie){b=!1,S&&(S=!1,y(x),x=-1),m=!0;var N=p;try{for(T(ie),h=n(u);h!==null&&(!(h.expirationTime>ie)||K&&!C());){var fe=h.callback;if(typeof fe=="function"){h.callback=null,p=h.priorityLevel;var ye=fe(h.expirationTime<=ie);ie=t.unstable_now(),typeof ye=="function"?h.callback=ye:h===n(u)&&r(u),T(ie)}else r(u);h=n(u)}if(h!==null)var R=!0;else{var H=n(c);H!==null&&ve(L,H.startTime-ie),R=!1}return R}finally{h=null,p=N,m=!1}}var D=!1,_=null,x=-1,E=5,k=-1;function C(){return!(t.unstable_now()-kK||125fe?(K.sortIndex=N,e(c,K),n(u)===null&&K===n(c)&&(S?(y(x),x=-1):S=!0,ve(L,N-fe))):(K.sortIndex=ye,e(u,K),b||m||(b=!0,le(F))),K},t.unstable_shouldYield=C,t.unstable_wrapCallback=function(K){var ie=p;return function(){var N=p;p=ie;try{return K.apply(this,arguments)}finally{p=N}}}})(Lw);jw.exports=Lw;var YS=jw.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 XS=V,Fn=YS;function X(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Xh=Object.prototype.hasOwnProperty,JS=/^[: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]*$/,Ly={},Oy={};function ZS(t){return Xh.call(Oy,t)?!0:Xh.call(Ly,t)?!1:JS.test(t)?Oy[t]=!0:(Ly[t]=!0,!1)}function eT(t,e,n,r){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function tT(t,e,n,r){if(e===null||typeof e>"u"||eT(t,e,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function pn(t,e,n,r,i,s,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=s,this.removeEmptyString=o}var Jt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Jt[t]=new pn(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Jt[e]=new pn(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Jt[t]=new pn(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Jt[t]=new pn(t,2,!1,t,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(t){Jt[t]=new pn(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Jt[t]=new pn(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Jt[t]=new pn(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Jt[t]=new pn(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Jt[t]=new pn(t,5,!1,t.toLowerCase(),null,!1,!1)});var Mp=/[\-:]([a-z])/g;function Vp(t){return t[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(t){var e=t.replace(Mp,Vp);Jt[e]=new pn(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(Mp,Vp);Jt[e]=new pn(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(Mp,Vp);Jt[e]=new pn(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Jt[t]=new pn(t,1,!1,t.toLowerCase(),null,!1,!1)});Jt.xlinkHref=new pn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Jt[t]=new pn(t,1,!1,t.toLowerCase(),null,!0,!0)});function Fp(t,e,n,r){var i=Jt.hasOwnProperty(e)?Jt[e]:null;(i!==null?i.type!==0:r||!(2a||i[o]!==s[a]){var u=` +`+i[o].replace(" at new "," at ");return t.displayName&&u.includes("")&&(u=u.replace("",t.displayName)),u}while(1<=o&&0<=a);break}}}finally{eh=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?fa(t):""}function nT(t){switch(t.tag){case 5:return fa(t.type);case 16:return fa("Lazy");case 13:return fa("Suspense");case 19:return fa("SuspenseList");case 0:case 2:case 15:return t=th(t.type,!1),t;case 11:return t=th(t.type.render,!1),t;case 1:return t=th(t.type,!0),t;default:return""}}function tf(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case qs:return"Fragment";case Hs:return"Portal";case Jh:return"Profiler";case Up:return"StrictMode";case Zh:return"Suspense";case ef:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case Vw:return(t.displayName||"Context")+".Consumer";case Mw:return(t._context.displayName||"Context")+".Provider";case zp:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Bp:return e=t.displayName||null,e!==null?e:tf(t.type)||"Memo";case pi:e=t._payload,t=t._init;try{return tf(t(e))}catch{}}return null}function rT(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return tf(e);case 8:return e===Up?"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 e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function Mi(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Uw(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function iT(t){var e=Uw(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,s=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,s.call(this,o)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function Wl(t){t._valueTracker||(t._valueTracker=iT(t))}function zw(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=Uw(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function Wu(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function nf(t,e){var n=e.checked;return ft({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function Vy(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=Mi(e.value!=null?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function Bw(t,e){e=e.checked,e!=null&&Fp(t,"checked",e,!1)}function rf(t,e){Bw(t,e);var n=Mi(e.value),r=e.type;if(n!=null)r==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?sf(t,e.type,n):e.hasOwnProperty("defaultValue")&&sf(t,e.type,Mi(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function Fy(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function sf(t,e,n){(e!=="number"||Wu(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var pa=Array.isArray;function io(t,e,n,r){if(t=t.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=Gl.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Ua(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var _a={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},sT=["Webkit","ms","Moz","O"];Object.keys(_a).forEach(function(t){sT.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),_a[e]=_a[t]})});function Ww(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||_a.hasOwnProperty(t)&&_a[t]?(""+e).trim():e+"px"}function Gw(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=Ww(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,i):t[n]=i}}var oT=ft({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 lf(t,e){if(e){if(oT[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(X(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(X(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(X(61))}if(e.style!=null&&typeof e.style!="object")throw Error(X(62))}}function uf(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){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 cf=null;function $p(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var df=null,so=null,oo=null;function By(t){if(t=vl(t)){if(typeof df!="function")throw Error(X(280));var e=t.stateNode;e&&(e=Gc(e),df(t.stateNode,t.type,e))}}function Kw(t){so?oo?oo.push(t):oo=[t]:so=t}function Qw(){if(so){var t=so,e=oo;if(oo=so=null,By(t),e)for(t=0;t>>=0,t===0?32:31-(yT(t)/vT|0)|0}var Kl=64,Ql=4194304;function ma(t){switch(t&-t){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 t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Yu(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,i=t.suspendedLanes,s=t.pingedLanes,o=n&268435455;if(o!==0){var a=o&~i;a!==0?r=ma(a):(s&=o,s!==0&&(r=ma(s)))}else o=n&~i,o!==0?r=ma(o):s!==0&&(r=ma(s));if(r===0)return 0;if(e!==0&&e!==r&&!(e&i)&&(i=r&-r,s=e&-e,i>=s||i===16&&(s&4194240)!==0))return e;if(r&4&&(r|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0n;n++)e.push(t);return e}function gl(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-or(e),t[e]=n}function bT(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var r=t.eventTimes;for(t=t.expirationTimes;0=Ea),Xy=" ",Jy=!1;function m_(t,e){switch(t){case"keyup":return YT.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function g_(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Ws=!1;function JT(t,e){switch(t){case"compositionend":return g_(e);case"keypress":return e.which!==32?null:(Jy=!0,Xy);case"textInput":return t=e.data,t===Xy&&Jy?null:t;default:return null}}function ZT(t,e){if(Ws)return t==="compositionend"||!Xp&&m_(t,e)?(t=f_(),Eu=Kp=_i=null,Ws=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=n0(n)}}function w_(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?w_(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function __(){for(var t=window,e=Wu();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=Wu(t.document)}return e}function Jp(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function lk(t){var e=__(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&w_(n.ownerDocument.documentElement,n)){if(r!==null&&Jp(n)){if(e=r.start,t=r.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var i=n.textContent.length,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!t.extend&&s>r&&(i=r,r=s,s=i),i=r0(n,s);var o=r0(n,r);i&&o&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==o.node||t.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),s>r?(t.addRange(e),t.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Gs=null,yf=null,Sa=null,vf=!1;function i0(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;vf||Gs==null||Gs!==Wu(r)||(r=Gs,"selectionStart"in r&&Jp(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Sa&&Wa(Sa,r)||(Sa=r,r=Zu(yf,"onSelect"),0Ys||(t.current=If[Ys],If[Ys]=null,Ys--)}function it(t,e){Ys++,If[Ys]=t.current,t.current=e}var Vi={},ln=Gi(Vi),_n=Gi(!1),vs=Vi;function xo(t,e){var n=t.type.contextTypes;if(!n)return Vi;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in n)i[s]=e[s];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function bn(t){return t=t.childContextTypes,t!=null}function tc(){lt(_n),lt(ln)}function d0(t,e,n){if(ln.current!==Vi)throw Error(X(168));it(ln,e),it(_n,n)}function A_(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in e))throw Error(X(108,rT(t)||"Unknown",i));return ft({},n,r)}function nc(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Vi,vs=ln.current,it(ln,t),it(_n,_n.current),!0}function h0(t,e,n){var r=t.stateNode;if(!r)throw Error(X(169));n?(t=A_(t,e,vs),r.__reactInternalMemoizedMergedChildContext=t,lt(_n),lt(ln),it(ln,t)):lt(_n),it(_n,n)}var Mr=null,Kc=!1,mh=!1;function P_(t){Mr===null?Mr=[t]:Mr.push(t)}function wk(t){Kc=!0,P_(t)}function Ki(){if(!mh&&Mr!==null){mh=!0;var t=0,e=Xe;try{var n=Mr;for(Xe=1;t>=o,i-=o,Fr=1<<32-or(e)+i|n<x?(E=_,_=null):E=_.sibling;var k=p(y,_,T[x],L);if(k===null){_===null&&(_=E);break}t&&_&&k.alternate===null&&e(y,_),w=s(k,w,x),D===null?F=k:D.sibling=k,D=k,_=E}if(x===T.length)return n(y,_),ct&&is(y,x),F;if(_===null){for(;xx?(E=_,_=null):E=_.sibling;var C=p(y,_,k.value,L);if(C===null){_===null&&(_=E);break}t&&_&&C.alternate===null&&e(y,_),w=s(C,w,x),D===null?F=C:D.sibling=C,D=C,_=E}if(k.done)return n(y,_),ct&&is(y,x),F;if(_===null){for(;!k.done;x++,k=T.next())k=h(y,k.value,L),k!==null&&(w=s(k,w,x),D===null?F=k:D.sibling=k,D=k);return ct&&is(y,x),F}for(_=r(y,_);!k.done;x++,k=T.next())k=m(_,y,x,k.value,L),k!==null&&(t&&k.alternate!==null&&_.delete(k.key===null?x:k.key),w=s(k,w,x),D===null?F=k:D.sibling=k,D=k);return t&&_.forEach(function(j){return e(y,j)}),ct&&is(y,x),F}function P(y,w,T,L){if(typeof T=="object"&&T!==null&&T.type===qs&&T.key===null&&(T=T.props.children),typeof T=="object"&&T!==null){switch(T.$$typeof){case ql:e:{for(var F=T.key,D=w;D!==null;){if(D.key===F){if(F=T.type,F===qs){if(D.tag===7){n(y,D.sibling),w=i(D,T.props.children),w.return=y,y=w;break e}}else if(D.elementType===F||typeof F=="object"&&F!==null&&F.$$typeof===pi&&m0(F)===D.type){n(y,D.sibling),w=i(D,T.props),w.ref=oa(y,D,T),w.return=y,y=w;break e}n(y,D);break}else e(y,D);D=D.sibling}T.type===qs?(w=fs(T.props.children,y.mode,L,T.key),w.return=y,y=w):(L=Pu(T.type,T.key,T.props,null,y.mode,L),L.ref=oa(y,w,T),L.return=y,y=L)}return o(y);case Hs:e:{for(D=T.key;w!==null;){if(w.key===D)if(w.tag===4&&w.stateNode.containerInfo===T.containerInfo&&w.stateNode.implementation===T.implementation){n(y,w.sibling),w=i(w,T.children||[]),w.return=y,y=w;break e}else{n(y,w);break}else e(y,w);w=w.sibling}w=Eh(T,y.mode,L),w.return=y,y=w}return o(y);case pi:return D=T._init,P(y,w,D(T._payload),L)}if(pa(T))return b(y,w,T,L);if(ta(T))return S(y,w,T,L);nu(y,T)}return typeof T=="string"&&T!==""||typeof T=="number"?(T=""+T,w!==null&&w.tag===6?(n(y,w.sibling),w=i(w,T),w.return=y,y=w):(n(y,w),w=bh(T,y.mode,L),w.return=y,y=w),o(y)):n(y,w)}return P}var _o=L_(!0),O_=L_(!1),sc=Gi(null),oc=null,Zs=null,nm=null;function rm(){nm=Zs=oc=null}function im(t){var e=sc.current;lt(sc),t._currentValue=e}function kf(t,e,n){for(;t!==null;){var r=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),t===n)break;t=t.return}}function lo(t,e){oc=t,nm=Zs=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(wn=!0),t.firstContext=null)}function Xn(t){var e=t._currentValue;if(nm!==t)if(t={context:t,memoizedValue:e,next:null},Zs===null){if(oc===null)throw Error(X(308));Zs=t,oc.dependencies={lanes:0,firstContext:t}}else Zs=Zs.next=t;return e}var us=null;function sm(t){us===null?us=[t]:us.push(t)}function M_(t,e,n,r){var i=e.interleaved;return i===null?(n.next=n,sm(e)):(n.next=i.next,i.next=n),e.interleaved=n,Gr(t,r)}function Gr(t,e){t.lanes|=e;var n=t.alternate;for(n!==null&&(n.lanes|=e),n=t,t=t.return;t!==null;)t.childLanes|=e,n=t.alternate,n!==null&&(n.childLanes|=e),n=t,t=t.return;return n.tag===3?n.stateNode:null}var mi=!1;function om(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function V_(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function $r(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function Ni(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,qe&2){var i=r.pending;return i===null?e.next=e:(e.next=i.next,i.next=e),r.pending=e,Gr(t,n)}return i=r.interleaved,i===null?(e.next=e,sm(r)):(e.next=i.next,i.next=e),r.interleaved=e,Gr(t,n)}function Su(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,qp(t,n)}}function g0(t,e){var n=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?i=s=o:s=s.next=o,n=n.next}while(n!==null);s===null?i=s=e:s=s.next=e}else i=s=e;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:r.shared,effects:r.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function ac(t,e,n,r){var i=t.updateQueue;mi=!1;var s=i.firstBaseUpdate,o=i.lastBaseUpdate,a=i.shared.pending;if(a!==null){i.shared.pending=null;var u=a,c=u.next;u.next=null,o===null?s=c:o.next=c,o=u;var f=t.alternate;f!==null&&(f=f.updateQueue,a=f.lastBaseUpdate,a!==o&&(a===null?f.firstBaseUpdate=c:a.next=c,f.lastBaseUpdate=u))}if(s!==null){var h=i.baseState;o=0,f=c=u=null,a=s;do{var p=a.lane,m=a.eventTime;if((r&p)===p){f!==null&&(f=f.next={eventTime:m,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var b=t,S=a;switch(p=e,m=n,S.tag){case 1:if(b=S.payload,typeof b=="function"){h=b.call(m,h,p);break e}h=b;break e;case 3:b.flags=b.flags&-65537|128;case 0:if(b=S.payload,p=typeof b=="function"?b.call(m,h,p):b,p==null)break e;h=ft({},h,p);break e;case 2:mi=!0}}a.callback!==null&&a.lane!==0&&(t.flags|=64,p=i.effects,p===null?i.effects=[a]:p.push(a))}else m={eventTime:m,lane:p,tag:a.tag,payload:a.payload,callback:a.callback,next:null},f===null?(c=f=m,u=h):f=f.next=m,o|=p;if(a=a.next,a===null){if(a=i.shared.pending,a===null)break;p=a,a=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(!0);if(f===null&&(u=h),i.baseState=u,i.firstBaseUpdate=c,i.lastBaseUpdate=f,e=i.shared.interleaved,e!==null){i=e;do o|=i.lane,i=i.next;while(i!==e)}else s===null&&(i.shared.lanes=0);_s|=o,t.lanes=o,t.memoizedState=h}}function y0(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;en?n:4,t(!0);var r=yh.transition;yh.transition={};try{t(!1),e()}finally{Xe=n,yh.transition=r}}function t1(){return Jn().memoizedState}function Ik(t,e,n){var r=Pi(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},n1(t))r1(e,n);else if(n=M_(t,e,n,r),n!==null){var i=hn();ar(n,t,r,i),i1(n,e,r)}}function Sk(t,e,n){var r=Pi(t),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(n1(t))r1(e,i);else{var s=t.alternate;if(t.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var o=e.lastRenderedState,a=s(o,n);if(i.hasEagerState=!0,i.eagerState=a,ur(a,o)){var u=e.interleaved;u===null?(i.next=i,sm(e)):(i.next=u.next,u.next=i),e.interleaved=i;return}}catch{}finally{}n=M_(t,e,i,r),n!==null&&(i=hn(),ar(n,t,r,i),i1(n,e,r))}}function n1(t){var e=t.alternate;return t===ht||e!==null&&e===ht}function r1(t,e){Ta=uc=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function i1(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,qp(t,n)}}var cc={readContext:Xn,useCallback:tn,useContext:tn,useEffect:tn,useImperativeHandle:tn,useInsertionEffect:tn,useLayoutEffect:tn,useMemo:tn,useReducer:tn,useRef:tn,useState:tn,useDebugValue:tn,useDeferredValue:tn,useTransition:tn,useMutableSource:tn,useSyncExternalStore:tn,useId:tn,unstable_isNewReconciler:!1},Tk={readContext:Xn,useCallback:function(t,e){return mr().memoizedState=[t,e===void 0?null:e],t},useContext:Xn,useEffect:x0,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,ku(4194308,4,Y_.bind(null,e,t),n)},useLayoutEffect:function(t,e){return ku(4194308,4,t,e)},useInsertionEffect:function(t,e){return ku(4,2,t,e)},useMemo:function(t,e){var n=mr();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=mr();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=Ik.bind(null,ht,t),[r.memoizedState,t]},useRef:function(t){var e=mr();return t={current:t},e.memoizedState=t},useState:v0,useDebugValue:pm,useDeferredValue:function(t){return mr().memoizedState=t},useTransition:function(){var t=v0(!1),e=t[0];return t=Ek.bind(null,t[1]),mr().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=ht,i=mr();if(ct){if(n===void 0)throw Error(X(407));n=n()}else{if(n=e(),$t===null)throw Error(X(349));ws&30||B_(r,e,n)}i.memoizedState=n;var s={value:n,getSnapshot:e};return i.queue=s,x0(H_.bind(null,r,s,t),[t]),r.flags|=2048,el(9,$_.bind(null,r,s,n,e),void 0,null),n},useId:function(){var t=mr(),e=$t.identifierPrefix;if(ct){var n=Ur,r=Fr;n=(r&~(1<<32-or(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=Ja++,0<\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=o.createElement(n,{is:r.is}):(t=o.createElement(n),n==="select"&&(o=t,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):t=o.createElementNS(t,n),t[vr]=e,t[Qa]=r,p1(t,e,!1,!1),e.stateNode=t;e:{switch(o=uf(n,r),n){case"dialog":at("cancel",t),at("close",t),i=r;break;case"iframe":case"object":case"embed":at("load",t),i=r;break;case"video":case"audio":for(i=0;iIo&&(e.flags|=128,r=!0,aa(s,!1),e.lanes=4194304)}else{if(!r)if(t=lc(o),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),aa(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!ct)return nn(e),null}else 2*Tt()-s.renderingStartTime>Io&&n!==1073741824&&(e.flags|=128,r=!0,aa(s,!1),e.lanes=4194304);s.isBackwards?(o.sibling=e.child,e.child=o):(n=s.last,n!==null?n.sibling=o:e.child=o,s.last=o)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=Tt(),e.sibling=null,n=dt.current,it(dt,r?n&1|2:n&1),e):(nn(e),null);case 22:case 23:return wm(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?jn&1073741824&&(nn(e),e.subtreeFlags&6&&(e.flags|=8192)):nn(e),null;case 24:return null;case 25:return null}throw Error(X(156,e.tag))}function jk(t,e){switch(em(e),e.tag){case 1:return bn(e.type)&&tc(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return bo(),lt(_n),lt(ln),um(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return lm(e),null;case 13:if(lt(dt),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(X(340));wo()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return lt(dt),null;case 4:return bo(),null;case 10:return im(e.type._context),null;case 22:case 23:return wm(),null;case 24:return null;default:return null}}var iu=!1,on=!1,Lk=typeof WeakSet=="function"?WeakSet:Set,ce=null;function eo(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){wt(t,e,r)}else n.current=null}function Of(t,e,n){try{n()}catch(r){wt(t,e,r)}}var A0=!1;function Ok(t,e){if(xf=Xu,t=__(),Jp(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var o=0,a=-1,u=-1,c=0,f=0,h=t,p=null;t:for(;;){for(var m;h!==n||i!==0&&h.nodeType!==3||(a=o+i),h!==s||r!==0&&h.nodeType!==3||(u=o+r),h.nodeType===3&&(o+=h.nodeValue.length),(m=h.firstChild)!==null;)p=h,h=m;for(;;){if(h===t)break t;if(p===n&&++c===i&&(a=o),p===s&&++f===r&&(u=o),(m=h.nextSibling)!==null)break;h=p,p=h.parentNode}h=m}n=a===-1||u===-1?null:{start:a,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(wf={focusedElem:t,selectionRange:n},Xu=!1,ce=e;ce!==null;)if(e=ce,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,ce=t;else for(;ce!==null;){e=ce;try{var b=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(b!==null){var S=b.memoizedProps,P=b.memoizedState,y=e.stateNode,w=y.getSnapshotBeforeUpdate(e.elementType===e.type?S:er(e.type,S),P);y.__reactInternalSnapshotBeforeUpdate=w}break;case 3:var T=e.stateNode.containerInfo;T.nodeType===1?T.textContent="":T.nodeType===9&&T.documentElement&&T.removeChild(T.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(X(163))}}catch(L){wt(e,e.return,L)}if(t=e.sibling,t!==null){t.return=e.return,ce=t;break}ce=e.return}return b=A0,A0=!1,b}function ka(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&t)===t){var s=i.destroy;i.destroy=void 0,s!==void 0&&Of(e,n,s)}i=i.next}while(i!==r)}}function Xc(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function Mf(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function y1(t){var e=t.alternate;e!==null&&(t.alternate=null,y1(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[vr],delete e[Qa],delete e[Ef],delete e[vk],delete e[xk])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function v1(t){return t.tag===5||t.tag===3||t.tag===4}function P0(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||v1(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Vf(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=ec));else if(r!==4&&(t=t.child,t!==null))for(Vf(t,e,n),t=t.sibling;t!==null;)Vf(t,e,n),t=t.sibling}function Ff(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(Ff(t,e,n),t=t.sibling;t!==null;)Ff(t,e,n),t=t.sibling}var Kt=null,tr=!1;function di(t,e,n){for(n=n.child;n!==null;)x1(t,e,n),n=n.sibling}function x1(t,e,n){if(_r&&typeof _r.onCommitFiberUnmount=="function")try{_r.onCommitFiberUnmount($c,n)}catch{}switch(n.tag){case 5:on||eo(n,e);case 6:var r=Kt,i=tr;Kt=null,di(t,e,n),Kt=r,tr=i,Kt!==null&&(tr?(t=Kt,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):Kt.removeChild(n.stateNode));break;case 18:Kt!==null&&(tr?(t=Kt,n=n.stateNode,t.nodeType===8?ph(t.parentNode,n):t.nodeType===1&&ph(t,n),Ha(t)):ph(Kt,n.stateNode));break;case 4:r=Kt,i=tr,Kt=n.stateNode.containerInfo,tr=!0,di(t,e,n),Kt=r,tr=i;break;case 0:case 11:case 14:case 15:if(!on&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&Of(n,e,o),i=i.next}while(i!==r)}di(t,e,n);break;case 1:if(!on&&(eo(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){wt(n,e,a)}di(t,e,n);break;case 21:di(t,e,n);break;case 22:n.mode&1?(on=(r=on)||n.memoizedState!==null,di(t,e,n),on=r):di(t,e,n);break;default:di(t,e,n)}}function R0(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new Lk),e.forEach(function(r){var i=qk.bind(null,t,r);n.has(r)||(n.add(r),r.then(i,i))})}}function Zn(t,e){var n=e.deletions;if(n!==null)for(var r=0;ri&&(i=o),r&=~s}if(r=i,r=Tt()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Vk(r/1960))-r,10t?16:t,bi===null)var r=!1;else{if(t=bi,bi=null,fc=0,qe&6)throw Error(X(331));var i=qe;for(qe|=4,ce=t.current;ce!==null;){var s=ce,o=s.child;if(ce.flags&16){var a=s.deletions;if(a!==null){for(var u=0;uTt()-vm?hs(t,0):ym|=n),En(t,e)}function k1(t,e){e===0&&(t.mode&1?(e=Ql,Ql<<=1,!(Ql&130023424)&&(Ql=4194304)):e=1);var n=hn();t=Gr(t,e),t!==null&&(gl(t,e,n),En(t,n))}function Hk(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),k1(t,n)}function qk(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,i=t.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(X(314))}r!==null&&r.delete(e),k1(t,n)}var C1;C1=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||_n.current)wn=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return wn=!1,Rk(t,e,n);wn=!!(t.flags&131072)}else wn=!1,ct&&e.flags&1048576&&R_(e,ic,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;Cu(t,e),t=e.pendingProps;var i=xo(e,ln.current);lo(e,n),i=dm(null,e,r,t,i,n);var s=hm();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,bn(r)?(s=!0,nc(e)):s=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,om(e),i.updater=Yc,e.stateNode=i,i._reactInternals=e,Nf(e,r,t,n),e=Rf(null,e,r,!0,s,n)):(e.tag=0,ct&&s&&Zp(e),dn(null,e,i,n),e=e.child),e;case 16:r=e.elementType;e:{switch(Cu(t,e),t=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=Gk(r),t=er(r,t),i){case 0:e=Pf(null,e,r,t,n);break e;case 1:e=k0(null,e,r,t,n);break e;case 11:e=S0(null,e,r,t,n);break e;case 14:e=T0(null,e,r,er(r.type,t),n);break e}throw Error(X(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:er(r,i),Pf(t,e,r,i,n);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:er(r,i),k0(t,e,r,i,n);case 3:e:{if(d1(e),t===null)throw Error(X(387));r=e.pendingProps,s=e.memoizedState,i=s.element,V_(t,e),ac(e,r,null,n);var o=e.memoizedState;if(r=o.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){i=Eo(Error(X(423)),e),e=C0(t,e,r,n,i);break e}else if(r!==i){i=Eo(Error(X(424)),e),e=C0(t,e,r,n,i);break e}else for(Ln=Ci(e.stateNode.containerInfo.firstChild),Vn=e,ct=!0,nr=null,n=O_(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(wo(),r===i){e=Kr(t,e,n);break e}dn(t,e,r,n)}e=e.child}return e;case 5:return F_(e),t===null&&Tf(e),r=e.type,i=e.pendingProps,s=t!==null?t.memoizedProps:null,o=i.children,_f(r,i)?o=null:s!==null&&_f(r,s)&&(e.flags|=32),c1(t,e),dn(t,e,o,n),e.child;case 6:return t===null&&Tf(e),null;case 13:return h1(t,e,n);case 4:return am(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=_o(e,null,r,n):dn(t,e,r,n),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:er(r,i),S0(t,e,r,i,n);case 7:return dn(t,e,e.pendingProps,n),e.child;case 8:return dn(t,e,e.pendingProps.children,n),e.child;case 12:return dn(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,i=e.pendingProps,s=e.memoizedProps,o=i.value,it(sc,r._currentValue),r._currentValue=o,s!==null)if(ur(s.value,o)){if(s.children===i.children&&!_n.current){e=Kr(t,e,n);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var u=a.firstContext;u!==null;){if(u.context===r){if(s.tag===1){u=$r(-1,n&-n),u.tag=2;var c=s.updateQueue;if(c!==null){c=c.shared;var f=c.pending;f===null?u.next=u:(u.next=f.next,f.next=u),c.pending=u}}s.lanes|=n,u=s.alternate,u!==null&&(u.lanes|=n),kf(s.return,n,e),a.lanes|=n;break}u=u.next}}else if(s.tag===10)o=s.type===e.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(X(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),kf(o,n,e),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===e){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}dn(t,e,i.children,n),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,lo(e,n),i=Xn(i),r=r(i),e.flags|=1,dn(t,e,r,n),e.child;case 14:return r=e.type,i=er(r,e.pendingProps),i=er(r.type,i),T0(t,e,r,i,n);case 15:return l1(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:er(r,i),Cu(t,e),e.tag=1,bn(r)?(t=!0,nc(e)):t=!1,lo(e,n),s1(e,r,i),Nf(e,r,i,n),Rf(null,e,r,!0,t,n);case 19:return f1(t,e,n);case 22:return u1(t,e,n)}throw Error(X(156,e.tag))};function N1(t,e){return n_(t,e)}function Wk(t,e,n,r){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Gn(t,e,n,r){return new Wk(t,e,n,r)}function bm(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Gk(t){if(typeof t=="function")return bm(t)?1:0;if(t!=null){if(t=t.$$typeof,t===zp)return 11;if(t===Bp)return 14}return 2}function Ri(t,e){var n=t.alternate;return n===null?(n=Gn(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function Pu(t,e,n,r,i,s){var o=2;if(r=t,typeof t=="function")bm(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case qs:return fs(n.children,i,s,e);case Up:o=8,i|=8;break;case Jh:return t=Gn(12,n,e,i|2),t.elementType=Jh,t.lanes=s,t;case Zh:return t=Gn(13,n,e,i),t.elementType=Zh,t.lanes=s,t;case ef:return t=Gn(19,n,e,i),t.elementType=ef,t.lanes=s,t;case Fw:return Zc(n,i,s,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case Mw:o=10;break e;case Vw:o=9;break e;case zp:o=11;break e;case Bp:o=14;break e;case pi:o=16,r=null;break e}throw Error(X(130,t==null?t:typeof t,""))}return e=Gn(o,n,e,i),e.elementType=t,e.type=r,e.lanes=s,e}function fs(t,e,n,r){return t=Gn(7,t,r,e),t.lanes=n,t}function Zc(t,e,n,r){return t=Gn(22,t,r,e),t.elementType=Fw,t.lanes=n,t.stateNode={isHidden:!1},t}function bh(t,e,n){return t=Gn(6,t,null,e),t.lanes=n,t}function Eh(t,e,n){return e=Gn(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function Kk(t,e,n,r,i){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=rh(0),this.expirationTimes=rh(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=rh(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function Em(t,e,n,r,i,s,o,a,u){return t=new Kk(t,e,n,a,u),e===1?(e=1,s===!0&&(e|=8)):e=0,s=Gn(3,null,null,e),t.current=s,s.stateNode=t,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},om(s),t}function Qk(t,e,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(D1)}catch(t){console.error(t)}}D1(),Dw.exports=Un;var j1=Dw.exports;const e2=zc(j1);var L1,U0=j1;L1=U0.createRoot,U0.hydrateRoot;/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */var t2={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"};/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const n2=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),Re=(t,e)=>{const n=V.forwardRef(({color:r="currentColor",size:i=24,strokeWidth:s=2,absoluteStrokeWidth:o,className:a="",children:u,...c},f)=>V.createElement("svg",{ref:f,...t2,width:i,height:i,stroke:r,strokeWidth:o?Number(s)*24/Number(i):s,className:["lucide",`lucide-${n2(t)}`,a].join(" "),...c},[...e.map(([h,p])=>V.createElement(h,p)),...Array.isArray(u)?u:[u]]));return n.displayName=`${t}`,n};/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const r2=Re("AlertCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const So=Re("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const i2=Re("ArrowUpDown",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const z0=Re("BookMarked",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H20v20H6.5a2.5 2.5 0 0 1 0-5H20",key:"t4utmx"}],["polyline",{points:"10 2 10 10 13 7 16 10 16 2",key:"13o6vz"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const nl=Re("BookOpen",[["path",{d:"M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z",key:"vv98re"}],["path",{d:"M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z",key:"1cyq3y"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const s2=Re("Book",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H20v20H6.5a2.5 2.5 0 0 1 0-5H20",key:"t4utmx"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const wl=Re("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const id=Re("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const sd=Re("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const O1=Re("ChevronsLeft",[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const M1=Re("ChevronsRight",[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const o2=Re("ChevronsUpDown",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const a2=Re("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ua=Re("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Hf=Re("Eye",[["path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z",key:"rwhkz3"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ca=Re("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const V1=Re("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const qf=Re("Grid2x2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M12 3v18",key:"108xh3"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Wf=Re("Grid3x3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const B0=Re("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const $0=Re("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const F1=Re("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const l2=Re("Key",[["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["path",{d:"m15.5 7.5 3 3L22 7l-3-3",key:"1rn1fs"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const U1=Re("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const u2=Re("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const z1=Re("Megaphone",[["path",{d:"m3 11 18-5v12L3 14v-3z",key:"n962bs"}],["path",{d:"M11.6 16.8a3 3 0 1 1-5.8-1.6",key:"1yl0tm"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const B1=Re("Pen",[["path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z",key:"5qss01"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const co=Re("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const km=Re("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Gf=Re("Rows2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 12h18",key:"1i2n21"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Cm=Re("Save",[["path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z",key:"1owoqh"}],["polyline",{points:"17 21 17 13 7 13 7 21",key:"1md35c"}],["polyline",{points:"7 3 7 8 15 8",key:"8nz8an"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const gc=Re("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const c2=Re("Send",[["path",{d:"m22 2-7 20-4-9-9-4Z",key:"1q3vgg"}],["path",{d:"M22 2 11 13",key:"nzbqef"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const H0=Re("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const $1=Re("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const d2=Re("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const h2=Re("Timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const wr=Re("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Nm=Re("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const In=Re("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Am=Re("ZoomIn",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Pm=Re("ZoomOut",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]),Ih=new Set;function Kn({src:t,alt:e,className:n="",imgClassName:r="",objectFit:i="contain",aspectRatio:s,loading:o,draggable:a}){const u=Ih.has(t),[c,f]=V.useState(u),[h,p]=V.useState(!1),[m,b]=V.useState(0);V.useEffect(()=>{Ih.has(t)?(f(!0),p(!1)):(f(!1),p(!1)),b(0)},[t]);const S=()=>{p(!1),f(!1),b(w=>w+1)},P=()=>{f(!0),p(!1),Ih.add(t)},y=m>0?`${t}${t.includes("?")?"&":"?"}retry=${m}`:t;return d.jsxs("div",{className:`relative w-full h-full overflow-hidden ${h?"bg-[#1a1a1a]/50 rounded-lg min-h-[300px]":""} ${n}`,style:s&&s!=="auto"?{aspectRatio:s}:void 0,children:[d.jsx("div",{className:`absolute inset-0 flex items-center justify-center transition-opacity duration-500 ${c?"opacity-0 pointer-events-none":"opacity-100"}`,children:h?d.jsxs("div",{className:"flex flex-col items-center justify-center p-6 text-center max-w-sm w-full h-full",children:[d.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center mb-3",children:d.jsx(r2,{className:"w-6 h-6 text-red-500"})}),d.jsx("p",{className:"text-sm text-gray-400 mb-4",children:"La imagen no cargó. ImgBB podría tener problemas."}),d.jsxs("button",{onClick:S,className:"flex items-center justify-center gap-2 px-4 py-2 bg-gray-800 hover:bg-gray-700 text-white rounded-lg transition-colors border border-gray-700 w-full max-w-[200px]",children:[d.jsx(km,{className:"w-4 h-4"}),d.jsxs("span",{children:["Reintentar (",m,")"]})]})]}):d.jsx("div",{className:"w-8 h-8 border-2 border-[#bb86fc] border-t-transparent rounded-full animate-spin"})}),!h&&d.jsx("img",{src:y,alt:e,loading:o,draggable:a,className:`w-full h-full object-${i} transition-all duration-1000 ease-linear ${r} ${c?"opacity-100":"opacity-0"}`,onLoad:P,onError:()=>{p(!0),f(!1)}})]})}function H1({images:t,initialIndex:e,onClose:n}){const[r,i]=V.useState(e),[s,o]=V.useState(!1),[a,u]=V.useState(0),[c,f]=V.useState(1),[h,p]=V.useState({x:0,y:0}),[m,b]=V.useState(!1),[S,P]=V.useState({x:0,y:0}),[y,w]=V.useState(null),[T,L]=V.useState(1),F=V.useRef(null);V.useEffect(()=>(document.body.style.overflow="hidden",()=>{document.body.style.overflow="unset"}),[]);const D=H=>{const J=t.length;return(H%J+J)%J},_=H=>Math.hypot(H[0].clientX-H[1].clientX,H[0].clientY-H[1].clientY),x=(H,J)=>{const te=window.innerWidth,Ie=window.innerHeight,pe=(te*J-te)/2,Fe=(Ie*J-Ie)/2;return{x:Math.min(Math.max(H.x,-pe),pe),y:Math.min(Math.max(H.y,-Fe),Fe)}},E=s?2:1,k=()=>{i(H=>D(H-E)),u(0),f(1),p({x:0,y:0})},C=()=>{i(H=>D(H+E)),u(0),f(1),p({x:0,y:0})},j=(H,J)=>{b(!0),P({x:H,y:J})},A=(H,J)=>{if(m)if(c>1){const te=H-S.x,Ie=J-S.y;p(pe=>({x:pe.x+te,y:pe.y+Ie})),P({x:H,y:J})}else{const te=H-S.x;u(te)}},de=()=>{var te;if(b(!1),w(null),c>1)return;const J=(((te=F.current)==null?void 0:te.clientWidth)||window.innerWidth)*.25;Math.abs(a)>J?a>0?k():C():u(0)},oe=H=>{H.preventDefault(),j(H.clientX,H.clientY)},le=H=>{H.preventDefault(),A(H.clientX,H.clientY)},ve=()=>de(),K=H=>{if(H.touches.length===2){const J=_(H.touches);w(J),L(c),b(!1)}else H.touches.length===1&&j(H.touches[0].clientX,H.touches[0].clientY)},ie=H=>{if(H.touches.length===2&&y!==null){const te=_(H.touches)/y,Ie=Math.min(Math.max(T*te,1),4);f(Ie),p(pe=>x(pe,Ie))}else H.touches.length===1&&A(H.touches[0].clientX,H.touches[0].clientY)},N=H=>{if(y!==null&&H.touches.length<2){w(null);return}de()};V.useEffect(()=>{function H(J){J.key==="Escape"?n():J.key==="ArrowLeft"?k():J.key==="ArrowRight"?C():J.key==="+"||J.key==="="?f(te=>{const Ie=Math.min(te+.5,4);return p(pe=>x(pe,Ie)),Ie}):J.key==="-"&&f(te=>{const Ie=Math.max(te-.5,1);return p(pe=>x(pe,Ie)),Ie})}return window.addEventListener("keydown",H),()=>window.removeEventListener("keydown",H)},[c,s]);let fe=`translateX(calc(-33.333333% + ${a}px))`,ye=m?"none":"transform 0.1s ease-out";a===0&&(ye="none");const R=H=>{const J=D(H);if(s){const te=D(H+1);return d.jsxs("div",{className:"flex w-full h-full items-center justify-center px-2 sm:px-10",children:[d.jsx("div",{className:"flex-1 h-full flex items-center justify-end",children:d.jsx(Kn,{src:t[J],alt:`Página ${J+1}`,aspectRatio:"auto",objectFit:"contain",loading:"lazy",draggable:!1,imgClassName:"max-w-full max-h-screen object-contain select-none shadow-lg origin-right object-right transition-none"})}),d.jsx("div",{className:"flex-1 h-full flex items-center justify-start",children:d.jsx(Kn,{src:t[te],alt:`Página ${te+1}`,aspectRatio:"auto",objectFit:"contain",loading:"lazy",draggable:!1,imgClassName:"max-w-full max-h-screen object-contain select-none shadow-lg origin-left object-left transition-none"})})]})}else return d.jsx(Kn,{src:t[J],alt:`Página ${J+1}`,aspectRatio:"auto",objectFit:"contain",loading:"lazy",draggable:!1,imgClassName:"max-w-full max-h-screen object-contain select-none shadow-2xl transition-none"})};return d.jsxs("div",{className:"fixed inset-0 bg-black/95 flex items-center justify-center z-50 select-none touch-none overflow-hidden",style:{touchAction:"none"},ref:F,onWheel:H=>{H.stopPropagation();const J=H.deltaY<0?.5:-.5;f(te=>{const Ie=Math.min(Math.max(te+J,1),4);return p(pe=>x(pe,Ie)),Ie})},onMouseDown:oe,onMouseMove:le,onMouseUp:ve,onMouseLeave:()=>{b(!1),c===1&&u(0)},onTouchStart:K,onTouchMove:ie,onTouchEnd:N,children:[d.jsxs("div",{className:"absolute top-6 right-6 flex items-center gap-4 z-50",children:[d.jsxs("div",{className:"flex items-center gap-2 bg-black/50 rounded-lg p-1",children:[d.jsx("button",{onClick:()=>o(!s),className:`p-2 transition-colors ${s?"text-[#bb86fc]":"text-white hover:text-[#bb86fc]"}`,title:s?"Vista Individual":"Vista de Libro",children:s?d.jsx(nl,{className:"w-5 h-5"}):d.jsx(s2,{className:"w-5 h-5"})}),d.jsx("div",{className:"w-px h-4 bg-white/20 mx-1"}),d.jsx("button",{onClick:()=>f(H=>{const J=Math.max(H-.5,1);return p(te=>x(te,J)),J}),className:"p-2 text-white hover:text-[#bb86fc] transition-colors",children:d.jsx(Pm,{className:"w-5 h-5"})}),d.jsxs("span",{className:"text-white text-sm min-w-[3ch] text-center",children:[Math.round(c*100),"%"]}),d.jsx("button",{onClick:()=>f(H=>{const J=Math.min(H+.5,4);return p(te=>x(te,J)),J}),className:"p-2 text-white hover:text-[#bb86fc] transition-colors",children:d.jsx(Am,{className:"w-5 h-5"})})]}),d.jsx("button",{onClick:n,className:"p-2 rounded-lg bg-white/10 hover:bg-white/20 text-white transition-all duration-200",children:d.jsx(In,{className:"w-6 h-6"})})]}),d.jsxs("div",{className:"flex h-full w-[300%] absolute top-0 left-0",style:{transform:fe,transition:ye},children:[d.jsx("div",{className:"w-1/3 h-full flex items-center justify-center relative",children:R(r-E)}),d.jsx("div",{className:"w-1/3 h-full flex items-center justify-center relative",children:d.jsx("div",{className:"relative flex items-center justify-center w-full h-full",style:{transform:`translate(${h.x}px, ${h.y}px) scale(${c})`,transition:m?"none":"transform 0.1s ease-out",cursor:c>1?m?"grabbing":"grab":"default"},onDoubleClick:H=>{H.stopPropagation(),f(J=>J>1?1:2.5),p({x:0,y:0})},children:R(r)})}),d.jsx("div",{className:"w-1/3 h-full flex items-center justify-center relative",children:R(r+E)})]}),c===1&&d.jsxs(d.Fragment,{children:[d.jsx("button",{onClick:H=>{H.stopPropagation(),k()},className:"absolute left-4 sm:left-8 top-1/2 -translate-y-1/2 p-3 sm:p-4 rounded-lg text-white opacity-40 hover:opacity-100 transition-opacity duration-200 z-40",children:d.jsx(id,{className:"w-8 h-8 sm:w-10 sm:h-10"})}),d.jsx("button",{onClick:H=>{H.stopPropagation(),C()},className:"absolute right-4 sm:right-8 top-1/2 -translate-y-1/2 p-3 sm:p-4 rounded-lg text-white opacity-40 hover:opacity-100 transition-opacity duration-200 z-40",children:d.jsx(sd,{className:"w-8 h-8 sm:w-10 sm:h-10"})})]}),d.jsx("div",{className:"absolute bottom-6 left-1/2 -translate-x-1/2 bg-black/60 text-white px-4 py-2 rounded-lg text-sm font-medium z-40 pointer-events-none",children:s?`${r+1}-${Math.min(r+2,t.length)} / ${t.length}`:`${r+1} / ${t.length}`})]})}function od(){return d.jsxs("footer",{className:"py-6 border-t border-gray-800/50 flex flex-col md:flex-row items-center justify-between gap-4 text-gray-400 text-sm mt-auto w-full px-8 relative",children:[d.jsxs("div",{className:"flex flex-wrap justify-center gap-6 mx-auto",children:[d.jsxs("a",{href:"https://t.me/twistedbrody",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 hover:text-[#bb86fc] transition-colors",children:[d.jsx("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"currentColor",children:d.jsx("path",{d:"M12 0C5.373 0 0 5.373 0 12s5.373 12 12 12 12-5.373 12-12S18.627 0 12 0zm5.894 8.221l-1.97 9.28c-.145.658-.537.818-1.084.508l-3-2.21-1.446 1.394c-.16.16-.295.295-.605.295l.213-3.054 5.56-5.022c.242-.213-.054-.333-.373-.121l-6.869 4.326-2.96-.924c-.64-.203-.658-.64.135-.954l11.566-4.458c.538-.196 1.006.128.832.941z"})}),"Twisted Brody"]}),d.jsxs("a",{href:"https://t.me/+CmmZFHM9hpViYzMx",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 hover:text-[#bb86fc] transition-colors",children:[d.jsx("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"currentColor",children:d.jsx("path",{d:"M12 0C5.373 0 0 5.373 0 12s5.373 12 12 12 12-5.373 12-12S18.627 0 12 0zm5.894 8.221l-1.97 9.28c-.145.658-.537.818-1.084.508l-3-2.21-1.446 1.394c-.16.16-.295.295-.605.295l.213-3.054 5.56-5.022c.242-.213-.054-.333-.373-.121l-6.869 4.326-2.96-.924c-.64-.203-.658-.64.135-.954l11.566-4.458c.538-.196 1.006.128.832.941z"})}),"Canal Hub"]}),d.jsxs("a",{href:"https://x.com/TwistedBrody",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 hover:text-[#bb86fc] transition-colors",children:[d.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:d.jsx("path",{d:"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"})}),"X"]}),d.jsxs("a",{href:"https://www.patreon.com/cw/Twistedbrody",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 hover:text-[#bb86fc] transition-colors",children:[d.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:d.jsx("path",{d:"M0 .48v23.04h4.22V.48zm15.385 0c-4.764 0-8.641 3.88-8.641 8.65 0 4.755 3.877 8.623 8.641 8.623 4.75 0 8.615-3.868 8.615-8.623C24 4.36 20.136.48 15.385.48z"})}),"Patreon"]}),d.jsxs("button",{onClick:()=>{window.location.hash="info"},className:"flex items-center gap-2 hover:text-[#bb86fc] transition-colors",children:[d.jsx(F1,{className:"w-4 h-4"}),d.jsx("span",{children:"Info"})]})]}),d.jsxs("div",{className:"md:absolute md:right-8 text-xs opacity-50",children:["Twisted Brody MangaFlow © ",new Date().getFullYear()]})]})}function f2({manga:t,onBack:e}){const n=t.chapters&&t.chapters.length>0?t.chapters[0]:null,r=n?n.original_pages&&n.original_pages.length>0?n.original_pages:n.pages:[],[i,s]=V.useState("vertical"),[o,a]=V.useState(1),[u,c]=V.useState(!1),[f,h]=V.useState(0);if(!r||r.length===0)return d.jsxs("div",{className:"min-h-screen bg-[#121212] flex flex-col items-center justify-center",children:[d.jsx("button",{onClick:e,className:"absolute top-6 left-6 p-2 hover:bg-[#333] rounded-lg transition-colors text-white",children:d.jsx(So,{className:"w-6 h-6"})}),d.jsx("div",{className:"text-gray-400 text-lg",children:"No hay páginas disponibles"})]});const p=()=>a(S=>Math.min(S+.25,3)),m=()=>a(S=>Math.max(S-.25,.5)),b=()=>a(1);return d.jsxs("div",{className:"min-h-screen flex flex-col bg-[#121212]",children:[d.jsxs("header",{className:"sticky top-0 z-50 bg-[#121212]/90 backdrop-blur-md border-b border-gray-800 px-4 py-3 flex items-center justify-between gap-4",children:[d.jsx("div",{className:"flex items-center gap-2 flex-shrink-0",children:d.jsxs("button",{onClick:e,className:"p-2 hover:bg-[#333] rounded-lg transition-colors text-white flex items-center gap-2",children:[d.jsx(So,{className:"w-5 h-5"}),d.jsx("span",{className:"font-semibold text-sm hidden sm:inline",children:"Volver"})]})}),d.jsx("div",{className:"flex-1 flex justify-center min-w-0",children:d.jsxs("h1",{className:"text-white font-bold truncate text-center max-w-full",children:[t.title," ",d.jsx("span",{className:"text-[#bb86fc] text-xs ml-2 border border-[#bb86fc] px-1 rounded",children:"HD"})]})}),d.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[d.jsxs("div",{className:"flex items-center gap-1 bg-[#0a0a0a] border border-gray-800 rounded-lg p-1 hidden md:flex",children:[d.jsx("button",{onClick:()=>s("vertical"),className:`p-2 rounded-md transition-all duration-200 ${i==="vertical"?"bg-[#bb86fc] text-white":"text-gray-400 hover:text-white"}`,title:"Vertical",children:d.jsx(Gf,{className:"w-4 h-4"})}),d.jsx("button",{onClick:()=>s("gallery"),className:`p-2 rounded-md transition-all duration-200 ${i==="gallery"?"bg-[#bb86fc] text-white":"text-gray-400 hover:text-white"}`,title:"Galería",children:d.jsx(qf,{className:"w-4 h-4"})}),d.jsx("button",{onClick:()=>s("grid"),className:`p-2 rounded-md transition-all duration-200 ${i==="grid"?"bg-[#bb86fc] text-white":"text-gray-400 hover:text-white"}`,title:"Cuadrícula",children:d.jsx(Wf,{className:"w-4 h-4"})})]}),i==="vertical"&&d.jsxs("div",{className:"flex items-center gap-1 bg-[#0a0a0a] border border-gray-800 rounded-lg p-1",children:[d.jsx("button",{onClick:m,className:"p-2 text-gray-400 hover:text-white hover:bg-[#333] rounded",children:d.jsx(Pm,{className:"w-4 h-4"})}),d.jsxs("span",{className:"text-xs text-gray-300 w-8 text-center",children:[Math.round(o*100),"%"]}),d.jsx("button",{onClick:p,className:"p-2 text-gray-400 hover:text-white hover:bg-[#333] rounded",children:d.jsx(Am,{className:"w-4 h-4"})}),d.jsx("button",{onClick:b,className:"p-2 text-gray-400 hover:text-white hover:bg-[#333] rounded",title:"Reset",children:d.jsx(km,{className:"w-3 h-3"})})]})]})]}),d.jsx("div",{className:"md:hidden px-4 py-2 border-b border-gray-800 bg-[#121212] flex justify-center",children:d.jsxs("div",{className:"flex items-center gap-1 bg-[#0a0a0a] border border-gray-800 rounded-lg p-1",children:[d.jsxs("button",{onClick:()=>s("vertical"),className:`px-3 py-1.5 rounded-md flex items-center gap-2 text-xs font-medium ${i==="vertical"?"bg-[#bb86fc] text-white":"text-gray-400"}`,children:[d.jsx(Gf,{className:"w-3 h-3"})," Vertical"]}),d.jsxs("button",{onClick:()=>s("gallery"),className:`px-3 py-1.5 rounded-md flex items-center gap-2 text-xs font-medium ${i==="gallery"?"bg-[#bb86fc] text-white":"text-gray-400"}`,children:[d.jsx(qf,{className:"w-3 h-3"})," Galería"]}),d.jsxs("button",{onClick:()=>s("grid"),className:`px-3 py-1.5 rounded-md flex items-center gap-2 text-xs font-medium ${i==="grid"?"bg-[#bb86fc] text-white":"text-gray-400"}`,children:[d.jsx(Wf,{className:"w-3 h-3"})," Cuadrícula"]})]})}),d.jsx("main",{className:"flex-1 w-full max-w-[1920px] mx-auto px-0 sm:px-4 py-6",children:d.jsx("div",{className:` + bg-[#050505] min-h-screen transition-all duration-150 ease-out + ${i==="vertical"?"flex flex-col items-center gap-1":""} + ${i==="gallery"?"masonry-container p-2":""} + ${i==="grid"?"grid grid-cols-3 md:grid-cols-5 gap-2 p-2":""} + `,children:r.map((S,P)=>{const y=S;return i==="vertical"?d.jsx("div",{className:"relative transition-all duration-200",style:{width:o===1?"100%":`${100*o}%`,maxWidth:o>1?"none":"80rem"},children:d.jsx("div",{className:`mx-auto ${o<=1?"max-w-5xl":""}`,children:d.jsx(Kn,{src:y,alt:`Página ${P+1}`,aspectRatio:"auto",objectFit:"contain",loading:P<3?"eager":"lazy",className:"w-full h-auto",imgClassName:"w-full h-auto block"})})},P):d.jsx("div",{className:` + group cursor-pointer relative bg-black rounded-lg shadow-lg overflow-hidden transition-transform duration-300 hover:scale-[1.02] + ${i==="gallery"?"masonry-item":""} + `,onClick:()=>{h(P),c(!0)},children:d.jsx(Kn,{src:y,alt:`Página ${P+1}`,aspectRatio:i==="grid"?"1/1":"auto",objectFit:i==="grid"?"cover":"contain",loading:P<5?"eager":"lazy",className:"w-full h-auto rounded-lg",imgClassName:"group-hover:scale-110"})},P)})})}),d.jsx(od,{}),u&&d.jsx(H1,{images:r,initialIndex:f,onClose:()=>c(!1)})]})}async function q0(t,e,n){const r=await p2(t),i=m2(t);try{const s=await fetch("/api/process-image",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({image:r,name:t.name,index:e,total:n})});if(!s.ok)throw new Error(`Server processing failed: ${s.statusText}`);const o=await s.json();if(!o.success||!o.data)throw new Error("Invalid response from processing server");return{thumbnail:o.data.thumbnail,original:r,webpDisplay:o.data.webp,webpCover:o.data.webp,originalFormat:i,originalBase64:r,originalUnmodified:r}}catch(s){throw console.error("Error processing image on server, falling back to local:",s),s}}async function p2(t){return new Promise((e,n)=>{const r=new FileReader;r.onload=i=>{var s;return e((s=i.target)==null?void 0:s.result)},r.onerror=()=>n(new Error("Failed to read file")),r.readAsDataURL(t)})}function m2(t){var r;const e=t.type;if(e==="image/png")return"png";if(e==="image/jpeg")return"jpg";if(e==="image/gif")return"gif";if(e==="image/webp")return"webp";const n=(r=t.name.split(".").pop())==null?void 0:r.toLowerCase();return n&&["png","jpg","jpeg","gif","webp"].includes(n)?n==="jpeg"?"jpg":n:"jpg"}async function g2(t){return new Promise((e,n)=>{const r=new Image;r.crossOrigin="anonymous",r.onload=()=>{const i=r.width/r.height;i<.9?e("portrait"):i>1.1?e("landscape"):e("square")},r.onerror=()=>n(new Error("Failed to load image")),r.src=t})}const Rm="userApiKey";function y2(t){if(!t||t.trim()==="")throw new Error("API key no puede estar vacía");localStorage.setItem(Rm,t.trim())}function q1(){return localStorage.getItem(Rm)}function v2(){localStorage.removeItem(Rm)}const W1="imageBatchSize",W0=10;function au(t){if(t<0)throw new Error("El tamaño del lote no puede ser negativo");localStorage.setItem(W1,t.toString())}function G1(){const t=localStorage.getItem(W1);if(!t)return W0;const e=parseInt(t,10);return isNaN(e)||e<0?W0:e>=999999?0:e}const x2="90ba8efe6890e9e76175089dc182a22a",w2="https://api.imgbb.com/1/upload";function _2(){return q1()||x2}const Ru=t=>new Promise(e=>setTimeout(e,t));async function yc(t,e,n=3){var u,c,f;const r=t.includes(",")?t.split(",")[1]:t,i=_2(),s=`${w2}?key=${i}`,o=new FormData;o.append("image",r),e&&o.append("name",e);let a=0;for(;ah.abort(),3e4);try{const m=await fetch(s,{method:"POST",body:o,signal:h.signal});if(clearTimeout(p),!m.ok){const S=await m.text();if(m.status===429||S.includes("rate limit"))throw new Error("API_BURNED");if(m.status===403||m.status===401)throw new Error("API_INVALID_KEY");if(m.status>=500&&a=n)throw m}}throw new Error("No se pudo subir la imagen a ImgBB tras varios intentos.")}async function lu(t,e,n){const r=G1(),i=[];if(r===0||r>=t.length){const s=t.map((a,u)=>{const c=e?`${e}_${u+1}`:void 0;return yc(a,c)}),o=await Promise.all(s);i.push(...o),n&&n(t.length,t.length)}else for(let s=0;s{const h=s+f,p=e?`${e}_${h+1}`:void 0;return yc(c,p)}),u=await Promise.all(a);i.push(...u),n&&n(Math.min(s+r,t.length),t.length),s+r{};var G0={};/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const K1=function(t){const e=[];let n=0;for(let r=0;r>6|192,e[n++]=i&63|128):(i&64512)===55296&&r+1>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=i&63|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=i&63|128)}return e},E2=function(t){const e=[];let n=0,r=0;for(;n191&&i<224){const s=t[n++];e[r++]=String.fromCharCode((i&31)<<6|s&63)}else if(i>239&&i<365){const s=t[n++],o=t[n++],a=t[n++],u=((i&7)<<18|(s&63)<<12|(o&63)<<6|a&63)-65536;e[r++]=String.fromCharCode(55296+(u>>10)),e[r++]=String.fromCharCode(56320+(u&1023))}else{const s=t[n++],o=t[n++];e[r++]=String.fromCharCode((i&15)<<12|(s&63)<<6|o&63)}}return e.join("")},Q1={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let i=0;i>2,h=(s&3)<<4|a>>4;let p=(a&15)<<2|c>>6,m=c&63;u||(m=64,o||(p=64)),r.push(n[f],n[h],n[p],n[m])}return r.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(K1(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):E2(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();const n=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let i=0;i>4;if(r.push(p),c!==64){const m=a<<4&240|c>>2;if(r.push(m),h!==64){const b=c<<6&192|h;r.push(b)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let t=0;t=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}};class I2 extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const S2=function(t){const e=K1(t);return Q1.encodeByteArray(e,!0)},vc=function(t){return S2(t).replace(/\./g,"")},Y1=function(t){try{return Q1.decodeString(t,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};/** + * @license + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function T2(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}/** + * @license + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const k2=()=>T2().__FIREBASE_DEFAULTS__,C2=()=>{if(typeof process>"u"||typeof G0>"u")return;const t=G0.__FIREBASE_DEFAULTS__;if(t)return JSON.parse(t)},N2=()=>{if(typeof document>"u")return;let t;try{t=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const e=t&&Y1(t[1]);return e&&JSON.parse(e)},ad=()=>{try{return b2()||k2()||C2()||N2()}catch(t){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${t}`);return}},X1=t=>{var e,n;return(n=(e=ad())==null?void 0:e.emulatorHosts)==null?void 0:n[t]},J1=t=>{const e=X1(t);if(!e)return;const n=e.lastIndexOf(":");if(n<=0||n+1===e.length)throw new Error(`Invalid host ${e} with no separate hostname and port!`);const r=parseInt(e.substring(n+1),10);return e[0]==="["?[e.substring(1,n-1),r]:[e.substring(0,n),r]},Z1=()=>{var t;return(t=ad())==null?void 0:t.config},eb=t=>{var e;return(e=ad())==null?void 0:e[`_${t}`]};/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class A2{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}wrapCallback(e){return(n,r)=>{n?this.reject(n):this.resolve(r),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(n):e(n,r))}}}/** + * @license + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function As(t){try{return(t.startsWith("http://")||t.startsWith("https://")?new URL(t).hostname:t).endsWith(".cloudworkstations.dev")}catch{return!1}}async function Dm(t){return(await fetch(t,{credentials:"include"})).ok}/** + * @license + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function tb(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const n={alg:"none",type:"JWT"},r=e||"demo-project",i=t.iat||0,s=t.sub||t.user_id;if(!s)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const o={iss:`https://securetoken.google.com/${r}`,aud:r,iat:i,exp:i+3600,auth_time:i,sub:s,user_id:s,firebase:{sign_in_provider:"custom",identities:{}},...t};return[vc(JSON.stringify(n)),vc(JSON.stringify(o)),""].join(".")}const Aa={};function P2(){const t={prod:[],emulator:[]};for(const e of Object.keys(Aa))Aa[e]?t.emulator.push(e):t.prod.push(e);return t}function R2(t){let e=document.getElementById(t),n=!1;return e||(e=document.createElement("div"),e.setAttribute("id",t),n=!0),{created:n,element:e}}let K0=!1;function jm(t,e){if(typeof window>"u"||typeof document>"u"||!As(window.location.host)||Aa[t]===e||Aa[t]||K0)return;Aa[t]=e;function n(p){return`__firebase__banner__${p}`}const r="__firebase__banner",s=P2().prod.length>0;function o(){const p=document.getElementById(r);p&&p.remove()}function a(p){p.style.display="flex",p.style.background="#7faaf0",p.style.position="fixed",p.style.bottom="5px",p.style.left="5px",p.style.padding=".5em",p.style.borderRadius="5px",p.style.alignItems="center"}function u(p,m){p.setAttribute("width","24"),p.setAttribute("id",m),p.setAttribute("height","24"),p.setAttribute("viewBox","0 0 24 24"),p.setAttribute("fill","none"),p.style.marginLeft="-6px"}function c(){const p=document.createElement("span");return p.style.cursor="pointer",p.style.marginLeft="16px",p.style.fontSize="24px",p.innerHTML=" ×",p.onclick=()=>{K0=!0,o()},p}function f(p,m){p.setAttribute("id",m),p.innerText="Learn more",p.href="https://firebase.google.com/docs/studio/preview-apps#preview-backend",p.setAttribute("target","__blank"),p.style.paddingLeft="5px",p.style.textDecoration="underline"}function h(){const p=R2(r),m=n("text"),b=document.getElementById(m)||document.createElement("span"),S=n("learnmore"),P=document.getElementById(S)||document.createElement("a"),y=n("preprendIcon"),w=document.getElementById(y)||document.createElementNS("http://www.w3.org/2000/svg","svg");if(p.created){const T=p.element;a(T),f(P,S);const L=c();u(w,y),T.append(w,b,P,L),document.body.appendChild(T)}s?(b.innerText="Preview backend disconnected.",w.innerHTML=` + + + + + + +`):(w.innerHTML=` + + + + + + +`,b.innerText="Preview backend running in this workspace."),b.setAttribute("id",m)}document.readyState==="loading"?window.addEventListener("DOMContentLoaded",h):h()}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function un(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function D2(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(un())}function j2(){var e;const t=(e=ad())==null?void 0:e.forceEnvironment;if(t==="node")return!0;if(t==="browser")return!1;try{return Object.prototype.toString.call(global.process)==="[object process]"}catch{return!1}}function L2(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function O2(){const t=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof t=="object"&&t.id!==void 0}function M2(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function V2(){const t=un();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0}function F2(){return!j2()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}function U2(){try{return typeof indexedDB=="object"}catch{return!1}}function z2(){return new Promise((t,e)=>{try{let n=!0;const r="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(r);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(r),t(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{var s;e(((s=i.error)==null?void 0:s.message)||"")}}catch(n){e(n)}})}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const B2="FirebaseError";class Dr extends Error{constructor(e,n,r){super(n),this.code=e,this.customData=r,this.name=B2,Object.setPrototypeOf(this,Dr.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,_l.prototype.create)}}class _l{constructor(e,n,r){this.service=e,this.serviceName=n,this.errors=r}create(e,...n){const r=n[0]||{},i=`${this.service}/${e}`,s=this.errors[e],o=s?$2(s,r):"Error",a=`${this.serviceName}: ${o} (${i}).`;return new Dr(i,a,r)}}function $2(t,e){return t.replace(H2,(n,r)=>{const i=e[r];return i!=null?String(i):`<${r}?>`})}const H2=/\{\$([^}]+)}/g;function q2(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}function Es(t,e){if(t===e)return!0;const n=Object.keys(t),r=Object.keys(e);for(const i of n){if(!r.includes(i))return!1;const s=t[i],o=e[i];if(Q0(s)&&Q0(o)){if(!Es(s,o))return!1}else if(s!==o)return!1}for(const i of r)if(!n.includes(i))return!1;return!0}function Q0(t){return t!==null&&typeof t=="object"}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function bl(t){const e=[];for(const[n,r]of Object.entries(t))Array.isArray(r)?r.forEach(i=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(i))}):e.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return e.length?"&"+e.join("&"):""}function W2(t,e){const n=new G2(t,e);return n.subscribe.bind(n)}class G2{constructor(e,n){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=n,this.task.then(()=>{e(this)}).catch(r=>{this.error(r)})}next(e){this.forEachObserver(n=>{n.next(e)})}error(e){this.forEachObserver(n=>{n.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,n,r){let i;if(e===void 0&&n===void 0&&r===void 0)throw new Error("Missing Observer.");K2(e,["next","error","complete"])?i=e:i={next:e,error:n,complete:r},i.next===void 0&&(i.next=Sh),i.error===void 0&&(i.error=Sh),i.complete===void 0&&(i.complete=Sh);const s=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?i.error(this.finalError):i.complete()}catch{}}),this.observers.push(i),s}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let n=0;n{if(this.observers!==void 0&&this.observers[e]!==void 0)try{n(this.observers[e])}catch(r){typeof console<"u"&&console.error&&console.error(r)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}}function K2(t,e){if(typeof t!="object"||t===null)return!1;for(const n of e)if(n in t&&typeof t[n]=="function")return!0;return!1}function Sh(){}/** + * @license + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Zt(t){return t&&t._delegate?t._delegate:t}class Fi{constructor(e,n,r){this.name=e,this.instanceFactory=n,this.type=r,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const os="[DEFAULT]";/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Q2{constructor(e,n){this.name=e,this.container=n,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){const n=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(n)){const r=new A2;if(this.instancesDeferred.set(n,r),this.isInitialized(n)||this.shouldAutoInitialize())try{const i=this.getOrInitializeService({instanceIdentifier:n});i&&r.resolve(i)}catch{}}return this.instancesDeferred.get(n).promise}getImmediate(e){const n=this.normalizeInstanceIdentifier(e==null?void 0:e.identifier),r=(e==null?void 0:e.optional)??!1;if(this.isInitialized(n)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:n})}catch(i){if(r)return null;throw i}else{if(r)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,!!this.shouldAutoInitialize()){if(X2(e))try{this.getOrInitializeService({instanceIdentifier:os})}catch{}for(const[n,r]of this.instancesDeferred.entries()){const i=this.normalizeInstanceIdentifier(n);try{const s=this.getOrInitializeService({instanceIdentifier:i});r.resolve(s)}catch{}}}}clearInstance(e=os){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){const e=Array.from(this.instances.values());await Promise.all([...e.filter(n=>"INTERNAL"in n).map(n=>n.INTERNAL.delete()),...e.filter(n=>"_delete"in n).map(n=>n._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=os){return this.instances.has(e)}getOptions(e=os){return this.instancesOptions.get(e)||{}}initialize(e={}){const{options:n={}}=e,r=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(r))throw Error(`${this.name}(${r}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const i=this.getOrInitializeService({instanceIdentifier:r,options:n});for(const[s,o]of this.instancesDeferred.entries()){const a=this.normalizeInstanceIdentifier(s);r===a&&o.resolve(i)}return i}onInit(e,n){const r=this.normalizeInstanceIdentifier(n),i=this.onInitCallbacks.get(r)??new Set;i.add(e),this.onInitCallbacks.set(r,i);const s=this.instances.get(r);return s&&e(s,r),()=>{i.delete(e)}}invokeOnInitCallbacks(e,n){const r=this.onInitCallbacks.get(n);if(r)for(const i of r)try{i(e,n)}catch{}}getOrInitializeService({instanceIdentifier:e,options:n={}}){let r=this.instances.get(e);if(!r&&this.component&&(r=this.component.instanceFactory(this.container,{instanceIdentifier:Y2(e),options:n}),this.instances.set(e,r),this.instancesOptions.set(e,n),this.invokeOnInitCallbacks(r,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,r)}catch{}return r||null}normalizeInstanceIdentifier(e=os){return this.component?this.component.multipleInstances?e:os:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function Y2(t){return t===os?void 0:t}function X2(t){return t.instantiationMode==="EAGER"}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class J2{constructor(e){this.name=e,this.providers=new Map}addComponent(e){const n=this.getProvider(e.name);if(n.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);n.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);const n=new Q2(e,this);return this.providers.set(e,n),n}getProviders(){return Array.from(this.providers.values())}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */var Ue;(function(t){t[t.DEBUG=0]="DEBUG",t[t.VERBOSE=1]="VERBOSE",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.SILENT=5]="SILENT"})(Ue||(Ue={}));const Z2={debug:Ue.DEBUG,verbose:Ue.VERBOSE,info:Ue.INFO,warn:Ue.WARN,error:Ue.ERROR,silent:Ue.SILENT},eC=Ue.INFO,tC={[Ue.DEBUG]:"log",[Ue.VERBOSE]:"log",[Ue.INFO]:"info",[Ue.WARN]:"warn",[Ue.ERROR]:"error"},nC=(t,e,...n)=>{if(ee.some(n=>t instanceof n);let Y0,X0;function iC(){return Y0||(Y0=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function sC(){return X0||(X0=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const nb=new WeakMap,Kf=new WeakMap,rb=new WeakMap,Th=new WeakMap,Om=new WeakMap;function oC(t){const e=new Promise((n,r)=>{const i=()=>{t.removeEventListener("success",s),t.removeEventListener("error",o)},s=()=>{n(Di(t.result)),i()},o=()=>{r(t.error),i()};t.addEventListener("success",s),t.addEventListener("error",o)});return e.then(n=>{n instanceof IDBCursor&&nb.set(n,t)}).catch(()=>{}),Om.set(e,t),e}function aC(t){if(Kf.has(t))return;const e=new Promise((n,r)=>{const i=()=>{t.removeEventListener("complete",s),t.removeEventListener("error",o),t.removeEventListener("abort",o)},s=()=>{n(),i()},o=()=>{r(t.error||new DOMException("AbortError","AbortError")),i()};t.addEventListener("complete",s),t.addEventListener("error",o),t.addEventListener("abort",o)});Kf.set(t,e)}let Qf={get(t,e,n){if(t instanceof IDBTransaction){if(e==="done")return Kf.get(t);if(e==="objectStoreNames")return t.objectStoreNames||rb.get(t);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return Di(t[e])},set(t,e,n){return t[e]=n,!0},has(t,e){return t instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in t}};function lC(t){Qf=t(Qf)}function uC(t){return t===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...n){const r=t.call(kh(this),e,...n);return rb.set(r,e.sort?e.sort():[e]),Di(r)}:sC().includes(t)?function(...e){return t.apply(kh(this),e),Di(nb.get(this))}:function(...e){return Di(t.apply(kh(this),e))}}function cC(t){return typeof t=="function"?uC(t):(t instanceof IDBTransaction&&aC(t),rC(t,iC())?new Proxy(t,Qf):t)}function Di(t){if(t instanceof IDBRequest)return oC(t);if(Th.has(t))return Th.get(t);const e=cC(t);return e!==t&&(Th.set(t,e),Om.set(e,t)),e}const kh=t=>Om.get(t);function dC(t,e,{blocked:n,upgrade:r,blocking:i,terminated:s}={}){const o=indexedDB.open(t,e),a=Di(o);return r&&o.addEventListener("upgradeneeded",u=>{r(Di(o.result),u.oldVersion,u.newVersion,Di(o.transaction),u)}),n&&o.addEventListener("blocked",u=>n(u.oldVersion,u.newVersion,u)),a.then(u=>{s&&u.addEventListener("close",()=>s()),i&&u.addEventListener("versionchange",c=>i(c.oldVersion,c.newVersion,c))}).catch(()=>{}),a}const hC=["get","getKey","getAll","getAllKeys","count"],fC=["put","add","delete","clear"],Ch=new Map;function J0(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(Ch.get(e))return Ch.get(e);const n=e.replace(/FromIndex$/,""),r=e!==n,i=fC.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(i||hC.includes(n)))return;const s=async function(o,...a){const u=this.transaction(o,i?"readwrite":"readonly");let c=u.store;return r&&(c=c.index(a.shift())),(await Promise.all([c[n](...a),i&&u.done]))[0]};return Ch.set(e,s),s}lC(t=>({...t,get:(e,n,r)=>J0(e,n)||t.get(e,n,r),has:(e,n)=>!!J0(e,n)||t.has(e,n)}));/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class pC{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(mC(n)){const r=n.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(n=>n).join(" ")}}function mC(t){const e=t.getComponent();return(e==null?void 0:e.type)==="VERSION"}const Yf="@firebase/app",Z0="0.14.6";/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Qr=new Lm("@firebase/app"),gC="@firebase/app-compat",yC="@firebase/analytics-compat",vC="@firebase/analytics",xC="@firebase/app-check-compat",wC="@firebase/app-check",_C="@firebase/auth",bC="@firebase/auth-compat",EC="@firebase/database",IC="@firebase/data-connect",SC="@firebase/database-compat",TC="@firebase/functions",kC="@firebase/functions-compat",CC="@firebase/installations",NC="@firebase/installations-compat",AC="@firebase/messaging",PC="@firebase/messaging-compat",RC="@firebase/performance",DC="@firebase/performance-compat",jC="@firebase/remote-config",LC="@firebase/remote-config-compat",OC="@firebase/storage",MC="@firebase/storage-compat",VC="@firebase/firestore",FC="@firebase/ai",UC="@firebase/firestore-compat",zC="firebase",BC="12.6.0";/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Xf="[DEFAULT]",$C={[Yf]:"fire-core",[gC]:"fire-core-compat",[vC]:"fire-analytics",[yC]:"fire-analytics-compat",[wC]:"fire-app-check",[xC]:"fire-app-check-compat",[_C]:"fire-auth",[bC]:"fire-auth-compat",[EC]:"fire-rtdb",[IC]:"fire-data-connect",[SC]:"fire-rtdb-compat",[TC]:"fire-fn",[kC]:"fire-fn-compat",[CC]:"fire-iid",[NC]:"fire-iid-compat",[AC]:"fire-fcm",[PC]:"fire-fcm-compat",[RC]:"fire-perf",[DC]:"fire-perf-compat",[jC]:"fire-rc",[LC]:"fire-rc-compat",[OC]:"fire-gcs",[MC]:"fire-gcs-compat",[VC]:"fire-fst",[UC]:"fire-fst-compat",[FC]:"fire-vertex","fire-js":"fire-js",[zC]:"fire-js-all"};/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const xc=new Map,HC=new Map,Jf=new Map;function ev(t,e){try{t.container.addComponent(e)}catch(n){Qr.debug(`Component ${e.name} failed to register with FirebaseApp ${t.name}`,n)}}function Is(t){const e=t.name;if(Jf.has(e))return Qr.debug(`There were multiple attempts to register component ${e}.`),!1;Jf.set(e,t);for(const n of xc.values())ev(n,t);for(const n of HC.values())ev(n,t);return!0}function ld(t,e){const n=t.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),t.container.getProvider(e)}function rr(t){return t==null?!1:t.settings!==void 0}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const qC={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},ji=new _l("app","Firebase",qC);/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class WC{constructor(e,n,r){this._isDeleted=!1,this._options={...e},this._config={...n},this._name=n.name,this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new Fi("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw ji.create("app-deleted",{appName:this._name})}}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Ps=BC;function ib(t,e={}){let n=t;typeof e!="object"&&(e={name:e});const r={name:Xf,automaticDataCollectionEnabled:!0,...e},i=r.name;if(typeof i!="string"||!i)throw ji.create("bad-app-name",{appName:String(i)});if(n||(n=Z1()),!n)throw ji.create("no-options");const s=xc.get(i);if(s){if(Es(n,s.options)&&Es(r,s.config))return s;throw ji.create("duplicate-app",{appName:i})}const o=new J2(i);for(const u of Jf.values())o.addComponent(u);const a=new WC(n,r,o);return xc.set(i,a),a}function Mm(t=Xf){const e=xc.get(t);if(!e&&t===Xf&&Z1())return ib();if(!e)throw ji.create("no-app",{appName:t});return e}function Er(t,e,n){let r=$C[t]??t;n&&(r+=`-${n}`);const i=r.match(/\s|\//),s=e.match(/\s|\//);if(i||s){const o=[`Unable to register library "${r}" with version "${e}":`];i&&o.push(`library name "${r}" contains illegal characters (whitespace or "/")`),i&&s&&o.push("and"),s&&o.push(`version name "${e}" contains illegal characters (whitespace or "/")`),Qr.warn(o.join(" "));return}Is(new Fi(`${r}-version`,()=>({library:r,version:e}),"VERSION"))}/** + * @license + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const GC="firebase-heartbeat-database",KC=1,rl="firebase-heartbeat-store";let Nh=null;function sb(){return Nh||(Nh=dC(GC,KC,{upgrade:(t,e)=>{switch(e){case 0:try{t.createObjectStore(rl)}catch(n){console.warn(n)}}}}).catch(t=>{throw ji.create("idb-open",{originalErrorMessage:t.message})})),Nh}async function QC(t){try{const n=(await sb()).transaction(rl),r=await n.objectStore(rl).get(ob(t));return await n.done,r}catch(e){if(e instanceof Dr)Qr.warn(e.message);else{const n=ji.create("idb-get",{originalErrorMessage:e==null?void 0:e.message});Qr.warn(n.message)}}}async function tv(t,e){try{const r=(await sb()).transaction(rl,"readwrite");await r.objectStore(rl).put(e,ob(t)),await r.done}catch(n){if(n instanceof Dr)Qr.warn(n.message);else{const r=ji.create("idb-set",{originalErrorMessage:n==null?void 0:n.message});Qr.warn(r.message)}}}function ob(t){return`${t.name}!${t.options.appId}`}/** + * @license + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const YC=1024,XC=30;class JC{constructor(e){this.container=e,this._heartbeatsCache=null;const n=this.container.getProvider("app").getImmediate();this._storage=new eN(n),this._heartbeatsCachePromise=this._storage.read().then(r=>(this._heartbeatsCache=r,r))}async triggerHeartbeat(){var e,n;try{const i=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),s=nv();if(((e=this._heartbeatsCache)==null?void 0:e.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((n=this._heartbeatsCache)==null?void 0:n.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===s||this._heartbeatsCache.heartbeats.some(o=>o.date===s))return;if(this._heartbeatsCache.heartbeats.push({date:s,agent:i}),this._heartbeatsCache.heartbeats.length>XC){const o=tN(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(o,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(r){Qr.warn(r)}}async getHeartbeatsHeader(){var e;try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((e=this._heartbeatsCache)==null?void 0:e.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";const n=nv(),{heartbeatsToSend:r,unsentEntries:i}=ZC(this._heartbeatsCache.heartbeats),s=vc(JSON.stringify({version:2,heartbeats:r}));return this._heartbeatsCache.lastSentHeartbeatDate=n,i.length>0?(this._heartbeatsCache.heartbeats=i,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),s}catch(n){return Qr.warn(n),""}}}function nv(){return new Date().toISOString().substring(0,10)}function ZC(t,e=YC){const n=[];let r=t.slice();for(const i of t){const s=n.find(o=>o.agent===i.agent);if(s){if(s.dates.push(i.date),rv(n)>e){s.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),rv(n)>e){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}class eN{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return U2()?z2().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const n=await QC(this.app);return n!=null&&n.heartbeats?n:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){if(await this._canUseIndexedDBPromise){const r=await this.read();return tv(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){if(await this._canUseIndexedDBPromise){const r=await this.read();return tv(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:[...r.heartbeats,...e.heartbeats]})}else return}}function rv(t){return vc(JSON.stringify({version:2,heartbeats:t})).length}function tN(t){if(t.length===0)return-1;let e=0,n=t[0].date;for(let r=1;rnew pC(e),"PRIVATE")),Is(new Fi("heartbeat",e=>new JC(e),"PRIVATE")),Er(Yf,Z0,t),Er(Yf,Z0,"esm2020"),Er("fire-js","")}nN("");var rN="firebase",iN="12.6.0";/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */Er(rN,iN,"app");var iv=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/** @license +Copyright The Closure Library Authors. +SPDX-License-Identifier: Apache-2.0 +*/var Li,ab;(function(){var t;/** @license + + Copyright The Closure Library Authors. + SPDX-License-Identifier: Apache-2.0 +*/function e(_,x){function E(){}E.prototype=x.prototype,_.F=x.prototype,_.prototype=new E,_.prototype.constructor=_,_.D=function(k,C,j){for(var A=Array(arguments.length-2),de=2;de>>25),A=j+(C^x&(E^C))+k[1]+3905402710&4294967295,j=x+(A<<12&4294967295|A>>>20),A=C+(E^j&(x^E))+k[2]+606105819&4294967295,C=j+(A<<17&4294967295|A>>>15),A=E+(x^C&(j^x))+k[3]+3250441966&4294967295,E=C+(A<<22&4294967295|A>>>10),A=x+(j^E&(C^j))+k[4]+4118548399&4294967295,x=E+(A<<7&4294967295|A>>>25),A=j+(C^x&(E^C))+k[5]+1200080426&4294967295,j=x+(A<<12&4294967295|A>>>20),A=C+(E^j&(x^E))+k[6]+2821735955&4294967295,C=j+(A<<17&4294967295|A>>>15),A=E+(x^C&(j^x))+k[7]+4249261313&4294967295,E=C+(A<<22&4294967295|A>>>10),A=x+(j^E&(C^j))+k[8]+1770035416&4294967295,x=E+(A<<7&4294967295|A>>>25),A=j+(C^x&(E^C))+k[9]+2336552879&4294967295,j=x+(A<<12&4294967295|A>>>20),A=C+(E^j&(x^E))+k[10]+4294925233&4294967295,C=j+(A<<17&4294967295|A>>>15),A=E+(x^C&(j^x))+k[11]+2304563134&4294967295,E=C+(A<<22&4294967295|A>>>10),A=x+(j^E&(C^j))+k[12]+1804603682&4294967295,x=E+(A<<7&4294967295|A>>>25),A=j+(C^x&(E^C))+k[13]+4254626195&4294967295,j=x+(A<<12&4294967295|A>>>20),A=C+(E^j&(x^E))+k[14]+2792965006&4294967295,C=j+(A<<17&4294967295|A>>>15),A=E+(x^C&(j^x))+k[15]+1236535329&4294967295,E=C+(A<<22&4294967295|A>>>10),A=x+(C^j&(E^C))+k[1]+4129170786&4294967295,x=E+(A<<5&4294967295|A>>>27),A=j+(E^C&(x^E))+k[6]+3225465664&4294967295,j=x+(A<<9&4294967295|A>>>23),A=C+(x^E&(j^x))+k[11]+643717713&4294967295,C=j+(A<<14&4294967295|A>>>18),A=E+(j^x&(C^j))+k[0]+3921069994&4294967295,E=C+(A<<20&4294967295|A>>>12),A=x+(C^j&(E^C))+k[5]+3593408605&4294967295,x=E+(A<<5&4294967295|A>>>27),A=j+(E^C&(x^E))+k[10]+38016083&4294967295,j=x+(A<<9&4294967295|A>>>23),A=C+(x^E&(j^x))+k[15]+3634488961&4294967295,C=j+(A<<14&4294967295|A>>>18),A=E+(j^x&(C^j))+k[4]+3889429448&4294967295,E=C+(A<<20&4294967295|A>>>12),A=x+(C^j&(E^C))+k[9]+568446438&4294967295,x=E+(A<<5&4294967295|A>>>27),A=j+(E^C&(x^E))+k[14]+3275163606&4294967295,j=x+(A<<9&4294967295|A>>>23),A=C+(x^E&(j^x))+k[3]+4107603335&4294967295,C=j+(A<<14&4294967295|A>>>18),A=E+(j^x&(C^j))+k[8]+1163531501&4294967295,E=C+(A<<20&4294967295|A>>>12),A=x+(C^j&(E^C))+k[13]+2850285829&4294967295,x=E+(A<<5&4294967295|A>>>27),A=j+(E^C&(x^E))+k[2]+4243563512&4294967295,j=x+(A<<9&4294967295|A>>>23),A=C+(x^E&(j^x))+k[7]+1735328473&4294967295,C=j+(A<<14&4294967295|A>>>18),A=E+(j^x&(C^j))+k[12]+2368359562&4294967295,E=C+(A<<20&4294967295|A>>>12),A=x+(E^C^j)+k[5]+4294588738&4294967295,x=E+(A<<4&4294967295|A>>>28),A=j+(x^E^C)+k[8]+2272392833&4294967295,j=x+(A<<11&4294967295|A>>>21),A=C+(j^x^E)+k[11]+1839030562&4294967295,C=j+(A<<16&4294967295|A>>>16),A=E+(C^j^x)+k[14]+4259657740&4294967295,E=C+(A<<23&4294967295|A>>>9),A=x+(E^C^j)+k[1]+2763975236&4294967295,x=E+(A<<4&4294967295|A>>>28),A=j+(x^E^C)+k[4]+1272893353&4294967295,j=x+(A<<11&4294967295|A>>>21),A=C+(j^x^E)+k[7]+4139469664&4294967295,C=j+(A<<16&4294967295|A>>>16),A=E+(C^j^x)+k[10]+3200236656&4294967295,E=C+(A<<23&4294967295|A>>>9),A=x+(E^C^j)+k[13]+681279174&4294967295,x=E+(A<<4&4294967295|A>>>28),A=j+(x^E^C)+k[0]+3936430074&4294967295,j=x+(A<<11&4294967295|A>>>21),A=C+(j^x^E)+k[3]+3572445317&4294967295,C=j+(A<<16&4294967295|A>>>16),A=E+(C^j^x)+k[6]+76029189&4294967295,E=C+(A<<23&4294967295|A>>>9),A=x+(E^C^j)+k[9]+3654602809&4294967295,x=E+(A<<4&4294967295|A>>>28),A=j+(x^E^C)+k[12]+3873151461&4294967295,j=x+(A<<11&4294967295|A>>>21),A=C+(j^x^E)+k[15]+530742520&4294967295,C=j+(A<<16&4294967295|A>>>16),A=E+(C^j^x)+k[2]+3299628645&4294967295,E=C+(A<<23&4294967295|A>>>9),A=x+(C^(E|~j))+k[0]+4096336452&4294967295,x=E+(A<<6&4294967295|A>>>26),A=j+(E^(x|~C))+k[7]+1126891415&4294967295,j=x+(A<<10&4294967295|A>>>22),A=C+(x^(j|~E))+k[14]+2878612391&4294967295,C=j+(A<<15&4294967295|A>>>17),A=E+(j^(C|~x))+k[5]+4237533241&4294967295,E=C+(A<<21&4294967295|A>>>11),A=x+(C^(E|~j))+k[12]+1700485571&4294967295,x=E+(A<<6&4294967295|A>>>26),A=j+(E^(x|~C))+k[3]+2399980690&4294967295,j=x+(A<<10&4294967295|A>>>22),A=C+(x^(j|~E))+k[10]+4293915773&4294967295,C=j+(A<<15&4294967295|A>>>17),A=E+(j^(C|~x))+k[1]+2240044497&4294967295,E=C+(A<<21&4294967295|A>>>11),A=x+(C^(E|~j))+k[8]+1873313359&4294967295,x=E+(A<<6&4294967295|A>>>26),A=j+(E^(x|~C))+k[15]+4264355552&4294967295,j=x+(A<<10&4294967295|A>>>22),A=C+(x^(j|~E))+k[6]+2734768916&4294967295,C=j+(A<<15&4294967295|A>>>17),A=E+(j^(C|~x))+k[13]+1309151649&4294967295,E=C+(A<<21&4294967295|A>>>11),A=x+(C^(E|~j))+k[4]+4149444226&4294967295,x=E+(A<<6&4294967295|A>>>26),A=j+(E^(x|~C))+k[11]+3174756917&4294967295,j=x+(A<<10&4294967295|A>>>22),A=C+(x^(j|~E))+k[2]+718787259&4294967295,C=j+(A<<15&4294967295|A>>>17),A=E+(j^(C|~x))+k[9]+3951481745&4294967295,_.g[0]=_.g[0]+x&4294967295,_.g[1]=_.g[1]+(C+(A<<21&4294967295|A>>>11))&4294967295,_.g[2]=_.g[2]+C&4294967295,_.g[3]=_.g[3]+j&4294967295}r.prototype.v=function(_,x){x===void 0&&(x=_.length);const E=x-this.blockSize,k=this.C;let C=this.h,j=0;for(;j>>k&255;return _};function s(_,x){var E=a;return Object.prototype.hasOwnProperty.call(E,_)?E[_]:E[_]=x(_)}function o(_,x){this.h=x;const E=[];let k=!0;for(let C=_.length-1;C>=0;C--){const j=_[C]|0;k&&j==x||(E[C]=j,k=!1)}this.g=E}var a={};function u(_){return-128<=_&&_<128?s(_,function(x){return new o([x|0],x<0?-1:0)}):new o([_|0],_<0?-1:0)}function c(_){if(isNaN(_)||!isFinite(_))return h;if(_<0)return P(c(-_));const x=[];let E=1;for(let k=0;_>=E;k++)x[k]=_/E|0,E*=4294967296;return new o(x,0)}function f(_,x){if(_.length==0)throw Error("number format error: empty string");if(x=x||10,x<2||36=0)throw Error('number format error: interior "-" character');const E=c(Math.pow(x,8));let k=h;for(let j=0;j<_.length;j+=8){var C=Math.min(8,_.length-j);const A=parseInt(_.substring(j,j+C),x);C<8?(C=c(Math.pow(x,C)),k=k.j(C).add(c(A))):(k=k.j(E),k=k.add(c(A)))}return k}var h=u(0),p=u(1),m=u(16777216);t=o.prototype,t.m=function(){if(S(this))return-P(this).m();let _=0,x=1;for(let E=0;E=0?k:4294967296+k)*x,x*=4294967296}return _},t.toString=function(_){if(_=_||10,_<2||36<_)throw Error("radix out of range: "+_);if(b(this))return"0";if(S(this))return"-"+P(this).toString(_);const x=c(Math.pow(_,6));var E=this;let k="";for(;;){const C=L(E,x).g;E=y(E,C.j(x));let j=((E.g.length>0?E.g[0]:E.h)>>>0).toString(_);if(E=C,b(E))return j+k;for(;j.length<6;)j="0"+j;k=j+k}},t.i=function(_){return _<0?0:_>>16)+(this.i(C)>>>16)+(_.i(C)>>>16);k=A>>>16,j&=65535,A&=65535,E[C]=A<<16|j}return new o(E,E[E.length-1]&-2147483648?-1:0)};function y(_,x){return _.add(P(x))}t.j=function(_){if(b(this)||b(_))return h;if(S(this))return S(_)?P(this).j(P(_)):P(P(this).j(_));if(S(_))return P(this.j(P(_)));if(this.l(m)<0&&_.l(m)<0)return c(this.m()*_.m());const x=this.g.length+_.g.length,E=[];for(var k=0;k<2*x;k++)E[k]=0;for(k=0;k>>16,A=this.i(k)&65535,de=_.i(C)>>>16,oe=_.i(C)&65535;E[2*k+2*C]+=A*oe,w(E,2*k+2*C),E[2*k+2*C+1]+=j*oe,w(E,2*k+2*C+1),E[2*k+2*C+1]+=A*de,w(E,2*k+2*C+1),E[2*k+2*C+2]+=j*de,w(E,2*k+2*C+2)}for(_=0;_>>16,_[x]&=65535,x++}function T(_,x){this.g=_,this.h=x}function L(_,x){if(b(x))throw Error("division by zero");if(b(_))return new T(h,h);if(S(_))return x=L(P(_),x),new T(P(x.g),P(x.h));if(S(x))return x=L(_,P(x)),new T(P(x.g),x.h);if(_.g.length>30){if(S(_)||S(x))throw Error("slowDivide_ only works with positive integers.");for(var E=p,k=x;k.l(_)<=0;)E=F(E),k=F(k);var C=D(E,1),j=D(k,1);for(k=D(k,2),E=D(E,2);!b(k);){var A=j.add(k);A.l(_)<=0&&(C=C.add(E),j=A),k=D(k,1),E=D(E,1)}return x=y(_,C.j(x)),new T(C,x)}for(C=h;_.l(x)>=0;){for(E=Math.max(1,Math.floor(_.m()/x.m())),k=Math.ceil(Math.log(E)/Math.LN2),k=k<=48?1:Math.pow(2,k-48),j=c(E),A=j.j(x);S(A)||A.l(_)>0;)E-=k,j=c(E),A=j.j(x);b(j)&&(j=p),C=C.add(j),_=y(_,A)}return new T(C,_)}t.B=function(_){return L(this,_).h},t.and=function(_){const x=Math.max(this.g.length,_.g.length),E=[];for(let k=0;k>>31;return new o(E,_.h)}function D(_,x){const E=x>>5;x%=32;const k=_.g.length-E,C=[];for(let j=0;j0?_.i(j+E)>>>x|_.i(j+E+1)<<32-x:_.i(j+E);return new o(C,_.h)}r.prototype.digest=r.prototype.A,r.prototype.reset=r.prototype.u,r.prototype.update=r.prototype.v,ab=r,o.prototype.add=o.prototype.add,o.prototype.multiply=o.prototype.j,o.prototype.modulo=o.prototype.B,o.prototype.compare=o.prototype.l,o.prototype.toNumber=o.prototype.m,o.prototype.toString=o.prototype.toString,o.prototype.getBits=o.prototype.i,o.fromNumber=c,o.fromString=f,Li=o}).apply(typeof iv<"u"?iv:typeof self<"u"?self:typeof window<"u"?window:{});var uu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/** @license +Copyright The Closure Library Authors. +SPDX-License-Identifier: Apache-2.0 +*/var lb,ya,ub,Du,Zf,cb,db,hb;(function(){var t,e=Object.defineProperty;function n(l){l=[typeof globalThis=="object"&&globalThis,l,typeof window=="object"&&window,typeof self=="object"&&self,typeof uu=="object"&&uu];for(var g=0;gl&&AsyncContext.Snapshot.wrap(l):l=>l;function m(l){const g=l.length;if(g>0){const v=Array(g);for(let I=0;I0?(this.h--,g=this.g,this.g=g.next,g.next=null):g=this.i(),g}}function P(l){o.setTimeout(()=>{throw l},0)}function y(){var l=_;let g=null;return l.g&&(g=l.g,l.g=l.g.next,l.g||(l.h=null),g.next=null),g}class w{constructor(){this.h=this.g=null}add(g,v){const I=T.get();I.set(g,v),this.h?this.h.next=I:this.g=I,this.h=I}}var T=new S(()=>new L,l=>l.reset());class L{constructor(){this.next=this.g=this.h=null}set(g,v){this.h=g,this.g=v,this.next=null}reset(){this.next=this.g=this.h=null}}let F,D=!1,_=new w,x=()=>{const l=Promise.resolve(void 0);F=()=>{l.then(E)}};function E(){for(var l;l=y();){try{l.h.call(l.g)}catch(v){P(v)}var g=T;g.j(l),g.h<100&&(g.h++,l.next=g.g,g.g=l)}D=!1}function k(){this.u=this.u,this.C=this.C}k.prototype.u=!1,k.prototype.dispose=function(){this.u||(this.u=!0,this.N())},k.prototype[Symbol.dispose]=function(){this.dispose()},k.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()};function C(l,g){this.type=l,this.g=this.target=g,this.defaultPrevented=!1}C.prototype.h=function(){this.defaultPrevented=!0};var j=function(){if(!o.addEventListener||!Object.defineProperty)return!1;var l=!1,g=Object.defineProperty({},"passive",{get:function(){l=!0}});try{const v=()=>{};o.addEventListener("test",v,g),o.removeEventListener("test",v,g)}catch{}return l}();function A(l){return/^[\s\xa0]*$/.test(l)}function de(l,g){C.call(this,l?l.type:""),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType="",this.i=null,l&&this.init(l,g)}h(de,C),de.prototype.init=function(l,g){const v=this.type=l.type,I=l.changedTouches&&l.changedTouches.length?l.changedTouches[0]:null;this.target=l.target||l.srcElement,this.g=g,g=l.relatedTarget,g||(v=="mouseover"?g=l.fromElement:v=="mouseout"&&(g=l.toElement)),this.relatedTarget=g,I?(this.clientX=I.clientX!==void 0?I.clientX:I.pageX,this.clientY=I.clientY!==void 0?I.clientY:I.pageY,this.screenX=I.screenX||0,this.screenY=I.screenY||0):(this.clientX=l.clientX!==void 0?l.clientX:l.pageX,this.clientY=l.clientY!==void 0?l.clientY:l.pageY,this.screenX=l.screenX||0,this.screenY=l.screenY||0),this.button=l.button,this.key=l.key||"",this.ctrlKey=l.ctrlKey,this.altKey=l.altKey,this.shiftKey=l.shiftKey,this.metaKey=l.metaKey,this.pointerId=l.pointerId||0,this.pointerType=l.pointerType,this.state=l.state,this.i=l,l.defaultPrevented&&de.Z.h.call(this)},de.prototype.h=function(){de.Z.h.call(this);const l=this.i;l.preventDefault?l.preventDefault():l.returnValue=!1};var oe="closure_listenable_"+(Math.random()*1e6|0),le=0;function ve(l,g,v,I,M){this.listener=l,this.proxy=null,this.src=g,this.type=v,this.capture=!!I,this.ha=M,this.key=++le,this.da=this.fa=!1}function K(l){l.da=!0,l.listener=null,l.proxy=null,l.src=null,l.ha=null}function ie(l,g,v){for(const I in l)g.call(v,l[I],I,l)}function N(l,g){for(const v in l)g.call(void 0,l[v],v,l)}function fe(l){const g={};for(const v in l)g[v]=l[v];return g}const ye="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function R(l,g){let v,I;for(let M=1;M-1?(g=l[ne],v||(g.fa=!1)):(g=new ve(g,this.src,U,!!I,M),g.fa=v,l.push(g)),g};function J(l,g){const v=g.type;if(v in l.g){var I=l.g[v],M=Array.prototype.indexOf.call(I,g,void 0),U;(U=M>=0)&&Array.prototype.splice.call(I,M,1),U&&(K(g),l.g[v].length==0&&(delete l.g[v],l.h--))}}function te(l,g,v,I){for(let M=0;M-1&&(K(g[v]),Array.prototype.splice.call(g,v,1),g.length==0&&(delete l.g[U],l.h--)))):l&&(l=Vt(l))&&(g=l.g[g.toString()],l=-1,g&&(l=te(g,v,I,M)),(v=l>-1?g[l]:null)&&mt(v))}function mt(l){if(typeof l!="number"&&l&&!l.da){var g=l.src;if(g&&g[oe])J(g.i,l);else{var v=l.type,I=l.proxy;g.removeEventListener?g.removeEventListener(v,I,l.capture):g.detachEvent?g.detachEvent(gt(v),I):g.addListener&&g.removeListener&&g.removeListener(I),(v=Vt(g))?(J(v,l),v.h==0&&(v.src=null,g[Ie]=null)):K(l)}}}function gt(l){return l in pe?pe[l]:pe[l]="on"+l}function Ht(l,g){if(l.da)l=!0;else{g=new de(g,this);const v=l.listener,I=l.ha||l.src;l.fa&&mt(l),l=v.call(I,g)}return l}function Vt(l){return l=l[Ie],l instanceof H?l:null}var Ze="__closure_events_fn_"+(Math.random()*1e9>>>0);function Nn(l){return typeof l=="function"?l:(l[Ze]||(l[Ze]=function(g){return l.handleEvent(g)}),l[Ze])}function W(){k.call(this),this.i=new H(this),this.M=this,this.G=null}h(W,k),W.prototype[oe]=!0,W.prototype.removeEventListener=function(l,g,v,I){bt(this,l,g,v,I)};function ue(l,g){var v,I=l.G;if(I)for(v=[];I;I=I.G)v.push(I);if(l=l.M,I=g.type||g,typeof g=="string")g=new C(g,l);else if(g instanceof C)g.target=g.target||l;else{var M=g;g=new C(I,l),R(g,M)}M=!0;let U,ne;if(v)for(ne=v.length-1;ne>=0;ne--)U=g.g=v[ne],M=Ce(U,I,!0,g)&&M;if(U=g.g=l,M=Ce(U,I,!0,g)&&M,M=Ce(U,I,!1,g)&&M,v)for(ne=0;ne2147483647?-1:o.setTimeout(l,g||0)}function He(l){l.g=we(()=>{l.g=null,l.i&&(l.i=!1,He(l))},l.l);const g=l.h;l.h=null,l.m.apply(null,g)}class Et extends k{constructor(g,v){super(),this.m=g,this.l=v,this.h=null,this.i=!1,this.g=null}j(g){this.h=arguments,this.g?this.i=!0:He(this)}N(){super.N(),this.g&&(o.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function Ft(l){k.call(this),this.h=l,this.g={}}h(Ft,k);var z=[];function O(l){ie(l.g,function(g,v){this.g.hasOwnProperty(v)&&mt(g)},l),l.g={}}Ft.prototype.N=function(){Ft.Z.N.call(this),O(this)},Ft.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var B=o.JSON.stringify,Q=o.JSON.parse,Y=class{stringify(l){return o.JSON.stringify(l,void 0)}parse(l){return o.JSON.parse(l,void 0)}};function Ae(){}function Oe(){}var Ne={OPEN:"a",hb:"b",ERROR:"c",tb:"d"};function et(){C.call(this,"d")}h(et,C);function $(){C.call(this,"c")}h($,C);var Z={},he=null;function me(){return he=he||new W}Z.Ia="serverreachability";function Pe(l){C.call(this,Z.Ia,l)}h(Pe,C);function Ge(l){const g=me();ue(g,new Pe(g))}Z.STAT_EVENT="statevent";function It(l,g){C.call(this,Z.STAT_EVENT,l),this.stat=g}h(It,C);function Me(l){const g=me();ue(g,new It(g,l))}Z.Ja="timingevent";function Lr(l,g){C.call(this,Z.Ja,l),this.size=g}h(Lr,C);function xe(l,g){if(typeof l!="function")throw Error("Fn must not be null and must be a function");return o.setTimeout(function(){l()},g)}function Te(){this.g=!0}Te.prototype.ua=function(){this.g=!1};function yt(l,g,v,I,M,U){l.info(function(){if(l.g)if(U){var ne="",Le=U.split("&");for(let tt=0;tt1){const Ut=jt[0];jt=jt[1];const hr=Ut.split("_");ne=hr.length>=2&&hr[1]=="type"?ne+(Ut+"="+jt+"&"):ne+(Ut+"=redacted&")}}}else ne=null;else ne=U;return"XMLHTTP REQ ("+I+") [attempt "+M+"]: "+g+` +`+v+` +`+ne})}function qt(l,g,v,I,M,U,ne){l.info(function(){return"XMLHTTP RESP ("+I+") [ attempt "+M+"]: "+g+` +`+v+` +`+U+" "+ne})}function An(l,g,v,I){l.info(function(){return"XMLHTTP TEXT ("+g+"): "+Wt(l,v)+(I?" "+I:"")})}function vt(l,g){l.info(function(){return"TIMEOUT: "+g})}Te.prototype.info=function(){};function Wt(l,g){if(!l.g)return g;if(!g)return null;try{const U=JSON.parse(g);if(U){for(l=0;l0&&l.length;)v.push(l.shift()),g--;return l.length&&v.push(l.join(":")),v}function si(l,g,v,I){this.j=l,this.i=g,this.l=v,this.S=I||1,this.V=new Ft(this),this.H=45e3,this.J=null,this.o=!1,this.u=this.B=this.A=this.M=this.F=this.T=this.D=null,this.G=[],this.g=null,this.C=0,this.m=this.v=null,this.X=-1,this.K=!1,this.P=0,this.O=null,this.W=this.L=this.U=this.R=!1,this.h=new Qg}function Qg(){this.i=null,this.g="",this.h=!1}var Yg={},Fd={};function Ud(l,g,v){l.M=1,l.A=Ol(dr(g)),l.u=v,l.R=!0,Xg(l,null)}function Xg(l,g){l.F=Date.now(),Ll(l),l.B=dr(l.A);var v=l.B,I=l.S;Array.isArray(I)||(I=[String(I)]),cy(v.i,"t",I),l.C=0,v=l.j.L,l.h=new Qg,l.g=Cy(l.j,v?g:null,!l.u),l.P>0&&(l.O=new Et(c(l.Y,l,l.g),l.P)),g=l.V,v=l.g,I=l.ba;var M="readystatechange";Array.isArray(M)||(M&&(z[0]=M.toString()),M=z);for(let U=0;U0&&!this.W){this.W=!0;var ne=this.j;ne.g==this&&ne.aa&&!ne.P&&(ne.j.info("Great, no buffering proxy detected. Bytes received: "+v.length),Yd(ne),ne.P=!0,Me(11))}}else An(this.i,this.l,v,null),Bd(this,v);Le==4&&es(this),this.o&&!this.K&&(Le==4?Iy(this.j,this):(this.o=!1,Ll(this)))}else kS(this.g),g==400&&v.indexOf("Unknown SID")>0?(this.m=3,Me(12)):(this.m=0,Me(13)),es(this),qo(this)}}}catch{}finally{}};function hS(l){if(!Jg(l))return l.g.la();const g=yy(l.g);if(g==="")return"";let v="";const I=g.length,M=li(l.g)==4;if(!l.h.i){if(typeof TextDecoder>"u")return es(l),qo(l),"";l.h.i=new o.TextDecoder}for(let U=0;Ug.length?Fd:(g=g.slice(I,I+v),l.C=I+v,g)))}si.prototype.cancel=function(){this.K=!0,es(this)};function Ll(l){l.T=Date.now()+l.H,Zg(l,l.H)}function Zg(l,g){if(l.D!=null)throw Error("WatchDog timer not null");l.D=xe(c(l.aa,l),g)}function zd(l){l.D&&(o.clearTimeout(l.D),l.D=null)}si.prototype.aa=function(){this.D=null;const l=Date.now();l-this.T>=0?(vt(this.i,this.B),this.M!=2&&(Ge(),Me(17)),es(this),this.m=2,qo(this)):Zg(this,this.T-l)};function qo(l){l.j.I==0||l.K||Iy(l.j,l)}function es(l){zd(l);var g=l.O;g&&typeof g.dispose=="function"&&g.dispose(),l.O=null,O(l.V),l.g&&(g=l.g,l.g=null,g.abort(),g.dispose())}function Bd(l,g){try{var v=l.j;if(v.I!=0&&(v.g==l||$d(v.h,l))){if(!l.L&&$d(v.h,l)&&v.I==3){try{var I=v.Ba.g.parse(g)}catch{I=null}if(Array.isArray(I)&&I.length==3){var M=I;if(M[0]==0){e:if(!v.v){if(v.g)if(v.g.F+3e30&&(I=1.5*ui,v.O=I,v.j.info("backChannelRequestTimeoutMs_="+I)),I=v;const ci=l.g;if(ci){const $l=ci.g?ci.g.getResponseHeader("X-Client-Wire-Protocol"):null;if($l){var U=I.h;U.g||$l.indexOf("spdy")==-1&&$l.indexOf("quic")==-1&&$l.indexOf("h2")==-1||(U.j=U.l,U.g=new Set,U.h&&(Hd(U,U.h),U.h=null))}if(I.G){const Xd=ci.g?ci.g.getResponseHeader("X-HTTP-Session-Id"):null;Xd&&(I.wa=Xd,ot(I.J,I.G,Xd))}}v.I=3,v.l&&v.l.ra(),v.aa&&(v.T=Date.now()-l.F,v.j.info("Handshake RTT: "+v.T+"ms")),I=v;var ne=l;if(I.na=ky(I,I.L?I.ba:null,I.W),ne.L){ry(I.h,ne);var Le=ne,jt=I.O;jt&&(Le.H=jt),Le.D&&(zd(Le),Ll(Le)),I.g=ne}else by(I);v.i.length>0&&Ul(v)}else tt[0]!="stop"&&tt[0]!="close"||ns(v,7);else v.I==3&&(tt[0]=="stop"||tt[0]=="close"?tt[0]=="stop"?ns(v,7):Kd(v):tt[0]!="noop"&&v.l&&v.l.qa(tt),v.A=0)}}Ge(4)}catch{}}var pS=class{constructor(l,g){this.g=l,this.map=g}};function ey(l){this.l=l||10,o.PerformanceNavigationTiming?(l=o.performance.getEntriesByType("navigation"),l=l.length>0&&(l[0].nextHopProtocol=="hq"||l[0].nextHopProtocol=="h2")):l=!!(o.chrome&&o.chrome.loadTimes&&o.chrome.loadTimes()&&o.chrome.loadTimes().wasFetchedViaSpdy),this.j=l?this.l:1,this.g=null,this.j>1&&(this.g=new Set),this.h=null,this.i=[]}function ty(l){return l.h?!0:l.g?l.g.size>=l.j:!1}function ny(l){return l.h?1:l.g?l.g.size:0}function $d(l,g){return l.h?l.h==g:l.g?l.g.has(g):!1}function Hd(l,g){l.g?l.g.add(g):l.h=g}function ry(l,g){l.h&&l.h==g?l.h=null:l.g&&l.g.has(g)&&l.g.delete(g)}ey.prototype.cancel=function(){if(this.i=iy(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&this.g.size!==0){for(const l of this.g.values())l.cancel();this.g.clear()}};function iy(l){if(l.h!=null)return l.i.concat(l.h.G);if(l.g!=null&&l.g.size!==0){let g=l.i;for(const v of l.g.values())g=g.concat(v.G);return g}return m(l.i)}var sy=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function mS(l,g){if(l){l=l.split("&");for(let v=0;v=0?(M=l[v].substring(0,I),U=l[v].substring(I+1)):M=l[v],g(M,U?decodeURIComponent(U.replace(/\+/g," ")):"")}}}function oi(l){this.g=this.o=this.j="",this.u=null,this.m=this.h="",this.l=!1;let g;l instanceof oi?(this.l=l.l,Wo(this,l.j),this.o=l.o,this.g=l.g,Go(this,l.u),this.h=l.h,qd(this,dy(l.i)),this.m=l.m):l&&(g=String(l).match(sy))?(this.l=!1,Wo(this,g[1]||"",!0),this.o=Ko(g[2]||""),this.g=Ko(g[3]||"",!0),Go(this,g[4]),this.h=Ko(g[5]||"",!0),qd(this,g[6]||"",!0),this.m=Ko(g[7]||"")):(this.l=!1,this.i=new Yo(null,this.l))}oi.prototype.toString=function(){const l=[];var g=this.j;g&&l.push(Qo(g,oy,!0),":");var v=this.g;return(v||g=="file")&&(l.push("//"),(g=this.o)&&l.push(Qo(g,oy,!0),"@"),l.push(Pn(v).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),v=this.u,v!=null&&l.push(":",String(v))),(v=this.h)&&(this.g&&v.charAt(0)!="/"&&l.push("/"),l.push(Qo(v,v.charAt(0)=="/"?vS:yS,!0))),(v=this.i.toString())&&l.push("?",v),(v=this.m)&&l.push("#",Qo(v,wS)),l.join("")},oi.prototype.resolve=function(l){const g=dr(this);let v=!!l.j;v?Wo(g,l.j):v=!!l.o,v?g.o=l.o:v=!!l.g,v?g.g=l.g:v=l.u!=null;var I=l.h;if(v)Go(g,l.u);else if(v=!!l.h){if(I.charAt(0)!="/")if(this.g&&!this.h)I="/"+I;else{var M=g.h.lastIndexOf("/");M!=-1&&(I=g.h.slice(0,M+1)+I)}if(M=I,M==".."||M==".")I="";else if(M.indexOf("./")!=-1||M.indexOf("/.")!=-1){I=M.lastIndexOf("/",0)==0,M=M.split("/");const U=[];for(let ne=0;ne1||U.length==1&&U[0]!="")&&U.pop(),I&&ne==M.length&&U.push("")):(U.push(Le),I=!0)}I=U.join("/")}else I=M}return v?g.h=I:v=l.i.toString()!=="",v?qd(g,dy(l.i)):v=!!l.m,v&&(g.m=l.m),g};function dr(l){return new oi(l)}function Wo(l,g,v){l.j=v?Ko(g,!0):g,l.j&&(l.j=l.j.replace(/:$/,""))}function Go(l,g){if(g){if(g=Number(g),isNaN(g)||g<0)throw Error("Bad port number "+g);l.u=g}else l.u=null}function qd(l,g,v){g instanceof Yo?(l.i=g,_S(l.i,l.l)):(v||(g=Qo(g,xS)),l.i=new Yo(g,l.l))}function ot(l,g,v){l.i.set(g,v)}function Ol(l){return ot(l,"zx",Math.floor(Math.random()*2147483648).toString(36)+Math.abs(Math.floor(Math.random()*2147483648)^Date.now()).toString(36)),l}function Ko(l,g){return l?g?decodeURI(l.replace(/%25/g,"%2525")):decodeURIComponent(l):""}function Qo(l,g,v){return typeof l=="string"?(l=encodeURI(l).replace(g,gS),v&&(l=l.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),l):null}function gS(l){return l=l.charCodeAt(0),"%"+(l>>4&15).toString(16)+(l&15).toString(16)}var oy=/[#\/\?@]/g,yS=/[#\?:]/g,vS=/[#\?]/g,xS=/[#\?@]/g,wS=/#/g;function Yo(l,g){this.h=this.g=null,this.i=l||null,this.j=!!g}function ts(l){l.g||(l.g=new Map,l.h=0,l.i&&mS(l.i,function(g,v){l.add(decodeURIComponent(g.replace(/\+/g," ")),v)}))}t=Yo.prototype,t.add=function(l,g){ts(this),this.i=null,l=Os(this,l);let v=this.g.get(l);return v||this.g.set(l,v=[]),v.push(g),this.h+=1,this};function ay(l,g){ts(l),g=Os(l,g),l.g.has(g)&&(l.i=null,l.h-=l.g.get(g).length,l.g.delete(g))}function ly(l,g){return ts(l),g=Os(l,g),l.g.has(g)}t.forEach=function(l,g){ts(this),this.g.forEach(function(v,I){v.forEach(function(M){l.call(g,M,I,this)},this)},this)};function uy(l,g){ts(l);let v=[];if(typeof g=="string")ly(l,g)&&(v=v.concat(l.g.get(Os(l,g))));else for(l=Array.from(l.g.values()),g=0;g0?String(l[0]):g):g};function cy(l,g,v){ay(l,g),v.length>0&&(l.i=null,l.g.set(Os(l,g),m(v)),l.h+=v.length)}t.toString=function(){if(this.i)return this.i;if(!this.g)return"";const l=[],g=Array.from(this.g.keys());for(let I=0;I{I.abort(),ai(v,"TestPingServer: timeout",!1,g)},1e4);fetch(l,{signal:I.signal}).then(U=>{clearTimeout(M),U.ok?ai(v,"TestPingServer: ok",!0,g):ai(v,"TestPingServer: server error",!1,g)}).catch(()=>{clearTimeout(M),ai(v,"TestPingServer: error",!1,g)})}function ai(l,g,v,I,M){try{M&&(M.onload=null,M.onerror=null,M.onabort=null,M.ontimeout=null),I(v)}catch{}}function IS(){this.g=new Y}function Wd(l){this.i=l.Sb||null,this.h=l.ab||!1}h(Wd,Ae),Wd.prototype.g=function(){return new Ml(this.i,this.h)};function Ml(l,g){W.call(this),this.H=l,this.o=g,this.m=void 0,this.status=this.readyState=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.A=new Headers,this.h=null,this.F="GET",this.D="",this.g=!1,this.B=this.j=this.l=null,this.v=new AbortController}h(Ml,W),t=Ml.prototype,t.open=function(l,g){if(this.readyState!=0)throw this.abort(),Error("Error reopening a connection");this.F=l,this.D=g,this.readyState=1,Jo(this)},t.send=function(l){if(this.readyState!=1)throw this.abort(),Error("need to call open() first. ");if(this.v.signal.aborted)throw this.abort(),Error("Request was aborted.");this.g=!0;const g={headers:this.A,method:this.F,credentials:this.m,cache:void 0,signal:this.v.signal};l&&(g.body=l),(this.H||o).fetch(new Request(this.D,g)).then(this.Pa.bind(this),this.ga.bind(this))},t.abort=function(){this.response=this.responseText="",this.A=new Headers,this.status=0,this.v.abort(),this.j&&this.j.cancel("Request was aborted.").catch(()=>{}),this.readyState>=1&&this.g&&this.readyState!=4&&(this.g=!1,Xo(this)),this.readyState=0},t.Pa=function(l){if(this.g&&(this.l=l,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=l.headers,this.readyState=2,Jo(this)),this.g&&(this.readyState=3,Jo(this),this.g)))if(this.responseType==="arraybuffer")l.arrayBuffer().then(this.Na.bind(this),this.ga.bind(this));else if(typeof o.ReadableStream<"u"&&"body"in l){if(this.j=l.body.getReader(),this.o){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.B=new TextDecoder;hy(this)}else l.text().then(this.Oa.bind(this),this.ga.bind(this))};function hy(l){l.j.read().then(l.Ma.bind(l)).catch(l.ga.bind(l))}t.Ma=function(l){if(this.g){if(this.o&&l.value)this.response.push(l.value);else if(!this.o){var g=l.value?l.value:new Uint8Array(0);(g=this.B.decode(g,{stream:!l.done}))&&(this.response=this.responseText+=g)}l.done?Xo(this):Jo(this),this.readyState==3&&hy(this)}},t.Oa=function(l){this.g&&(this.response=this.responseText=l,Xo(this))},t.Na=function(l){this.g&&(this.response=l,Xo(this))},t.ga=function(){this.g&&Xo(this)};function Xo(l){l.readyState=4,l.l=null,l.j=null,l.B=null,Jo(l)}t.setRequestHeader=function(l,g){this.A.append(l,g)},t.getResponseHeader=function(l){return this.h&&this.h.get(l.toLowerCase())||""},t.getAllResponseHeaders=function(){if(!this.h)return"";const l=[],g=this.h.entries();for(var v=g.next();!v.done;)v=v.value,l.push(v[0]+": "+v[1]),v=g.next();return l.join(`\r +`)};function Jo(l){l.onreadystatechange&&l.onreadystatechange.call(l)}Object.defineProperty(Ml.prototype,"withCredentials",{get:function(){return this.m==="include"},set:function(l){this.m=l?"include":"same-origin"}});function fy(l){let g="";return ie(l,function(v,I){g+=I,g+=":",g+=v,g+=`\r +`}),g}function Gd(l,g,v){e:{for(I in v){var I=!1;break e}I=!0}I||(v=fy(v),typeof l=="string"?v!=null&&Pn(v):ot(l,g,v))}function xt(l){W.call(this),this.headers=new Map,this.L=l||null,this.h=!1,this.g=null,this.D="",this.o=0,this.l="",this.j=this.B=this.v=this.A=!1,this.m=null,this.F="",this.H=!1}h(xt,W);var SS=/^https?$/i,TS=["POST","PUT"];t=xt.prototype,t.Fa=function(l){this.H=l},t.ea=function(l,g,v,I){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+l);g=g?g.toUpperCase():"GET",this.D=l,this.l="",this.o=0,this.A=!1,this.h=!0,this.g=this.L?this.L.g():je.g(),this.g.onreadystatechange=p(c(this.Ca,this));try{this.B=!0,this.g.open(g,String(l),!0),this.B=!1}catch(U){py(this,U);return}if(l=v||"",v=new Map(this.headers),I)if(Object.getPrototypeOf(I)===Object.prototype)for(var M in I)v.set(M,I[M]);else if(typeof I.keys=="function"&&typeof I.get=="function")for(const U of I.keys())v.set(U,I.get(U));else throw Error("Unknown input type for opt_headers: "+String(I));I=Array.from(v.keys()).find(U=>U.toLowerCase()=="content-type"),M=o.FormData&&l instanceof o.FormData,!(Array.prototype.indexOf.call(TS,g,void 0)>=0)||I||M||v.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(const[U,ne]of v)this.g.setRequestHeader(U,ne);this.F&&(this.g.responseType=this.F),"withCredentials"in this.g&&this.g.withCredentials!==this.H&&(this.g.withCredentials=this.H);try{this.m&&(clearTimeout(this.m),this.m=null),this.v=!0,this.g.send(l),this.v=!1}catch(U){py(this,U)}};function py(l,g){l.h=!1,l.g&&(l.j=!0,l.g.abort(),l.j=!1),l.l=g,l.o=5,my(l),Vl(l)}function my(l){l.A||(l.A=!0,ue(l,"complete"),ue(l,"error"))}t.abort=function(l){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.o=l||7,ue(this,"complete"),ue(this,"abort"),Vl(this))},t.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),Vl(this,!0)),xt.Z.N.call(this)},t.Ca=function(){this.u||(this.B||this.v||this.j?gy(this):this.Xa())},t.Xa=function(){gy(this)};function gy(l){if(l.h&&typeof s<"u"){if(l.v&&li(l)==4)setTimeout(l.Ca.bind(l),0);else if(ue(l,"readystatechange"),li(l)==4){l.h=!1;try{const U=l.ca();e:switch(U){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var g=!0;break e;default:g=!1}var v;if(!(v=g)){var I;if(I=U===0){let ne=String(l.D).match(sy)[1]||null;!ne&&o.self&&o.self.location&&(ne=o.self.location.protocol.slice(0,-1)),I=!SS.test(ne?ne.toLowerCase():"")}v=I}if(v)ue(l,"complete"),ue(l,"success");else{l.o=6;try{var M=li(l)>2?l.g.statusText:""}catch{M=""}l.l=M+" ["+l.ca()+"]",my(l)}}finally{Vl(l)}}}}function Vl(l,g){if(l.g){l.m&&(clearTimeout(l.m),l.m=null);const v=l.g;l.g=null,g||ue(l,"ready");try{v.onreadystatechange=null}catch{}}}t.isActive=function(){return!!this.g};function li(l){return l.g?l.g.readyState:0}t.ca=function(){try{return li(this)>2?this.g.status:-1}catch{return-1}},t.la=function(){try{return this.g?this.g.responseText:""}catch{return""}},t.La=function(l){if(this.g){var g=this.g.responseText;return l&&g.indexOf(l)==0&&(g=g.substring(l.length)),Q(g)}};function yy(l){try{if(!l.g)return null;if("response"in l.g)return l.g.response;switch(l.F){case"":case"text":return l.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in l.g)return l.g.mozResponseArrayBuffer}return null}catch{return null}}function kS(l){const g={};l=(l.g&&li(l)>=2&&l.g.getAllResponseHeaders()||"").split(`\r +`);for(let I=0;I0&&(this.ia=l.longPollingTimeout),this.ta=void 0,this.T=0,this.P=!1,this.ja=this.B=null}t=vy.prototype,t.ka=8,t.I=1,t.connect=function(l,g,v,I){Me(0),this.W=l,this.H=g||{},v&&I!==void 0&&(this.H.OSID=v,this.H.OAID=I),this.F=this.X,this.J=ky(this,null,this.W),Ul(this)};function Kd(l){if(xy(l),l.I==3){var g=l.V++,v=dr(l.J);if(ot(v,"SID",l.M),ot(v,"RID",g),ot(v,"TYPE","terminate"),ea(l,v),g=new si(l,l.j,g),g.M=2,g.A=Ol(dr(v)),v=!1,o.navigator&&o.navigator.sendBeacon)try{v=o.navigator.sendBeacon(g.A.toString(),"")}catch{}!v&&o.Image&&(new Image().src=g.A,v=!0),v||(g.g=Cy(g.j,null),g.g.ea(g.A)),g.F=Date.now(),Ll(g)}Ty(l)}function Fl(l){l.g&&(Yd(l),l.g.cancel(),l.g=null)}function xy(l){Fl(l),l.v&&(o.clearTimeout(l.v),l.v=null),zl(l),l.h.cancel(),l.m&&(typeof l.m=="number"&&o.clearTimeout(l.m),l.m=null)}function Ul(l){if(!ty(l.h)&&!l.m){l.m=!0;var g=l.Ea;F||x(),D||(F(),D=!0),_.add(g,l),l.D=0}}function CS(l,g){return ny(l.h)>=l.h.j-(l.m?1:0)?!1:l.m?(l.i=g.G.concat(l.i),!0):l.I==1||l.I==2||l.D>=(l.Sa?0:l.Ta)?!1:(l.m=xe(c(l.Ea,l,g),Sy(l,l.D)),l.D++,!0)}t.Ea=function(l){if(this.m)if(this.m=null,this.I==1){if(!l){this.V=Math.floor(Math.random()*1e5),l=this.V++;const M=new si(this,this.j,l);let U=this.o;if(this.U&&(U?(U=fe(U),R(U,this.U)):U=this.U),this.u!==null||this.R||(M.J=U,U=null),this.S)e:{for(var g=0,v=0;v4096){g=v;break e}if(g===4096||v===this.i.length-1){g=v+1;break e}}g=1e3}else g=1e3;g=_y(this,M,g),v=dr(this.J),ot(v,"RID",l),ot(v,"CVER",22),this.G&&ot(v,"X-HTTP-Session-Id",this.G),ea(this,v),U&&(this.R?g="headers="+Pn(fy(U))+"&"+g:this.u&&Gd(v,this.u,U)),Hd(this.h,M),this.Ra&&ot(v,"TYPE","init"),this.S?(ot(v,"$req",g),ot(v,"SID","null"),M.U=!0,Ud(M,v,null)):Ud(M,v,g),this.I=2}}else this.I==3&&(l?wy(this,l):this.i.length==0||ty(this.h)||wy(this))};function wy(l,g){var v;g?v=g.l:v=l.V++;const I=dr(l.J);ot(I,"SID",l.M),ot(I,"RID",v),ot(I,"AID",l.K),ea(l,I),l.u&&l.o&&Gd(I,l.u,l.o),v=new si(l,l.j,v,l.D+1),l.u===null&&(v.J=l.o),g&&(l.i=g.G.concat(l.i)),g=_y(l,v,1e3),v.H=Math.round(l.va*.5)+Math.round(l.va*.5*Math.random()),Hd(l.h,v),Ud(v,I,g)}function ea(l,g){l.H&&ie(l.H,function(v,I){ot(g,I,v)}),l.l&&ie({},function(v,I){ot(g,I,v)})}function _y(l,g,v){v=Math.min(l.i.length,v);const I=l.l?c(l.l.Ka,l.l,l):null;e:{var M=l.i;let Le=-1;for(;;){const jt=["count="+v];Le==-1?v>0?(Le=M[0].g,jt.push("ofs="+Le)):Le=0:jt.push("ofs="+Le);let tt=!0;for(let Ut=0;Ut=3?!1:(l.Y++,l.v=xe(c(l.Da,l),Sy(l,l.A)),l.A++,!0)}t.Da=function(){if(this.v=null,Ey(this),this.aa&&!(this.P||this.g==null||this.T<=0)){var l=4*this.T;this.j.info("BP detection timer enabled: "+l),this.B=xe(c(this.Wa,this),l)}},t.Wa=function(){this.B&&(this.B=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.F=!1,this.P=!0,Me(10),Fl(this),Ey(this))};function Yd(l){l.B!=null&&(o.clearTimeout(l.B),l.B=null)}function Ey(l){l.g=new si(l,l.j,"rpc",l.Y),l.u===null&&(l.g.J=l.o),l.g.P=0;var g=dr(l.na);ot(g,"RID","rpc"),ot(g,"SID",l.M),ot(g,"AID",l.K),ot(g,"CI",l.F?"0":"1"),!l.F&&l.ia&&ot(g,"TO",l.ia),ot(g,"TYPE","xmlhttp"),ea(l,g),l.u&&l.o&&Gd(g,l.u,l.o),l.O&&(l.g.H=l.O);var v=l.g;l=l.ba,v.M=1,v.A=Ol(dr(g)),v.u=null,v.R=!0,Xg(v,l)}t.Va=function(){this.C!=null&&(this.C=null,Fl(this),Qd(this),Me(19))};function zl(l){l.C!=null&&(o.clearTimeout(l.C),l.C=null)}function Iy(l,g){var v=null;if(l.g==g){zl(l),Yd(l),l.g=null;var I=2}else if($d(l.h,g))v=g.G,ry(l.h,g),I=1;else return;if(l.I!=0){if(g.o)if(I==1){v=g.u?g.u.length:0,g=Date.now()-g.F;var M=l.D;I=me(),ue(I,new Lr(I,v)),Ul(l)}else by(l);else if(M=g.m,M==3||M==0&&g.X>0||!(I==1&&CS(l,g)||I==2&&Qd(l)))switch(v&&v.length>0&&(g=l.h,g.i=g.i.concat(v)),M){case 1:ns(l,5);break;case 4:ns(l,10);break;case 3:ns(l,6);break;default:ns(l,2)}}}function Sy(l,g){let v=l.Qa+Math.floor(Math.random()*l.Za);return l.isActive()||(v*=2),v*g}function ns(l,g){if(l.j.info("Error code "+g),g==2){var v=c(l.bb,l),I=l.Ua;const M=!I;I=new oi(I||"//www.google.com/images/cleardot.gif"),o.location&&o.location.protocol=="http"||Wo(I,"https"),Ol(I),M?bS(I.toString(),v):ES(I.toString(),v)}else Me(2);l.I=0,l.l&&l.l.pa(g),Ty(l),xy(l)}t.bb=function(l){l?(this.j.info("Successfully pinged google.com"),Me(2)):(this.j.info("Failed to ping google.com"),Me(1))};function Ty(l){if(l.I=0,l.ja=[],l.l){const g=iy(l.h);(g.length!=0||l.i.length!=0)&&(b(l.ja,g),b(l.ja,l.i),l.h.i.length=0,m(l.i),l.i.length=0),l.l.oa()}}function ky(l,g,v){var I=v instanceof oi?dr(v):new oi(v);if(I.g!="")g&&(I.g=g+"."+I.g),Go(I,I.u);else{var M=o.location;I=M.protocol,g=g?g+"."+M.hostname:M.hostname,M=+M.port;const U=new oi(null);I&&Wo(U,I),g&&(U.g=g),M&&Go(U,M),v&&(U.h=v),I=U}return v=l.G,g=l.wa,v&&g&&ot(I,v,g),ot(I,"VER",l.ka),ea(l,I),I}function Cy(l,g,v){if(g&&!l.L)throw Error("Can't create secondary domain capable XhrIo object.");return g=l.Aa&&!l.ma?new xt(new Wd({ab:v})):new xt(l.ma),g.Fa(l.L),g}t.isActive=function(){return!!this.l&&this.l.isActive(this)};function Ny(){}t=Ny.prototype,t.ra=function(){},t.qa=function(){},t.pa=function(){},t.oa=function(){},t.isActive=function(){return!0},t.Ka=function(){};function Bl(){}Bl.prototype.g=function(l,g){return new Rn(l,g)};function Rn(l,g){W.call(this),this.g=new vy(g),this.l=l,this.h=g&&g.messageUrlParams||null,l=g&&g.messageHeaders||null,g&&g.clientProtocolHeaderRequired&&(l?l["X-Client-Protocol"]="webchannel":l={"X-Client-Protocol":"webchannel"}),this.g.o=l,l=g&&g.initMessageHeaders||null,g&&g.messageContentType&&(l?l["X-WebChannel-Content-Type"]=g.messageContentType:l={"X-WebChannel-Content-Type":g.messageContentType}),g&&g.sa&&(l?l["X-WebChannel-Client-Profile"]=g.sa:l={"X-WebChannel-Client-Profile":g.sa}),this.g.U=l,(l=g&&g.Qb)&&!A(l)&&(this.g.u=l),this.A=g&&g.supportsCrossDomainXhr||!1,this.v=g&&g.sendRawJson||!1,(g=g&&g.httpSessionIdParam)&&!A(g)&&(this.g.G=g,l=this.h,l!==null&&g in l&&(l=this.h,g in l&&delete l[g])),this.j=new Ms(this)}h(Rn,W),Rn.prototype.m=function(){this.g.l=this.j,this.A&&(this.g.L=!0),this.g.connect(this.l,this.h||void 0)},Rn.prototype.close=function(){Kd(this.g)},Rn.prototype.o=function(l){var g=this.g;if(typeof l=="string"){var v={};v.__data__=l,l=v}else this.v&&(v={},v.__data__=B(l),l=v);g.i.push(new pS(g.Ya++,l)),g.I==3&&Ul(g)},Rn.prototype.N=function(){this.g.l=null,delete this.j,Kd(this.g),delete this.g,Rn.Z.N.call(this)};function Ay(l){et.call(this),l.__headers__&&(this.headers=l.__headers__,this.statusCode=l.__status__,delete l.__headers__,delete l.__status__);var g=l.__sm__;if(g){e:{for(const v in g){l=v;break e}l=void 0}(this.i=l)&&(l=this.i,g=g!==null&&l in g?g[l]:void 0),this.data=g}else this.data=l}h(Ay,et);function Py(){$.call(this),this.status=1}h(Py,$);function Ms(l){this.g=l}h(Ms,Ny),Ms.prototype.ra=function(){ue(this.g,"a")},Ms.prototype.qa=function(l){ue(this.g,new Ay(l))},Ms.prototype.pa=function(l){ue(this.g,new Py)},Ms.prototype.oa=function(){ue(this.g,"b")},Bl.prototype.createWebChannel=Bl.prototype.g,Rn.prototype.send=Rn.prototype.o,Rn.prototype.open=Rn.prototype.m,Rn.prototype.close=Rn.prototype.close,hb=function(){return new Bl},db=function(){return me()},cb=Z,Zf={jb:0,mb:1,nb:2,Hb:3,Mb:4,Jb:5,Kb:6,Ib:7,Gb:8,Lb:9,PROXY:10,NOPROXY:11,Eb:12,Ab:13,Bb:14,zb:15,Cb:16,Db:17,fb:18,eb:19,gb:20},Bn.NO_ERROR=0,Bn.TIMEOUT=8,Bn.HTTP_ERROR=6,Du=Bn,Gt.COMPLETE="complete",ub=Gt,Oe.EventType=Ne,Ne.OPEN="a",Ne.CLOSE="b",Ne.ERROR="c",Ne.MESSAGE="d",W.prototype.listen=W.prototype.J,ya=Oe,xt.prototype.listenOnce=xt.prototype.K,xt.prototype.getLastError=xt.prototype.Ha,xt.prototype.getLastErrorCode=xt.prototype.ya,xt.prototype.getStatus=xt.prototype.ca,xt.prototype.getResponseJson=xt.prototype.La,xt.prototype.getResponseText=xt.prototype.la,xt.prototype.send=xt.prototype.ea,xt.prototype.setWithCredentials=xt.prototype.Fa,lb=xt}).apply(typeof uu<"u"?uu:typeof self<"u"?self:typeof window<"u"?window:{});const sv="@firebase/firestore",ov="4.9.2";/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class sn{constructor(e){this.uid=e}isAuthenticated(){return this.uid!=null}toKey(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}isEqual(e){return e.uid===this.uid}}sn.UNAUTHENTICATED=new sn(null),sn.GOOGLE_CREDENTIALS=new sn("google-credentials-uid"),sn.FIRST_PARTY=new sn("first-party-uid"),sn.MOCK_USER=new sn("mock-user");/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */let Mo="12.3.0";/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Ss=new Lm("@firebase/firestore");function Us(){return Ss.logLevel}function ae(t,...e){if(Ss.logLevel<=Ue.DEBUG){const n=e.map(Vm);Ss.debug(`Firestore (${Mo}): ${t}`,...n)}}function Yr(t,...e){if(Ss.logLevel<=Ue.ERROR){const n=e.map(Vm);Ss.error(`Firestore (${Mo}): ${t}`,...n)}}function To(t,...e){if(Ss.logLevel<=Ue.WARN){const n=e.map(Vm);Ss.warn(`Firestore (${Mo}): ${t}`,...n)}}function Vm(t){if(typeof t=="string")return t;try{/** +* @license +* Copyright 2020 Google LLC +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/return function(n){return JSON.stringify(n)}(t)}catch{return t}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function _e(t,e,n){let r="Unexpected state";typeof e=="string"?r=e:n=e,fb(t,r,n)}function fb(t,e,n){let r=`FIRESTORE (${Mo}) INTERNAL ASSERTION FAILED: ${e} (ID: ${t.toString(16)})`;if(n!==void 0)try{r+=" CONTEXT: "+JSON.stringify(n)}catch{r+=" CONTEXT: "+n}throw Yr(r),new Error(r)}function Ye(t,e,n,r){let i="Unexpected state";typeof n=="string"?i=n:r=n,t||fb(e,i,r)}function ke(t,e){return t}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const q={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENTED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"};class se extends Dr{constructor(e,n){super(e,n),this.code=e,this.message=n,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Hr{constructor(){this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class pb{constructor(e,n){this.user=n,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}}class sN{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,n){e.enqueueRetryable(()=>n(sn.UNAUTHENTICATED))}shutdown(){}}class oN{constructor(e){this.token=e,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(e,n){this.changeListener=n,e.enqueueRetryable(()=>n(this.token.user))}shutdown(){this.changeListener=null}}class aN{constructor(e){this.t=e,this.currentUser=sn.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,n){Ye(this.o===void 0,42304);let r=this.i;const i=u=>this.i!==r?(r=this.i,n(u)):Promise.resolve();let s=new Hr;this.o=()=>{this.i++,this.currentUser=this.u(),s.resolve(),s=new Hr,e.enqueueRetryable(()=>i(this.currentUser))};const o=()=>{const u=s;e.enqueueRetryable(async()=>{await u.promise,await i(this.currentUser)})},a=u=>{ae("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=u,this.o&&(this.auth.addAuthTokenListener(this.o),o())};this.t.onInit(u=>a(u)),setTimeout(()=>{if(!this.auth){const u=this.t.getImmediate({optional:!0});u?a(u):(ae("FirebaseAuthCredentialsProvider","Auth not yet detected"),s.resolve(),s=new Hr)}},0),o()}getToken(){const e=this.i,n=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(n).then(r=>this.i!==e?(ae("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):r?(Ye(typeof r.accessToken=="string",31837,{l:r}),new pb(r.accessToken,this.currentUser)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.o&&this.auth.removeAuthTokenListener(this.o),this.o=void 0}u(){const e=this.auth&&this.auth.getUid();return Ye(e===null||typeof e=="string",2055,{h:e}),new sn(e)}}class lN{constructor(e,n,r){this.P=e,this.T=n,this.I=r,this.type="FirstParty",this.user=sn.FIRST_PARTY,this.A=new Map}R(){return this.I?this.I():null}get headers(){this.A.set("X-Goog-AuthUser",this.P);const e=this.R();return e&&this.A.set("Authorization",e),this.T&&this.A.set("X-Goog-Iam-Authorization-Token",this.T),this.A}}class uN{constructor(e,n,r){this.P=e,this.T=n,this.I=r}getToken(){return Promise.resolve(new lN(this.P,this.T,this.I))}start(e,n){e.enqueueRetryable(()=>n(sn.FIRST_PARTY))}shutdown(){}invalidateToken(){}}class av{constructor(e){this.value=e,this.type="AppCheck",this.headers=new Map,e&&e.length>0&&this.headers.set("x-firebase-appcheck",this.value)}}class cN{constructor(e,n){this.V=n,this.forceRefresh=!1,this.appCheck=null,this.m=null,this.p=null,rr(e)&&e.settings.appCheckToken&&(this.p=e.settings.appCheckToken)}start(e,n){Ye(this.o===void 0,3512);const r=s=>{s.error!=null&&ae("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${s.error.message}`);const o=s.token!==this.m;return this.m=s.token,ae("FirebaseAppCheckTokenProvider",`Received ${o?"new":"existing"} token.`),o?n(s.token):Promise.resolve()};this.o=s=>{e.enqueueRetryable(()=>r(s))};const i=s=>{ae("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=s,this.o&&this.appCheck.addTokenListener(this.o)};this.V.onInit(s=>i(s)),setTimeout(()=>{if(!this.appCheck){const s=this.V.getImmediate({optional:!0});s?i(s):ae("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}},0)}getToken(){if(this.p)return Promise.resolve(new av(this.p));const e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then(n=>n?(Ye(typeof n.token=="string",44558,{tokenResult:n}),this.m=n.token,new av(n.token)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.o&&this.appCheck.removeTokenListener(this.o),this.o=void 0}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function dN(t){const e=typeof self<"u"&&(self.crypto||self.msCrypto),n=new Uint8Array(t);if(e&&typeof e.getRandomValues=="function")e.getRandomValues(n);else for(let r=0;re?1:0}function ep(t,e){const n=Math.min(t.length,e.length);for(let r=0;r=hN&&e<=fN}function ko(t,e,n){return t.length===e.length&&t.every((r,i)=>n(r,e[i]))}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const lv="__name__";class yr{constructor(e,n,r){n===void 0?n=0:n>e.length&&_e(637,{offset:n,range:e.length}),r===void 0?r=e.length-n:r>e.length-n&&_e(1746,{length:r,range:e.length-n}),this.segments=e,this.offset=n,this.len=r}get length(){return this.len}isEqual(e){return yr.comparator(this,e)===0}child(e){const n=this.segments.slice(this.offset,this.limit());return e instanceof yr?e.forEach(r=>{n.push(r)}):n.push(e),this.construct(n)}limit(){return this.offset+this.length}popFirst(e){return e=e===void 0?1:e,this.construct(this.segments,this.offset+e,this.length-e)}popLast(){return this.construct(this.segments,this.offset,this.length-1)}firstSegment(){return this.segments[this.offset]}lastSegment(){return this.get(this.length-1)}get(e){return this.segments[this.offset+e]}isEmpty(){return this.length===0}isPrefixOf(e){if(e.length=0)throw new se(q.INVALID_ARGUMENT,`Invalid segment (${r}). Paths must not contain // in them.`);n.push(...r.split("/").filter(i=>i.length>0))}return new rt(n)}static emptyPath(){return new rt([])}}const pN=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class Yt extends yr{construct(e,n,r){return new Yt(e,n,r)}static isValidIdentifier(e){return pN.test(e)}canonicalString(){return this.toArray().map(e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),Yt.isValidIdentifier(e)||(e="`"+e+"`"),e)).join(".")}toString(){return this.canonicalString()}isKeyField(){return this.length===1&&this.get(0)===lv}static keyField(){return new Yt([lv])}static fromServerFormat(e){const n=[];let r="",i=0;const s=()=>{if(r.length===0)throw new se(q.INVALID_ARGUMENT,`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);n.push(r),r=""};let o=!1;for(;i=2&&this.path.get(this.path.length-2)===e}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(e){return e!==null&&rt.comparator(this.path,e.path)===0}toString(){return this.path.toString()}static comparator(e,n){return rt.comparator(e.path,n.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new ge(new rt(e.slice()))}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function mb(t,e,n){if(!n)throw new se(q.INVALID_ARGUMENT,`Function ${t}() cannot be called with an empty ${e}.`)}function mN(t,e,n,r){if(e===!0&&r===!0)throw new se(q.INVALID_ARGUMENT,`${t} and ${n} cannot be used together.`)}function uv(t){if(!ge.isDocumentKey(t))throw new se(q.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`)}function cv(t){if(ge.isDocumentKey(t))throw new se(q.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`)}function gb(t){return typeof t=="object"&&t!==null&&(Object.getPrototypeOf(t)===Object.prototype||Object.getPrototypeOf(t)===null)}function ud(t){if(t===void 0)return"undefined";if(t===null)return"null";if(typeof t=="string")return t.length>20&&(t=`${t.substring(0,20)}...`),JSON.stringify(t);if(typeof t=="number"||typeof t=="boolean")return""+t;if(typeof t=="object"){if(t instanceof Array)return"an array";{const e=function(r){return r.constructor?r.constructor.name:null}(t);return e?`a custom ${e} object`:"an object"}}return typeof t=="function"?"a function":_e(12329,{type:typeof t})}function Sn(t,e){if("_delegate"in t&&(t=t._delegate),!(t instanceof e)){if(e.name===t.constructor.name)throw new se(q.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const n=ud(t);throw new se(q.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${n}`)}}return t}/** + * @license + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Rt(t,e){const n={typeString:t};return e&&(n.value=e),n}function El(t,e){if(!gb(t))throw new se(q.INVALID_ARGUMENT,"JSON must be an object");let n;for(const r in e)if(e[r]){const i=e[r].typeString,s="value"in e[r]?{value:e[r].value}:void 0;if(!(r in t)){n=`JSON missing required field: '${r}'`;break}const o=t[r];if(i&&typeof o!==i){n=`JSON field '${r}' must be a ${i}.`;break}if(s!==void 0&&o!==s.value){n=`Expected '${r}' field to equal '${s.value}'`;break}}if(n)throw new se(q.INVALID_ARGUMENT,n);return!0}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const dv=-62135596800,hv=1e6;class Qe{static now(){return Qe.fromMillis(Date.now())}static fromDate(e){return Qe.fromMillis(e.getTime())}static fromMillis(e){const n=Math.floor(e/1e3),r=Math.floor((e-1e3*n)*hv);return new Qe(n,r)}constructor(e,n){if(this.seconds=e,this.nanoseconds=n,n<0)throw new se(q.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+n);if(n>=1e9)throw new se(q.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+n);if(e=253402300800)throw new se(q.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/hv}_compareTo(e){return this.seconds===e.seconds?ze(this.nanoseconds,e.nanoseconds):ze(this.seconds,e.seconds)}isEqual(e){return e.seconds===this.seconds&&e.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{type:Qe._jsonSchemaVersion,seconds:this.seconds,nanoseconds:this.nanoseconds}}static fromJSON(e){if(El(e,Qe._jsonSchema))return new Qe(e.seconds,e.nanoseconds)}valueOf(){const e=this.seconds-dv;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}Qe._jsonSchemaVersion="firestore/timestamp/1.0",Qe._jsonSchema={type:Rt("string",Qe._jsonSchemaVersion),seconds:Rt("number"),nanoseconds:Rt("number")};/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Se{static fromTimestamp(e){return new Se(e)}static min(){return new Se(new Qe(0,0))}static max(){return new Se(new Qe(253402300799,999999999))}constructor(e){this.timestamp=e}compareTo(e){return this.timestamp._compareTo(e.timestamp)}isEqual(e){return this.timestamp.isEqual(e.timestamp)}toMicroseconds(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}toString(){return"SnapshotVersion("+this.timestamp.toString()+")"}toTimestamp(){return this.timestamp}}/** + * @license + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const il=-1;function gN(t,e){const n=t.toTimestamp().seconds,r=t.toTimestamp().nanoseconds+1,i=Se.fromTimestamp(r===1e9?new Qe(n+1,0):new Qe(n,r));return new Ui(i,ge.empty(),e)}function yN(t){return new Ui(t.readTime,t.key,il)}class Ui{constructor(e,n,r){this.readTime=e,this.documentKey=n,this.largestBatchId=r}static min(){return new Ui(Se.min(),ge.empty(),il)}static max(){return new Ui(Se.max(),ge.empty(),il)}}function vN(t,e){let n=t.readTime.compareTo(e.readTime);return n!==0?n:(n=ge.comparator(t.documentKey,e.documentKey),n!==0?n:ze(t.largestBatchId,e.largestBatchId))}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const xN="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.";class wN{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach(e=>e())}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function Vo(t){if(t.code!==q.FAILED_PRECONDITION||t.message!==xN)throw t;ae("LocalStore","Unexpectedly lost primary lease")}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class G{constructor(e){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,e(n=>{this.isDone=!0,this.result=n,this.nextCallback&&this.nextCallback(n)},n=>{this.isDone=!0,this.error=n,this.catchCallback&&this.catchCallback(n)})}catch(e){return this.next(void 0,e)}next(e,n){return this.callbackAttached&&_e(59440),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(n,this.error):this.wrapSuccess(e,this.result):new G((r,i)=>{this.nextCallback=s=>{this.wrapSuccess(e,s).next(r,i)},this.catchCallback=s=>{this.wrapFailure(n,s).next(r,i)}})}toPromise(){return new Promise((e,n)=>{this.next(e,n)})}wrapUserFunction(e){try{const n=e();return n instanceof G?n:G.resolve(n)}catch(n){return G.reject(n)}}wrapSuccess(e,n){return e?this.wrapUserFunction(()=>e(n)):G.resolve(n)}wrapFailure(e,n){return e?this.wrapUserFunction(()=>e(n)):G.reject(n)}static resolve(e){return new G((n,r)=>{n(e)})}static reject(e){return new G((n,r)=>{r(e)})}static waitFor(e){return new G((n,r)=>{let i=0,s=0,o=!1;e.forEach(a=>{++i,a.next(()=>{++s,o&&s===i&&n()},u=>r(u))}),o=!0,s===i&&n()})}static or(e){let n=G.resolve(!1);for(const r of e)n=n.next(i=>i?G.resolve(i):r());return n}static forEach(e,n){const r=[];return e.forEach((i,s)=>{r.push(n.call(this,i,s))}),this.waitFor(r)}static mapArray(e,n){return new G((r,i)=>{const s=e.length,o=new Array(s);let a=0;for(let u=0;u{o[c]=f,++a,a===s&&r(o)},f=>i(f))}})}static doWhile(e,n){return new G((r,i)=>{const s=()=>{e()===!0?n().next(()=>{s()},i):r()};s()})}}function _N(t){const e=t.match(/Android ([\d.]+)/i),n=e?e[1].split(".").slice(0,2).join("."):"-1";return Number(n)}function Fo(t){return t.name==="IndexedDbTransactionError"}/** + * @license + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class cd{constructor(e,n){this.previousValue=e,n&&(n.sequenceNumberHandler=r=>this.ae(r),this.ue=r=>n.writeSequenceNumber(r))}ae(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){const e=++this.previousValue;return this.ue&&this.ue(e),e}}cd.ce=-1;/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Um=-1;function dd(t){return t==null}function wc(t){return t===0&&1/t==-1/0}function bN(t){return typeof t=="number"&&Number.isInteger(t)&&!wc(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const yb="";function EN(t){let e="";for(let n=0;n0&&(e=fv(e)),e=IN(t.get(n),e);return fv(e)}function IN(t,e){let n=e;const r=t.length;for(let i=0;i0&&(n=n.right)}return null}indexOf(e){let n=0,r=this.root;for(;!r.isEmpty();){const i=this.comparator(e,r.key);if(i===0)return n+r.left.size;i<0?r=r.left:(n+=r.left.size+1,r=r.right)}return-1}isEmpty(){return this.root.isEmpty()}get size(){return this.root.size}minKey(){return this.root.minKey()}maxKey(){return this.root.maxKey()}inorderTraversal(e){return this.root.inorderTraversal(e)}forEach(e){this.inorderTraversal((n,r)=>(e(n,r),!1))}toString(){const e=[];return this.inorderTraversal((n,r)=>(e.push(`${n}:${r}`),!1)),`{${e.join(", ")}}`}reverseTraversal(e){return this.root.reverseTraversal(e)}getIterator(){return new cu(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new cu(this.root,e,this.comparator,!1)}getReverseIterator(){return new cu(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new cu(this.root,e,this.comparator,!0)}}class cu{constructor(e,n,r,i){this.isReverse=i,this.nodeStack=[];let s=1;for(;!e.isEmpty();)if(s=n?r(e.key,n):1,n&&i&&(s*=-1),s<0)e=this.isReverse?e.left:e.right;else{if(s===0){this.nodeStack.push(e);break}this.nodeStack.push(e),e=this.isReverse?e.right:e.left}}getNext(){let e=this.nodeStack.pop();const n={key:e.key,value:e.value};if(this.isReverse)for(e=e.left;!e.isEmpty();)this.nodeStack.push(e),e=e.right;else for(e=e.right;!e.isEmpty();)this.nodeStack.push(e),e=e.left;return n}hasNext(){return this.nodeStack.length>0}peek(){if(this.nodeStack.length===0)return null;const e=this.nodeStack[this.nodeStack.length-1];return{key:e.key,value:e.value}}}class Qt{constructor(e,n,r,i,s){this.key=e,this.value=n,this.color=r??Qt.RED,this.left=i??Qt.EMPTY,this.right=s??Qt.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,n,r,i,s){return new Qt(e??this.key,n??this.value,r??this.color,i??this.left,s??this.right)}isEmpty(){return!1}inorderTraversal(e){return this.left.inorderTraversal(e)||e(this.key,this.value)||this.right.inorderTraversal(e)}reverseTraversal(e){return this.right.reverseTraversal(e)||e(this.key,this.value)||this.left.reverseTraversal(e)}min(){return this.left.isEmpty()?this:this.left.min()}minKey(){return this.min().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(e,n,r){let i=this;const s=r(e,i.key);return i=s<0?i.copy(null,null,null,i.left.insert(e,n,r),null):s===0?i.copy(null,n,null,null,null):i.copy(null,null,null,null,i.right.insert(e,n,r)),i.fixUp()}removeMin(){if(this.left.isEmpty())return Qt.EMPTY;let e=this;return e.left.isRed()||e.left.left.isRed()||(e=e.moveRedLeft()),e=e.copy(null,null,null,e.left.removeMin(),null),e.fixUp()}remove(e,n){let r,i=this;if(n(e,i.key)<0)i.left.isEmpty()||i.left.isRed()||i.left.left.isRed()||(i=i.moveRedLeft()),i=i.copy(null,null,null,i.left.remove(e,n),null);else{if(i.left.isRed()&&(i=i.rotateRight()),i.right.isEmpty()||i.right.isRed()||i.right.left.isRed()||(i=i.moveRedRight()),n(e,i.key)===0){if(i.right.isEmpty())return Qt.EMPTY;r=i.right.min(),i=i.copy(r.key,r.value,null,null,i.right.removeMin())}i=i.copy(null,null,null,null,i.right.remove(e,n))}return i.fixUp()}isRed(){return this.color}fixUp(){let e=this;return e.right.isRed()&&!e.left.isRed()&&(e=e.rotateLeft()),e.left.isRed()&&e.left.left.isRed()&&(e=e.rotateRight()),e.left.isRed()&&e.right.isRed()&&(e=e.colorFlip()),e}moveRedLeft(){let e=this.colorFlip();return e.right.left.isRed()&&(e=e.copy(null,null,null,null,e.right.rotateRight()),e=e.rotateLeft(),e=e.colorFlip()),e}moveRedRight(){let e=this.colorFlip();return e.left.left.isRed()&&(e=e.rotateRight(),e=e.colorFlip()),e}rotateLeft(){const e=this.copy(null,null,Qt.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){const e=this.copy(null,null,Qt.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)}colorFlip(){const e=this.left.copy(null,null,!this.left.color,null,null),n=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,n)}checkMaxDepth(){const e=this.check();return Math.pow(2,e)<=this.size+1}check(){if(this.isRed()&&this.left.isRed())throw _e(43730,{key:this.key,value:this.value});if(this.right.isRed())throw _e(14113,{key:this.key,value:this.value});const e=this.left.check();if(e!==this.right.check())throw _e(27949);return e+(this.isRed()?0:1)}}Qt.EMPTY=null,Qt.RED=!0,Qt.BLACK=!1;Qt.EMPTY=new class{constructor(){this.size=0}get key(){throw _e(57766)}get value(){throw _e(16141)}get color(){throw _e(16727)}get left(){throw _e(29726)}get right(){throw _e(36894)}copy(e,n,r,i,s){return this}insert(e,n,r){return new Qt(e,n)}remove(e,n){return this}isEmpty(){return!0}inorderTraversal(e){return!1}reverseTraversal(e){return!1}minKey(){return null}maxKey(){return null}isRed(){return!1}checkMaxDepth(){return!0}check(){return 0}};/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Mt{constructor(e){this.comparator=e,this.data=new pt(this.comparator)}has(e){return this.data.get(e)!==null}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(e){return this.data.indexOf(e)}forEach(e){this.data.inorderTraversal((n,r)=>(e(n),!1))}forEachInRange(e,n){const r=this.data.getIteratorFrom(e[0]);for(;r.hasNext();){const i=r.getNext();if(this.comparator(i.key,e[1])>=0)return;n(i.key)}}forEachWhile(e,n){let r;for(r=n!==void 0?this.data.getIteratorFrom(n):this.data.getIterator();r.hasNext();)if(!e(r.getNext().key))return}firstAfterOrEqual(e){const n=this.data.getIteratorFrom(e);return n.hasNext()?n.getNext().key:null}getIterator(){return new mv(this.data.getIterator())}getIteratorFrom(e){return new mv(this.data.getIteratorFrom(e))}add(e){return this.copy(this.data.remove(e).insert(e,!0))}delete(e){return this.has(e)?this.copy(this.data.remove(e)):this}isEmpty(){return this.data.isEmpty()}unionWith(e){let n=this;return n.size{n=n.add(r)}),n}isEqual(e){if(!(e instanceof Mt)||this.size!==e.size)return!1;const n=this.data.getIterator(),r=e.data.getIterator();for(;n.hasNext();){const i=n.getNext().key,s=r.getNext().key;if(this.comparator(i,s)!==0)return!1}return!0}toArray(){const e=[];return this.forEach(n=>{e.push(n)}),e}toString(){const e=[];return this.forEach(n=>e.push(n)),"SortedSet("+e.toString()+")"}copy(e){const n=new Mt(this.comparator);return n.data=e,n}}class mv{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class On{constructor(e){this.fields=e,e.sort(Yt.comparator)}static empty(){return new On([])}unionWith(e){let n=new Mt(Yt.comparator);for(const r of this.fields)n=n.add(r);for(const r of e)n=n.add(r);return new On(n.toArray())}covers(e){for(const n of this.fields)if(n.isPrefixOf(e))return!0;return!1}isEqual(e){return ko(this.fields,e.fields,(n,r)=>n.isEqual(r))}}/** + * @license + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class xb extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class en{constructor(e){this.binaryString=e}static fromBase64String(e){const n=function(i){try{return atob(i)}catch(s){throw typeof DOMException<"u"&&s instanceof DOMException?new xb("Invalid base64 string: "+s):s}}(e);return new en(n)}static fromUint8Array(e){const n=function(i){let s="";for(let o=0;oeAr(n,e))!==void 0}function Co(t,e){if(t===e)return 0;const n=$i(t),r=$i(e);if(n!==r)return ze(n,r);switch(n){case 0:case 9007199254740991:return 0;case 1:return ze(t.booleanValue,e.booleanValue);case 2:return function(s,o){const a=St(s.integerValue||s.doubleValue),u=St(o.integerValue||o.doubleValue);return au?1:a===u?0:isNaN(a)?isNaN(u)?0:-1:1}(t,e);case 3:return gv(t.timestampValue,e.timestampValue);case 4:return gv(sl(t),sl(e));case 5:return ep(t.stringValue,e.stringValue);case 6:return function(s,o){const a=Bi(s),u=Bi(o);return a.compareTo(u)}(t.bytesValue,e.bytesValue);case 7:return function(s,o){const a=s.split("/"),u=o.split("/");for(let c=0;ci+ju(s),0)}(t.arrayValue);case 10:case 11:return function(r){let i=0;return Qi(r.fields,(s,o)=>{i+=s.length+ju(o)}),i}(t.mapValue);default:throw _e(13486,{value:t})}}function vv(t,e){return{referenceValue:`projects/${t.projectId}/databases/${t.database}/documents/${e.path.canonicalString()}`}}function np(t){return!!t&&"integerValue"in t}function Bm(t){return!!t&&"arrayValue"in t}function xv(t){return!!t&&"nullValue"in t}function wv(t){return!!t&&"doubleValue"in t&&isNaN(Number(t.doubleValue))}function Lu(t){return!!t&&"mapValue"in t}function CN(t){var n,r;return((r=(((n=t==null?void 0:t.mapValue)==null?void 0:n.fields)||{})[Ib])==null?void 0:r.stringValue)===Sb}function Pa(t){if(t.geoPointValue)return{geoPointValue:{...t.geoPointValue}};if(t.timestampValue&&typeof t.timestampValue=="object")return{timestampValue:{...t.timestampValue}};if(t.mapValue){const e={mapValue:{fields:{}}};return Qi(t.mapValue.fields,(n,r)=>e.mapValue.fields[n]=Pa(r)),e}if(t.arrayValue){const e={arrayValue:{values:[]}};for(let n=0;n<(t.arrayValue.values||[]).length;++n)e.arrayValue.values[n]=Pa(t.arrayValue.values[n]);return e}return{...t}}function NN(t){return(((t.mapValue||{}).fields||{}).__type__||{}).stringValue===kN}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class xn{constructor(e){this.value=e}static empty(){return new xn({mapValue:{}})}field(e){if(e.isEmpty())return this.value;{let n=this.value;for(let r=0;r{if(!n.isImmediateParentOf(a)){const u=this.getFieldsMap(n);this.applyChanges(u,r,i),r={},i=[],n=a.popLast()}o?r[a.lastSegment()]=Pa(o):i.push(a.lastSegment())});const s=this.getFieldsMap(n);this.applyChanges(s,r,i)}delete(e){const n=this.field(e.popLast());Lu(n)&&n.mapValue.fields&&delete n.mapValue.fields[e.lastSegment()]}isEqual(e){return Ar(this.value,e.value)}getFieldsMap(e){let n=this.value;n.mapValue.fields||(n.mapValue={fields:{}});for(let r=0;re[i]=s);for(const i of r)delete e[i]}clone(){return new xn(Pa(this.value))}}function Tb(t){const e=[];return Qi(t.fields,(n,r)=>{const i=new Yt([n]);if(Lu(r)){const s=Tb(r.mapValue).fields;if(s.length===0)e.push(i);else for(const o of s)e.push(i.child(o))}else e.push(i)}),new On(e)}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class an{constructor(e,n,r,i,s,o,a){this.key=e,this.documentType=n,this.version=r,this.readTime=i,this.createTime=s,this.data=o,this.documentState=a}static newInvalidDocument(e){return new an(e,0,Se.min(),Se.min(),Se.min(),xn.empty(),0)}static newFoundDocument(e,n,r,i){return new an(e,1,n,Se.min(),r,i,0)}static newNoDocument(e,n){return new an(e,2,n,Se.min(),Se.min(),xn.empty(),0)}static newUnknownDocument(e,n){return new an(e,3,n,Se.min(),Se.min(),xn.empty(),2)}convertToFoundDocument(e,n){return!this.createTime.isEqual(Se.min())||this.documentType!==2&&this.documentType!==0||(this.createTime=e),this.version=e,this.documentType=1,this.data=n,this.documentState=0,this}convertToNoDocument(e){return this.version=e,this.documentType=2,this.data=xn.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=xn.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=Se.min(),this}setReadTime(e){return this.readTime=e,this}get hasLocalMutations(){return this.documentState===1}get hasCommittedMutations(){return this.documentState===2}get hasPendingWrites(){return this.hasLocalMutations||this.hasCommittedMutations}isValidDocument(){return this.documentType!==0}isFoundDocument(){return this.documentType===1}isNoDocument(){return this.documentType===2}isUnknownDocument(){return this.documentType===3}isEqual(e){return e instanceof an&&this.key.isEqual(e.key)&&this.version.isEqual(e.version)&&this.documentType===e.documentType&&this.documentState===e.documentState&&this.data.isEqual(e.data)}mutableCopy(){return new an(this.key,this.documentType,this.version,this.readTime,this.createTime,this.data.clone(),this.documentState)}toString(){return`Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {createTime: ${this.createTime}}), {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`}}/** + * @license + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Ec{constructor(e,n){this.position=e,this.inclusive=n}}function _v(t,e,n){let r=0;for(let i=0;i":return e>0;case">=":return e>=0;default:return _e(47266,{operator:this.op})}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}}class cr extends kb{constructor(e,n){super(),this.filters=e,this.op=n,this.Pe=null}static create(e,n){return new cr(e,n)}matches(e){return Cb(this)?this.filters.find(n=>!n.matches(e))===void 0:this.filters.find(n=>n.matches(e))!==void 0}getFlattenedFilters(){return this.Pe!==null||(this.Pe=this.filters.reduce((e,n)=>e.concat(n.getFlattenedFilters()),[])),this.Pe}getFilters(){return Object.assign([],this.filters)}}function Cb(t){return t.op==="and"}function Nb(t){return PN(t)&&Cb(t)}function PN(t){for(const e of t.filters)if(e instanceof cr)return!1;return!0}function rp(t){if(t instanceof Pt)return t.field.canonicalString()+t.op.toString()+No(t.value);if(Nb(t))return t.filters.map(e=>rp(e)).join(",");{const e=t.filters.map(n=>rp(n)).join(",");return`${t.op}(${e})`}}function Ab(t,e){return t instanceof Pt?function(r,i){return i instanceof Pt&&r.op===i.op&&r.field.isEqual(i.field)&&Ar(r.value,i.value)}(t,e):t instanceof cr?function(r,i){return i instanceof cr&&r.op===i.op&&r.filters.length===i.filters.length?r.filters.reduce((s,o,a)=>s&&Ab(o,i.filters[a]),!0):!1}(t,e):void _e(19439)}function Pb(t){return t instanceof Pt?function(n){return`${n.field.canonicalString()} ${n.op} ${No(n.value)}`}(t):t instanceof cr?function(n){return n.op.toString()+" {"+n.getFilters().map(Pb).join(" ,")+"}"}(t):"Filter"}class RN extends Pt{constructor(e,n,r){super(e,n,r),this.key=ge.fromName(r.referenceValue)}matches(e){const n=ge.comparator(e.key,this.key);return this.matchesComparison(n)}}class DN extends Pt{constructor(e,n){super(e,"in",n),this.keys=Rb("in",n)}matches(e){return this.keys.some(n=>n.isEqual(e.key))}}class jN extends Pt{constructor(e,n){super(e,"not-in",n),this.keys=Rb("not-in",n)}matches(e){return!this.keys.some(n=>n.isEqual(e.key))}}function Rb(t,e){var n;return(((n=e.arrayValue)==null?void 0:n.values)||[]).map(r=>ge.fromName(r.referenceValue))}class LN extends Pt{constructor(e,n){super(e,"array-contains",n)}matches(e){const n=e.data.field(this.field);return Bm(n)&&al(n.arrayValue,this.value)}}class ON extends Pt{constructor(e,n){super(e,"in",n)}matches(e){const n=e.data.field(this.field);return n!==null&&al(this.value.arrayValue,n)}}class MN extends Pt{constructor(e,n){super(e,"not-in",n)}matches(e){if(al(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const n=e.data.field(this.field);return n!==null&&n.nullValue===void 0&&!al(this.value.arrayValue,n)}}class VN extends Pt{constructor(e,n){super(e,"array-contains-any",n)}matches(e){const n=e.data.field(this.field);return!(!Bm(n)||!n.arrayValue.values)&&n.arrayValue.values.some(r=>al(this.value.arrayValue,r))}}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class FN{constructor(e,n=null,r=[],i=[],s=null,o=null,a=null){this.path=e,this.collectionGroup=n,this.orderBy=r,this.filters=i,this.limit=s,this.startAt=o,this.endAt=a,this.Te=null}}function Ev(t,e=null,n=[],r=[],i=null,s=null,o=null){return new FN(t,e,n,r,i,s,o)}function $m(t){const e=ke(t);if(e.Te===null){let n=e.path.canonicalString();e.collectionGroup!==null&&(n+="|cg:"+e.collectionGroup),n+="|f:",n+=e.filters.map(r=>rp(r)).join(","),n+="|ob:",n+=e.orderBy.map(r=>function(s){return s.field.canonicalString()+s.dir}(r)).join(","),dd(e.limit)||(n+="|l:",n+=e.limit),e.startAt&&(n+="|lb:",n+=e.startAt.inclusive?"b:":"a:",n+=e.startAt.position.map(r=>No(r)).join(",")),e.endAt&&(n+="|ub:",n+=e.endAt.inclusive?"a:":"b:",n+=e.endAt.position.map(r=>No(r)).join(",")),e.Te=n}return e.Te}function Hm(t,e){if(t.limit!==e.limit||t.orderBy.length!==e.orderBy.length)return!1;for(let n=0;n0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc";(function(o){let a=new Mt(Yt.comparator);return o.filters.forEach(u=>{u.getFlattenedFilters().forEach(c=>{c.isInequality()&&(a=a.add(c.field))})}),a})(e).forEach(s=>{n.has(s.canonicalString())||s.isKeyField()||e.Ie.push(new ll(s,r))}),n.has(Yt.keyField().canonicalString())||e.Ie.push(new ll(Yt.keyField(),r))}return e.Ie}function Ir(t){const e=ke(t);return e.Ee||(e.Ee=zN(e,Ra(t))),e.Ee}function zN(t,e){if(t.limitType==="F")return Ev(t.path,t.collectionGroup,e,t.filters,t.limit,t.startAt,t.endAt);{e=e.map(i=>{const s=i.dir==="desc"?"asc":"desc";return new ll(i.field,s)});const n=t.endAt?new Ec(t.endAt.position,t.endAt.inclusive):null,r=t.startAt?new Ec(t.startAt.position,t.startAt.inclusive):null;return Ev(t.path,t.collectionGroup,e,t.filters,t.limit,n,r)}}function sp(t,e){const n=t.filters.concat([e]);return new Uo(t.path,t.collectionGroup,t.explicitOrderBy.slice(),n,t.limit,t.limitType,t.startAt,t.endAt)}function op(t,e,n){return new Uo(t.path,t.collectionGroup,t.explicitOrderBy.slice(),t.filters.slice(),e,n,t.startAt,t.endAt)}function pd(t,e){return Hm(Ir(t),Ir(e))&&t.limitType===e.limitType}function jb(t){return`${$m(Ir(t))}|lt:${t.limitType}`}function zs(t){return`Query(target=${function(n){let r=n.path.canonicalString();return n.collectionGroup!==null&&(r+=" collectionGroup="+n.collectionGroup),n.filters.length>0&&(r+=`, filters: [${n.filters.map(i=>Pb(i)).join(", ")}]`),dd(n.limit)||(r+=", limit: "+n.limit),n.orderBy.length>0&&(r+=`, orderBy: [${n.orderBy.map(i=>function(o){return`${o.field.canonicalString()} (${o.dir})`}(i)).join(", ")}]`),n.startAt&&(r+=", startAt: ",r+=n.startAt.inclusive?"b:":"a:",r+=n.startAt.position.map(i=>No(i)).join(",")),n.endAt&&(r+=", endAt: ",r+=n.endAt.inclusive?"a:":"b:",r+=n.endAt.position.map(i=>No(i)).join(",")),`Target(${r})`}(Ir(t))}; limitType=${t.limitType})`}function md(t,e){return e.isFoundDocument()&&function(r,i){const s=i.key.path;return r.collectionGroup!==null?i.key.hasCollectionId(r.collectionGroup)&&r.path.isPrefixOf(s):ge.isDocumentKey(r.path)?r.path.isEqual(s):r.path.isImmediateParentOf(s)}(t,e)&&function(r,i){for(const s of Ra(r))if(!s.field.isKeyField()&&i.data.field(s.field)===null)return!1;return!0}(t,e)&&function(r,i){for(const s of r.filters)if(!s.matches(i))return!1;return!0}(t,e)&&function(r,i){return!(r.startAt&&!function(o,a,u){const c=_v(o,a,u);return o.inclusive?c<=0:c<0}(r.startAt,Ra(r),i)||r.endAt&&!function(o,a,u){const c=_v(o,a,u);return o.inclusive?c>=0:c>0}(r.endAt,Ra(r),i))}(t,e)}function BN(t){return t.collectionGroup||(t.path.length%2==1?t.path.lastSegment():t.path.get(t.path.length-2))}function Lb(t){return(e,n)=>{let r=!1;for(const i of Ra(t)){const s=$N(i,e,n);if(s!==0)return s;r=r||i.field.isKeyField()}return 0}}function $N(t,e,n){const r=t.field.isKeyField()?ge.comparator(e.key,n.key):function(s,o,a){const u=o.data.field(s),c=a.data.field(s);return u!==null&&c!==null?Co(u,c):_e(42886)}(t.field,e,n);switch(t.dir){case"asc":return r;case"desc":return-1*r;default:return _e(19790,{direction:t.dir})}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Rs{constructor(e,n){this.mapKeyFn=e,this.equalsFn=n,this.inner={},this.innerSize=0}get(e){const n=this.mapKeyFn(e),r=this.inner[n];if(r!==void 0){for(const[i,s]of r)if(this.equalsFn(i,e))return s}}has(e){return this.get(e)!==void 0}set(e,n){const r=this.mapKeyFn(e),i=this.inner[r];if(i===void 0)return this.inner[r]=[[e,n]],void this.innerSize++;for(let s=0;s{for(const[i,s]of r)e(i,s)})}isEmpty(){return vb(this.inner)}size(){return this.innerSize}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const HN=new pt(ge.comparator);function Xr(){return HN}const Ob=new pt(ge.comparator);function va(...t){let e=Ob;for(const n of t)e=e.insert(n.key,n);return e}function Mb(t){let e=Ob;return t.forEach((n,r)=>e=e.insert(n,r.overlayedDocument)),e}function ds(){return Da()}function Vb(){return Da()}function Da(){return new Rs(t=>t.toString(),(t,e)=>t.isEqual(e))}const qN=new pt(ge.comparator),WN=new Mt(ge.comparator);function Be(...t){let e=WN;for(const n of t)e=e.add(n);return e}const GN=new Mt(ze);function KN(){return GN}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function qm(t,e){if(t.useProto3Json){if(isNaN(e))return{doubleValue:"NaN"};if(e===1/0)return{doubleValue:"Infinity"};if(e===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:wc(e)?"-0":e}}function Fb(t){return{integerValue:""+t}}function Ub(t,e){return bN(e)?Fb(e):qm(t,e)}/** + * @license + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class gd{constructor(){this._=void 0}}function QN(t,e,n){return t instanceof Ic?function(i,s){const o={fields:{[_b]:{stringValue:wb},[Eb]:{timestampValue:{seconds:i.seconds,nanos:i.nanoseconds}}}};return s&&zm(s)&&(s=hd(s)),s&&(o.fields[bb]=s),{mapValue:o}}(n,e):t instanceof ul?Bb(t,e):t instanceof cl?$b(t,e):function(i,s){const o=zb(i,s),a=Sv(o)+Sv(i.Ae);return np(o)&&np(i.Ae)?Fb(a):qm(i.serializer,a)}(t,e)}function YN(t,e,n){return t instanceof ul?Bb(t,e):t instanceof cl?$b(t,e):n}function zb(t,e){return t instanceof dl?function(r){return np(r)||function(s){return!!s&&"doubleValue"in s}(r)}(e)?e:{integerValue:0}:null}class Ic extends gd{}class ul extends gd{constructor(e){super(),this.elements=e}}function Bb(t,e){const n=Hb(e);for(const r of t.elements)n.some(i=>Ar(i,r))||n.push(r);return{arrayValue:{values:n}}}class cl extends gd{constructor(e){super(),this.elements=e}}function $b(t,e){let n=Hb(e);for(const r of t.elements)n=n.filter(i=>!Ar(i,r));return{arrayValue:{values:n}}}class dl extends gd{constructor(e,n){super(),this.serializer=e,this.Ae=n}}function Sv(t){return St(t.integerValue||t.doubleValue)}function Hb(t){return Bm(t)&&t.arrayValue.values?t.arrayValue.values.slice():[]}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class XN{constructor(e,n){this.field=e,this.transform=n}}function JN(t,e){return t.field.isEqual(e.field)&&function(r,i){return r instanceof ul&&i instanceof ul||r instanceof cl&&i instanceof cl?ko(r.elements,i.elements,Ar):r instanceof dl&&i instanceof dl?Ar(r.Ae,i.Ae):r instanceof Ic&&i instanceof Ic}(t.transform,e.transform)}class ZN{constructor(e,n){this.version=e,this.transformResults=n}}class Yn{constructor(e,n){this.updateTime=e,this.exists=n}static none(){return new Yn}static exists(e){return new Yn(void 0,e)}static updateTime(e){return new Yn(e)}get isNone(){return this.updateTime===void 0&&this.exists===void 0}isEqual(e){return this.exists===e.exists&&(this.updateTime?!!e.updateTime&&this.updateTime.isEqual(e.updateTime):!e.updateTime)}}function Ou(t,e){return t.updateTime!==void 0?e.isFoundDocument()&&e.version.isEqual(t.updateTime):t.exists===void 0||t.exists===e.isFoundDocument()}class yd{}function qb(t,e){if(!t.hasLocalMutations||e&&e.fields.length===0)return null;if(e===null)return t.isNoDocument()?new Wm(t.key,Yn.none()):new Il(t.key,t.data,Yn.none());{const n=t.data,r=xn.empty();let i=new Mt(Yt.comparator);for(let s of e.fields)if(!i.has(s)){let o=n.field(s);o===null&&s.length>1&&(s=s.popLast(),o=n.field(s)),o===null?r.delete(s):r.set(s,o),i=i.add(s)}return new Yi(t.key,r,new On(i.toArray()),Yn.none())}}function eA(t,e,n){t instanceof Il?function(i,s,o){const a=i.value.clone(),u=kv(i.fieldTransforms,s,o.transformResults);a.setAll(u),s.convertToFoundDocument(o.version,a).setHasCommittedMutations()}(t,e,n):t instanceof Yi?function(i,s,o){if(!Ou(i.precondition,s))return void s.convertToUnknownDocument(o.version);const a=kv(i.fieldTransforms,s,o.transformResults),u=s.data;u.setAll(Wb(i)),u.setAll(a),s.convertToFoundDocument(o.version,u).setHasCommittedMutations()}(t,e,n):function(i,s,o){s.convertToNoDocument(o.version).setHasCommittedMutations()}(0,e,n)}function ja(t,e,n,r){return t instanceof Il?function(s,o,a,u){if(!Ou(s.precondition,o))return a;const c=s.value.clone(),f=Cv(s.fieldTransforms,u,o);return c.setAll(f),o.convertToFoundDocument(o.version,c).setHasLocalMutations(),null}(t,e,n,r):t instanceof Yi?function(s,o,a,u){if(!Ou(s.precondition,o))return a;const c=Cv(s.fieldTransforms,u,o),f=o.data;return f.setAll(Wb(s)),f.setAll(c),o.convertToFoundDocument(o.version,f).setHasLocalMutations(),a===null?null:a.unionWith(s.fieldMask.fields).unionWith(s.fieldTransforms.map(h=>h.field))}(t,e,n,r):function(s,o,a){return Ou(s.precondition,o)?(o.convertToNoDocument(o.version).setHasLocalMutations(),null):a}(t,e,n)}function tA(t,e){let n=null;for(const r of t.fieldTransforms){const i=e.data.field(r.field),s=zb(r.transform,i||null);s!=null&&(n===null&&(n=xn.empty()),n.set(r.field,s))}return n||null}function Tv(t,e){return t.type===e.type&&!!t.key.isEqual(e.key)&&!!t.precondition.isEqual(e.precondition)&&!!function(r,i){return r===void 0&&i===void 0||!(!r||!i)&&ko(r,i,(s,o)=>JN(s,o))}(t.fieldTransforms,e.fieldTransforms)&&(t.type===0?t.value.isEqual(e.value):t.type!==1||t.data.isEqual(e.data)&&t.fieldMask.isEqual(e.fieldMask))}class Il extends yd{constructor(e,n,r,i=[]){super(),this.key=e,this.value=n,this.precondition=r,this.fieldTransforms=i,this.type=0}getFieldMask(){return null}}class Yi extends yd{constructor(e,n,r,i,s=[]){super(),this.key=e,this.data=n,this.fieldMask=r,this.precondition=i,this.fieldTransforms=s,this.type=1}getFieldMask(){return this.fieldMask}}function Wb(t){const e=new Map;return t.fieldMask.fields.forEach(n=>{if(!n.isEmpty()){const r=t.data.field(n);e.set(n,r)}}),e}function kv(t,e,n){const r=new Map;Ye(t.length===n.length,32656,{Re:n.length,Ve:t.length});for(let i=0;i{const s=e.get(i.key),o=s.overlayedDocument;let a=this.applyToLocalView(o,s.mutatedFields);a=n.has(i.key)?null:a;const u=qb(o,a);u!==null&&r.set(i.key,u),o.isValidDocument()||o.convertToNoDocument(Se.min())}),r}keys(){return this.mutations.reduce((e,n)=>e.add(n.key),Be())}isEqual(e){return this.batchId===e.batchId&&ko(this.mutations,e.mutations,(n,r)=>Tv(n,r))&&ko(this.baseMutations,e.baseMutations,(n,r)=>Tv(n,r))}}class Gm{constructor(e,n,r,i){this.batch=e,this.commitVersion=n,this.mutationResults=r,this.docVersions=i}static from(e,n,r){Ye(e.mutations.length===r.length,58842,{me:e.mutations.length,fe:r.length});let i=function(){return qN}();const s=e.mutations;for(let o=0;o=8)throw new xa(`Invalid padding: ${n}`);if(r<0)throw new xa(`Invalid hash count: ${r}`);if(e.length>0&&this.hashCount===0)throw new xa(`Invalid hash count: ${r}`);if(e.length===0&&n!==0)throw new xa(`Invalid padding when bitmap length is 0: ${n}`);this.ge=8*e.length-n,this.pe=Li.fromNumber(this.ge)}ye(e,n,r){let i=e.add(n.multiply(Li.fromNumber(r)));return i.compare(lA)===1&&(i=new Li([i.getBits(0),i.getBits(1)],0)),i.modulo(this.pe).toNumber()}we(e){return!!(this.bitmap[Math.floor(e/8)]&1<o.insert(a)),o}insert(e){if(this.ge===0)return;const n=Nv(e),[r,i]=Av(n);for(let s=0;s0&&(this.Oe=!0,this.Me=e)}ke(){let e=Be(),n=Be(),r=Be();return this.Fe.forEach((i,s)=>{switch(s){case 0:e=e.add(i);break;case 2:n=n.add(i);break;case 1:r=r.add(i);break;default:_e(38017,{changeType:s})}}),new Sl(this.Me,this.xe,e,n,r)}qe(){this.Oe=!1,this.Fe=Rv()}Qe(e,n){this.Oe=!0,this.Fe=this.Fe.insert(e,n)}$e(e){this.Oe=!0,this.Fe=this.Fe.remove(e)}Ue(){this.ve+=1}Ke(){this.ve-=1,Ye(this.ve>=0,3241,{ve:this.ve})}We(){this.Oe=!0,this.xe=!0}}class uA{constructor(e){this.Ge=e,this.ze=new Map,this.je=Xr(),this.Je=hu(),this.He=hu(),this.Ye=new pt(ze)}Ze(e){for(const n of e.be)e.De&&e.De.isFoundDocument()?this.Xe(n,e.De):this.et(n,e.key,e.De);for(const n of e.removedTargetIds)this.et(n,e.key,e.De)}tt(e){this.forEachTarget(e,n=>{const r=this.nt(n);switch(e.state){case 0:this.rt(n)&&r.Le(e.resumeToken);break;case 1:r.Ke(),r.Ne||r.qe(),r.Le(e.resumeToken);break;case 2:r.Ke(),r.Ne||this.removeTarget(n);break;case 3:this.rt(n)&&(r.We(),r.Le(e.resumeToken));break;case 4:this.rt(n)&&(this.it(n),r.Le(e.resumeToken));break;default:_e(56790,{state:e.state})}})}forEachTarget(e,n){e.targetIds.length>0?e.targetIds.forEach(n):this.ze.forEach((r,i)=>{this.rt(i)&&n(i)})}st(e){const n=e.targetId,r=e.Ce.count,i=this.ot(n);if(i){const s=i.target;if(ip(s))if(r===0){const o=new ge(s.path);this.et(n,o,an.newNoDocument(o,Se.min()))}else Ye(r===1,20013,{expectedCount:r});else{const o=this._t(n);if(o!==r){const a=this.ut(e),u=a?this.ct(a,e,o):1;if(u!==0){this.it(n);const c=u===2?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.Ye=this.Ye.insert(n,c)}}}}}ut(e){const n=e.Ce.unchangedNames;if(!n||!n.bits)return null;const{bits:{bitmap:r="",padding:i=0},hashCount:s=0}=n;let o,a;try{o=Bi(r).toUint8Array()}catch(u){if(u instanceof xb)return To("Decoding the base64 bloom filter in existence filter failed ("+u.message+"); ignoring the bloom filter and falling back to full re-query."),null;throw u}try{a=new Km(o,i,s)}catch(u){return To(u instanceof xa?"BloomFilter error: ":"Applying bloom filter failed: ",u),null}return a.ge===0?null:a}ct(e,n,r){return n.Ce.count===r-this.Pt(e,n.targetId)?0:2}Pt(e,n){const r=this.Ge.getRemoteKeysForTarget(n);let i=0;return r.forEach(s=>{const o=this.Ge.ht(),a=`projects/${o.projectId}/databases/${o.database}/documents/${s.path.canonicalString()}`;e.mightContain(a)||(this.et(n,s,null),i++)}),i}Tt(e){const n=new Map;this.ze.forEach((s,o)=>{const a=this.ot(o);if(a){if(s.current&&ip(a.target)){const u=new ge(a.target.path);this.It(u).has(o)||this.Et(o,u)||this.et(o,u,an.newNoDocument(u,e))}s.Be&&(n.set(o,s.ke()),s.qe())}});let r=Be();this.He.forEach((s,o)=>{let a=!0;o.forEachWhile(u=>{const c=this.ot(u);return!c||c.purpose==="TargetPurposeLimboResolution"||(a=!1,!1)}),a&&(r=r.add(s))}),this.je.forEach((s,o)=>o.setReadTime(e));const i=new vd(e,n,this.Ye,this.je,r);return this.je=Xr(),this.Je=hu(),this.He=hu(),this.Ye=new pt(ze),i}Xe(e,n){if(!this.rt(e))return;const r=this.Et(e,n.key)?2:0;this.nt(e).Qe(n.key,r),this.je=this.je.insert(n.key,n),this.Je=this.Je.insert(n.key,this.It(n.key).add(e)),this.He=this.He.insert(n.key,this.dt(n.key).add(e))}et(e,n,r){if(!this.rt(e))return;const i=this.nt(e);this.Et(e,n)?i.Qe(n,1):i.$e(n),this.He=this.He.insert(n,this.dt(n).delete(e)),this.He=this.He.insert(n,this.dt(n).add(e)),r&&(this.je=this.je.insert(n,r))}removeTarget(e){this.ze.delete(e)}_t(e){const n=this.nt(e).ke();return this.Ge.getRemoteKeysForTarget(e).size+n.addedDocuments.size-n.removedDocuments.size}Ue(e){this.nt(e).Ue()}nt(e){let n=this.ze.get(e);return n||(n=new Pv,this.ze.set(e,n)),n}dt(e){let n=this.He.get(e);return n||(n=new Mt(ze),this.He=this.He.insert(e,n)),n}It(e){let n=this.Je.get(e);return n||(n=new Mt(ze),this.Je=this.Je.insert(e,n)),n}rt(e){const n=this.ot(e)!==null;return n||ae("WatchChangeAggregator","Detected inactive target",e),n}ot(e){const n=this.ze.get(e);return n&&n.Ne?null:this.Ge.At(e)}it(e){this.ze.set(e,new Pv),this.Ge.getRemoteKeysForTarget(e).forEach(n=>{this.et(e,n,null)})}Et(e,n){return this.Ge.getRemoteKeysForTarget(e).has(n)}}function hu(){return new pt(ge.comparator)}function Rv(){return new pt(ge.comparator)}const cA={asc:"ASCENDING",desc:"DESCENDING"},dA={"<":"LESS_THAN","<=":"LESS_THAN_OR_EQUAL",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","!=":"NOT_EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","not-in":"NOT_IN","array-contains-any":"ARRAY_CONTAINS_ANY"},hA={and:"AND",or:"OR"};class fA{constructor(e,n){this.databaseId=e,this.useProto3Json=n}}function ap(t,e){return t.useProto3Json||dd(e)?e:{value:e}}function Sc(t,e){return t.useProto3Json?`${new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+e.nanoseconds).slice(-9)}Z`:{seconds:""+e.seconds,nanos:e.nanoseconds}}function Yb(t,e){return t.useProto3Json?e.toBase64():e.toUint8Array()}function pA(t,e){return Sc(t,e.toTimestamp())}function Sr(t){return Ye(!!t,49232),Se.fromTimestamp(function(n){const r=zi(n);return new Qe(r.seconds,r.nanos)}(t))}function Qm(t,e){return lp(t,e).canonicalString()}function lp(t,e){const n=function(i){return new rt(["projects",i.projectId,"databases",i.database])}(t).child("documents");return e===void 0?n:n.child(e)}function Xb(t){const e=rt.fromString(t);return Ye(nE(e),10190,{key:e.toString()}),e}function up(t,e){return Qm(t.databaseId,e.path)}function Ph(t,e){const n=Xb(e);if(n.get(1)!==t.databaseId.projectId)throw new se(q.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+n.get(1)+" vs "+t.databaseId.projectId);if(n.get(3)!==t.databaseId.database)throw new se(q.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+t.databaseId.database);return new ge(Zb(n))}function Jb(t,e){return Qm(t.databaseId,e)}function mA(t){const e=Xb(t);return e.length===4?rt.emptyPath():Zb(e)}function cp(t){return new rt(["projects",t.databaseId.projectId,"databases",t.databaseId.database]).canonicalString()}function Zb(t){return Ye(t.length>4&&t.get(4)==="documents",29091,{key:t.toString()}),t.popFirst(5)}function Dv(t,e,n){return{name:up(t,e),fields:n.value.mapValue.fields}}function gA(t,e){let n;if("targetChange"in e){e.targetChange;const r=function(c){return c==="NO_CHANGE"?0:c==="ADD"?1:c==="REMOVE"?2:c==="CURRENT"?3:c==="RESET"?4:_e(39313,{state:c})}(e.targetChange.targetChangeType||"NO_CHANGE"),i=e.targetChange.targetIds||[],s=function(c,f){return c.useProto3Json?(Ye(f===void 0||typeof f=="string",58123),en.fromBase64String(f||"")):(Ye(f===void 0||f instanceof Buffer||f instanceof Uint8Array,16193),en.fromUint8Array(f||new Uint8Array))}(t,e.targetChange.resumeToken),o=e.targetChange.cause,a=o&&function(c){const f=c.code===void 0?q.UNKNOWN:Gb(c.code);return new se(f,c.message||"")}(o);n=new Qb(r,i,s,a||null)}else if("documentChange"in e){e.documentChange;const r=e.documentChange;r.document,r.document.name,r.document.updateTime;const i=Ph(t,r.document.name),s=Sr(r.document.updateTime),o=r.document.createTime?Sr(r.document.createTime):Se.min(),a=new xn({mapValue:{fields:r.document.fields}}),u=an.newFoundDocument(i,s,o,a),c=r.targetIds||[],f=r.removedTargetIds||[];n=new Mu(c,f,u.key,u)}else if("documentDelete"in e){e.documentDelete;const r=e.documentDelete;r.document;const i=Ph(t,r.document),s=r.readTime?Sr(r.readTime):Se.min(),o=an.newNoDocument(i,s),a=r.removedTargetIds||[];n=new Mu([],a,o.key,o)}else if("documentRemove"in e){e.documentRemove;const r=e.documentRemove;r.document;const i=Ph(t,r.document),s=r.removedTargetIds||[];n=new Mu([],s,i,null)}else{if(!("filter"in e))return _e(11601,{Rt:e});{e.filter;const r=e.filter;r.targetId;const{count:i=0,unchangedNames:s}=r,o=new sA(i,s),a=r.targetId;n=new Kb(a,o)}}return n}function yA(t,e){let n;if(e instanceof Il)n={update:Dv(t,e.key,e.value)};else if(e instanceof Wm)n={delete:up(t,e.key)};else if(e instanceof Yi)n={update:Dv(t,e.key,e.data),updateMask:TA(e.fieldMask)};else{if(!(e instanceof nA))return _e(16599,{Vt:e.type});n={verify:up(t,e.key)}}return e.fieldTransforms.length>0&&(n.updateTransforms=e.fieldTransforms.map(r=>function(s,o){const a=o.transform;if(a instanceof Ic)return{fieldPath:o.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(a instanceof ul)return{fieldPath:o.field.canonicalString(),appendMissingElements:{values:a.elements}};if(a instanceof cl)return{fieldPath:o.field.canonicalString(),removeAllFromArray:{values:a.elements}};if(a instanceof dl)return{fieldPath:o.field.canonicalString(),increment:a.Ae};throw _e(20930,{transform:o.transform})}(0,r))),e.precondition.isNone||(n.currentDocument=function(i,s){return s.updateTime!==void 0?{updateTime:pA(i,s.updateTime)}:s.exists!==void 0?{exists:s.exists}:_e(27497)}(t,e.precondition)),n}function vA(t,e){return t&&t.length>0?(Ye(e!==void 0,14353),t.map(n=>function(i,s){let o=i.updateTime?Sr(i.updateTime):Sr(s);return o.isEqual(Se.min())&&(o=Sr(s)),new ZN(o,i.transformResults||[])}(n,e))):[]}function xA(t,e){return{documents:[Jb(t,e.path)]}}function wA(t,e){const n={structuredQuery:{}},r=e.path;let i;e.collectionGroup!==null?(i=r,n.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(i=r.popLast(),n.structuredQuery.from=[{collectionId:r.lastSegment()}]),n.parent=Jb(t,i);const s=function(c){if(c.length!==0)return tE(cr.create(c,"and"))}(e.filters);s&&(n.structuredQuery.where=s);const o=function(c){if(c.length!==0)return c.map(f=>function(p){return{field:Bs(p.field),direction:EA(p.dir)}}(f))}(e.orderBy);o&&(n.structuredQuery.orderBy=o);const a=ap(t,e.limit);return a!==null&&(n.structuredQuery.limit=a),e.startAt&&(n.structuredQuery.startAt=function(c){return{before:c.inclusive,values:c.position}}(e.startAt)),e.endAt&&(n.structuredQuery.endAt=function(c){return{before:!c.inclusive,values:c.position}}(e.endAt)),{ft:n,parent:i}}function _A(t){let e=mA(t.parent);const n=t.structuredQuery,r=n.from?n.from.length:0;let i=null;if(r>0){Ye(r===1,65062);const f=n.from[0];f.allDescendants?i=f.collectionId:e=e.child(f.collectionId)}let s=[];n.where&&(s=function(h){const p=eE(h);return p instanceof cr&&Nb(p)?p.getFilters():[p]}(n.where));let o=[];n.orderBy&&(o=function(h){return h.map(p=>function(b){return new ll($s(b.field),function(P){switch(P){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(b.direction))}(p))}(n.orderBy));let a=null;n.limit&&(a=function(h){let p;return p=typeof h=="object"?h.value:h,dd(p)?null:p}(n.limit));let u=null;n.startAt&&(u=function(h){const p=!!h.before,m=h.values||[];return new Ec(m,p)}(n.startAt));let c=null;return n.endAt&&(c=function(h){const p=!h.before,m=h.values||[];return new Ec(m,p)}(n.endAt)),UN(e,i,o,s,a,"F",u,c)}function bA(t,e){const n=function(i){switch(i){case"TargetPurposeListen":return null;case"TargetPurposeExistenceFilterMismatch":return"existence-filter-mismatch";case"TargetPurposeExistenceFilterMismatchBloom":return"existence-filter-mismatch-bloom";case"TargetPurposeLimboResolution":return"limbo-document";default:return _e(28987,{purpose:i})}}(e.purpose);return n==null?null:{"goog-listen-tags":n}}function eE(t){return t.unaryFilter!==void 0?function(n){switch(n.unaryFilter.op){case"IS_NAN":const r=$s(n.unaryFilter.field);return Pt.create(r,"==",{doubleValue:NaN});case"IS_NULL":const i=$s(n.unaryFilter.field);return Pt.create(i,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const s=$s(n.unaryFilter.field);return Pt.create(s,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const o=$s(n.unaryFilter.field);return Pt.create(o,"!=",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":return _e(61313);default:return _e(60726)}}(t):t.fieldFilter!==void 0?function(n){return Pt.create($s(n.fieldFilter.field),function(i){switch(i){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";case"OPERATOR_UNSPECIFIED":return _e(58110);default:return _e(50506)}}(n.fieldFilter.op),n.fieldFilter.value)}(t):t.compositeFilter!==void 0?function(n){return cr.create(n.compositeFilter.filters.map(r=>eE(r)),function(i){switch(i){case"AND":return"and";case"OR":return"or";default:return _e(1026)}}(n.compositeFilter.op))}(t):_e(30097,{filter:t})}function EA(t){return cA[t]}function IA(t){return dA[t]}function SA(t){return hA[t]}function Bs(t){return{fieldPath:t.canonicalString()}}function $s(t){return Yt.fromServerFormat(t.fieldPath)}function tE(t){return t instanceof Pt?function(n){if(n.op==="=="){if(wv(n.value))return{unaryFilter:{field:Bs(n.field),op:"IS_NAN"}};if(xv(n.value))return{unaryFilter:{field:Bs(n.field),op:"IS_NULL"}}}else if(n.op==="!="){if(wv(n.value))return{unaryFilter:{field:Bs(n.field),op:"IS_NOT_NAN"}};if(xv(n.value))return{unaryFilter:{field:Bs(n.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:Bs(n.field),op:IA(n.op),value:n.value}}}(t):t instanceof cr?function(n){const r=n.getFilters().map(i=>tE(i));return r.length===1?r[0]:{compositeFilter:{op:SA(n.op),filters:r}}}(t):_e(54877,{filter:t})}function TA(t){const e=[];return t.fields.forEach(n=>e.push(n.canonicalString())),{fieldPaths:e}}function nE(t){return t.length>=4&&t.get(0)==="projects"&&t.get(2)==="databases"}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Ei{constructor(e,n,r,i,s=Se.min(),o=Se.min(),a=en.EMPTY_BYTE_STRING,u=null){this.target=e,this.targetId=n,this.purpose=r,this.sequenceNumber=i,this.snapshotVersion=s,this.lastLimboFreeSnapshotVersion=o,this.resumeToken=a,this.expectedCount=u}withSequenceNumber(e){return new Ei(this.target,this.targetId,this.purpose,e,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(e,n){return new Ei(this.target,this.targetId,this.purpose,this.sequenceNumber,n,this.lastLimboFreeSnapshotVersion,e,null)}withExpectedCount(e){return new Ei(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,e)}withLastLimboFreeSnapshotVersion(e){return new Ei(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,e,this.resumeToken,this.expectedCount)}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class kA{constructor(e){this.yt=e}}function CA(t){const e=_A({parent:t.parent,structuredQuery:t.structuredQuery});return t.limitType==="LAST"?op(e,e.limit,"L"):e}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class NA{constructor(){this.Cn=new AA}addToCollectionParentIndex(e,n){return this.Cn.add(n),G.resolve()}getCollectionParents(e,n){return G.resolve(this.Cn.getEntries(n))}addFieldIndex(e,n){return G.resolve()}deleteFieldIndex(e,n){return G.resolve()}deleteAllFieldIndexes(e){return G.resolve()}createTargetIndexes(e,n){return G.resolve()}getDocumentsMatchingTarget(e,n){return G.resolve(null)}getIndexType(e,n){return G.resolve(0)}getFieldIndexes(e,n){return G.resolve([])}getNextCollectionGroupToUpdate(e){return G.resolve(null)}getMinOffset(e,n){return G.resolve(Ui.min())}getMinOffsetFromCollectionGroup(e,n){return G.resolve(Ui.min())}updateCollectionGroup(e,n,r){return G.resolve()}updateIndexEntries(e,n){return G.resolve()}}class AA{constructor(){this.index={}}add(e){const n=e.lastSegment(),r=e.popLast(),i=this.index[n]||new Mt(rt.comparator),s=!i.has(r);return this.index[n]=i.add(r),s}has(e){const n=e.lastSegment(),r=e.popLast(),i=this.index[n];return i&&i.has(r)}getEntries(e){return(this.index[e]||new Mt(rt.comparator)).toArray()}}/** + * @license + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const jv={didRun:!1,sequenceNumbersCollected:0,targetsRemoved:0,documentsRemoved:0},rE=41943040;class yn{static withCacheSize(e){return new yn(e,yn.DEFAULT_COLLECTION_PERCENTILE,yn.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}constructor(e,n,r){this.cacheSizeCollectionThreshold=e,this.percentileToCollect=n,this.maximumSequenceNumbersToCollect=r}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */yn.DEFAULT_COLLECTION_PERCENTILE=10,yn.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,yn.DEFAULT=new yn(rE,yn.DEFAULT_COLLECTION_PERCENTILE,yn.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),yn.DISABLED=new yn(-1,0,0);/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Ao{constructor(e){this.ar=e}next(){return this.ar+=2,this.ar}static ur(){return new Ao(0)}static cr(){return new Ao(-1)}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Lv="LruGarbageCollector",PA=1048576;function Ov([t,e],[n,r]){const i=ze(t,n);return i===0?ze(e,r):i}class RA{constructor(e){this.Ir=e,this.buffer=new Mt(Ov),this.Er=0}dr(){return++this.Er}Ar(e){const n=[e,this.dr()];if(this.buffer.size{this.Rr=null;try{await this.localStore.collectGarbage(this.garbageCollector)}catch(n){Fo(n)?ae(Lv,"Ignoring IndexedDB error during garbage collection: ",n):await Vo(n)}await this.Vr(3e5)})}}class jA{constructor(e,n){this.mr=e,this.params=n}calculateTargetCount(e,n){return this.mr.gr(e).next(r=>Math.floor(n/100*r))}nthSequenceNumber(e,n){if(n===0)return G.resolve(cd.ce);const r=new RA(n);return this.mr.forEachTarget(e,i=>r.Ar(i.sequenceNumber)).next(()=>this.mr.pr(e,i=>r.Ar(i))).next(()=>r.maxValue)}removeTargets(e,n,r){return this.mr.removeTargets(e,n,r)}removeOrphanedDocuments(e,n){return this.mr.removeOrphanedDocuments(e,n)}collect(e,n){return this.params.cacheSizeCollectionThreshold===-1?(ae("LruGarbageCollector","Garbage collection skipped; disabled"),G.resolve(jv)):this.getCacheSize(e).next(r=>r(h>this.params.maximumSequenceNumbersToCollect?(ae("LruGarbageCollector",`Capping sequence numbers to collect down to the maximum of ${this.params.maximumSequenceNumbersToCollect} from ${h}`),i=this.params.maximumSequenceNumbersToCollect):i=h,o=Date.now(),this.nthSequenceNumber(e,i))).next(h=>(r=h,a=Date.now(),this.removeTargets(e,r,n))).next(h=>(s=h,u=Date.now(),this.removeOrphanedDocuments(e,r))).next(h=>(c=Date.now(),Us()<=Ue.DEBUG&&ae("LruGarbageCollector",`LRU Garbage Collection + Counted targets in ${o-f}ms + Determined least recently used ${i} in `+(a-o)+`ms + Removed ${s} targets in `+(u-a)+`ms + Removed ${h} documents in `+(c-u)+`ms +Total Duration: ${c-f}ms`),G.resolve({didRun:!0,sequenceNumbersCollected:i,targetsRemoved:s,documentsRemoved:h})))}}function LA(t,e){return new jA(t,e)}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class OA{constructor(){this.changes=new Rs(e=>e.toString(),(e,n)=>e.isEqual(n)),this.changesApplied=!1}addEntry(e){this.assertNotApplied(),this.changes.set(e.key,e)}removeEntry(e,n){this.assertNotApplied(),this.changes.set(e,an.newInvalidDocument(e).setReadTime(n))}getEntry(e,n){this.assertNotApplied();const r=this.changes.get(n);return r!==void 0?G.resolve(r):this.getFromCache(e,n)}getEntries(e,n){return this.getAllFromCache(e,n)}apply(e){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(e)}assertNotApplied(){}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *//** + * @license + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class MA{constructor(e,n){this.overlayedDocument=e,this.mutatedFields=n}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class VA{constructor(e,n,r,i){this.remoteDocumentCache=e,this.mutationQueue=n,this.documentOverlayCache=r,this.indexManager=i}getDocument(e,n){let r=null;return this.documentOverlayCache.getOverlay(e,n).next(i=>(r=i,this.remoteDocumentCache.getEntry(e,n))).next(i=>(r!==null&&ja(r.mutation,i,On.empty(),Qe.now()),i))}getDocuments(e,n){return this.remoteDocumentCache.getEntries(e,n).next(r=>this.getLocalViewOfDocuments(e,r,Be()).next(()=>r))}getLocalViewOfDocuments(e,n,r=Be()){const i=ds();return this.populateOverlays(e,i,n).next(()=>this.computeViews(e,n,i,r).next(s=>{let o=va();return s.forEach((a,u)=>{o=o.insert(a,u.overlayedDocument)}),o}))}getOverlayedDocuments(e,n){const r=ds();return this.populateOverlays(e,r,n).next(()=>this.computeViews(e,n,r,Be()))}populateOverlays(e,n,r){const i=[];return r.forEach(s=>{n.has(s)||i.push(s)}),this.documentOverlayCache.getOverlays(e,i).next(s=>{s.forEach((o,a)=>{n.set(o,a)})})}computeViews(e,n,r,i){let s=Xr();const o=Da(),a=function(){return Da()}();return n.forEach((u,c)=>{const f=r.get(c.key);i.has(c.key)&&(f===void 0||f.mutation instanceof Yi)?s=s.insert(c.key,c):f!==void 0?(o.set(c.key,f.mutation.getFieldMask()),ja(f.mutation,c,f.mutation.getFieldMask(),Qe.now())):o.set(c.key,On.empty())}),this.recalculateAndSaveOverlays(e,s).next(u=>(u.forEach((c,f)=>o.set(c,f)),n.forEach((c,f)=>a.set(c,new MA(f,o.get(c)??null))),a))}recalculateAndSaveOverlays(e,n){const r=Da();let i=new pt((o,a)=>o-a),s=Be();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,n).next(o=>{for(const a of o)a.keys().forEach(u=>{const c=n.get(u);if(c===null)return;let f=r.get(u)||On.empty();f=a.applyToLocalView(c,f),r.set(u,f);const h=(i.get(a.batchId)||Be()).add(u);i=i.insert(a.batchId,h)})}).next(()=>{const o=[],a=i.getReverseIterator();for(;a.hasNext();){const u=a.getNext(),c=u.key,f=u.value,h=Vb();f.forEach(p=>{if(!s.has(p)){const m=qb(n.get(p),r.get(p));m!==null&&h.set(p,m),s=s.add(p)}}),o.push(this.documentOverlayCache.saveOverlays(e,c,h))}return G.waitFor(o)}).next(()=>r)}recalculateAndSaveOverlaysForDocumentKeys(e,n){return this.remoteDocumentCache.getEntries(e,n).next(r=>this.recalculateAndSaveOverlays(e,r))}getDocumentsMatchingQuery(e,n,r,i){return function(o){return ge.isDocumentKey(o.path)&&o.collectionGroup===null&&o.filters.length===0}(n)?this.getDocumentsMatchingDocumentQuery(e,n.path):Db(n)?this.getDocumentsMatchingCollectionGroupQuery(e,n,r,i):this.getDocumentsMatchingCollectionQuery(e,n,r,i)}getNextDocuments(e,n,r,i){return this.remoteDocumentCache.getAllFromCollectionGroup(e,n,r,i).next(s=>{const o=i-s.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,n,r.largestBatchId,i-s.size):G.resolve(ds());let a=il,u=s;return o.next(c=>G.forEach(c,(f,h)=>(a{u=u.insert(f,p)}))).next(()=>this.populateOverlays(e,c,s)).next(()=>this.computeViews(e,u,c,Be())).next(f=>({batchId:a,changes:Mb(f)})))})}getDocumentsMatchingDocumentQuery(e,n){return this.getDocument(e,new ge(n)).next(r=>{let i=va();return r.isFoundDocument()&&(i=i.insert(r.key,r)),i})}getDocumentsMatchingCollectionGroupQuery(e,n,r,i){const s=n.collectionGroup;let o=va();return this.indexManager.getCollectionParents(e,s).next(a=>G.forEach(a,u=>{const c=function(h,p){return new Uo(p,null,h.explicitOrderBy.slice(),h.filters.slice(),h.limit,h.limitType,h.startAt,h.endAt)}(n,u.child(s));return this.getDocumentsMatchingCollectionQuery(e,c,r,i).next(f=>{f.forEach((h,p)=>{o=o.insert(h,p)})})}).next(()=>o))}getDocumentsMatchingCollectionQuery(e,n,r,i){let s;return this.documentOverlayCache.getOverlaysForCollection(e,n.path,r.largestBatchId).next(o=>(s=o,this.remoteDocumentCache.getDocumentsMatchingQuery(e,n,r,s,i))).next(o=>{s.forEach((u,c)=>{const f=c.getKey();o.get(f)===null&&(o=o.insert(f,an.newInvalidDocument(f)))});let a=va();return o.forEach((u,c)=>{const f=s.get(u);f!==void 0&&ja(f.mutation,c,On.empty(),Qe.now()),md(n,c)&&(a=a.insert(u,c))}),a})}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class FA{constructor(e){this.serializer=e,this.Lr=new Map,this.kr=new Map}getBundleMetadata(e,n){return G.resolve(this.Lr.get(n))}saveBundleMetadata(e,n){return this.Lr.set(n.id,function(i){return{id:i.id,version:i.version,createTime:Sr(i.createTime)}}(n)),G.resolve()}getNamedQuery(e,n){return G.resolve(this.kr.get(n))}saveNamedQuery(e,n){return this.kr.set(n.name,function(i){return{name:i.name,query:CA(i.bundledQuery),readTime:Sr(i.readTime)}}(n)),G.resolve()}}/** + * @license + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class UA{constructor(){this.overlays=new pt(ge.comparator),this.qr=new Map}getOverlay(e,n){return G.resolve(this.overlays.get(n))}getOverlays(e,n){const r=ds();return G.forEach(n,i=>this.getOverlay(e,i).next(s=>{s!==null&&r.set(i,s)})).next(()=>r)}saveOverlays(e,n,r){return r.forEach((i,s)=>{this.St(e,n,s)}),G.resolve()}removeOverlaysForBatchId(e,n,r){const i=this.qr.get(r);return i!==void 0&&(i.forEach(s=>this.overlays=this.overlays.remove(s)),this.qr.delete(r)),G.resolve()}getOverlaysForCollection(e,n,r){const i=ds(),s=n.length+1,o=new ge(n.child("")),a=this.overlays.getIteratorFrom(o);for(;a.hasNext();){const u=a.getNext().value,c=u.getKey();if(!n.isPrefixOf(c.path))break;c.path.length===s&&u.largestBatchId>r&&i.set(u.getKey(),u)}return G.resolve(i)}getOverlaysForCollectionGroup(e,n,r,i){let s=new pt((c,f)=>c-f);const o=this.overlays.getIterator();for(;o.hasNext();){const c=o.getNext().value;if(c.getKey().getCollectionGroup()===n&&c.largestBatchId>r){let f=s.get(c.largestBatchId);f===null&&(f=ds(),s=s.insert(c.largestBatchId,f)),f.set(c.getKey(),c)}}const a=ds(),u=s.getIterator();for(;u.hasNext()&&(u.getNext().value.forEach((c,f)=>a.set(c,f)),!(a.size()>=i)););return G.resolve(a)}St(e,n,r){const i=this.overlays.get(r.key);if(i!==null){const o=this.qr.get(i.largestBatchId).delete(r.key);this.qr.set(i.largestBatchId,o)}this.overlays=this.overlays.insert(r.key,new iA(n,r));let s=this.qr.get(n);s===void 0&&(s=Be(),this.qr.set(n,s)),this.qr.set(n,s.add(r.key))}}/** + * @license + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class zA{constructor(){this.sessionToken=en.EMPTY_BYTE_STRING}getSessionToken(e){return G.resolve(this.sessionToken)}setSessionToken(e,n){return this.sessionToken=n,G.resolve()}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Ym{constructor(){this.Qr=new Mt(zt.$r),this.Ur=new Mt(zt.Kr)}isEmpty(){return this.Qr.isEmpty()}addReference(e,n){const r=new zt(e,n);this.Qr=this.Qr.add(r),this.Ur=this.Ur.add(r)}Wr(e,n){e.forEach(r=>this.addReference(r,n))}removeReference(e,n){this.Gr(new zt(e,n))}zr(e,n){e.forEach(r=>this.removeReference(r,n))}jr(e){const n=new ge(new rt([])),r=new zt(n,e),i=new zt(n,e+1),s=[];return this.Ur.forEachInRange([r,i],o=>{this.Gr(o),s.push(o.key)}),s}Jr(){this.Qr.forEach(e=>this.Gr(e))}Gr(e){this.Qr=this.Qr.delete(e),this.Ur=this.Ur.delete(e)}Hr(e){const n=new ge(new rt([])),r=new zt(n,e),i=new zt(n,e+1);let s=Be();return this.Ur.forEachInRange([r,i],o=>{s=s.add(o.key)}),s}containsKey(e){const n=new zt(e,0),r=this.Qr.firstAfterOrEqual(n);return r!==null&&e.isEqual(r.key)}}class zt{constructor(e,n){this.key=e,this.Yr=n}static $r(e,n){return ge.comparator(e.key,n.key)||ze(e.Yr,n.Yr)}static Kr(e,n){return ze(e.Yr,n.Yr)||ge.comparator(e.key,n.key)}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class BA{constructor(e,n){this.indexManager=e,this.referenceDelegate=n,this.mutationQueue=[],this.tr=1,this.Zr=new Mt(zt.$r)}checkEmpty(e){return G.resolve(this.mutationQueue.length===0)}addMutationBatch(e,n,r,i){const s=this.tr;this.tr++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const o=new rA(s,n,r,i);this.mutationQueue.push(o);for(const a of i)this.Zr=this.Zr.add(new zt(a.key,s)),this.indexManager.addToCollectionParentIndex(e,a.key.path.popLast());return G.resolve(o)}lookupMutationBatch(e,n){return G.resolve(this.Xr(n))}getNextMutationBatchAfterBatchId(e,n){const r=n+1,i=this.ei(r),s=i<0?0:i;return G.resolve(this.mutationQueue.length>s?this.mutationQueue[s]:null)}getHighestUnacknowledgedBatchId(){return G.resolve(this.mutationQueue.length===0?Um:this.tr-1)}getAllMutationBatches(e){return G.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,n){const r=new zt(n,0),i=new zt(n,Number.POSITIVE_INFINITY),s=[];return this.Zr.forEachInRange([r,i],o=>{const a=this.Xr(o.Yr);s.push(a)}),G.resolve(s)}getAllMutationBatchesAffectingDocumentKeys(e,n){let r=new Mt(ze);return n.forEach(i=>{const s=new zt(i,0),o=new zt(i,Number.POSITIVE_INFINITY);this.Zr.forEachInRange([s,o],a=>{r=r.add(a.Yr)})}),G.resolve(this.ti(r))}getAllMutationBatchesAffectingQuery(e,n){const r=n.path,i=r.length+1;let s=r;ge.isDocumentKey(s)||(s=s.child(""));const o=new zt(new ge(s),0);let a=new Mt(ze);return this.Zr.forEachWhile(u=>{const c=u.key.path;return!!r.isPrefixOf(c)&&(c.length===i&&(a=a.add(u.Yr)),!0)},o),G.resolve(this.ti(a))}ti(e){const n=[];return e.forEach(r=>{const i=this.Xr(r);i!==null&&n.push(i)}),n}removeMutationBatch(e,n){Ye(this.ni(n.batchId,"removed")===0,55003),this.mutationQueue.shift();let r=this.Zr;return G.forEach(n.mutations,i=>{const s=new zt(i.key,n.batchId);return r=r.delete(s),this.referenceDelegate.markPotentiallyOrphaned(e,i.key)}).next(()=>{this.Zr=r})}ir(e){}containsKey(e,n){const r=new zt(n,0),i=this.Zr.firstAfterOrEqual(r);return G.resolve(n.isEqual(i&&i.key))}performConsistencyCheck(e){return this.mutationQueue.length,G.resolve()}ni(e,n){return this.ei(e)}ei(e){return this.mutationQueue.length===0?0:e-this.mutationQueue[0].batchId}Xr(e){const n=this.ei(e);return n<0||n>=this.mutationQueue.length?null:this.mutationQueue[n]}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class $A{constructor(e){this.ri=e,this.docs=function(){return new pt(ge.comparator)}(),this.size=0}setIndexManager(e){this.indexManager=e}addEntry(e,n){const r=n.key,i=this.docs.get(r),s=i?i.size:0,o=this.ri(n);return this.docs=this.docs.insert(r,{document:n.mutableCopy(),size:o}),this.size+=o-s,this.indexManager.addToCollectionParentIndex(e,r.path.popLast())}removeEntry(e){const n=this.docs.get(e);n&&(this.docs=this.docs.remove(e),this.size-=n.size)}getEntry(e,n){const r=this.docs.get(n);return G.resolve(r?r.document.mutableCopy():an.newInvalidDocument(n))}getEntries(e,n){let r=Xr();return n.forEach(i=>{const s=this.docs.get(i);r=r.insert(i,s?s.document.mutableCopy():an.newInvalidDocument(i))}),G.resolve(r)}getDocumentsMatchingQuery(e,n,r,i){let s=Xr();const o=n.path,a=new ge(o.child("__id-9223372036854775808__")),u=this.docs.getIteratorFrom(a);for(;u.hasNext();){const{key:c,value:{document:f}}=u.getNext();if(!o.isPrefixOf(c.path))break;c.path.length>o.length+1||vN(yN(f),r)<=0||(i.has(f.key)||md(n,f))&&(s=s.insert(f.key,f.mutableCopy()))}return G.resolve(s)}getAllFromCollectionGroup(e,n,r,i){_e(9500)}ii(e,n){return G.forEach(this.docs,r=>n(r))}newChangeBuffer(e){return new HA(this)}getSize(e){return G.resolve(this.size)}}class HA extends OA{constructor(e){super(),this.Nr=e}applyChanges(e){const n=[];return this.changes.forEach((r,i)=>{i.isValidDocument()?n.push(this.Nr.addEntry(e,i)):this.Nr.removeEntry(r)}),G.waitFor(n)}getFromCache(e,n){return this.Nr.getEntry(e,n)}getAllFromCache(e,n){return this.Nr.getEntries(e,n)}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class qA{constructor(e){this.persistence=e,this.si=new Rs(n=>$m(n),Hm),this.lastRemoteSnapshotVersion=Se.min(),this.highestTargetId=0,this.oi=0,this._i=new Ym,this.targetCount=0,this.ai=Ao.ur()}forEachTarget(e,n){return this.si.forEach((r,i)=>n(i)),G.resolve()}getLastRemoteSnapshotVersion(e){return G.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return G.resolve(this.oi)}allocateTargetId(e){return this.highestTargetId=this.ai.next(),G.resolve(this.highestTargetId)}setTargetsMetadata(e,n,r){return r&&(this.lastRemoteSnapshotVersion=r),n>this.oi&&(this.oi=n),G.resolve()}Pr(e){this.si.set(e.target,e);const n=e.targetId;n>this.highestTargetId&&(this.ai=new Ao(n),this.highestTargetId=n),e.sequenceNumber>this.oi&&(this.oi=e.sequenceNumber)}addTargetData(e,n){return this.Pr(n),this.targetCount+=1,G.resolve()}updateTargetData(e,n){return this.Pr(n),G.resolve()}removeTargetData(e,n){return this.si.delete(n.target),this._i.jr(n.targetId),this.targetCount-=1,G.resolve()}removeTargets(e,n,r){let i=0;const s=[];return this.si.forEach((o,a)=>{a.sequenceNumber<=n&&r.get(a.targetId)===null&&(this.si.delete(o),s.push(this.removeMatchingKeysForTargetId(e,a.targetId)),i++)}),G.waitFor(s).next(()=>i)}getTargetCount(e){return G.resolve(this.targetCount)}getTargetData(e,n){const r=this.si.get(n)||null;return G.resolve(r)}addMatchingKeys(e,n,r){return this._i.Wr(n,r),G.resolve()}removeMatchingKeys(e,n,r){this._i.zr(n,r);const i=this.persistence.referenceDelegate,s=[];return i&&n.forEach(o=>{s.push(i.markPotentiallyOrphaned(e,o))}),G.waitFor(s)}removeMatchingKeysForTargetId(e,n){return this._i.jr(n),G.resolve()}getMatchingKeysForTargetId(e,n){const r=this._i.Hr(n);return G.resolve(r)}containsKey(e,n){return G.resolve(this._i.containsKey(n))}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class iE{constructor(e,n){this.ui={},this.overlays={},this.ci=new cd(0),this.li=!1,this.li=!0,this.hi=new zA,this.referenceDelegate=e(this),this.Pi=new qA(this),this.indexManager=new NA,this.remoteDocumentCache=function(i){return new $A(i)}(r=>this.referenceDelegate.Ti(r)),this.serializer=new kA(n),this.Ii=new FA(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.li=!1,Promise.resolve()}get started(){return this.li}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let n=this.overlays[e.toKey()];return n||(n=new UA,this.overlays[e.toKey()]=n),n}getMutationQueue(e,n){let r=this.ui[e.toKey()];return r||(r=new BA(n,this.referenceDelegate),this.ui[e.toKey()]=r),r}getGlobalsCache(){return this.hi}getTargetCache(){return this.Pi}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.Ii}runTransaction(e,n,r){ae("MemoryPersistence","Starting transaction:",e);const i=new WA(this.ci.next());return this.referenceDelegate.Ei(),r(i).next(s=>this.referenceDelegate.di(i).next(()=>s)).toPromise().then(s=>(i.raiseOnCommittedEvent(),s))}Ai(e,n){return G.or(Object.values(this.ui).map(r=>()=>r.containsKey(e,n)))}}class WA extends wN{constructor(e){super(),this.currentSequenceNumber=e}}class Xm{constructor(e){this.persistence=e,this.Ri=new Ym,this.Vi=null}static mi(e){return new Xm(e)}get fi(){if(this.Vi)return this.Vi;throw _e(60996)}addReference(e,n,r){return this.Ri.addReference(r,n),this.fi.delete(r.toString()),G.resolve()}removeReference(e,n,r){return this.Ri.removeReference(r,n),this.fi.add(r.toString()),G.resolve()}markPotentiallyOrphaned(e,n){return this.fi.add(n.toString()),G.resolve()}removeTarget(e,n){this.Ri.jr(n.targetId).forEach(i=>this.fi.add(i.toString()));const r=this.persistence.getTargetCache();return r.getMatchingKeysForTargetId(e,n.targetId).next(i=>{i.forEach(s=>this.fi.add(s.toString()))}).next(()=>r.removeTargetData(e,n))}Ei(){this.Vi=new Set}di(e){const n=this.persistence.getRemoteDocumentCache().newChangeBuffer();return G.forEach(this.fi,r=>{const i=ge.fromPath(r);return this.gi(e,i).next(s=>{s||n.removeEntry(i,Se.min())})}).next(()=>(this.Vi=null,n.apply(e)))}updateLimboDocument(e,n){return this.gi(e,n).next(r=>{r?this.fi.delete(n.toString()):this.fi.add(n.toString())})}Ti(e){return 0}gi(e,n){return G.or([()=>G.resolve(this.Ri.containsKey(n)),()=>this.persistence.getTargetCache().containsKey(e,n),()=>this.persistence.Ai(e,n)])}}class Tc{constructor(e,n){this.persistence=e,this.pi=new Rs(r=>EN(r.path),(r,i)=>r.isEqual(i)),this.garbageCollector=LA(this,n)}static mi(e,n){return new Tc(e,n)}Ei(){}di(e){return G.resolve()}forEachTarget(e,n){return this.persistence.getTargetCache().forEachTarget(e,n)}gr(e){const n=this.wr(e);return this.persistence.getTargetCache().getTargetCount(e).next(r=>n.next(i=>r+i))}wr(e){let n=0;return this.pr(e,r=>{n++}).next(()=>n)}pr(e,n){return G.forEach(this.pi,(r,i)=>this.br(e,r,i).next(s=>s?G.resolve():n(i)))}removeTargets(e,n,r){return this.persistence.getTargetCache().removeTargets(e,n,r)}removeOrphanedDocuments(e,n){let r=0;const i=this.persistence.getRemoteDocumentCache(),s=i.newChangeBuffer();return i.ii(e,o=>this.br(e,o,n).next(a=>{a||(r++,s.removeEntry(o,Se.min()))})).next(()=>s.apply(e)).next(()=>r)}markPotentiallyOrphaned(e,n){return this.pi.set(n,e.currentSequenceNumber),G.resolve()}removeTarget(e,n){const r=n.withSequenceNumber(e.currentSequenceNumber);return this.persistence.getTargetCache().updateTargetData(e,r)}addReference(e,n,r){return this.pi.set(r,e.currentSequenceNumber),G.resolve()}removeReference(e,n,r){return this.pi.set(r,e.currentSequenceNumber),G.resolve()}updateLimboDocument(e,n){return this.pi.set(n,e.currentSequenceNumber),G.resolve()}Ti(e){let n=e.key.toString().length;return e.isFoundDocument()&&(n+=ju(e.data.value)),n}br(e,n,r){return G.or([()=>this.persistence.Ai(e,n),()=>this.persistence.getTargetCache().containsKey(e,n),()=>{const i=this.pi.get(n);return G.resolve(i!==void 0&&i>r)}])}getCacheSize(e){return this.persistence.getRemoteDocumentCache().getSize(e)}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Jm{constructor(e,n,r,i){this.targetId=e,this.fromCache=n,this.Es=r,this.ds=i}static As(e,n){let r=Be(),i=Be();for(const s of n.docChanges)switch(s.type){case 0:r=r.add(s.doc.key);break;case 1:i=i.add(s.doc.key)}return new Jm(e,n.fromCache,r,i)}}/** + * @license + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class GA{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class KA{constructor(){this.Rs=!1,this.Vs=!1,this.fs=100,this.gs=function(){return F2()?8:_N(un())>0?6:4}()}initialize(e,n){this.ps=e,this.indexManager=n,this.Rs=!0}getDocumentsMatchingQuery(e,n,r,i){const s={result:null};return this.ys(e,n).next(o=>{s.result=o}).next(()=>{if(!s.result)return this.ws(e,n,i,r).next(o=>{s.result=o})}).next(()=>{if(s.result)return;const o=new GA;return this.Ss(e,n,o).next(a=>{if(s.result=a,this.Vs)return this.bs(e,n,o,a.size)})}).next(()=>s.result)}bs(e,n,r,i){return r.documentReadCountthis.gs*i?(Us()<=Ue.DEBUG&&ae("QueryEngine","The SDK decides to create cache indexes for query:",zs(n),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(e,Ir(n))):G.resolve())}ys(e,n){if(Iv(n))return G.resolve(null);let r=Ir(n);return this.indexManager.getIndexType(e,r).next(i=>i===0?null:(n.limit!==null&&i===1&&(n=op(n,null,"F"),r=Ir(n)),this.indexManager.getDocumentsMatchingTarget(e,r).next(s=>{const o=Be(...s);return this.ps.getDocuments(e,o).next(a=>this.indexManager.getMinOffset(e,r).next(u=>{const c=this.Ds(n,a);return this.Cs(n,c,o,u.readTime)?this.ys(e,op(n,null,"F")):this.vs(e,c,n,u)}))})))}ws(e,n,r,i){return Iv(n)||i.isEqual(Se.min())?G.resolve(null):this.ps.getDocuments(e,r).next(s=>{const o=this.Ds(n,s);return this.Cs(n,o,r,i)?G.resolve(null):(Us()<=Ue.DEBUG&&ae("QueryEngine","Re-using previous result from %s to execute query: %s",i.toString(),zs(n)),this.vs(e,o,n,gN(i,il)).next(a=>a))})}Ds(e,n){let r=new Mt(Lb(e));return n.forEach((i,s)=>{md(e,s)&&(r=r.add(s))}),r}Cs(e,n,r,i){if(e.limit===null)return!1;if(r.size!==n.size)return!0;const s=e.limitType==="F"?n.last():n.first();return!!s&&(s.hasPendingWrites||s.version.compareTo(i)>0)}Ss(e,n,r){return Us()<=Ue.DEBUG&&ae("QueryEngine","Using full collection scan to execute query:",zs(n)),this.ps.getDocumentsMatchingQuery(e,n,Ui.min(),r)}vs(e,n,r,i){return this.ps.getDocumentsMatchingQuery(e,r,i).next(s=>(n.forEach(o=>{s=s.insert(o.key,o)}),s))}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Zm="LocalStore",QA=3e8;class YA{constructor(e,n,r,i){this.persistence=e,this.Fs=n,this.serializer=i,this.Ms=new pt(ze),this.xs=new Rs(s=>$m(s),Hm),this.Os=new Map,this.Ns=e.getRemoteDocumentCache(),this.Pi=e.getTargetCache(),this.Ii=e.getBundleCache(),this.Bs(r)}Bs(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new VA(this.Ns,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.Ns.setIndexManager(this.indexManager),this.Fs.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction("Collect garbage","readwrite-primary",n=>e.collect(n,this.Ms))}}function XA(t,e,n,r){return new YA(t,e,n,r)}async function sE(t,e){const n=ke(t);return await n.persistence.runTransaction("Handle user change","readonly",r=>{let i;return n.mutationQueue.getAllMutationBatches(r).next(s=>(i=s,n.Bs(e),n.mutationQueue.getAllMutationBatches(r))).next(s=>{const o=[],a=[];let u=Be();for(const c of i){o.push(c.batchId);for(const f of c.mutations)u=u.add(f.key)}for(const c of s){a.push(c.batchId);for(const f of c.mutations)u=u.add(f.key)}return n.localDocuments.getDocuments(r,u).next(c=>({Ls:c,removedBatchIds:o,addedBatchIds:a}))})})}function JA(t,e){const n=ke(t);return n.persistence.runTransaction("Acknowledge batch","readwrite-primary",r=>{const i=e.batch.keys(),s=n.Ns.newChangeBuffer({trackRemovals:!0});return function(a,u,c,f){const h=c.batch,p=h.keys();let m=G.resolve();return p.forEach(b=>{m=m.next(()=>f.getEntry(u,b)).next(S=>{const P=c.docVersions.get(b);Ye(P!==null,48541),S.version.compareTo(P)<0&&(h.applyToRemoteDocument(S,c),S.isValidDocument()&&(S.setReadTime(c.commitVersion),f.addEntry(S)))})}),m.next(()=>a.mutationQueue.removeMutationBatch(u,h))}(n,r,e,s).next(()=>s.apply(r)).next(()=>n.mutationQueue.performConsistencyCheck(r)).next(()=>n.documentOverlayCache.removeOverlaysForBatchId(r,i,e.batch.batchId)).next(()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(r,function(a){let u=Be();for(let c=0;c0&&(u=u.add(a.batch.mutations[c].key));return u}(e))).next(()=>n.localDocuments.getDocuments(r,i))})}function oE(t){const e=ke(t);return e.persistence.runTransaction("Get last remote snapshot version","readonly",n=>e.Pi.getLastRemoteSnapshotVersion(n))}function ZA(t,e){const n=ke(t),r=e.snapshotVersion;let i=n.Ms;return n.persistence.runTransaction("Apply remote event","readwrite-primary",s=>{const o=n.Ns.newChangeBuffer({trackRemovals:!0});i=n.Ms;const a=[];e.targetChanges.forEach((f,h)=>{const p=i.get(h);if(!p)return;a.push(n.Pi.removeMatchingKeys(s,f.removedDocuments,h).next(()=>n.Pi.addMatchingKeys(s,f.addedDocuments,h)));let m=p.withSequenceNumber(s.currentSequenceNumber);e.targetMismatches.get(h)!==null?m=m.withResumeToken(en.EMPTY_BYTE_STRING,Se.min()).withLastLimboFreeSnapshotVersion(Se.min()):f.resumeToken.approximateByteSize()>0&&(m=m.withResumeToken(f.resumeToken,r)),i=i.insert(h,m),function(S,P,y){return S.resumeToken.approximateByteSize()===0||P.snapshotVersion.toMicroseconds()-S.snapshotVersion.toMicroseconds()>=QA?!0:y.addedDocuments.size+y.modifiedDocuments.size+y.removedDocuments.size>0}(p,m,f)&&a.push(n.Pi.updateTargetData(s,m))});let u=Xr(),c=Be();if(e.documentUpdates.forEach(f=>{e.resolvedLimboDocuments.has(f)&&a.push(n.persistence.referenceDelegate.updateLimboDocument(s,f))}),a.push(eP(s,o,e.documentUpdates).next(f=>{u=f.ks,c=f.qs})),!r.isEqual(Se.min())){const f=n.Pi.getLastRemoteSnapshotVersion(s).next(h=>n.Pi.setTargetsMetadata(s,s.currentSequenceNumber,r));a.push(f)}return G.waitFor(a).next(()=>o.apply(s)).next(()=>n.localDocuments.getLocalViewOfDocuments(s,u,c)).next(()=>u)}).then(s=>(n.Ms=i,s))}function eP(t,e,n){let r=Be(),i=Be();return n.forEach(s=>r=r.add(s)),e.getEntries(t,r).next(s=>{let o=Xr();return n.forEach((a,u)=>{const c=s.get(a);u.isFoundDocument()!==c.isFoundDocument()&&(i=i.add(a)),u.isNoDocument()&&u.version.isEqual(Se.min())?(e.removeEntry(a,u.readTime),o=o.insert(a,u)):!c.isValidDocument()||u.version.compareTo(c.version)>0||u.version.compareTo(c.version)===0&&c.hasPendingWrites?(e.addEntry(u),o=o.insert(a,u)):ae(Zm,"Ignoring outdated watch update for ",a,". Current version:",c.version," Watch version:",u.version)}),{ks:o,qs:i}})}function tP(t,e){const n=ke(t);return n.persistence.runTransaction("Get next mutation batch","readonly",r=>(e===void 0&&(e=Um),n.mutationQueue.getNextMutationBatchAfterBatchId(r,e)))}function nP(t,e){const n=ke(t);return n.persistence.runTransaction("Allocate target","readwrite",r=>{let i;return n.Pi.getTargetData(r,e).next(s=>s?(i=s,G.resolve(i)):n.Pi.allocateTargetId(r).next(o=>(i=new Ei(e,o,"TargetPurposeListen",r.currentSequenceNumber),n.Pi.addTargetData(r,i).next(()=>i))))}).then(r=>{const i=n.Ms.get(r.targetId);return(i===null||r.snapshotVersion.compareTo(i.snapshotVersion)>0)&&(n.Ms=n.Ms.insert(r.targetId,r),n.xs.set(e,r.targetId)),r})}async function dp(t,e,n){const r=ke(t),i=r.Ms.get(e),s=n?"readwrite":"readwrite-primary";try{n||await r.persistence.runTransaction("Release target",s,o=>r.persistence.referenceDelegate.removeTarget(o,i))}catch(o){if(!Fo(o))throw o;ae(Zm,`Failed to update sequence numbers for target ${e}: ${o}`)}r.Ms=r.Ms.remove(e),r.xs.delete(i.target)}function Mv(t,e,n){const r=ke(t);let i=Se.min(),s=Be();return r.persistence.runTransaction("Execute query","readwrite",o=>function(u,c,f){const h=ke(u),p=h.xs.get(f);return p!==void 0?G.resolve(h.Ms.get(p)):h.Pi.getTargetData(c,f)}(r,o,Ir(e)).next(a=>{if(a)return i=a.lastLimboFreeSnapshotVersion,r.Pi.getMatchingKeysForTargetId(o,a.targetId).next(u=>{s=u})}).next(()=>r.Fs.getDocumentsMatchingQuery(o,e,n?i:Se.min(),n?s:Be())).next(a=>(rP(r,BN(e),a),{documents:a,Qs:s})))}function rP(t,e,n){let r=t.Os.get(e)||Se.min();n.forEach((i,s)=>{s.readTime.compareTo(r)>0&&(r=s.readTime)}),t.Os.set(e,r)}class Vv{constructor(){this.activeTargetIds=KN()}zs(e){this.activeTargetIds=this.activeTargetIds.add(e)}js(e){this.activeTargetIds=this.activeTargetIds.delete(e)}Gs(){const e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)}}class iP{constructor(){this.Mo=new Vv,this.xo={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,n,r){}addLocalQueryTarget(e,n=!0){return n&&this.Mo.zs(e),this.xo[e]||"not-current"}updateQueryState(e,n,r){this.xo[e]=n}removeLocalQueryTarget(e){this.Mo.js(e)}isLocalQueryTarget(e){return this.Mo.activeTargetIds.has(e)}clearQueryState(e){delete this.xo[e]}getAllActiveQueryTargets(){return this.Mo.activeTargetIds}isActiveQueryTarget(e){return this.Mo.activeTargetIds.has(e)}start(){return this.Mo=new Vv,Promise.resolve()}handleUserChange(e,n,r){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class sP{Oo(e){}shutdown(){}}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Fv="ConnectivityMonitor";class Uv{constructor(){this.No=()=>this.Bo(),this.Lo=()=>this.ko(),this.qo=[],this.Qo()}Oo(e){this.qo.push(e)}shutdown(){window.removeEventListener("online",this.No),window.removeEventListener("offline",this.Lo)}Qo(){window.addEventListener("online",this.No),window.addEventListener("offline",this.Lo)}Bo(){ae(Fv,"Network connectivity changed: AVAILABLE");for(const e of this.qo)e(0)}ko(){ae(Fv,"Network connectivity changed: UNAVAILABLE");for(const e of this.qo)e(1)}static v(){return typeof window<"u"&&window.addEventListener!==void 0&&window.removeEventListener!==void 0}}/** + * @license + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */let fu=null;function hp(){return fu===null?fu=function(){return 268435456+Math.round(2147483648*Math.random())}():fu++,"0x"+fu.toString(16)}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Rh="RestConnection",oP={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery"};class aP{get $o(){return!1}constructor(e){this.databaseInfo=e,this.databaseId=e.databaseId;const n=e.ssl?"https":"http",r=encodeURIComponent(this.databaseId.projectId),i=encodeURIComponent(this.databaseId.database);this.Uo=n+"://"+e.host,this.Ko=`projects/${r}/databases/${i}`,this.Wo=this.databaseId.database===_c?`project_id=${r}`:`project_id=${r}&database_id=${i}`}Go(e,n,r,i,s){const o=hp(),a=this.zo(e,n.toUriEncodedString());ae(Rh,`Sending RPC '${e}' ${o}:`,a,r);const u={"google-cloud-resource-prefix":this.Ko,"x-goog-request-params":this.Wo};this.jo(u,i,s);const{host:c}=new URL(a),f=As(c);return this.Jo(e,a,u,r,f).then(h=>(ae(Rh,`Received RPC '${e}' ${o}: `,h),h),h=>{throw To(Rh,`RPC '${e}' ${o} failed with error: `,h,"url: ",a,"request:",r),h})}Ho(e,n,r,i,s,o){return this.Go(e,n,r,i,s)}jo(e,n,r){e["X-Goog-Api-Client"]=function(){return"gl-js/ fire/"+Mo}(),e["Content-Type"]="text/plain",this.databaseInfo.appId&&(e["X-Firebase-GMPID"]=this.databaseInfo.appId),n&&n.headers.forEach((i,s)=>e[s]=i),r&&r.headers.forEach((i,s)=>e[s]=i)}zo(e,n){const r=oP[e];return`${this.Uo}/v1/${n}:${r}`}terminate(){}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class lP{constructor(e){this.Yo=e.Yo,this.Zo=e.Zo}Xo(e){this.e_=e}t_(e){this.n_=e}r_(e){this.i_=e}onMessage(e){this.s_=e}close(){this.Zo()}send(e){this.Yo(e)}o_(){this.e_()}__(){this.n_()}a_(e){this.i_(e)}u_(e){this.s_(e)}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const rn="WebChannelConnection";class uP extends aP{constructor(e){super(e),this.c_=[],this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}Jo(e,n,r,i,s){const o=hp();return new Promise((a,u)=>{const c=new lb;c.setWithCredentials(!0),c.listenOnce(ub.COMPLETE,()=>{try{switch(c.getLastErrorCode()){case Du.NO_ERROR:const h=c.getResponseJson();ae(rn,`XHR for RPC '${e}' ${o} received:`,JSON.stringify(h)),a(h);break;case Du.TIMEOUT:ae(rn,`RPC '${e}' ${o} timed out`),u(new se(q.DEADLINE_EXCEEDED,"Request time out"));break;case Du.HTTP_ERROR:const p=c.getStatus();if(ae(rn,`RPC '${e}' ${o} failed with status:`,p,"response text:",c.getResponseText()),p>0){let m=c.getResponseJson();Array.isArray(m)&&(m=m[0]);const b=m==null?void 0:m.error;if(b&&b.status&&b.message){const S=function(y){const w=y.toLowerCase().replace(/_/g,"-");return Object.values(q).indexOf(w)>=0?w:q.UNKNOWN}(b.status);u(new se(S,b.message))}else u(new se(q.UNKNOWN,"Server responded with status "+c.getStatus()))}else u(new se(q.UNAVAILABLE,"Connection failed."));break;default:_e(9055,{l_:e,streamId:o,h_:c.getLastErrorCode(),P_:c.getLastError()})}}finally{ae(rn,`RPC '${e}' ${o} completed.`)}});const f=JSON.stringify(i);ae(rn,`RPC '${e}' ${o} sending request:`,i),c.send(n,"POST",f,r,15)})}T_(e,n,r){const i=hp(),s=[this.Uo,"/","google.firestore.v1.Firestore","/",e,"/channel"],o=hb(),a=db(),u={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:`projects/${this.databaseId.projectId}/databases/${this.databaseId.database}`},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling},c=this.longPollingOptions.timeoutSeconds;c!==void 0&&(u.longPollingTimeout=Math.round(1e3*c)),this.useFetchStreams&&(u.useFetchStreams=!0),this.jo(u.initMessageHeaders,n,r),u.encodeInitMessageHeaders=!0;const f=s.join("");ae(rn,`Creating RPC '${e}' stream ${i}: ${f}`,u);const h=o.createWebChannel(f,u);this.I_(h);let p=!1,m=!1;const b=new lP({Yo:P=>{m?ae(rn,`Not sending because RPC '${e}' stream ${i} is closed:`,P):(p||(ae(rn,`Opening RPC '${e}' stream ${i} transport.`),h.open(),p=!0),ae(rn,`RPC '${e}' stream ${i} sending:`,P),h.send(P))},Zo:()=>h.close()}),S=(P,y,w)=>{P.listen(y,T=>{try{w(T)}catch(L){setTimeout(()=>{throw L},0)}})};return S(h,ya.EventType.OPEN,()=>{m||(ae(rn,`RPC '${e}' stream ${i} transport opened.`),b.o_())}),S(h,ya.EventType.CLOSE,()=>{m||(m=!0,ae(rn,`RPC '${e}' stream ${i} transport closed`),b.a_(),this.E_(h))}),S(h,ya.EventType.ERROR,P=>{m||(m=!0,To(rn,`RPC '${e}' stream ${i} transport errored. Name:`,P.name,"Message:",P.message),b.a_(new se(q.UNAVAILABLE,"The operation could not be completed")))}),S(h,ya.EventType.MESSAGE,P=>{var y;if(!m){const w=P.data[0];Ye(!!w,16349);const T=w,L=(T==null?void 0:T.error)||((y=T[0])==null?void 0:y.error);if(L){ae(rn,`RPC '${e}' stream ${i} received error:`,L);const F=L.status;let D=function(E){const k=kt[E];if(k!==void 0)return Gb(k)}(F),_=L.message;D===void 0&&(D=q.INTERNAL,_="Unknown error status: "+F+" with message "+L.message),m=!0,b.a_(new se(D,_)),h.close()}else ae(rn,`RPC '${e}' stream ${i} received:`,w),b.u_(w)}}),S(a,cb.STAT_EVENT,P=>{P.stat===Zf.PROXY?ae(rn,`RPC '${e}' stream ${i} detected buffering proxy`):P.stat===Zf.NOPROXY&&ae(rn,`RPC '${e}' stream ${i} detected no buffering proxy`)}),setTimeout(()=>{b.__()},0),b}terminate(){this.c_.forEach(e=>e.close()),this.c_=[]}I_(e){this.c_.push(e)}E_(e){this.c_=this.c_.filter(n=>n===e)}}function Dh(){return typeof document<"u"?document:null}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function xd(t){return new fA(t,!0)}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class aE{constructor(e,n,r=1e3,i=1.5,s=6e4){this.Mi=e,this.timerId=n,this.d_=r,this.A_=i,this.R_=s,this.V_=0,this.m_=null,this.f_=Date.now(),this.reset()}reset(){this.V_=0}g_(){this.V_=this.R_}p_(e){this.cancel();const n=Math.floor(this.V_+this.y_()),r=Math.max(0,Date.now()-this.f_),i=Math.max(0,n-r);i>0&&ae("ExponentialBackoff",`Backing off for ${i} ms (base delay: ${this.V_} ms, delay with jitter: ${n} ms, last attempt: ${r} ms ago)`),this.m_=this.Mi.enqueueAfterDelay(this.timerId,i,()=>(this.f_=Date.now(),e())),this.V_*=this.A_,this.V_this.R_&&(this.V_=this.R_)}w_(){this.m_!==null&&(this.m_.skipDelay(),this.m_=null)}cancel(){this.m_!==null&&(this.m_.cancel(),this.m_=null)}y_(){return(Math.random()-.5)*this.V_}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const zv="PersistentStream";class lE{constructor(e,n,r,i,s,o,a,u){this.Mi=e,this.S_=r,this.b_=i,this.connection=s,this.authCredentialsProvider=o,this.appCheckCredentialsProvider=a,this.listener=u,this.state=0,this.D_=0,this.C_=null,this.v_=null,this.stream=null,this.F_=0,this.M_=new aE(e,n)}x_(){return this.state===1||this.state===5||this.O_()}O_(){return this.state===2||this.state===3}start(){this.F_=0,this.state!==4?this.auth():this.N_()}async stop(){this.x_()&&await this.close(0)}B_(){this.state=0,this.M_.reset()}L_(){this.O_()&&this.C_===null&&(this.C_=this.Mi.enqueueAfterDelay(this.S_,6e4,()=>this.k_()))}q_(e){this.Q_(),this.stream.send(e)}async k_(){if(this.O_())return this.close(0)}Q_(){this.C_&&(this.C_.cancel(),this.C_=null)}U_(){this.v_&&(this.v_.cancel(),this.v_=null)}async close(e,n){this.Q_(),this.U_(),this.M_.cancel(),this.D_++,e!==4?this.M_.reset():n&&n.code===q.RESOURCE_EXHAUSTED?(Yr(n.toString()),Yr("Using maximum backoff delay to prevent overloading the backend."),this.M_.g_()):n&&n.code===q.UNAUTHENTICATED&&this.state!==3&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),this.stream!==null&&(this.K_(),this.stream.close(),this.stream=null),this.state=e,await this.listener.r_(n)}K_(){}auth(){this.state=1;const e=this.W_(this.D_),n=this.D_;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then(([r,i])=>{this.D_===n&&this.G_(r,i)},r=>{e(()=>{const i=new se(q.UNKNOWN,"Fetching auth token failed: "+r.message);return this.z_(i)})})}G_(e,n){const r=this.W_(this.D_);this.stream=this.j_(e,n),this.stream.Xo(()=>{r(()=>this.listener.Xo())}),this.stream.t_(()=>{r(()=>(this.state=2,this.v_=this.Mi.enqueueAfterDelay(this.b_,1e4,()=>(this.O_()&&(this.state=3),Promise.resolve())),this.listener.t_()))}),this.stream.r_(i=>{r(()=>this.z_(i))}),this.stream.onMessage(i=>{r(()=>++this.F_==1?this.J_(i):this.onNext(i))})}N_(){this.state=5,this.M_.p_(async()=>{this.state=0,this.start()})}z_(e){return ae(zv,`close with error: ${e}`),this.stream=null,this.close(4,e)}W_(e){return n=>{this.Mi.enqueueAndForget(()=>this.D_===e?n():(ae(zv,"stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve()))}}}class cP extends lE{constructor(e,n,r,i,s,o){super(e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",n,r,i,o),this.serializer=s}j_(e,n){return this.connection.T_("Listen",e,n)}J_(e){return this.onNext(e)}onNext(e){this.M_.reset();const n=gA(this.serializer,e),r=function(s){if(!("targetChange"in s))return Se.min();const o=s.targetChange;return o.targetIds&&o.targetIds.length?Se.min():o.readTime?Sr(o.readTime):Se.min()}(e);return this.listener.H_(n,r)}Y_(e){const n={};n.database=cp(this.serializer),n.addTarget=function(s,o){let a;const u=o.target;if(a=ip(u)?{documents:xA(s,u)}:{query:wA(s,u).ft},a.targetId=o.targetId,o.resumeToken.approximateByteSize()>0){a.resumeToken=Yb(s,o.resumeToken);const c=ap(s,o.expectedCount);c!==null&&(a.expectedCount=c)}else if(o.snapshotVersion.compareTo(Se.min())>0){a.readTime=Sc(s,o.snapshotVersion.toTimestamp());const c=ap(s,o.expectedCount);c!==null&&(a.expectedCount=c)}return a}(this.serializer,e);const r=bA(this.serializer,e);r&&(n.labels=r),this.q_(n)}Z_(e){const n={};n.database=cp(this.serializer),n.removeTarget=e,this.q_(n)}}class dP extends lE{constructor(e,n,r,i,s,o){super(e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",n,r,i,o),this.serializer=s}get X_(){return this.F_>0}start(){this.lastStreamToken=void 0,super.start()}K_(){this.X_&&this.ea([])}j_(e,n){return this.connection.T_("Write",e,n)}J_(e){return Ye(!!e.streamToken,31322),this.lastStreamToken=e.streamToken,Ye(!e.writeResults||e.writeResults.length===0,55816),this.listener.ta()}onNext(e){Ye(!!e.streamToken,12678),this.lastStreamToken=e.streamToken,this.M_.reset();const n=vA(e.writeResults,e.commitTime),r=Sr(e.commitTime);return this.listener.na(r,n)}ra(){const e={};e.database=cp(this.serializer),this.q_(e)}ea(e){const n={streamToken:this.lastStreamToken,writes:e.map(r=>yA(this.serializer,r))};this.q_(n)}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class hP{}class fP extends hP{constructor(e,n,r,i){super(),this.authCredentials=e,this.appCheckCredentials=n,this.connection=r,this.serializer=i,this.ia=!1}sa(){if(this.ia)throw new se(q.FAILED_PRECONDITION,"The client has already been terminated.")}Go(e,n,r,i){return this.sa(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([s,o])=>this.connection.Go(e,lp(n,r),i,s,o)).catch(s=>{throw s.name==="FirebaseError"?(s.code===q.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),s):new se(q.UNKNOWN,s.toString())})}Ho(e,n,r,i,s){return this.sa(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([o,a])=>this.connection.Ho(e,lp(n,r),i,o,a,s)).catch(o=>{throw o.name==="FirebaseError"?(o.code===q.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),o):new se(q.UNKNOWN,o.toString())})}terminate(){this.ia=!0,this.connection.terminate()}}class pP{constructor(e,n){this.asyncQueue=e,this.onlineStateHandler=n,this.state="Unknown",this.oa=0,this._a=null,this.aa=!0}ua(){this.oa===0&&(this.ca("Unknown"),this._a=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,()=>(this._a=null,this.la("Backend didn't respond within 10 seconds."),this.ca("Offline"),Promise.resolve())))}ha(e){this.state==="Online"?this.ca("Unknown"):(this.oa++,this.oa>=1&&(this.Pa(),this.la(`Connection failed 1 times. Most recent error: ${e.toString()}`),this.ca("Offline")))}set(e){this.Pa(),this.oa=0,e==="Online"&&(this.aa=!1),this.ca(e)}ca(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}la(e){const n=`Could not reach Cloud Firestore backend. ${e} +This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.`;this.aa?(Yr(n),this.aa=!1):ae("OnlineStateTracker",n)}Pa(){this._a!==null&&(this._a.cancel(),this._a=null)}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Ts="RemoteStore";class mP{constructor(e,n,r,i,s){this.localStore=e,this.datastore=n,this.asyncQueue=r,this.remoteSyncer={},this.Ta=[],this.Ia=new Map,this.Ea=new Set,this.da=[],this.Aa=s,this.Aa.Oo(o=>{r.enqueueAndForget(async()=>{Ds(this)&&(ae(Ts,"Restarting streams for network reachability change."),await async function(u){const c=ke(u);c.Ea.add(4),await Tl(c),c.Ra.set("Unknown"),c.Ea.delete(4),await wd(c)}(this))})}),this.Ra=new pP(r,i)}}async function wd(t){if(Ds(t))for(const e of t.da)await e(!0)}async function Tl(t){for(const e of t.da)await e(!1)}function uE(t,e){const n=ke(t);n.Ia.has(e.targetId)||(n.Ia.set(e.targetId,e),rg(n)?ng(n):zo(n).O_()&&tg(n,e))}function eg(t,e){const n=ke(t),r=zo(n);n.Ia.delete(e),r.O_()&&cE(n,e),n.Ia.size===0&&(r.O_()?r.L_():Ds(n)&&n.Ra.set("Unknown"))}function tg(t,e){if(t.Va.Ue(e.targetId),e.resumeToken.approximateByteSize()>0||e.snapshotVersion.compareTo(Se.min())>0){const n=t.remoteSyncer.getRemoteKeysForTarget(e.targetId).size;e=e.withExpectedCount(n)}zo(t).Y_(e)}function cE(t,e){t.Va.Ue(e),zo(t).Z_(e)}function ng(t){t.Va=new uA({getRemoteKeysForTarget:e=>t.remoteSyncer.getRemoteKeysForTarget(e),At:e=>t.Ia.get(e)||null,ht:()=>t.datastore.serializer.databaseId}),zo(t).start(),t.Ra.ua()}function rg(t){return Ds(t)&&!zo(t).x_()&&t.Ia.size>0}function Ds(t){return ke(t).Ea.size===0}function dE(t){t.Va=void 0}async function gP(t){t.Ra.set("Online")}async function yP(t){t.Ia.forEach((e,n)=>{tg(t,e)})}async function vP(t,e){dE(t),rg(t)?(t.Ra.ha(e),ng(t)):t.Ra.set("Unknown")}async function xP(t,e,n){if(t.Ra.set("Online"),e instanceof Qb&&e.state===2&&e.cause)try{await async function(i,s){const o=s.cause;for(const a of s.targetIds)i.Ia.has(a)&&(await i.remoteSyncer.rejectListen(a,o),i.Ia.delete(a),i.Va.removeTarget(a))}(t,e)}catch(r){ae(Ts,"Failed to remove targets %s: %s ",e.targetIds.join(","),r),await kc(t,r)}else if(e instanceof Mu?t.Va.Ze(e):e instanceof Kb?t.Va.st(e):t.Va.tt(e),!n.isEqual(Se.min()))try{const r=await oE(t.localStore);n.compareTo(r)>=0&&await function(s,o){const a=s.Va.Tt(o);return a.targetChanges.forEach((u,c)=>{if(u.resumeToken.approximateByteSize()>0){const f=s.Ia.get(c);f&&s.Ia.set(c,f.withResumeToken(u.resumeToken,o))}}),a.targetMismatches.forEach((u,c)=>{const f=s.Ia.get(u);if(!f)return;s.Ia.set(u,f.withResumeToken(en.EMPTY_BYTE_STRING,f.snapshotVersion)),cE(s,u);const h=new Ei(f.target,u,c,f.sequenceNumber);tg(s,h)}),s.remoteSyncer.applyRemoteEvent(a)}(t,n)}catch(r){ae(Ts,"Failed to raise snapshot:",r),await kc(t,r)}}async function kc(t,e,n){if(!Fo(e))throw e;t.Ea.add(1),await Tl(t),t.Ra.set("Offline"),n||(n=()=>oE(t.localStore)),t.asyncQueue.enqueueRetryable(async()=>{ae(Ts,"Retrying IndexedDB access"),await n(),t.Ea.delete(1),await wd(t)})}function hE(t,e){return e().catch(n=>kc(t,n,e))}async function _d(t){const e=ke(t),n=Hi(e);let r=e.Ta.length>0?e.Ta[e.Ta.length-1].batchId:Um;for(;wP(e);)try{const i=await tP(e.localStore,r);if(i===null){e.Ta.length===0&&n.L_();break}r=i.batchId,_P(e,i)}catch(i){await kc(e,i)}fE(e)&&pE(e)}function wP(t){return Ds(t)&&t.Ta.length<10}function _P(t,e){t.Ta.push(e);const n=Hi(t);n.O_()&&n.X_&&n.ea(e.mutations)}function fE(t){return Ds(t)&&!Hi(t).x_()&&t.Ta.length>0}function pE(t){Hi(t).start()}async function bP(t){Hi(t).ra()}async function EP(t){const e=Hi(t);for(const n of t.Ta)e.ea(n.mutations)}async function IP(t,e,n){const r=t.Ta.shift(),i=Gm.from(r,e,n);await hE(t,()=>t.remoteSyncer.applySuccessfulWrite(i)),await _d(t)}async function SP(t,e){e&&Hi(t).X_&&await async function(r,i){if(function(o){return oA(o)&&o!==q.ABORTED}(i.code)){const s=r.Ta.shift();Hi(r).B_(),await hE(r,()=>r.remoteSyncer.rejectFailedWrite(s.batchId,i)),await _d(r)}}(t,e),fE(t)&&pE(t)}async function Bv(t,e){const n=ke(t);n.asyncQueue.verifyOperationInProgress(),ae(Ts,"RemoteStore received new credentials");const r=Ds(n);n.Ea.add(3),await Tl(n),r&&n.Ra.set("Unknown"),await n.remoteSyncer.handleCredentialChange(e),n.Ea.delete(3),await wd(n)}async function TP(t,e){const n=ke(t);e?(n.Ea.delete(2),await wd(n)):e||(n.Ea.add(2),await Tl(n),n.Ra.set("Unknown"))}function zo(t){return t.ma||(t.ma=function(n,r,i){const s=ke(n);return s.sa(),new cP(r,s.connection,s.authCredentials,s.appCheckCredentials,s.serializer,i)}(t.datastore,t.asyncQueue,{Xo:gP.bind(null,t),t_:yP.bind(null,t),r_:vP.bind(null,t),H_:xP.bind(null,t)}),t.da.push(async e=>{e?(t.ma.B_(),rg(t)?ng(t):t.Ra.set("Unknown")):(await t.ma.stop(),dE(t))})),t.ma}function Hi(t){return t.fa||(t.fa=function(n,r,i){const s=ke(n);return s.sa(),new dP(r,s.connection,s.authCredentials,s.appCheckCredentials,s.serializer,i)}(t.datastore,t.asyncQueue,{Xo:()=>Promise.resolve(),t_:bP.bind(null,t),r_:SP.bind(null,t),ta:EP.bind(null,t),na:IP.bind(null,t)}),t.da.push(async e=>{e?(t.fa.B_(),await _d(t)):(await t.fa.stop(),t.Ta.length>0&&(ae(Ts,`Stopping write stream with ${t.Ta.length} pending writes`),t.Ta=[]))})),t.fa}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class ig{constructor(e,n,r,i,s){this.asyncQueue=e,this.timerId=n,this.targetTimeMs=r,this.op=i,this.removalCallback=s,this.deferred=new Hr,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch(o=>{})}get promise(){return this.deferred.promise}static createAndSchedule(e,n,r,i,s){const o=Date.now()+r,a=new ig(e,n,o,i,s);return a.start(r),a}start(e){this.timerHandle=setTimeout(()=>this.handleDelayElapsed(),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){this.timerHandle!==null&&(this.clearTimeout(),this.deferred.reject(new se(q.CANCELLED,"Operation cancelled"+(e?": "+e:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget(()=>this.timerHandle!==null?(this.clearTimeout(),this.op().then(e=>this.deferred.resolve(e))):Promise.resolve())}clearTimeout(){this.timerHandle!==null&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}}function sg(t,e){if(Yr("AsyncQueue",`${e}: ${t}`),Fo(t))return new se(q.UNAVAILABLE,`${e}: ${t}`);throw t}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class ho{static emptySet(e){return new ho(e.comparator)}constructor(e){this.comparator=e?(n,r)=>e(n,r)||ge.comparator(n.key,r.key):(n,r)=>ge.comparator(n.key,r.key),this.keyedMap=va(),this.sortedSet=new pt(this.comparator)}has(e){return this.keyedMap.get(e)!=null}get(e){return this.keyedMap.get(e)}first(){return this.sortedSet.minKey()}last(){return this.sortedSet.maxKey()}isEmpty(){return this.sortedSet.isEmpty()}indexOf(e){const n=this.keyedMap.get(e);return n?this.sortedSet.indexOf(n):-1}get size(){return this.sortedSet.size}forEach(e){this.sortedSet.inorderTraversal((n,r)=>(e(n),!1))}add(e){const n=this.delete(e.key);return n.copy(n.keyedMap.insert(e.key,e),n.sortedSet.insert(e,null))}delete(e){const n=this.get(e);return n?this.copy(this.keyedMap.remove(e),this.sortedSet.remove(n)):this}isEqual(e){if(!(e instanceof ho)||this.size!==e.size)return!1;const n=this.sortedSet.getIterator(),r=e.sortedSet.getIterator();for(;n.hasNext();){const i=n.getNext().key,s=r.getNext().key;if(!i.isEqual(s))return!1}return!0}toString(){const e=[];return this.forEach(n=>{e.push(n.toString())}),e.length===0?"DocumentSet ()":`DocumentSet ( + `+e.join(` +`)+` +)`}copy(e,n){const r=new ho;return r.comparator=this.comparator,r.keyedMap=e,r.sortedSet=n,r}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class $v{constructor(){this.ga=new pt(ge.comparator)}track(e){const n=e.doc.key,r=this.ga.get(n);r?e.type!==0&&r.type===3?this.ga=this.ga.insert(n,e):e.type===3&&r.type!==1?this.ga=this.ga.insert(n,{type:r.type,doc:e.doc}):e.type===2&&r.type===2?this.ga=this.ga.insert(n,{type:2,doc:e.doc}):e.type===2&&r.type===0?this.ga=this.ga.insert(n,{type:0,doc:e.doc}):e.type===1&&r.type===0?this.ga=this.ga.remove(n):e.type===1&&r.type===2?this.ga=this.ga.insert(n,{type:1,doc:r.doc}):e.type===0&&r.type===1?this.ga=this.ga.insert(n,{type:2,doc:e.doc}):_e(63341,{Rt:e,pa:r}):this.ga=this.ga.insert(n,e)}ya(){const e=[];return this.ga.inorderTraversal((n,r)=>{e.push(r)}),e}}class Po{constructor(e,n,r,i,s,o,a,u,c){this.query=e,this.docs=n,this.oldDocs=r,this.docChanges=i,this.mutatedKeys=s,this.fromCache=o,this.syncStateChanged=a,this.excludesMetadataChanges=u,this.hasCachedResults=c}static fromInitialDocuments(e,n,r,i,s){const o=[];return n.forEach(a=>{o.push({type:0,doc:a})}),new Po(e,n,ho.emptySet(n),o,r,i,!0,!1,s)}get hasPendingWrites(){return!this.mutatedKeys.isEmpty()}isEqual(e){if(!(this.fromCache===e.fromCache&&this.hasCachedResults===e.hasCachedResults&&this.syncStateChanged===e.syncStateChanged&&this.mutatedKeys.isEqual(e.mutatedKeys)&&pd(this.query,e.query)&&this.docs.isEqual(e.docs)&&this.oldDocs.isEqual(e.oldDocs)))return!1;const n=this.docChanges,r=e.docChanges;if(n.length!==r.length)return!1;for(let i=0;ie.Da())}}class CP{constructor(){this.queries=Hv(),this.onlineState="Unknown",this.Ca=new Set}terminate(){(function(n,r){const i=ke(n),s=i.queries;i.queries=Hv(),s.forEach((o,a)=>{for(const u of a.Sa)u.onError(r)})})(this,new se(q.ABORTED,"Firestore shutting down"))}}function Hv(){return new Rs(t=>jb(t),pd)}async function og(t,e){const n=ke(t);let r=3;const i=e.query;let s=n.queries.get(i);s?!s.ba()&&e.Da()&&(r=2):(s=new kP,r=e.Da()?0:1);try{switch(r){case 0:s.wa=await n.onListen(i,!0);break;case 1:s.wa=await n.onListen(i,!1);break;case 2:await n.onFirstRemoteStoreListen(i)}}catch(o){const a=sg(o,`Initialization of query '${zs(e.query)}' failed`);return void e.onError(a)}n.queries.set(i,s),s.Sa.push(e),e.va(n.onlineState),s.wa&&e.Fa(s.wa)&&lg(n)}async function ag(t,e){const n=ke(t),r=e.query;let i=3;const s=n.queries.get(r);if(s){const o=s.Sa.indexOf(e);o>=0&&(s.Sa.splice(o,1),s.Sa.length===0?i=e.Da()?0:1:!s.ba()&&e.Da()&&(i=2))}switch(i){case 0:return n.queries.delete(r),n.onUnlisten(r,!0);case 1:return n.queries.delete(r),n.onUnlisten(r,!1);case 2:return n.onLastRemoteStoreUnlisten(r);default:return}}function NP(t,e){const n=ke(t);let r=!1;for(const i of e){const s=i.query,o=n.queries.get(s);if(o){for(const a of o.Sa)a.Fa(i)&&(r=!0);o.wa=i}}r&&lg(n)}function AP(t,e,n){const r=ke(t),i=r.queries.get(e);if(i)for(const s of i.Sa)s.onError(n);r.queries.delete(e)}function lg(t){t.Ca.forEach(e=>{e.next()})}var fp,qv;(qv=fp||(fp={})).Ma="default",qv.Cache="cache";class ug{constructor(e,n,r){this.query=e,this.xa=n,this.Oa=!1,this.Na=null,this.onlineState="Unknown",this.options=r||{}}Fa(e){if(!this.options.includeMetadataChanges){const r=[];for(const i of e.docChanges)i.type!==3&&r.push(i);e=new Po(e.query,e.docs,e.oldDocs,r,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let n=!1;return this.Oa?this.Ba(e)&&(this.xa.next(e),n=!0):this.La(e,this.onlineState)&&(this.ka(e),n=!0),this.Na=e,n}onError(e){this.xa.error(e)}va(e){this.onlineState=e;let n=!1;return this.Na&&!this.Oa&&this.La(this.Na,e)&&(this.ka(this.Na),n=!0),n}La(e,n){if(!e.fromCache||!this.Da())return!0;const r=n!=="Offline";return(!this.options.qa||!r)&&(!e.docs.isEmpty()||e.hasCachedResults||n==="Offline")}Ba(e){if(e.docChanges.length>0)return!0;const n=this.Na&&this.Na.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!n)&&this.options.includeMetadataChanges===!0}ka(e){e=Po.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.Oa=!0,this.xa.next(e)}Da(){return this.options.source!==fp.Cache}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class mE{constructor(e){this.key=e}}class gE{constructor(e){this.key=e}}class PP{constructor(e,n){this.query=e,this.Ya=n,this.Za=null,this.hasCachedResults=!1,this.current=!1,this.Xa=Be(),this.mutatedKeys=Be(),this.eu=Lb(e),this.tu=new ho(this.eu)}get nu(){return this.Ya}ru(e,n){const r=n?n.iu:new $v,i=n?n.tu:this.tu;let s=n?n.mutatedKeys:this.mutatedKeys,o=i,a=!1;const u=this.query.limitType==="F"&&i.size===this.query.limit?i.last():null,c=this.query.limitType==="L"&&i.size===this.query.limit?i.first():null;if(e.inorderTraversal((f,h)=>{const p=i.get(f),m=md(this.query,h)?h:null,b=!!p&&this.mutatedKeys.has(p.key),S=!!m&&(m.hasLocalMutations||this.mutatedKeys.has(m.key)&&m.hasCommittedMutations);let P=!1;p&&m?p.data.isEqual(m.data)?b!==S&&(r.track({type:3,doc:m}),P=!0):this.su(p,m)||(r.track({type:2,doc:m}),P=!0,(u&&this.eu(m,u)>0||c&&this.eu(m,c)<0)&&(a=!0)):!p&&m?(r.track({type:0,doc:m}),P=!0):p&&!m&&(r.track({type:1,doc:p}),P=!0,(u||c)&&(a=!0)),P&&(m?(o=o.add(m),s=S?s.add(f):s.delete(f)):(o=o.delete(f),s=s.delete(f)))}),this.query.limit!==null)for(;o.size>this.query.limit;){const f=this.query.limitType==="F"?o.last():o.first();o=o.delete(f.key),s=s.delete(f.key),r.track({type:1,doc:f})}return{tu:o,iu:r,Cs:a,mutatedKeys:s}}su(e,n){return e.hasLocalMutations&&n.hasCommittedMutations&&!n.hasLocalMutations}applyChanges(e,n,r,i){const s=this.tu;this.tu=e.tu,this.mutatedKeys=e.mutatedKeys;const o=e.iu.ya();o.sort((f,h)=>function(m,b){const S=P=>{switch(P){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return _e(20277,{Rt:P})}};return S(m)-S(b)}(f.type,h.type)||this.eu(f.doc,h.doc)),this.ou(r),i=i??!1;const a=n&&!i?this._u():[],u=this.Xa.size===0&&this.current&&!i?1:0,c=u!==this.Za;return this.Za=u,o.length!==0||c?{snapshot:new Po(this.query,e.tu,s,o,e.mutatedKeys,u===0,c,!1,!!r&&r.resumeToken.approximateByteSize()>0),au:a}:{au:a}}va(e){return this.current&&e==="Offline"?(this.current=!1,this.applyChanges({tu:this.tu,iu:new $v,mutatedKeys:this.mutatedKeys,Cs:!1},!1)):{au:[]}}uu(e){return!this.Ya.has(e)&&!!this.tu.has(e)&&!this.tu.get(e).hasLocalMutations}ou(e){e&&(e.addedDocuments.forEach(n=>this.Ya=this.Ya.add(n)),e.modifiedDocuments.forEach(n=>{}),e.removedDocuments.forEach(n=>this.Ya=this.Ya.delete(n)),this.current=e.current)}_u(){if(!this.current)return[];const e=this.Xa;this.Xa=Be(),this.tu.forEach(r=>{this.uu(r.key)&&(this.Xa=this.Xa.add(r.key))});const n=[];return e.forEach(r=>{this.Xa.has(r)||n.push(new gE(r))}),this.Xa.forEach(r=>{e.has(r)||n.push(new mE(r))}),n}cu(e){this.Ya=e.Qs,this.Xa=Be();const n=this.ru(e.documents);return this.applyChanges(n,!0)}lu(){return Po.fromInitialDocuments(this.query,this.tu,this.mutatedKeys,this.Za===0,this.hasCachedResults)}}const cg="SyncEngine";class RP{constructor(e,n,r){this.query=e,this.targetId=n,this.view=r}}class DP{constructor(e){this.key=e,this.hu=!1}}class jP{constructor(e,n,r,i,s,o){this.localStore=e,this.remoteStore=n,this.eventManager=r,this.sharedClientState=i,this.currentUser=s,this.maxConcurrentLimboResolutions=o,this.Pu={},this.Tu=new Rs(a=>jb(a),pd),this.Iu=new Map,this.Eu=new Set,this.du=new pt(ge.comparator),this.Au=new Map,this.Ru=new Ym,this.Vu={},this.mu=new Map,this.fu=Ao.cr(),this.onlineState="Unknown",this.gu=void 0}get isPrimaryClient(){return this.gu===!0}}async function LP(t,e,n=!0){const r=bE(t);let i;const s=r.Tu.get(e);return s?(r.sharedClientState.addLocalQueryTarget(s.targetId),i=s.view.lu()):i=await yE(r,e,n,!0),i}async function OP(t,e){const n=bE(t);await yE(n,e,!0,!1)}async function yE(t,e,n,r){const i=await nP(t.localStore,Ir(e)),s=i.targetId,o=t.sharedClientState.addLocalQueryTarget(s,n);let a;return r&&(a=await MP(t,e,s,o==="current",i.resumeToken)),t.isPrimaryClient&&n&&uE(t.remoteStore,i),a}async function MP(t,e,n,r,i){t.pu=(h,p,m)=>async function(S,P,y,w){let T=P.view.ru(y);T.Cs&&(T=await Mv(S.localStore,P.query,!1).then(({documents:_})=>P.view.ru(_,T)));const L=w&&w.targetChanges.get(P.targetId),F=w&&w.targetMismatches.get(P.targetId)!=null,D=P.view.applyChanges(T,S.isPrimaryClient,L,F);return Gv(S,P.targetId,D.au),D.snapshot}(t,h,p,m);const s=await Mv(t.localStore,e,!0),o=new PP(e,s.Qs),a=o.ru(s.documents),u=Sl.createSynthesizedTargetChangeForCurrentChange(n,r&&t.onlineState!=="Offline",i),c=o.applyChanges(a,t.isPrimaryClient,u);Gv(t,n,c.au);const f=new RP(e,n,o);return t.Tu.set(e,f),t.Iu.has(n)?t.Iu.get(n).push(e):t.Iu.set(n,[e]),c.snapshot}async function VP(t,e,n){const r=ke(t),i=r.Tu.get(e),s=r.Iu.get(i.targetId);if(s.length>1)return r.Iu.set(i.targetId,s.filter(o=>!pd(o,e))),void r.Tu.delete(e);r.isPrimaryClient?(r.sharedClientState.removeLocalQueryTarget(i.targetId),r.sharedClientState.isActiveQueryTarget(i.targetId)||await dp(r.localStore,i.targetId,!1).then(()=>{r.sharedClientState.clearQueryState(i.targetId),n&&eg(r.remoteStore,i.targetId),pp(r,i.targetId)}).catch(Vo)):(pp(r,i.targetId),await dp(r.localStore,i.targetId,!0))}async function FP(t,e){const n=ke(t),r=n.Tu.get(e),i=n.Iu.get(r.targetId);n.isPrimaryClient&&i.length===1&&(n.sharedClientState.removeLocalQueryTarget(r.targetId),eg(n.remoteStore,r.targetId))}async function UP(t,e,n){const r=GP(t);try{const i=await function(o,a){const u=ke(o),c=Qe.now(),f=a.reduce((m,b)=>m.add(b.key),Be());let h,p;return u.persistence.runTransaction("Locally write mutations","readwrite",m=>{let b=Xr(),S=Be();return u.Ns.getEntries(m,f).next(P=>{b=P,b.forEach((y,w)=>{w.isValidDocument()||(S=S.add(y))})}).next(()=>u.localDocuments.getOverlayedDocuments(m,b)).next(P=>{h=P;const y=[];for(const w of a){const T=tA(w,h.get(w.key).overlayedDocument);T!=null&&y.push(new Yi(w.key,T,Tb(T.value.mapValue),Yn.exists(!0)))}return u.mutationQueue.addMutationBatch(m,c,y,a)}).next(P=>{p=P;const y=P.applyToLocalDocumentSet(h,S);return u.documentOverlayCache.saveOverlays(m,P.batchId,y)})}).then(()=>({batchId:p.batchId,changes:Mb(h)}))}(r.localStore,e);r.sharedClientState.addPendingMutation(i.batchId),function(o,a,u){let c=o.Vu[o.currentUser.toKey()];c||(c=new pt(ze)),c=c.insert(a,u),o.Vu[o.currentUser.toKey()]=c}(r,i.batchId,n),await kl(r,i.changes),await _d(r.remoteStore)}catch(i){const s=sg(i,"Failed to persist write");n.reject(s)}}async function vE(t,e){const n=ke(t);try{const r=await ZA(n.localStore,e);e.targetChanges.forEach((i,s)=>{const o=n.Au.get(s);o&&(Ye(i.addedDocuments.size+i.modifiedDocuments.size+i.removedDocuments.size<=1,22616),i.addedDocuments.size>0?o.hu=!0:i.modifiedDocuments.size>0?Ye(o.hu,14607):i.removedDocuments.size>0&&(Ye(o.hu,42227),o.hu=!1))}),await kl(n,r,e)}catch(r){await Vo(r)}}function Wv(t,e,n){const r=ke(t);if(r.isPrimaryClient&&n===0||!r.isPrimaryClient&&n===1){const i=[];r.Tu.forEach((s,o)=>{const a=o.view.va(e);a.snapshot&&i.push(a.snapshot)}),function(o,a){const u=ke(o);u.onlineState=a;let c=!1;u.queries.forEach((f,h)=>{for(const p of h.Sa)p.va(a)&&(c=!0)}),c&&lg(u)}(r.eventManager,e),i.length&&r.Pu.H_(i),r.onlineState=e,r.isPrimaryClient&&r.sharedClientState.setOnlineState(e)}}async function zP(t,e,n){const r=ke(t);r.sharedClientState.updateQueryState(e,"rejected",n);const i=r.Au.get(e),s=i&&i.key;if(s){let o=new pt(ge.comparator);o=o.insert(s,an.newNoDocument(s,Se.min()));const a=Be().add(s),u=new vd(Se.min(),new Map,new pt(ze),o,a);await vE(r,u),r.du=r.du.remove(s),r.Au.delete(e),dg(r)}else await dp(r.localStore,e,!1).then(()=>pp(r,e,n)).catch(Vo)}async function BP(t,e){const n=ke(t),r=e.batch.batchId;try{const i=await JA(n.localStore,e);wE(n,r,null),xE(n,r),n.sharedClientState.updateMutationState(r,"acknowledged"),await kl(n,i)}catch(i){await Vo(i)}}async function $P(t,e,n){const r=ke(t);try{const i=await function(o,a){const u=ke(o);return u.persistence.runTransaction("Reject batch","readwrite-primary",c=>{let f;return u.mutationQueue.lookupMutationBatch(c,a).next(h=>(Ye(h!==null,37113),f=h.keys(),u.mutationQueue.removeMutationBatch(c,h))).next(()=>u.mutationQueue.performConsistencyCheck(c)).next(()=>u.documentOverlayCache.removeOverlaysForBatchId(c,f,a)).next(()=>u.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(c,f)).next(()=>u.localDocuments.getDocuments(c,f))})}(r.localStore,e);wE(r,e,n),xE(r,e),r.sharedClientState.updateMutationState(e,"rejected",n),await kl(r,i)}catch(i){await Vo(i)}}function xE(t,e){(t.mu.get(e)||[]).forEach(n=>{n.resolve()}),t.mu.delete(e)}function wE(t,e,n){const r=ke(t);let i=r.Vu[r.currentUser.toKey()];if(i){const s=i.get(e);s&&(n?s.reject(n):s.resolve(),i=i.remove(e)),r.Vu[r.currentUser.toKey()]=i}}function pp(t,e,n=null){t.sharedClientState.removeLocalQueryTarget(e);for(const r of t.Iu.get(e))t.Tu.delete(r),n&&t.Pu.yu(r,n);t.Iu.delete(e),t.isPrimaryClient&&t.Ru.jr(e).forEach(r=>{t.Ru.containsKey(r)||_E(t,r)})}function _E(t,e){t.Eu.delete(e.path.canonicalString());const n=t.du.get(e);n!==null&&(eg(t.remoteStore,n),t.du=t.du.remove(e),t.Au.delete(n),dg(t))}function Gv(t,e,n){for(const r of n)r instanceof mE?(t.Ru.addReference(r.key,e),HP(t,r)):r instanceof gE?(ae(cg,"Document no longer in limbo: "+r.key),t.Ru.removeReference(r.key,e),t.Ru.containsKey(r.key)||_E(t,r.key)):_e(19791,{wu:r})}function HP(t,e){const n=e.key,r=n.path.canonicalString();t.du.get(n)||t.Eu.has(r)||(ae(cg,"New document in limbo: "+n),t.Eu.add(r),dg(t))}function dg(t){for(;t.Eu.size>0&&t.du.size{o.push(r.pu(u,e,n).then(c=>{var f;if((c||n)&&r.isPrimaryClient){const h=c?!c.fromCache:(f=n==null?void 0:n.targetChanges.get(u.targetId))==null?void 0:f.current;r.sharedClientState.updateQueryState(u.targetId,h?"current":"not-current")}if(c){i.push(c);const h=Jm.As(u.targetId,c);s.push(h)}}))}),await Promise.all(o),r.Pu.H_(i),await async function(u,c){const f=ke(u);try{await f.persistence.runTransaction("notifyLocalViewChanges","readwrite",h=>G.forEach(c,p=>G.forEach(p.Es,m=>f.persistence.referenceDelegate.addReference(h,p.targetId,m)).next(()=>G.forEach(p.ds,m=>f.persistence.referenceDelegate.removeReference(h,p.targetId,m)))))}catch(h){if(!Fo(h))throw h;ae(Zm,"Failed to update sequence numbers: "+h)}for(const h of c){const p=h.targetId;if(!h.fromCache){const m=f.Ms.get(p),b=m.snapshotVersion,S=m.withLastLimboFreeSnapshotVersion(b);f.Ms=f.Ms.insert(p,S)}}}(r.localStore,s))}async function qP(t,e){const n=ke(t);if(!n.currentUser.isEqual(e)){ae(cg,"User change. New user:",e.toKey());const r=await sE(n.localStore,e);n.currentUser=e,function(s,o){s.mu.forEach(a=>{a.forEach(u=>{u.reject(new se(q.CANCELLED,o))})}),s.mu.clear()}(n,"'waitForPendingWrites' promise is rejected due to a user change."),n.sharedClientState.handleUserChange(e,r.removedBatchIds,r.addedBatchIds),await kl(n,r.Ls)}}function WP(t,e){const n=ke(t),r=n.Au.get(e);if(r&&r.hu)return Be().add(r.key);{let i=Be();const s=n.Iu.get(e);if(!s)return i;for(const o of s){const a=n.Tu.get(o);i=i.unionWith(a.view.nu)}return i}}function bE(t){const e=ke(t);return e.remoteStore.remoteSyncer.applyRemoteEvent=vE.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=WP.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=zP.bind(null,e),e.Pu.H_=NP.bind(null,e.eventManager),e.Pu.yu=AP.bind(null,e.eventManager),e}function GP(t){const e=ke(t);return e.remoteStore.remoteSyncer.applySuccessfulWrite=BP.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=$P.bind(null,e),e}class Cc{constructor(){this.kind="memory",this.synchronizeTabs=!1}async initialize(e){this.serializer=xd(e.databaseInfo.databaseId),this.sharedClientState=this.Du(e),this.persistence=this.Cu(e),await this.persistence.start(),this.localStore=this.vu(e),this.gcScheduler=this.Fu(e,this.localStore),this.indexBackfillerScheduler=this.Mu(e,this.localStore)}Fu(e,n){return null}Mu(e,n){return null}vu(e){return XA(this.persistence,new KA,e.initialUser,this.serializer)}Cu(e){return new iE(Xm.mi,this.serializer)}Du(e){return new iP}async terminate(){var e,n;(e=this.gcScheduler)==null||e.stop(),(n=this.indexBackfillerScheduler)==null||n.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}}Cc.provider={build:()=>new Cc};class KP extends Cc{constructor(e){super(),this.cacheSizeBytes=e}Fu(e,n){Ye(this.persistence.referenceDelegate instanceof Tc,46915);const r=this.persistence.referenceDelegate.garbageCollector;return new DA(r,e.asyncQueue,n)}Cu(e){const n=this.cacheSizeBytes!==void 0?yn.withCacheSize(this.cacheSizeBytes):yn.DEFAULT;return new iE(r=>Tc.mi(r,n),this.serializer)}}class mp{async initialize(e,n){this.localStore||(this.localStore=e.localStore,this.sharedClientState=e.sharedClientState,this.datastore=this.createDatastore(n),this.remoteStore=this.createRemoteStore(n),this.eventManager=this.createEventManager(n),this.syncEngine=this.createSyncEngine(n,!e.synchronizeTabs),this.sharedClientState.onlineStateHandler=r=>Wv(this.syncEngine,r,1),this.remoteStore.remoteSyncer.handleCredentialChange=qP.bind(null,this.syncEngine),await TP(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return function(){return new CP}()}createDatastore(e){const n=xd(e.databaseInfo.databaseId),r=function(s){return new uP(s)}(e.databaseInfo);return function(s,o,a,u){return new fP(s,o,a,u)}(e.authCredentials,e.appCheckCredentials,r,n)}createRemoteStore(e){return function(r,i,s,o,a){return new mP(r,i,s,o,a)}(this.localStore,this.datastore,e.asyncQueue,n=>Wv(this.syncEngine,n,0),function(){return Uv.v()?new Uv:new sP}())}createSyncEngine(e,n){return function(i,s,o,a,u,c,f){const h=new jP(i,s,o,a,u,c);return f&&(h.gu=!0),h}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,n)}async terminate(){var e,n;await async function(i){const s=ke(i);ae(Ts,"RemoteStore shutting down."),s.Ea.add(5),await Tl(s),s.Aa.shutdown(),s.Ra.set("Unknown")}(this.remoteStore),(e=this.datastore)==null||e.terminate(),(n=this.eventManager)==null||n.terminate()}}mp.provider={build:()=>new mp};/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *//** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class hg{constructor(e){this.observer=e,this.muted=!1}next(e){this.muted||this.observer.next&&this.Ou(this.observer.next,e)}error(e){this.muted||(this.observer.error?this.Ou(this.observer.error,e):Yr("Uncaught Error in snapshot listener:",e.toString()))}Nu(){this.muted=!0}Ou(e,n){setTimeout(()=>{this.muted||e(n)},0)}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const qi="FirestoreClient";class QP{constructor(e,n,r,i,s){this.authCredentials=e,this.appCheckCredentials=n,this.asyncQueue=r,this.databaseInfo=i,this.user=sn.UNAUTHENTICATED,this.clientId=Fm.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=s,this.authCredentials.start(r,async o=>{ae(qi,"Received user=",o.uid),await this.authCredentialListener(o),this.user=o}),this.appCheckCredentials.start(r,o=>(ae(qi,"Received new app check token=",o),this.appCheckCredentialListener(o,this.user)))}get configuration(){return{asyncQueue:this.asyncQueue,databaseInfo:this.databaseInfo,clientId:this.clientId,authCredentials:this.authCredentials,appCheckCredentials:this.appCheckCredentials,initialUser:this.user,maxConcurrentLimboResolutions:100}}setCredentialChangeListener(e){this.authCredentialListener=e}setAppCheckTokenChangeListener(e){this.appCheckCredentialListener=e}terminate(){this.asyncQueue.enterRestrictedMode();const e=new Hr;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted(async()=>{try{this._onlineComponents&&await this._onlineComponents.terminate(),this._offlineComponents&&await this._offlineComponents.terminate(),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),e.resolve()}catch(n){const r=sg(n,"Failed to shutdown persistence");e.reject(r)}}),e.promise}}async function jh(t,e){t.asyncQueue.verifyOperationInProgress(),ae(qi,"Initializing OfflineComponentProvider");const n=t.configuration;await e.initialize(n);let r=n.initialUser;t.setCredentialChangeListener(async i=>{r.isEqual(i)||(await sE(e.localStore,i),r=i)}),e.persistence.setDatabaseDeletedListener(()=>t.terminate()),t._offlineComponents=e}async function Kv(t,e){t.asyncQueue.verifyOperationInProgress();const n=await YP(t);ae(qi,"Initializing OnlineComponentProvider"),await e.initialize(n,t.configuration),t.setCredentialChangeListener(r=>Bv(e.remoteStore,r)),t.setAppCheckTokenChangeListener((r,i)=>Bv(e.remoteStore,i)),t._onlineComponents=e}async function YP(t){if(!t._offlineComponents)if(t._uninitializedComponentsProvider){ae(qi,"Using user provided OfflineComponentProvider");try{await jh(t,t._uninitializedComponentsProvider._offline)}catch(e){const n=e;if(!function(i){return i.name==="FirebaseError"?i.code===q.FAILED_PRECONDITION||i.code===q.UNIMPLEMENTED:!(typeof DOMException<"u"&&i instanceof DOMException)||i.code===22||i.code===20||i.code===11}(n))throw n;To("Error using user provided cache. Falling back to memory cache: "+n),await jh(t,new Cc)}}else ae(qi,"Using default OfflineComponentProvider"),await jh(t,new KP(void 0));return t._offlineComponents}async function EE(t){return t._onlineComponents||(t._uninitializedComponentsProvider?(ae(qi,"Using user provided OnlineComponentProvider"),await Kv(t,t._uninitializedComponentsProvider._online)):(ae(qi,"Using default OnlineComponentProvider"),await Kv(t,new mp))),t._onlineComponents}function XP(t){return EE(t).then(e=>e.syncEngine)}async function Nc(t){const e=await EE(t),n=e.eventManager;return n.onListen=LP.bind(null,e.syncEngine),n.onUnlisten=VP.bind(null,e.syncEngine),n.onFirstRemoteStoreListen=OP.bind(null,e.syncEngine),n.onLastRemoteStoreUnlisten=FP.bind(null,e.syncEngine),n}function JP(t,e,n={}){const r=new Hr;return t.asyncQueue.enqueueAndForget(async()=>function(s,o,a,u,c){const f=new hg({next:p=>{f.Nu(),o.enqueueAndForget(()=>ag(s,h));const m=p.docs.has(a);!m&&p.fromCache?c.reject(new se(q.UNAVAILABLE,"Failed to get document because the client is offline.")):m&&p.fromCache&&u&&u.source==="server"?c.reject(new se(q.UNAVAILABLE,'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')):c.resolve(p)},error:p=>c.reject(p)}),h=new ug(fd(a.path),f,{includeMetadataChanges:!0,qa:!0});return og(s,h)}(await Nc(t),t.asyncQueue,e,n,r)),r.promise}function ZP(t,e,n={}){const r=new Hr;return t.asyncQueue.enqueueAndForget(async()=>function(s,o,a,u,c){const f=new hg({next:p=>{f.Nu(),o.enqueueAndForget(()=>ag(s,h)),p.fromCache&&u.source==="server"?c.reject(new se(q.UNAVAILABLE,'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')):c.resolve(p)},error:p=>c.reject(p)}),h=new ug(a,f,{includeMetadataChanges:!0,qa:!0});return og(s,h)}(await Nc(t),t.asyncQueue,e,n,r)),r.promise}/** + * @license + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function IE(t){const e={};return t.timeoutSeconds!==void 0&&(e.timeoutSeconds=t.timeoutSeconds),e}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Qv=new Map;/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const SE="firestore.googleapis.com",Yv=!0;class Xv{constructor(e){if(e.host===void 0){if(e.ssl!==void 0)throw new se(q.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host=SE,this.ssl=Yv}else this.host=e.host,this.ssl=e.ssl??Yv;if(this.isUsingEmulator=e.emulatorOptions!==void 0,this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,this.localCache=e.localCache,e.cacheSizeBytes===void 0)this.cacheSizeBytes=rE;else{if(e.cacheSizeBytes!==-1&&e.cacheSizeBytes30)throw new se(q.INVALID_ARGUMENT,`invalid long polling timeout: ${r.timeoutSeconds} (maximum allowed value is 30)`)}}(this.experimentalLongPollingOptions),this.useFetchStreams=!!e.useFetchStreams}isEqual(e){return this.host===e.host&&this.ssl===e.ssl&&this.credentials===e.credentials&&this.cacheSizeBytes===e.cacheSizeBytes&&this.experimentalForceLongPolling===e.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===e.experimentalAutoDetectLongPolling&&function(r,i){return r.timeoutSeconds===i.timeoutSeconds}(this.experimentalLongPollingOptions,e.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}}class bd{constructor(e,n,r,i){this._authCredentials=e,this._appCheckCredentials=n,this._databaseId=r,this._app=i,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new Xv({}),this._settingsFrozen=!1,this._emulatorOptions={},this._terminateTask="notTerminated"}get app(){if(!this._app)throw new se(q.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}get _initialized(){return this._settingsFrozen}get _terminated(){return this._terminateTask!=="notTerminated"}_setSettings(e){if(this._settingsFrozen)throw new se(q.FAILED_PRECONDITION,"Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");this._settings=new Xv(e),this._emulatorOptions=e.emulatorOptions||{},e.credentials!==void 0&&(this._authCredentials=function(r){if(!r)return new sN;switch(r.type){case"firstParty":return new uN(r.sessionIndex||"0",r.iamToken||null,r.authTokenFactory||null);case"provider":return r.client;default:throw new se(q.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}}(e.credentials))}_getSettings(){return this._settings}_getEmulatorOptions(){return this._emulatorOptions}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return this._terminateTask==="notTerminated"&&(this._terminateTask=this._terminate()),this._terminateTask}async _restart(){this._terminateTask==="notTerminated"?await this._terminate():this._terminateTask="notTerminated"}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(n){const r=Qv.get(n);r&&(ae("ComponentProvider","Removing Datastore"),Qv.delete(n),r.terminate())}(this),Promise.resolve()}}function eR(t,e,n,r={}){var c;t=Sn(t,bd);const i=As(e),s=t._getSettings(),o={...s,emulatorOptions:t._getEmulatorOptions()},a=`${e}:${n}`;i&&(Dm(`https://${a}`),jm("Firestore",!0)),s.host!==SE&&s.host!==a&&To("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used.");const u={...s,host:a,ssl:i,emulatorOptions:r};if(!Es(u,o)&&(t._setSettings(u),r.mockUserToken)){let f,h;if(typeof r.mockUserToken=="string")f=r.mockUserToken,h=sn.MOCK_USER;else{f=tb(r.mockUserToken,(c=t._app)==null?void 0:c.options.projectId);const p=r.mockUserToken.sub||r.mockUserToken.user_id;if(!p)throw new se(q.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");h=new sn(p)}t._authCredentials=new oN(new pb(f,h))}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Xi{constructor(e,n,r){this.converter=n,this._query=r,this.type="query",this.firestore=e}withConverter(e){return new Xi(this.firestore,e,this._query)}}class _t{constructor(e,n,r){this.converter=n,this._key=r,this.type="document",this.firestore=e}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new Oi(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new _t(this.firestore,e,this._key)}toJSON(){return{type:_t._jsonSchemaVersion,referencePath:this._key.toString()}}static fromJSON(e,n,r){if(El(n,_t._jsonSchema))return new _t(e,r||null,new ge(rt.fromString(n.referencePath)))}}_t._jsonSchemaVersion="firestore/documentReference/1.0",_t._jsonSchema={type:Rt("string",_t._jsonSchemaVersion),referencePath:Rt("string")};class Oi extends Xi{constructor(e,n,r){super(e,n,fd(r)),this._path=r,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const e=this._path.popLast();return e.isEmpty()?null:new _t(this.firestore,null,new ge(e))}withConverter(e){return new Oi(this.firestore,e,this._path)}}function Tn(t,e,...n){if(t=Zt(t),mb("collection","path",e),t instanceof bd){const r=rt.fromString(e,...n);return cv(r),new Oi(t,null,r)}{if(!(t instanceof _t||t instanceof Oi))throw new se(q.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(rt.fromString(e,...n));return cv(r),new Oi(t.firestore,null,r)}}function Dt(t,e,...n){if(t=Zt(t),arguments.length===1&&(e=Fm.newId()),mb("doc","path",e),t instanceof bd){const r=rt.fromString(e,...n);return uv(r),new _t(t,null,new ge(r))}{if(!(t instanceof _t||t instanceof Oi))throw new se(q.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(rt.fromString(e,...n));return uv(r),new _t(t.firestore,t instanceof Oi?t.converter:null,new ge(r))}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Jv="AsyncQueue";class Zv{constructor(e=Promise.resolve()){this.Xu=[],this.ec=!1,this.tc=[],this.nc=null,this.rc=!1,this.sc=!1,this.oc=[],this.M_=new aE(this,"async_queue_retry"),this._c=()=>{const r=Dh();r&&ae(Jv,"Visibility state changed to "+r.visibilityState),this.M_.w_()},this.ac=e;const n=Dh();n&&typeof n.addEventListener=="function"&&n.addEventListener("visibilitychange",this._c)}get isShuttingDown(){return this.ec}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.uc(),this.cc(e)}enterRestrictedMode(e){if(!this.ec){this.ec=!0,this.sc=e||!1;const n=Dh();n&&typeof n.removeEventListener=="function"&&n.removeEventListener("visibilitychange",this._c)}}enqueue(e){if(this.uc(),this.ec)return new Promise(()=>{});const n=new Hr;return this.cc(()=>this.ec&&this.sc?Promise.resolve():(e().then(n.resolve,n.reject),n.promise)).then(()=>n.promise)}enqueueRetryable(e){this.enqueueAndForget(()=>(this.Xu.push(e),this.lc()))}async lc(){if(this.Xu.length!==0){try{await this.Xu[0](),this.Xu.shift(),this.M_.reset()}catch(e){if(!Fo(e))throw e;ae(Jv,"Operation failed with retryable error: "+e)}this.Xu.length>0&&this.M_.p_(()=>this.lc())}}cc(e){const n=this.ac.then(()=>(this.rc=!0,e().catch(r=>{throw this.nc=r,this.rc=!1,Yr("INTERNAL UNHANDLED ERROR: ",ex(r)),r}).then(r=>(this.rc=!1,r))));return this.ac=n,n}enqueueAfterDelay(e,n,r){this.uc(),this.oc.indexOf(e)>-1&&(n=0);const i=ig.createAndSchedule(this,e,n,r,s=>this.hc(s));return this.tc.push(i),i}uc(){this.nc&&_e(47125,{Pc:ex(this.nc)})}verifyOperationInProgress(){}async Tc(){let e;do e=this.ac,await e;while(e!==this.ac)}Ic(e){for(const n of this.tc)if(n.timerId===e)return!0;return!1}Ec(e){return this.Tc().then(()=>{this.tc.sort((n,r)=>n.targetTimeMs-r.targetTimeMs);for(const n of this.tc)if(n.skipDelay(),e!=="all"&&n.timerId===e)break;return this.Tc()})}dc(e){this.oc.push(e)}hc(e){const n=this.tc.indexOf(e);this.tc.splice(n,1)}}function ex(t){let e=t.message||"";return t.stack&&(e=t.stack.includes(t.message)?t.stack:t.message+` +`+t.stack),e}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function tx(t){return function(n,r){if(typeof n!="object"||n===null)return!1;const i=n;for(const s of r)if(s in i&&typeof i[s]=="function")return!0;return!1}(t,["next","error","complete"])}class Jr extends bd{constructor(e,n,r,i){super(e,n,r,i),this.type="firestore",this._queue=new Zv,this._persistenceKey=(i==null?void 0:i.name)||"[DEFAULT]"}async _terminate(){if(this._firestoreClient){const e=this._firestoreClient.terminate();this._queue=new Zv(e),this._firestoreClient=void 0,await e}}}function tR(t,e){const n=typeof t=="object"?t:Mm(),r=typeof t=="string"?t:_c,i=ld(n,"firestore").getImmediate({identifier:r});if(!i._initialized){const s=J1("firestore");s&&eR(i,...s)}return i}function Ed(t){if(t._terminated)throw new se(q.FAILED_PRECONDITION,"The client has already been terminated.");return t._firestoreClient||nR(t),t._firestoreClient}function nR(t){var r,i,s;const e=t._freezeSettings(),n=function(a,u,c,f){return new TN(a,u,c,f.host,f.ssl,f.experimentalForceLongPolling,f.experimentalAutoDetectLongPolling,IE(f.experimentalLongPollingOptions),f.useFetchStreams,f.isUsingEmulator)}(t._databaseId,((r=t._app)==null?void 0:r.options.appId)||"",t._persistenceKey,e);t._componentsProvider||(i=e.localCache)!=null&&i._offlineComponentProvider&&((s=e.localCache)!=null&&s._onlineComponentProvider)&&(t._componentsProvider={_offline:e.localCache._offlineComponentProvider,_online:e.localCache._onlineComponentProvider}),t._firestoreClient=new QP(t._authCredentials,t._appCheckCredentials,t._queue,n,t._componentsProvider&&function(a){const u=a==null?void 0:a._online.build();return{_offline:a==null?void 0:a._offline.build(u),_online:u}}(t._componentsProvider))}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Wn{constructor(e){this._byteString=e}static fromBase64String(e){try{return new Wn(en.fromBase64String(e))}catch(n){throw new se(q.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+n)}}static fromUint8Array(e){return new Wn(en.fromUint8Array(e))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return"Bytes(base64: "+this.toBase64()+")"}isEqual(e){return this._byteString.isEqual(e._byteString)}toJSON(){return{type:Wn._jsonSchemaVersion,bytes:this.toBase64()}}static fromJSON(e){if(El(e,Wn._jsonSchema))return Wn.fromBase64String(e.bytes)}}Wn._jsonSchemaVersion="firestore/bytes/1.0",Wn._jsonSchema={type:Rt("string",Wn._jsonSchemaVersion),bytes:Rt("string")};/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Id{constructor(...e){for(let n=0;n90)throw new se(q.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(n)||n<-180||n>180)throw new se(q.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+n);this._lat=e,this._long=n}get latitude(){return this._lat}get longitude(){return this._long}isEqual(e){return this._lat===e._lat&&this._long===e._long}_compareTo(e){return ze(this._lat,e._lat)||ze(this._long,e._long)}toJSON(){return{latitude:this._lat,longitude:this._long,type:Tr._jsonSchemaVersion}}static fromJSON(e){if(El(e,Tr._jsonSchema))return new Tr(e.latitude,e.longitude)}}Tr._jsonSchemaVersion="firestore/geoPoint/1.0",Tr._jsonSchema={type:Rt("string",Tr._jsonSchemaVersion),latitude:Rt("number"),longitude:Rt("number")};/** + * @license + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class kr{constructor(e){this._values=(e||[]).map(n=>n)}toArray(){return this._values.map(e=>e)}isEqual(e){return function(r,i){if(r.length!==i.length)return!1;for(let s=0;stypeof n=="number"))return new kr(e.vectorValues);throw new se(q.INVALID_ARGUMENT,"Expected 'vectorValues' field to be a number array")}}}kr._jsonSchemaVersion="firestore/vectorValue/1.0",kr._jsonSchema={type:Rt("string",kr._jsonSchemaVersion),vectorValues:Rt("object")};/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const rR=/^__.*__$/;class iR{constructor(e,n,r){this.data=e,this.fieldMask=n,this.fieldTransforms=r}toMutation(e,n){return this.fieldMask!==null?new Yi(e,this.data,this.fieldMask,n,this.fieldTransforms):new Il(e,this.data,n,this.fieldTransforms)}}class TE{constructor(e,n,r){this.data=e,this.fieldMask=n,this.fieldTransforms=r}toMutation(e,n){return new Yi(e,this.data,this.fieldMask,n,this.fieldTransforms)}}function kE(t){switch(t){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw _e(40011,{Ac:t})}}class fg{constructor(e,n,r,i,s,o){this.settings=e,this.databaseId=n,this.serializer=r,this.ignoreUndefinedProperties=i,s===void 0&&this.Rc(),this.fieldTransforms=s||[],this.fieldMask=o||[]}get path(){return this.settings.path}get Ac(){return this.settings.Ac}Vc(e){return new fg({...this.settings,...e},this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}mc(e){var i;const n=(i=this.path)==null?void 0:i.child(e),r=this.Vc({path:n,fc:!1});return r.gc(e),r}yc(e){var i;const n=(i=this.path)==null?void 0:i.child(e),r=this.Vc({path:n,fc:!1});return r.Rc(),r}wc(e){return this.Vc({path:void 0,fc:!0})}Sc(e){return Ac(e,this.settings.methodName,this.settings.bc||!1,this.path,this.settings.Dc)}contains(e){return this.fieldMask.find(n=>e.isPrefixOf(n))!==void 0||this.fieldTransforms.find(n=>e.isPrefixOf(n.field))!==void 0}Rc(){if(this.path)for(let e=0;eu.covers(h.field))}else u=null,c=o.fieldTransforms;return new iR(new xn(a),u,c)}class kd extends Sd{_toFieldTransform(e){if(e.Ac!==2)throw e.Ac===1?e.Sc(`${this._methodName}() can only appear at the top level of your update data`):e.Sc(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);return e.fieldMask.push(e.path),null}isEqual(e){return e instanceof kd}}class pg extends Sd{constructor(e,n){super(e),this.Fc=n}_toFieldTransform(e){const n=new dl(e.serializer,Ub(e.serializer,this.Fc));return new XN(e.path,n)}isEqual(e){return e instanceof pg&&this.Fc===e.Fc}}function oR(t,e,n,r){const i=t.Cc(1,e,n);mg("Data must be an object, but it was:",i,r);const s=[],o=xn.empty();Qi(r,(u,c)=>{const f=gg(e,u,n);c=Zt(c);const h=i.yc(f);if(c instanceof kd)s.push(f);else{const p=Cl(c,h);p!=null&&(s.push(f),o.set(f,p))}});const a=new On(s);return new TE(o,a,i.fieldTransforms)}function aR(t,e,n,r,i,s){const o=t.Cc(1,e,n),a=[gp(e,r,n)],u=[i];if(s.length%2!=0)throw new se(q.INVALID_ARGUMENT,`Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);for(let p=0;p=0;--p)if(!PE(c,a[p])){const m=a[p];let b=u[p];b=Zt(b);const S=o.yc(m);if(b instanceof kd)c.push(m);else{const P=Cl(b,S);P!=null&&(c.push(m),f.set(m,P))}}const h=new On(c);return new TE(f,h,o.fieldTransforms)}function lR(t,e,n,r=!1){return Cl(n,t.Cc(r?4:3,e))}function Cl(t,e){if(AE(t=Zt(t)))return mg("Unsupported field value:",e,t),NE(t,e);if(t instanceof Sd)return function(r,i){if(!kE(i.Ac))throw i.Sc(`${r._methodName}() can only be used with update() and set()`);if(!i.path)throw i.Sc(`${r._methodName}() is not currently supported inside arrays`);const s=r._toFieldTransform(i);s&&i.fieldTransforms.push(s)}(t,e),null;if(t===void 0&&e.ignoreUndefinedProperties)return null;if(e.path&&e.fieldMask.push(e.path),t instanceof Array){if(e.settings.fc&&e.Ac!==4)throw e.Sc("Nested arrays are not supported");return function(r,i){const s=[];let o=0;for(const a of r){let u=Cl(a,i.wc(o));u==null&&(u={nullValue:"NULL_VALUE"}),s.push(u),o++}return{arrayValue:{values:s}}}(t,e)}return function(r,i){if((r=Zt(r))===null)return{nullValue:"NULL_VALUE"};if(typeof r=="number")return Ub(i.serializer,r);if(typeof r=="boolean")return{booleanValue:r};if(typeof r=="string")return{stringValue:r};if(r instanceof Date){const s=Qe.fromDate(r);return{timestampValue:Sc(i.serializer,s)}}if(r instanceof Qe){const s=new Qe(r.seconds,1e3*Math.floor(r.nanoseconds/1e3));return{timestampValue:Sc(i.serializer,s)}}if(r instanceof Tr)return{geoPointValue:{latitude:r.latitude,longitude:r.longitude}};if(r instanceof Wn)return{bytesValue:Yb(i.serializer,r._byteString)};if(r instanceof _t){const s=i.databaseId,o=r.firestore._databaseId;if(!o.isEqual(s))throw i.Sc(`Document reference is for database ${o.projectId}/${o.database} but should be for database ${s.projectId}/${s.database}`);return{referenceValue:Qm(r.firestore._databaseId||i.databaseId,r._key.path)}}if(r instanceof kr)return function(o,a){return{mapValue:{fields:{[Ib]:{stringValue:Sb},[bc]:{arrayValue:{values:o.toArray().map(c=>{if(typeof c!="number")throw a.Sc("VectorValues must only contain numeric values.");return qm(a.serializer,c)})}}}}}}(r,i);throw i.Sc(`Unsupported field value: ${ud(r)}`)}(t,e)}function NE(t,e){const n={};return vb(t)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):Qi(t,(r,i)=>{const s=Cl(i,e.mc(r));s!=null&&(n[r]=s)}),{mapValue:{fields:n}}}function AE(t){return!(typeof t!="object"||t===null||t instanceof Array||t instanceof Date||t instanceof Qe||t instanceof Tr||t instanceof Wn||t instanceof _t||t instanceof Sd||t instanceof kr)}function mg(t,e,n){if(!AE(n)||!gb(n)){const r=ud(n);throw r==="an object"?e.Sc(t+" a custom object"):e.Sc(t+" "+r)}}function gp(t,e,n){if((e=Zt(e))instanceof Id)return e._internalPath;if(typeof e=="string")return gg(t,e);throw Ac("Field path arguments must be of type string or ",t,!1,void 0,n)}const uR=new RegExp("[~\\*/\\[\\]]");function gg(t,e,n){if(e.search(uR)>=0)throw Ac(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,t,!1,void 0,n);try{return new Id(...e.split("."))._internalPath}catch{throw Ac(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,t,!1,void 0,n)}}function Ac(t,e,n,r,i){const s=r&&!r.isEmpty(),o=i!==void 0;let a=`Function ${e}() called with invalid data`;n&&(a+=" (via `toFirestore()`)"),a+=". ";let u="";return(s||o)&&(u+=" (found",s&&(u+=` in field ${r}`),o&&(u+=` in document ${i}`),u+=")"),new se(q.INVALID_ARGUMENT,a+t+u)}function PE(t,e){return t.some(n=>n.isEqual(e))}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class RE{constructor(e,n,r,i,s){this._firestore=e,this._userDataWriter=n,this._key=r,this._document=i,this._converter=s}get id(){return this._key.path.lastSegment()}get ref(){return new _t(this._firestore,this._converter,this._key)}exists(){return this._document!==null}data(){if(this._document){if(this._converter){const e=new cR(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(e)}return this._userDataWriter.convertValue(this._document.data.value)}}get(e){if(this._document){const n=this._document.data.field(Cd("DocumentSnapshot.get",e));if(n!==null)return this._userDataWriter.convertValue(n)}}}class cR extends RE{data(){return super.data()}}function Cd(t,e){return typeof e=="string"?gg(t,e):e instanceof Id?e._internalPath:e._delegate._internalPath}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function DE(t){if(t.limitType==="L"&&t.explicitOrderBy.length===0)throw new se(q.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class yg{}class jE extends yg{}function Zr(t,e,...n){let r=[];e instanceof yg&&r.push(e),r=r.concat(n),function(s){const o=s.filter(u=>u instanceof vg).length,a=s.filter(u=>u instanceof Nd).length;if(o>1||o>0&&a>0)throw new se(q.INVALID_ARGUMENT,"InvalidQuery. When using composite filters, you cannot use more than one filter at the top level. Consider nesting the multiple filters within an `and(...)` statement. For example: change `query(query, where(...), or(...))` to `query(query, and(where(...), or(...)))`.")}(r);for(const i of r)t=i._apply(t);return t}class Nd extends jE{constructor(e,n,r){super(),this._field=e,this._op=n,this._value=r,this.type="where"}static _create(e,n,r){return new Nd(e,n,r)}_apply(e){const n=this._parse(e);return LE(e._query,n),new Xi(e.firestore,e.converter,sp(e._query,n))}_parse(e){const n=Td(e.firestore);return function(s,o,a,u,c,f,h){let p;if(c.isKeyField()){if(f==="array-contains"||f==="array-contains-any")throw new se(q.INVALID_ARGUMENT,`Invalid Query. You can't perform '${f}' queries on documentId().`);if(f==="in"||f==="not-in"){rx(h,f);const b=[];for(const S of h)b.push(nx(u,s,S));p={arrayValue:{values:b}}}else p=nx(u,s,h)}else f!=="in"&&f!=="not-in"&&f!=="array-contains-any"||rx(h,f),p=lR(a,o,h,f==="in"||f==="not-in");return Pt.create(c,f,p)}(e._query,"where",n,e.firestore._databaseId,this._field,this._op,this._value)}}function js(t,e,n){const r=e,i=Cd("where",t);return Nd._create(i,r,n)}class vg extends yg{constructor(e,n){super(),this.type=e,this._queryConstraints=n}static _create(e,n){return new vg(e,n)}_parse(e){const n=this._queryConstraints.map(r=>r._parse(e)).filter(r=>r.getFilters().length>0);return n.length===1?n[0]:cr.create(n,this._getOperator())}_apply(e){const n=this._parse(e);return n.getFilters().length===0?e:(function(i,s){let o=i;const a=s.getFlattenedFilters();for(const u of a)LE(o,u),o=sp(o,u)}(e._query,n),new Xi(e.firestore,e.converter,sp(e._query,n)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return this.type==="and"?"and":"or"}}class xg extends jE{constructor(e,n){super(),this._field=e,this._direction=n,this.type="orderBy"}static _create(e,n){return new xg(e,n)}_apply(e){const n=function(i,s,o){if(i.startAt!==null)throw new se(q.INVALID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(i.endAt!==null)throw new se(q.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");return new ll(s,o)}(e._query,this._field,this._direction);return new Xi(e.firestore,e.converter,function(i,s){const o=i.explicitOrderBy.concat([s]);return new Uo(i.path,i.collectionGroup,o,i.filters.slice(),i.limit,i.limitType,i.startAt,i.endAt)}(e._query,n))}}function dR(t,e="asc"){const n=e,r=Cd("orderBy",t);return xg._create(r,n)}function nx(t,e,n){if(typeof(n=Zt(n))=="string"){if(n==="")throw new se(q.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!Db(e)&&n.indexOf("/")!==-1)throw new se(q.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);const r=e.path.child(rt.fromString(n));if(!ge.isDocumentKey(r))throw new se(q.INVALID_ARGUMENT,`Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${r}' is not because it has an odd number of segments (${r.length}).`);return vv(t,new ge(r))}if(n instanceof _t)return vv(t,n._key);throw new se(q.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${ud(n)}.`)}function rx(t,e){if(!Array.isArray(t)||t.length===0)throw new se(q.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`)}function LE(t,e){const n=function(i,s){for(const o of i)for(const a of o.getFlattenedFilters())if(s.indexOf(a.op)>=0)return a.op;return null}(t.filters,function(i){switch(i){case"!=":return["!=","not-in"];case"array-contains-any":case"in":return["not-in"];case"not-in":return["array-contains-any","in","not-in","!="];default:return[]}}(e.op));if(n!==null)throw n===e.op?new se(q.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}' filter.`):new se(q.INVALID_ARGUMENT,`Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`)}class hR{convertValue(e,n="none"){switch($i(e)){case 0:return null;case 1:return e.booleanValue;case 2:return St(e.integerValue||e.doubleValue);case 3:return this.convertTimestamp(e.timestampValue);case 4:return this.convertServerTimestamp(e,n);case 5:return e.stringValue;case 6:return this.convertBytes(Bi(e.bytesValue));case 7:return this.convertReference(e.referenceValue);case 8:return this.convertGeoPoint(e.geoPointValue);case 9:return this.convertArray(e.arrayValue,n);case 11:return this.convertObject(e.mapValue,n);case 10:return this.convertVectorValue(e.mapValue);default:throw _e(62114,{value:e})}}convertObject(e,n){return this.convertObjectMap(e.fields,n)}convertObjectMap(e,n="none"){const r={};return Qi(e,(i,s)=>{r[i]=this.convertValue(s,n)}),r}convertVectorValue(e){var r,i,s;const n=(s=(i=(r=e.fields)==null?void 0:r[bc].arrayValue)==null?void 0:i.values)==null?void 0:s.map(o=>St(o.doubleValue));return new kr(n)}convertGeoPoint(e){return new Tr(St(e.latitude),St(e.longitude))}convertArray(e,n){return(e.values||[]).map(r=>this.convertValue(r,n))}convertServerTimestamp(e,n){switch(n){case"previous":const r=hd(e);return r==null?null:this.convertValue(r,n);case"estimate":return this.convertTimestamp(sl(e));default:return null}}convertTimestamp(e){const n=zi(e);return new Qe(n.seconds,n.nanos)}convertDocumentKey(e,n){const r=rt.fromString(e);Ye(nE(r),9688,{name:e});const i=new ol(r.get(1),r.get(3)),s=new ge(r.popFirst(5));return i.isEqual(n)||Yr(`Document ${s} contains a document reference within a different database (${i.projectId}/${i.database}) which is not supported. It will be treated as a reference in the current database (${n.projectId}/${n.database}) instead.`),s}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function OE(t,e,n){let r;return r=t?t.toFirestore(e):e,r}class wa{constructor(e,n){this.hasPendingWrites=e,this.fromCache=n}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}class ps extends RE{constructor(e,n,r,i,s,o){super(e,n,r,i,o),this._firestore=e,this._firestoreImpl=e,this.metadata=s}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){const n=new Vu(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(n,e)}return this._userDataWriter.convertValue(this._document.data.value,e.serverTimestamps)}}get(e,n={}){if(this._document){const r=this._document.data.field(Cd("DocumentSnapshot.get",e));if(r!==null)return this._userDataWriter.convertValue(r,n.serverTimestamps)}}toJSON(){if(this.metadata.hasPendingWrites)throw new se(q.FAILED_PRECONDITION,"DocumentSnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const e=this._document,n={};return n.type=ps._jsonSchemaVersion,n.bundle="",n.bundleSource="DocumentSnapshot",n.bundleName=this._key.toString(),!e||!e.isValidDocument()||!e.isFoundDocument()?n:(this._userDataWriter.convertObjectMap(e.data.value.mapValue.fields,"previous"),n.bundle=(this._firestore,this.ref.path,"NOT SUPPORTED"),n)}}ps._jsonSchemaVersion="firestore/documentSnapshot/1.0",ps._jsonSchema={type:Rt("string",ps._jsonSchemaVersion),bundleSource:Rt("string","DocumentSnapshot"),bundleName:Rt("string"),bundle:Rt("string")};class Vu extends ps{data(e={}){return super.data(e)}}class ms{constructor(e,n,r,i){this._firestore=e,this._userDataWriter=n,this._snapshot=i,this.metadata=new wa(i.hasPendingWrites,i.fromCache),this.query=r}get docs(){const e=[];return this.forEach(n=>e.push(n)),e}get size(){return this._snapshot.docs.size}get empty(){return this.size===0}forEach(e,n){this._snapshot.docs.forEach(r=>{e.call(n,new Vu(this._firestore,this._userDataWriter,r.key,r,new wa(this._snapshot.mutatedKeys.has(r.key),this._snapshot.fromCache),this.query.converter))})}docChanges(e={}){const n=!!e.includeMetadataChanges;if(n&&this._snapshot.excludesMetadataChanges)throw new se(q.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===n||(this._cachedChanges=function(i,s){if(i._snapshot.oldDocs.isEmpty()){let o=0;return i._snapshot.docChanges.map(a=>{const u=new Vu(i._firestore,i._userDataWriter,a.doc.key,a.doc,new wa(i._snapshot.mutatedKeys.has(a.doc.key),i._snapshot.fromCache),i.query.converter);return a.doc,{type:"added",doc:u,oldIndex:-1,newIndex:o++}})}{let o=i._snapshot.oldDocs;return i._snapshot.docChanges.filter(a=>s||a.type!==3).map(a=>{const u=new Vu(i._firestore,i._userDataWriter,a.doc.key,a.doc,new wa(i._snapshot.mutatedKeys.has(a.doc.key),i._snapshot.fromCache),i.query.converter);let c=-1,f=-1;return a.type!==0&&(c=o.indexOf(a.doc.key),o=o.delete(a.doc.key)),a.type!==1&&(o=o.add(a.doc),f=o.indexOf(a.doc.key)),{type:fR(a.type),doc:u,oldIndex:c,newIndex:f}})}}(this,n),this._cachedChangesIncludeMetadataChanges=n),this._cachedChanges}toJSON(){if(this.metadata.hasPendingWrites)throw new se(q.FAILED_PRECONDITION,"QuerySnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const e={};e.type=ms._jsonSchemaVersion,e.bundleSource="QuerySnapshot",e.bundleName=Fm.newId(),this._firestore._databaseId.database,this._firestore._databaseId.projectId;const n=[],r=[],i=[];return this.docs.forEach(s=>{s._document!==null&&(n.push(s._document),r.push(this._userDataWriter.convertObjectMap(s._document.data.value.mapValue.fields,"previous")),i.push(s.ref.path))}),e.bundle=(this._firestore,this.query._query,e.bundleName,"NOT SUPPORTED"),e}}function fR(t){switch(t){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return _e(61501,{type:t})}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function ei(t){t=Sn(t,_t);const e=Sn(t.firestore,Jr);return JP(Ed(e),t._key).then(n=>VE(e,t,n))}ms._jsonSchemaVersion="firestore/querySnapshot/1.0",ms._jsonSchema={type:Rt("string",ms._jsonSchemaVersion),bundleSource:Rt("string","QuerySnapshot"),bundleName:Rt("string"),bundle:Rt("string")};class wg extends hR{constructor(e){super(),this.firestore=e}convertBytes(e){return new Wn(e)}convertReference(e){const n=this.convertDocumentKey(e,this.firestore._databaseId);return new _t(this.firestore,null,n)}}function lr(t){t=Sn(t,Xi);const e=Sn(t.firestore,Jr),n=Ed(e),r=new wg(e);return DE(t._query),ZP(n,t._query).then(i=>new ms(e,r,t,i))}function ME(t,e,n){t=Sn(t,_t);const r=Sn(t.firestore,Jr),i=OE(t.converter,e);return Ad(r,[CE(Td(r),"setDoc",t._key,i,t.converter!==null,n).toMutation(t._key,Yn.none())])}function Ji(t,e,n,...r){t=Sn(t,_t);const i=Sn(t.firestore,Jr),s=Td(i);let o;return o=typeof(e=Zt(e))=="string"||e instanceof Id?aR(s,"updateDoc",t._key,e,n,r):oR(s,"updateDoc",t._key,e),Ad(i,[o.toMutation(t._key,Yn.exists(!0))])}function yp(t){return Ad(Sn(t.firestore,Jr),[new Wm(t._key,Yn.none())])}function _g(t,e){const n=Sn(t.firestore,Jr),r=Dt(t),i=OE(t.converter,e);return Ad(n,[CE(Td(t.firestore),"addDoc",r._key,i,t.converter!==null,{}).toMutation(r._key,Yn.exists(!1))]).then(()=>r)}function bg(t,...e){var u,c,f;t=Zt(t);let n={includeMetadataChanges:!1,source:"default"},r=0;typeof e[r]!="object"||tx(e[r])||(n=e[r++]);const i={includeMetadataChanges:n.includeMetadataChanges,source:n.source};if(tx(e[r])){const h=e[r];e[r]=(u=h.next)==null?void 0:u.bind(h),e[r+1]=(c=h.error)==null?void 0:c.bind(h),e[r+2]=(f=h.complete)==null?void 0:f.bind(h)}let s,o,a;if(t instanceof _t)o=Sn(t.firestore,Jr),a=fd(t._key.path),s={next:h=>{e[r]&&e[r](VE(o,t,h))},error:e[r+1],complete:e[r+2]};else{const h=Sn(t,Xi);o=Sn(h.firestore,Jr),a=h._query;const p=new wg(o);s={next:m=>{e[r]&&e[r](new ms(o,p,h,m))},error:e[r+1],complete:e[r+2]},DE(t._query)}return function(p,m,b,S){const P=new hg(S),y=new ug(m,P,b);return p.asyncQueue.enqueueAndForget(async()=>og(await Nc(p),y)),()=>{P.Nu(),p.asyncQueue.enqueueAndForget(async()=>ag(await Nc(p),y))}}(Ed(o),a,i,s)}function Ad(t,e){return function(r,i){const s=new Hr;return r.asyncQueue.enqueueAndForget(async()=>UP(await XP(r),i,s)),s.promise}(Ed(t),e)}function VE(t,e,n){const r=n.docs.get(e._key),i=new wg(t);return new ps(t,i,e._key,r,new wa(n.hasPendingWrites,n.fromCache),e.converter)}function pR(t){return new pg("increment",t)}(function(e,n=!0){(function(i){Mo=i})(Ps),Is(new Fi("firestore",(r,{instanceIdentifier:i,options:s})=>{const o=r.getProvider("app").getImmediate(),a=new Jr(new aN(r.getProvider("auth-internal")),new cN(o,r.getProvider("app-check-internal")),function(c,f){if(!Object.prototype.hasOwnProperty.apply(c.options,["projectId"]))throw new se(q.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new ol(c.options.projectId,f)}(o,i),o);return s={useFetchStreams:n,...s},a._setSettings(s),a},"PUBLIC").setMultipleInstances(!0)),Er(sv,ov,e),Er(sv,ov,"esm2020")})();/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const FE="firebasestorage.googleapis.com",mR="storageBucket",gR=2*60*1e3,yR=10*60*1e3;/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class jr extends Dr{constructor(e,n,r=0){super(Lh(e),`Firebase Storage: ${n} (${Lh(e)})`),this.status_=r,this.customData={serverResponse:null},this._baseMessage=this.message,Object.setPrototypeOf(this,jr.prototype)}get status(){return this.status_}set status(e){this.status_=e}_codeEquals(e){return Lh(e)===this.code}get serverResponse(){return this.customData.serverResponse}set serverResponse(e){this.customData.serverResponse=e,this.customData.serverResponse?this.message=`${this._baseMessage} +${this.customData.serverResponse}`:this.message=this._baseMessage}}var Pr;(function(t){t.UNKNOWN="unknown",t.OBJECT_NOT_FOUND="object-not-found",t.BUCKET_NOT_FOUND="bucket-not-found",t.PROJECT_NOT_FOUND="project-not-found",t.QUOTA_EXCEEDED="quota-exceeded",t.UNAUTHENTICATED="unauthenticated",t.UNAUTHORIZED="unauthorized",t.UNAUTHORIZED_APP="unauthorized-app",t.RETRY_LIMIT_EXCEEDED="retry-limit-exceeded",t.INVALID_CHECKSUM="invalid-checksum",t.CANCELED="canceled",t.INVALID_EVENT_NAME="invalid-event-name",t.INVALID_URL="invalid-url",t.INVALID_DEFAULT_BUCKET="invalid-default-bucket",t.NO_DEFAULT_BUCKET="no-default-bucket",t.CANNOT_SLICE_BLOB="cannot-slice-blob",t.SERVER_FILE_WRONG_SIZE="server-file-wrong-size",t.NO_DOWNLOAD_URL="no-download-url",t.INVALID_ARGUMENT="invalid-argument",t.INVALID_ARGUMENT_COUNT="invalid-argument-count",t.APP_DELETED="app-deleted",t.INVALID_ROOT_OPERATION="invalid-root-operation",t.INVALID_FORMAT="invalid-format",t.INTERNAL_ERROR="internal-error",t.UNSUPPORTED_ENVIRONMENT="unsupported-environment"})(Pr||(Pr={}));function Lh(t){return"storage/"+t}function vR(){const t="An unknown error occurred, please check the error payload for server response.";return new jr(Pr.UNKNOWN,t)}function xR(){return new jr(Pr.RETRY_LIMIT_EXCEEDED,"Max retry time for operation exceeded, please try again.")}function wR(){return new jr(Pr.CANCELED,"User canceled the upload/download.")}function _R(t){return new jr(Pr.INVALID_URL,"Invalid URL '"+t+"'.")}function bR(t){return new jr(Pr.INVALID_DEFAULT_BUCKET,"Invalid default bucket '"+t+"'.")}function ix(t){return new jr(Pr.INVALID_ARGUMENT,t)}function UE(){return new jr(Pr.APP_DELETED,"The Firebase app was deleted.")}function ER(t){return new jr(Pr.INVALID_ROOT_OPERATION,"The operation '"+t+"' cannot be performed on a root reference, create a non-root reference using child, such as .child('file.png').")}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class ir{constructor(e,n){this.bucket=e,this.path_=n}get path(){return this.path_}get isRoot(){return this.path.length===0}fullServerUrl(){const e=encodeURIComponent;return"/b/"+e(this.bucket)+"/o/"+e(this.path)}bucketOnlyServerUrl(){return"/b/"+encodeURIComponent(this.bucket)+"/o"}static makeFromBucketSpec(e,n){let r;try{r=ir.makeFromUrl(e,n)}catch{return new ir(e,"")}if(r.path==="")return r;throw bR(e)}static makeFromUrl(e,n){let r=null;const i="([A-Za-z0-9.\\-_]+)";function s(L){L.path.charAt(L.path.length-1)==="/"&&(L.path_=L.path_.slice(0,-1))}const o="(/(.*))?$",a=new RegExp("^gs://"+i+o,"i"),u={bucket:1,path:3};function c(L){L.path_=decodeURIComponent(L.path)}const f="v[A-Za-z0-9_]+",h=n.replace(/[.]/g,"\\."),p="(/([^?#]*).*)?$",m=new RegExp(`^https?://${h}/${f}/b/${i}/o${p}`,"i"),b={bucket:1,path:3},S=n===FE?"(?:storage.googleapis.com|storage.cloud.google.com)":n,P="([^?#]*)",y=new RegExp(`^https?://${S}/${i}/${P}`,"i"),T=[{regex:a,indices:u,postModify:s},{regex:m,indices:b,postModify:c},{regex:y,indices:{bucket:1,path:2},postModify:c}];for(let L=0;L{i=null,t(m,u())},P)}function p(){s&&clearTimeout(s)}function m(P,...y){if(c){p();return}if(P){p(),f.call(null,P,...y);return}if(u()||o){p(),f.call(null,P,...y);return}r<64&&(r*=2);let T;a===1?(a=2,T=0):T=(r+Math.random())*1e3,h(T)}let b=!1;function S(P){b||(b=!0,p(),!c&&(i!==null?(P||(a=2),clearTimeout(i),h(0)):P||(a=1)))}return h(0),s=setTimeout(()=>{o=!0,S(!0)},n),S}function TR(t){t(!1)}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function kR(t){return t!==void 0}function sx(t,e,n,r){if(rn)throw ix(`Invalid value for '${t}'. Expected ${n} or less.`)}function CR(t){const e=encodeURIComponent;let n="?";for(const r in t)if(t.hasOwnProperty(r)){const i=e(r)+"="+e(t[r]);n=n+i+"&"}return n=n.slice(0,-1),n}var Pc;(function(t){t[t.NO_ERROR=0]="NO_ERROR",t[t.NETWORK_ERROR=1]="NETWORK_ERROR",t[t.ABORT=2]="ABORT"})(Pc||(Pc={}));/** + * @license + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function NR(t,e){const n=t>=500&&t<600,i=[408,429].indexOf(t)!==-1,s=e.indexOf(t)!==-1;return n||i||s}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class AR{constructor(e,n,r,i,s,o,a,u,c,f,h,p=!0,m=!1){this.url_=e,this.method_=n,this.headers_=r,this.body_=i,this.successCodes_=s,this.additionalRetryCodes_=o,this.callback_=a,this.errorCallback_=u,this.timeout_=c,this.progressCallback_=f,this.connectionFactory_=h,this.retry=p,this.isUsingEmulator=m,this.pendingConnection_=null,this.backoffId_=null,this.canceled_=!1,this.appDelete_=!1,this.promise_=new Promise((b,S)=>{this.resolve_=b,this.reject_=S,this.start_()})}start_(){const e=(r,i)=>{if(i){r(!1,new pu(!1,null,!0));return}const s=this.connectionFactory_();this.pendingConnection_=s;const o=a=>{const u=a.loaded,c=a.lengthComputable?a.total:-1;this.progressCallback_!==null&&this.progressCallback_(u,c)};this.progressCallback_!==null&&s.addUploadProgressListener(o),s.send(this.url_,this.method_,this.isUsingEmulator,this.body_,this.headers_).then(()=>{this.progressCallback_!==null&&s.removeUploadProgressListener(o),this.pendingConnection_=null;const a=s.getErrorCode()===Pc.NO_ERROR,u=s.getStatus();if(!a||NR(u,this.additionalRetryCodes_)&&this.retry){const f=s.getErrorCode()===Pc.ABORT;r(!1,new pu(!1,null,f));return}const c=this.successCodes_.indexOf(u)!==-1;r(!0,new pu(c,s))})},n=(r,i)=>{const s=this.resolve_,o=this.reject_,a=i.connection;if(i.wasSuccessCode)try{const u=this.callback_(a,a.getResponse());kR(u)?s(u):s()}catch(u){o(u)}else if(a!==null){const u=vR();u.serverResponse=a.getErrorText(),this.errorCallback_?o(this.errorCallback_(a,u)):o(u)}else if(i.canceled){const u=this.appDelete_?UE():wR();o(u)}else{const u=xR();o(u)}};this.canceled_?n(!1,new pu(!1,null,!0)):this.backoffId_=SR(e,n,this.timeout_)}getPromise(){return this.promise_}cancel(e){this.canceled_=!0,this.appDelete_=e||!1,this.backoffId_!==null&&TR(this.backoffId_),this.pendingConnection_!==null&&this.pendingConnection_.abort()}}class pu{constructor(e,n,r){this.wasSuccessCode=e,this.connection=n,this.canceled=!!r}}function PR(t,e){e!==null&&e.length>0&&(t.Authorization="Firebase "+e)}function RR(t,e){t["X-Firebase-Storage-Version"]="webjs/"+(e??"AppManager")}function DR(t,e){e&&(t["X-Firebase-GMPID"]=e)}function jR(t,e){e!==null&&(t["X-Firebase-AppCheck"]=e)}function LR(t,e,n,r,i,s,o=!0,a=!1){const u=CR(t.urlParams),c=t.url+u,f=Object.assign({},t.headers);return DR(f,e),PR(f,n),RR(f,s),jR(f,r),new AR(c,t.method,f,t.body,t.successCodes,t.additionalRetryCodes,t.handler,t.errorHandler,t.timeout,t.progressCallback,i,o,a)}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function OR(t){if(t.length===0)return null;const e=t.lastIndexOf("/");return e===-1?"":t.slice(0,e)}function MR(t){const e=t.lastIndexOf("/",t.length-2);return e===-1?t:t.slice(e+1)}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Rc{constructor(e,n){this._service=e,n instanceof ir?this._location=n:this._location=ir.makeFromUrl(n,e.host)}toString(){return"gs://"+this._location.bucket+"/"+this._location.path}_newRef(e,n){return new Rc(e,n)}get root(){const e=new ir(this._location.bucket,"");return this._newRef(this._service,e)}get bucket(){return this._location.bucket}get fullPath(){return this._location.path}get name(){return MR(this._location.path)}get storage(){return this._service}get parent(){const e=OR(this._location.path);if(e===null)return null;const n=new ir(this._location.bucket,e);return new Rc(this._service,n)}_throwIfRoot(e){if(this._location.path==="")throw ER(e)}}function ox(t,e){const n=e==null?void 0:e[mR];return n==null?null:ir.makeFromBucketSpec(n,t)}function VR(t,e,n,r={}){t.host=`${e}:${n}`;const i=As(e);i&&(Dm(`https://${t.host}/b`),jm("Storage",!0)),t._isUsingEmulator=!0,t._protocol=i?"https":"http";const{mockUserToken:s}=r;s&&(t._overrideAuthToken=typeof s=="string"?s:tb(s,t.app.options.projectId))}class FR{constructor(e,n,r,i,s,o=!1){this.app=e,this._authProvider=n,this._appCheckProvider=r,this._url=i,this._firebaseVersion=s,this._isUsingEmulator=o,this._bucket=null,this._host=FE,this._protocol="https",this._appId=null,this._deleted=!1,this._maxOperationRetryTime=gR,this._maxUploadRetryTime=yR,this._requests=new Set,i!=null?this._bucket=ir.makeFromBucketSpec(i,this._host):this._bucket=ox(this._host,this.app.options)}get host(){return this._host}set host(e){this._host=e,this._url!=null?this._bucket=ir.makeFromBucketSpec(this._url,e):this._bucket=ox(e,this.app.options)}get maxUploadRetryTime(){return this._maxUploadRetryTime}set maxUploadRetryTime(e){sx("time",0,Number.POSITIVE_INFINITY,e),this._maxUploadRetryTime=e}get maxOperationRetryTime(){return this._maxOperationRetryTime}set maxOperationRetryTime(e){sx("time",0,Number.POSITIVE_INFINITY,e),this._maxOperationRetryTime=e}async _getAuthToken(){if(this._overrideAuthToken)return this._overrideAuthToken;const e=this._authProvider.getImmediate({optional:!0});if(e){const n=await e.getToken();if(n!==null)return n.accessToken}return null}async _getAppCheckToken(){if(rr(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const e=this._appCheckProvider.getImmediate({optional:!0});return e?(await e.getToken()).token:null}_delete(){return this._deleted||(this._deleted=!0,this._requests.forEach(e=>e.cancel()),this._requests.clear()),Promise.resolve()}_makeStorageReference(e){return new Rc(this,e)}_makeRequest(e,n,r,i,s=!0){if(this._deleted)return new IR(UE());{const o=LR(e,this._appId,r,i,n,this._firebaseVersion,s,this._isUsingEmulator);return this._requests.add(o),o.getPromise().then(()=>this._requests.delete(o),()=>this._requests.delete(o)),o}}async makeRequestWithTokens(e,n){const[r,i]=await Promise.all([this._getAuthToken(),this._getAppCheckToken()]);return this._makeRequest(e,n,r,i).getPromise()}}const ax="@firebase/storage",lx="0.14.0";/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const zE="storage";function UR(t=Mm(),e){t=Zt(t);const r=ld(t,zE).getImmediate({identifier:e}),i=J1("storage");return i&&zR(r,...i),r}function zR(t,e,n,r={}){VR(t,e,n,r)}function BR(t,{instanceIdentifier:e}){const n=t.getProvider("app").getImmediate(),r=t.getProvider("auth-internal"),i=t.getProvider("app-check-internal");return new FR(n,r,i,e,Ps)}function $R(){Is(new Fi(zE,BR,"PUBLIC").setMultipleInstances(!0)),Er(ax,lx,""),Er(ax,lx,"esm2020")}$R();function BE(){return{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}}const HR=BE,$E=new _l("auth","Firebase",BE());/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Dc=new Lm("@firebase/auth");function qR(t,...e){Dc.logLevel<=Ue.WARN&&Dc.warn(`Auth (${Ps}): ${t}`,...e)}function Fu(t,...e){Dc.logLevel<=Ue.ERROR&&Dc.error(`Auth (${Ps}): ${t}`,...e)}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function ti(t,...e){throw Eg(t,...e)}function Cr(t,...e){return Eg(t,...e)}function HE(t,e,n){const r={...HR(),[e]:n};return new _l("auth","Firebase",r).create(e,{appName:t.name})}function gs(t){return HE(t,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function Eg(t,...e){if(typeof t!="string"){const n=e[0],r=[...e.slice(1)];return r[0]&&(r[0].appName=t.name),t._errorFactory.create(n,...r)}return $E.create(t,...e)}function Ee(t,e,...n){if(!t)throw Eg(e,...n)}function zr(t){const e="INTERNAL ASSERTION FAILED: "+t;throw Fu(e),new Error(e)}function ni(t,e){t||zr(e)}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function vp(){var t;return typeof self<"u"&&((t=self.location)==null?void 0:t.href)||""}function WR(){return ux()==="http:"||ux()==="https:"}function ux(){var t;return typeof self<"u"&&((t=self.location)==null?void 0:t.protocol)||null}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function GR(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(WR()||O2()||"connection"in navigator)?navigator.onLine:!0}function KR(){if(typeof navigator>"u")return null;const t=navigator;return t.languages&&t.languages[0]||t.language||null}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Nl{constructor(e,n){this.shortDelay=e,this.longDelay=n,ni(n>e,"Short delay should be less than long delay!"),this.isMobile=D2()||M2()}get(){return GR()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Ig(t,e){ni(t.emulator,"Emulator should always be set here");const{url:n}=t.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class qE{static initialize(e,n,r){this.fetchImpl=e,n&&(this.headersImpl=n),r&&(this.responseImpl=r)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;zr("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;zr("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;zr("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const QR={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const YR=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],XR=new Nl(3e4,6e4);function Sg(t,e){return t.tenantId&&!e.tenantId?{...e,tenantId:t.tenantId}:e}async function Bo(t,e,n,r,i={}){return WE(t,i,async()=>{let s={},o={};r&&(e==="GET"?o=r:s={body:JSON.stringify(r)});const a=bl({key:t.config.apiKey,...o}).slice(1),u=await t._getAdditionalHeaders();u["Content-Type"]="application/json",t.languageCode&&(u["X-Firebase-Locale"]=t.languageCode);const c={method:e,headers:u,...s};return L2()||(c.referrerPolicy="no-referrer"),t.emulatorConfig&&As(t.emulatorConfig.host)&&(c.credentials="include"),qE.fetch()(await GE(t,t.config.apiHost,n,a),c)})}async function WE(t,e,n){t._canInitEmulator=!1;const r={...QR,...e};try{const i=new ZR(t),s=await Promise.race([n(),i.promise]);i.clearNetworkTimeout();const o=await s.json();if("needConfirmation"in o)throw mu(t,"account-exists-with-different-credential",o);if(s.ok&&!("errorMessage"in o))return o;{const a=s.ok?o.errorMessage:o.error.message,[u,c]=a.split(" : ");if(u==="FEDERATED_USER_ID_ALREADY_LINKED")throw mu(t,"credential-already-in-use",o);if(u==="EMAIL_EXISTS")throw mu(t,"email-already-in-use",o);if(u==="USER_DISABLED")throw mu(t,"user-disabled",o);const f=r[u]||u.toLowerCase().replace(/[_\s]+/g,"-");if(c)throw HE(t,f,c);ti(t,f)}}catch(i){if(i instanceof Dr)throw i;ti(t,"network-request-failed",{message:String(i)})}}async function JR(t,e,n,r,i={}){const s=await Bo(t,e,n,r,i);return"mfaPendingCredential"in s&&ti(t,"multi-factor-auth-required",{_serverResponse:s}),s}async function GE(t,e,n,r){const i=`${e}${n}?${r}`,s=t,o=s.config.emulator?Ig(t.config,i):`${t.config.apiScheme}://${i}`;return YR.includes(n)&&(await s._persistenceManagerAvailable,s._getPersistenceType()==="COOKIE")?s._getPersistence()._getFinalTarget(o).toString():o}class ZR{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((n,r)=>{this.timer=setTimeout(()=>r(Cr(this.auth,"network-request-failed")),XR.get())})}}function mu(t,e,n){const r={appName:t.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const i=Cr(t,e,r);return i.customData._tokenResponse=n,i}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function e4(t,e){return Bo(t,"POST","/v1/accounts:delete",e)}async function jc(t,e){return Bo(t,"POST","/v1/accounts:lookup",e)}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function La(t){if(t)try{const e=new Date(Number(t));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function t4(t,e=!1){const n=Zt(t),r=await n.getIdToken(e),i=Tg(r);Ee(i&&i.exp&&i.auth_time&&i.iat,n.auth,"internal-error");const s=typeof i.firebase=="object"?i.firebase:void 0,o=s==null?void 0:s.sign_in_provider;return{claims:i,token:r,authTime:La(Oh(i.auth_time)),issuedAtTime:La(Oh(i.iat)),expirationTime:La(Oh(i.exp)),signInProvider:o||null,signInSecondFactor:(s==null?void 0:s.sign_in_second_factor)||null}}function Oh(t){return Number(t)*1e3}function Tg(t){const[e,n,r]=t.split(".");if(e===void 0||n===void 0||r===void 0)return Fu("JWT malformed, contained fewer than 3 sections"),null;try{const i=Y1(n);return i?JSON.parse(i):(Fu("Failed to decode base64 JWT payload"),null)}catch(i){return Fu("Caught error parsing JWT payload as JSON",i==null?void 0:i.toString()),null}}function cx(t){const e=Tg(t);return Ee(e,"internal-error"),Ee(typeof e.exp<"u","internal-error"),Ee(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function hl(t,e,n=!1){if(n)return e;try{return await e}catch(r){throw r instanceof Dr&&n4(r)&&t.auth.currentUser===t&&await t.auth.signOut(),r}}function n4({code:t}){return t==="auth/user-disabled"||t==="auth/user-token-expired"}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class r4{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(e){if(e){const n=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),n}else{this.errorBackoff=3e4;const r=(this.user.stsTokenManager.expirationTime??0)-Date.now()-3e5;return Math.max(0,r)}}schedule(e=!1){if(!this.isRunning)return;const n=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},n)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){(e==null?void 0:e.code)==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class xp{constructor(e,n){this.createdAt=e,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=La(this.lastLoginAt),this.creationTime=La(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function Lc(t){var h;const e=t.auth,n=await t.getIdToken(),r=await hl(t,jc(e,{idToken:n}));Ee(r==null?void 0:r.users.length,e,"internal-error");const i=r.users[0];t._notifyReloadListener(i);const s=(h=i.providerUserInfo)!=null&&h.length?KE(i.providerUserInfo):[],o=s4(t.providerData,s),a=t.isAnonymous,u=!(t.email&&i.passwordHash)&&!(o!=null&&o.length),c=a?u:!1,f={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:o,metadata:new xp(i.createdAt,i.lastLoginAt),isAnonymous:c};Object.assign(t,f)}async function i4(t){const e=Zt(t);await Lc(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function s4(t,e){return[...t.filter(r=>!e.some(i=>i.providerId===r.providerId)),...e]}function KE(t){return t.map(({providerId:e,...n})=>({providerId:e,uid:n.rawId||"",displayName:n.displayName||null,email:n.email||null,phoneNumber:n.phoneNumber||null,photoURL:n.photoUrl||null}))}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function o4(t,e){const n=await WE(t,{},async()=>{const r=bl({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:i,apiKey:s}=t.config,o=await GE(t,i,"/v1/token",`key=${s}`),a=await t._getAdditionalHeaders();a["Content-Type"]="application/x-www-form-urlencoded";const u={method:"POST",headers:a,body:r};return t.emulatorConfig&&As(t.emulatorConfig.host)&&(u.credentials="include"),qE.fetch()(o,u)});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function a4(t,e){return Bo(t,"POST","/v2/accounts:revokeToken",Sg(t,e))}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class fo{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){Ee(e.idToken,"internal-error"),Ee(typeof e.idToken<"u","internal-error"),Ee(typeof e.refreshToken<"u","internal-error");const n="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):cx(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,n)}updateFromIdToken(e){Ee(e.length!==0,"internal-error");const n=cx(e);this.updateTokensAndExpiration(e,null,n)}async getToken(e,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(Ee(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(e,n){const{accessToken:r,refreshToken:i,expiresIn:s}=await o4(e,n);this.updateTokensAndExpiration(r,i,Number(s))}updateTokensAndExpiration(e,n,r){this.refreshToken=n||null,this.accessToken=e||null,this.expirationTime=Date.now()+r*1e3}static fromJSON(e,n){const{refreshToken:r,accessToken:i,expirationTime:s}=n,o=new fo;return r&&(Ee(typeof r=="string","internal-error",{appName:e}),o.refreshToken=r),i&&(Ee(typeof i=="string","internal-error",{appName:e}),o.accessToken=i),s&&(Ee(typeof s=="number","internal-error",{appName:e}),o.expirationTime=s),o}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new fo,this.toJSON())}_performRefresh(){return zr("not implemented")}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function hi(t,e){Ee(typeof t=="string"||typeof t>"u","internal-error",{appName:e})}class sr{constructor({uid:e,auth:n,stsTokenManager:r,...i}){this.providerId="firebase",this.proactiveRefresh=new r4(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=n,this.stsTokenManager=r,this.accessToken=r.accessToken,this.displayName=i.displayName||null,this.email=i.email||null,this.emailVerified=i.emailVerified||!1,this.phoneNumber=i.phoneNumber||null,this.photoURL=i.photoURL||null,this.isAnonymous=i.isAnonymous||!1,this.tenantId=i.tenantId||null,this.providerData=i.providerData?[...i.providerData]:[],this.metadata=new xp(i.createdAt||void 0,i.lastLoginAt||void 0)}async getIdToken(e){const n=await hl(this,this.stsTokenManager.getToken(this.auth,e));return Ee(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(e){return t4(this,e)}reload(){return i4(this)}_assign(e){this!==e&&(Ee(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(n=>({...n})),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){const n=new sr({...this,auth:e,stsTokenManager:this.stsTokenManager._clone()});return n.metadata._copy(this.metadata),n}_onReload(e){Ee(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,n=!1){let r=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),r=!0),n&&await Lc(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(rr(this.auth.app))return Promise.reject(gs(this.auth));const e=await this.getIdToken();return await hl(this,e4(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return{uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>({...e})),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId,...this.metadata.toJSON(),apiKey:this.auth.config.apiKey,appName:this.auth.name}}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,n){const r=n.displayName??void 0,i=n.email??void 0,s=n.phoneNumber??void 0,o=n.photoURL??void 0,a=n.tenantId??void 0,u=n._redirectEventId??void 0,c=n.createdAt??void 0,f=n.lastLoginAt??void 0,{uid:h,emailVerified:p,isAnonymous:m,providerData:b,stsTokenManager:S}=n;Ee(h&&S,e,"internal-error");const P=fo.fromJSON(this.name,S);Ee(typeof h=="string",e,"internal-error"),hi(r,e.name),hi(i,e.name),Ee(typeof p=="boolean",e,"internal-error"),Ee(typeof m=="boolean",e,"internal-error"),hi(s,e.name),hi(o,e.name),hi(a,e.name),hi(u,e.name),hi(c,e.name),hi(f,e.name);const y=new sr({uid:h,auth:e,email:i,emailVerified:p,displayName:r,isAnonymous:m,photoURL:o,phoneNumber:s,tenantId:a,stsTokenManager:P,createdAt:c,lastLoginAt:f});return b&&Array.isArray(b)&&(y.providerData=b.map(w=>({...w}))),u&&(y._redirectEventId=u),y}static async _fromIdTokenResponse(e,n,r=!1){const i=new fo;i.updateFromServerResponse(n);const s=new sr({uid:n.localId,auth:e,stsTokenManager:i,isAnonymous:r});return await Lc(s),s}static async _fromGetAccountInfoResponse(e,n,r){const i=n.users[0];Ee(i.localId!==void 0,"internal-error");const s=i.providerUserInfo!==void 0?KE(i.providerUserInfo):[],o=!(i.email&&i.passwordHash)&&!(s!=null&&s.length),a=new fo;a.updateFromIdToken(r);const u=new sr({uid:i.localId,auth:e,stsTokenManager:a,isAnonymous:o}),c={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:s,metadata:new xp(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash)&&!(s!=null&&s.length)};return Object.assign(u,c),u}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const dx=new Map;function Br(t){ni(t instanceof Function,"Expected a class definition");let e=dx.get(t);return e?(ni(e instanceof t,"Instance stored in cache mismatched with class"),e):(e=new t,dx.set(t,e),e)}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class QE{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,n){this.storage[e]=n}async _get(e){const n=this.storage[e];return n===void 0?null:n}async _remove(e){delete this.storage[e]}_addListener(e,n){}_removeListener(e,n){}}QE.type="NONE";const hx=QE;/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Uu(t,e,n){return`firebase:${t}:${e}:${n}`}class po{constructor(e,n,r){this.persistence=e,this.auth=n,this.userKey=r;const{config:i,name:s}=this.auth;this.fullUserKey=Uu(this.userKey,i.apiKey,s),this.fullPersistenceKey=Uu("persistence",i.apiKey,s),this.boundEventHandler=n._onStorageEvent.bind(n),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){const e=await this.persistence._get(this.fullUserKey);if(!e)return null;if(typeof e=="string"){const n=await jc(this.auth,{idToken:e}).catch(()=>{});return n?sr._fromGetAccountInfoResponse(this.auth,n,e):null}return sr._fromJSON(this.auth,e)}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;const n=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,n)return this.setCurrentUser(n)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,n,r="authUser"){if(!n.length)return new po(Br(hx),e,r);const i=(await Promise.all(n.map(async c=>{if(await c._isAvailable())return c}))).filter(c=>c);let s=i[0]||Br(hx);const o=Uu(r,e.config.apiKey,e.name);let a=null;for(const c of n)try{const f=await c._get(o);if(f){let h;if(typeof f=="string"){const p=await jc(e,{idToken:f}).catch(()=>{});if(!p)break;h=await sr._fromGetAccountInfoResponse(e,p,f)}else h=sr._fromJSON(e,f);c!==s&&(a=h),s=c;break}}catch{}const u=i.filter(c=>c._shouldAllowMigration);return!s._shouldAllowMigration||!u.length?new po(s,e,r):(s=u[0],a&&await s._set(o,a.toJSON()),await Promise.all(n.map(async c=>{if(c!==s)try{await c._remove(o)}catch{}})),new po(s,e,r))}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function fx(t){const e=t.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(ZE(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(YE(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(tI(e))return"Blackberry";if(nI(e))return"Webos";if(XE(e))return"Safari";if((e.includes("chrome/")||JE(e))&&!e.includes("edge/"))return"Chrome";if(eI(e))return"Android";{const n=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,r=t.match(n);if((r==null?void 0:r.length)===2)return r[1]}return"Other"}function YE(t=un()){return/firefox\//i.test(t)}function XE(t=un()){const e=t.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function JE(t=un()){return/crios\//i.test(t)}function ZE(t=un()){return/iemobile/i.test(t)}function eI(t=un()){return/android/i.test(t)}function tI(t=un()){return/blackberry/i.test(t)}function nI(t=un()){return/webos/i.test(t)}function kg(t=un()){return/iphone|ipad|ipod/i.test(t)||/macintosh/i.test(t)&&/mobile/i.test(t)}function l4(t=un()){var e;return kg(t)&&!!((e=window.navigator)!=null&&e.standalone)}function u4(){return V2()&&document.documentMode===10}function rI(t=un()){return kg(t)||eI(t)||nI(t)||tI(t)||/windows phone/i.test(t)||ZE(t)}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function iI(t,e=[]){let n;switch(t){case"Browser":n=fx(un());break;case"Worker":n=`${fx(un())}-${t}`;break;default:n=t}const r=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${Ps}/${r}`}/** + * @license + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class c4{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,n){const r=s=>new Promise((o,a)=>{try{const u=e(s);o(u)}catch(u){a(u)}});r.onAbort=n,this.queue.push(r);const i=this.queue.length-1;return()=>{this.queue[i]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;const n=[];try{for(const r of this.queue)await r(e),r.onAbort&&n.push(r.onAbort)}catch(r){n.reverse();for(const i of n)try{i()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:r==null?void 0:r.message})}}}/** + * @license + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function d4(t,e={}){return Bo(t,"GET","/v2/passwordPolicy",Sg(t,e))}/** + * @license + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const h4=6;class f4{constructor(e){var r;const n=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=n.minPasswordLength??h4,n.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=n.maxPasswordLength),n.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=n.containsLowercaseCharacter),n.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=n.containsUppercaseCharacter),n.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=n.containsNumericCharacter),n.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=n.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=((r=e.allowedNonAlphanumericCharacters)==null?void 0:r.join(""))??"",this.forceUpgradeOnSignin=e.forceUpgradeOnSignin??!1,this.schemaVersion=e.schemaVersion}validatePassword(e){const n={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,n),this.validatePasswordCharacterOptions(e,n),n.isValid&&(n.isValid=n.meetsMinPasswordLength??!0),n.isValid&&(n.isValid=n.meetsMaxPasswordLength??!0),n.isValid&&(n.isValid=n.containsLowercaseLetter??!0),n.isValid&&(n.isValid=n.containsUppercaseLetter??!0),n.isValid&&(n.isValid=n.containsNumericCharacter??!0),n.isValid&&(n.isValid=n.containsNonAlphanumericCharacter??!0),n}validatePasswordLengthOptions(e,n){const r=this.customStrengthOptions.minPasswordLength,i=this.customStrengthOptions.maxPasswordLength;r&&(n.meetsMinPasswordLength=e.length>=r),i&&(n.meetsMaxPasswordLength=e.length<=i)}validatePasswordCharacterOptions(e,n){this.updatePasswordCharacterOptionsStatuses(n,!1,!1,!1,!1);let r;for(let i=0;i="a"&&r<="z",r>="A"&&r<="Z",r>="0"&&r<="9",this.allowedNonAlphanumericCharacters.includes(r))}updatePasswordCharacterOptionsStatuses(e,n,r,i,s){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=n)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=r)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=i)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=s))}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class p4{constructor(e,n,r,i){this.app=e,this.heartbeatServiceProvider=n,this.appCheckServiceProvider=r,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new px(this),this.idTokenSubscription=new px(this),this.beforeStateQueue=new c4(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=$E,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this._resolvePersistenceManagerAvailable=void 0,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=i.sdkClientVersion,this._persistenceManagerAvailable=new Promise(s=>this._resolvePersistenceManagerAvailable=s)}_initializeWithPersistence(e,n){return n&&(this._popupRedirectResolver=Br(n)),this._initializationPromise=this.queue(async()=>{var r,i,s;if(!this._deleted&&(this.persistenceManager=await po.create(this,e),(r=this._resolvePersistenceManagerAvailable)==null||r.call(this),!this._deleted)){if((i=this._popupRedirectResolver)!=null&&i._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(n),this.lastNotifiedUid=((s=this.currentUser)==null?void 0:s.uid)||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const e=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!e)){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUserFromIdToken(e){try{const n=await jc(this,{idToken:e}),r=await sr._fromGetAccountInfoResponse(this,n,e);await this.directlySetCurrentUser(r)}catch(n){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",n),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){var s;if(rr(this.app)){const o=this.app.settings.authIdToken;return o?new Promise(a=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(o).then(a,a))}):this.directlySetCurrentUser(null)}const n=await this.assertedPersistence.getCurrentUser();let r=n,i=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const o=(s=this.redirectUser)==null?void 0:s._redirectEventId,a=r==null?void 0:r._redirectEventId,u=await this.tryRedirectSignIn(e);(!o||o===a)&&(u!=null&&u.user)&&(r=u.user,i=!0)}if(!r)return this.directlySetCurrentUser(null);if(!r._redirectEventId){if(i)try{await this.beforeStateQueue.runMiddleware(r)}catch(o){r=n,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(o))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return Ee(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===r._redirectEventId?this.directlySetCurrentUser(r):this.reloadAndSetCurrentUserOrClear(r)}async tryRedirectSignIn(e){let n=null;try{n=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return n}async reloadAndSetCurrentUserOrClear(e){try{await Lc(e)}catch(n){if((n==null?void 0:n.code)!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=KR()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(rr(this.app))return Promise.reject(gs(this));const n=e?Zt(e):null;return n&&Ee(n.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(n&&n._clone(this))}async _updateCurrentUser(e,n=!1){if(!this._deleted)return e&&Ee(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),n||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return rr(this.app)?Promise.reject(gs(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return rr(this.app)?Promise.reject(gs(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(Br(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();const n=this._getPasswordPolicyInternal();return n.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):n.validatePassword(e)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){const e=await d4(this),n=new f4(e);this.tenantId===null?this._projectPasswordPolicy=n:this._tenantPasswordPolicies[this.tenantId]=n}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(e){this._errorFactory=new _l("auth","Firebase",e())}onAuthStateChanged(e,n,r){return this.registerStateListener(this.authStateSubscription,e,n,r)}beforeAuthStateChanged(e,n){return this.beforeStateQueue.pushCallback(e,n)}onIdTokenChanged(e,n,r){return this.registerStateListener(this.idTokenSubscription,e,n,r)}authStateReady(){return new Promise((e,n)=>{if(this.currentUser)e();else{const r=this.onAuthStateChanged(()=>{r(),e()},n)}})}async revokeAccessToken(e){if(this.currentUser){const n=await this.currentUser.getIdToken(),r={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:n};this.tenantId!=null&&(r.tenantId=this.tenantId),await a4(this,r)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:(e=this._currentUser)==null?void 0:e.toJSON()}}async _setRedirectUser(e,n){const r=await this.getOrInitRedirectPersistenceManager(n);return e===null?r.removeCurrentUser():r.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){const n=e&&Br(e)||this._popupRedirectResolver;Ee(n,this,"argument-error"),this.redirectPersistenceManager=await po.create(this,[Br(n._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var n,r;return this._isInitialized&&await this.queue(async()=>{}),((n=this._currentUser)==null?void 0:n._redirectEventId)===e?this._currentUser:((r=this.redirectUser)==null?void 0:r._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var n;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const e=((n=this.currentUser)==null?void 0:n.uid)??null;this.lastNotifiedUid!==e&&(this.lastNotifiedUid=e,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,n,r,i){if(this._deleted)return()=>{};const s=typeof n=="function"?n:n.next.bind(n);let o=!1;const a=this._isInitialized?Promise.resolve():this._initializationPromise;if(Ee(a,this,"internal-error"),a.then(()=>{o||s(this.currentUser)}),typeof n=="function"){const u=e.addObserver(n,r,i);return()=>{o=!0,u()}}else{const u=e.addObserver(n);return()=>{o=!0,u()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return Ee(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=iI(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var i;const e={"X-Client-Version":this.clientVersion};this.app.options.appId&&(e["X-Firebase-gmpid"]=this.app.options.appId);const n=await((i=this.heartbeatServiceProvider.getImmediate({optional:!0}))==null?void 0:i.getHeartbeatsHeader());n&&(e["X-Firebase-Client"]=n);const r=await this._getAppCheckToken();return r&&(e["X-Firebase-AppCheck"]=r),e}async _getAppCheckToken(){var n;if(rr(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const e=await((n=this.appCheckServiceProvider.getImmediate({optional:!0}))==null?void 0:n.getToken());return e!=null&&e.error&&qR(`Error while retrieving App Check token: ${e.error}`),e==null?void 0:e.token}}function Cg(t){return Zt(t)}class px{constructor(e){this.auth=e,this.observer=null,this.addObserver=W2(n=>this.observer=n)}get next(){return Ee(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */let Ng={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function m4(t){Ng=t}function g4(t){return Ng.loadJS(t)}function y4(){return Ng.gapiScript}function v4(t){return`__${t}${Math.floor(Math.random()*1e6)}`}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function x4(t,e){const n=ld(t,"auth");if(n.isInitialized()){const i=n.getImmediate(),s=n.getOptions();if(Es(s,e??{}))return i;ti(i,"already-initialized")}return n.initialize({options:e})}function w4(t,e){const n=(e==null?void 0:e.persistence)||[],r=(Array.isArray(n)?n:[n]).map(Br);e!=null&&e.errorMap&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(r,e==null?void 0:e.popupRedirectResolver)}function _4(t,e,n){const r=Cg(t);Ee(/^https?:\/\//.test(e),r,"invalid-emulator-scheme");const i=!1,s=sI(e),{host:o,port:a}=b4(e),u=a===null?"":`:${a}`,c={url:`${s}//${o}${u}/`},f=Object.freeze({host:o,port:a,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:i})});if(!r._canInitEmulator){Ee(r.config.emulator&&r.emulatorConfig,r,"emulator-config-failed"),Ee(Es(c,r.config.emulator)&&Es(f,r.emulatorConfig),r,"emulator-config-failed");return}r.config.emulator=c,r.emulatorConfig=f,r.settings.appVerificationDisabledForTesting=!0,As(o)?(Dm(`${s}//${o}${u}`),jm("Auth",!0)):E4()}function sI(t){const e=t.indexOf(":");return e<0?"":t.substr(0,e+1)}function b4(t){const e=sI(t),n=/(\/\/)?([^?#/]+)/.exec(t.substr(e.length));if(!n)return{host:"",port:null};const r=n[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(r);if(i){const s=i[1];return{host:s,port:mx(r.substr(s.length+1))}}else{const[s,o]=r.split(":");return{host:s,port:mx(o)}}}function mx(t){if(!t)return null;const e=Number(t);return isNaN(e)?null:e}function E4(){function t(){const e=document.createElement("p"),n=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",n.position="fixed",n.width="100%",n.backgroundColor="#ffffff",n.border=".1em solid #000000",n.color="#b50000",n.bottom="0px",n.left="0px",n.margin="0px",n.zIndex="10000",n.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",t):t())}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class oI{constructor(e,n){this.providerId=e,this.signInMethod=n}toJSON(){return zr("not implemented")}_getIdTokenResponse(e){return zr("not implemented")}_linkToIdToken(e,n){return zr("not implemented")}_getReauthenticationResolver(e){return zr("not implemented")}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function mo(t,e){return JR(t,"POST","/v1/accounts:signInWithIdp",Sg(t,e))}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const I4="http://localhost";class ks extends oI{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const n=new ks(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(n.idToken=e.idToken),e.accessToken&&(n.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(n.nonce=e.nonce),e.pendingToken&&(n.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(n.accessToken=e.oauthToken,n.secret=e.oauthTokenSecret):ti("argument-error"),n}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){const n=typeof e=="string"?JSON.parse(e):e,{providerId:r,signInMethod:i,...s}=n;if(!r||!i)return null;const o=new ks(r,i);return o.idToken=s.idToken||void 0,o.accessToken=s.accessToken||void 0,o.secret=s.secret,o.nonce=s.nonce,o.pendingToken=s.pendingToken||null,o}_getIdTokenResponse(e){const n=this.buildRequest();return mo(e,n)}_linkToIdToken(e,n){const r=this.buildRequest();return r.idToken=n,mo(e,r)}_getReauthenticationResolver(e){const n=this.buildRequest();return n.autoCreate=!1,mo(e,n)}buildRequest(){const e={requestUri:I4,returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{const n={};this.idToken&&(n.id_token=this.idToken),this.accessToken&&(n.access_token=this.accessToken),this.secret&&(n.oauth_token_secret=this.secret),n.providerId=this.providerId,this.nonce&&!this.pendingToken&&(n.nonce=this.nonce),e.postBody=bl(n)}return e}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class aI{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Al extends aI{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class vi extends Al{constructor(){super("facebook.com")}static credential(e){return ks._fromParams({providerId:vi.PROVIDER_ID,signInMethod:vi.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return vi.credentialFromTaggedObject(e)}static credentialFromError(e){return vi.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return vi.credential(e.oauthAccessToken)}catch{return null}}}vi.FACEBOOK_SIGN_IN_METHOD="facebook.com";vi.PROVIDER_ID="facebook.com";/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Vr extends Al{constructor(){super("google.com"),this.addScope("profile")}static credential(e,n){return ks._fromParams({providerId:Vr.PROVIDER_ID,signInMethod:Vr.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:n})}static credentialFromResult(e){return Vr.credentialFromTaggedObject(e)}static credentialFromError(e){return Vr.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:n,oauthAccessToken:r}=e;if(!n&&!r)return null;try{return Vr.credential(n,r)}catch{return null}}}Vr.GOOGLE_SIGN_IN_METHOD="google.com";Vr.PROVIDER_ID="google.com";/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class xi extends Al{constructor(){super("github.com")}static credential(e){return ks._fromParams({providerId:xi.PROVIDER_ID,signInMethod:xi.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return xi.credentialFromTaggedObject(e)}static credentialFromError(e){return xi.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return xi.credential(e.oauthAccessToken)}catch{return null}}}xi.GITHUB_SIGN_IN_METHOD="github.com";xi.PROVIDER_ID="github.com";/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class wi extends Al{constructor(){super("twitter.com")}static credential(e,n){return ks._fromParams({providerId:wi.PROVIDER_ID,signInMethod:wi.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:n})}static credentialFromResult(e){return wi.credentialFromTaggedObject(e)}static credentialFromError(e){return wi.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthAccessToken:n,oauthTokenSecret:r}=e;if(!n||!r)return null;try{return wi.credential(n,r)}catch{return null}}}wi.TWITTER_SIGN_IN_METHOD="twitter.com";wi.PROVIDER_ID="twitter.com";/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Ro{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,n,r,i=!1){const s=await sr._fromIdTokenResponse(e,r,i),o=gx(r);return new Ro({user:s,providerId:o,_tokenResponse:r,operationType:n})}static async _forOperation(e,n,r){await e._updateTokensIfNecessary(r,!0);const i=gx(r);return new Ro({user:e,providerId:i,_tokenResponse:r,operationType:n})}}function gx(t){return t.providerId?t.providerId:"phoneNumber"in t?"phone":null}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Oc extends Dr{constructor(e,n,r,i){super(n.code,n.message),this.operationType=r,this.user=i,Object.setPrototypeOf(this,Oc.prototype),this.customData={appName:e.name,tenantId:e.tenantId??void 0,_serverResponse:n.customData._serverResponse,operationType:r}}static _fromErrorAndOperation(e,n,r,i){return new Oc(e,n,r,i)}}function lI(t,e,n,r){return(e==="reauthenticate"?n._getReauthenticationResolver(t):n._getIdTokenResponse(t)).catch(s=>{throw s.code==="auth/multi-factor-auth-required"?Oc._fromErrorAndOperation(t,s,e,r):s})}async function S4(t,e,n=!1){const r=await hl(t,e._linkToIdToken(t.auth,await t.getIdToken()),n);return Ro._forOperation(t,"link",r)}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function T4(t,e,n=!1){const{auth:r}=t;if(rr(r.app))return Promise.reject(gs(r));const i="reauthenticate";try{const s=await hl(t,lI(r,i,e,t),n);Ee(s.idToken,r,"internal-error");const o=Tg(s.idToken);Ee(o,r,"internal-error");const{sub:a}=o;return Ee(t.uid===a,r,"user-mismatch"),Ro._forOperation(t,i,s)}catch(s){throw(s==null?void 0:s.code)==="auth/user-not-found"&&ti(r,"user-mismatch"),s}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function k4(t,e,n=!1){if(rr(t.app))return Promise.reject(gs(t));const r="signIn",i=await lI(t,r,e),s=await Ro._fromIdTokenResponse(t,r,i);return n||await t._updateCurrentUser(s.user),s}function C4(t,e,n,r){return Zt(t).onIdTokenChanged(e,n,r)}function N4(t,e,n){return Zt(t).beforeAuthStateChanged(e,n)}const Mc="__sak";/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class uI{constructor(e,n){this.storageRetriever=e,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(Mc,"1"),this.storage.removeItem(Mc),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,n){return this.storage.setItem(e,JSON.stringify(n)),Promise.resolve()}_get(e){const n=this.storage.getItem(e);return Promise.resolve(n?JSON.parse(n):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const A4=1e3,P4=10;class cI extends uI{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,n)=>this.onStorageEvent(e,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=rI(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(const n of Object.keys(this.listeners)){const r=this.storage.getItem(n),i=this.localCache[n];r!==i&&e(n,i,r)}}onStorageEvent(e,n=!1){if(!e.key){this.forAllChangedKeys((o,a,u)=>{this.notifyListeners(o,u)});return}const r=e.key;n?this.detachListener():this.stopPolling();const i=()=>{const o=this.storage.getItem(r);!n&&this.localCache[r]===o||this.notifyListeners(r,o)},s=this.storage.getItem(r);u4()&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(i,P4):i()}notifyListeners(e,n){this.localCache[e]=n;const r=this.listeners[e];if(r)for(const i of Array.from(r))i(n&&JSON.parse(n))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,n,r)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:n,newValue:r}),!0)})},A4)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,n){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(e,n){await super._set(e,n),this.localCache[e]=JSON.stringify(n)}async _get(e){const n=await super._get(e);return this.localCache[e]=JSON.stringify(n),n}async _remove(e){await super._remove(e),delete this.localCache[e]}}cI.type="LOCAL";const R4=cI;/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class dI extends uI{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,n){}_removeListener(e,n){}}dI.type="SESSION";const hI=dI;/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function D4(t){return Promise.all(t.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(n){return{fulfilled:!1,reason:n}}}))}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Pd{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){const n=this.receivers.find(i=>i.isListeningto(e));if(n)return n;const r=new Pd(e);return this.receivers.push(r),r}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const n=e,{eventId:r,eventType:i,data:s}=n.data,o=this.handlersMap[i];if(!(o!=null&&o.size))return;n.ports[0].postMessage({status:"ack",eventId:r,eventType:i});const a=Array.from(o).map(async c=>c(n.origin,s)),u=await D4(a);n.ports[0].postMessage({status:"done",eventId:r,eventType:i,response:u})}_subscribe(e,n){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(n)}_unsubscribe(e,n){this.handlersMap[e]&&n&&this.handlersMap[e].delete(n),(!n||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}Pd.receivers=[];/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Ag(t="",e=10){let n="";for(let r=0;r{const c=Ag("",20);i.port1.start();const f=setTimeout(()=>{u(new Error("unsupported_event"))},r);o={messageChannel:i,onMessage(h){const p=h;if(p.data.eventId===c)switch(p.data.status){case"ack":clearTimeout(f),s=setTimeout(()=>{u(new Error("timeout"))},3e3);break;case"done":clearTimeout(s),a(p.data.response);break;default:clearTimeout(f),clearTimeout(s),u(new Error("invalid_response"));break}}},this.handlers.add(o),i.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:c,data:n},[i.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Nr(){return window}function L4(t){Nr().location.href=t}/** + * @license + * Copyright 2020 Google LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function fI(){return typeof Nr().WorkerGlobalScope<"u"&&typeof Nr().importScripts=="function"}async function O4(){if(!(navigator!=null&&navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function M4(){var t;return((t=navigator==null?void 0:navigator.serviceWorker)==null?void 0:t.controller)||null}function V4(){return fI()?self:null}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const pI="firebaseLocalStorageDb",F4=1,Vc="firebaseLocalStorage",mI="fbase_key";class Pl{constructor(e){this.request=e}toPromise(){return new Promise((e,n)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{n(this.request.error)})})}}function Rd(t,e){return t.transaction([Vc],e?"readwrite":"readonly").objectStore(Vc)}function U4(){const t=indexedDB.deleteDatabase(pI);return new Pl(t).toPromise()}function wp(){const t=indexedDB.open(pI,F4);return new Promise((e,n)=>{t.addEventListener("error",()=>{n(t.error)}),t.addEventListener("upgradeneeded",()=>{const r=t.result;try{r.createObjectStore(Vc,{keyPath:mI})}catch(i){n(i)}}),t.addEventListener("success",async()=>{const r=t.result;r.objectStoreNames.contains(Vc)?e(r):(r.close(),await U4(),e(await wp()))})})}async function yx(t,e,n){const r=Rd(t,!0).put({[mI]:e,value:n});return new Pl(r).toPromise()}async function z4(t,e){const n=Rd(t,!1).get(e),r=await new Pl(n).toPromise();return r===void 0?null:r.value}function vx(t,e){const n=Rd(t,!0).delete(e);return new Pl(n).toPromise()}const B4=800,$4=3;class gI{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.db?this.db:(this.db=await wp(),this.db)}async _withRetries(e){let n=0;for(;;)try{const r=await this._openDb();return await e(r)}catch(r){if(n++>$4)throw r;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return fI()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Pd._getInstance(V4()),this.receiver._subscribe("keyChanged",async(e,n)=>({keyProcessed:(await this._poll()).includes(n.key)})),this.receiver._subscribe("ping",async(e,n)=>["keyChanged"])}async initializeSender(){var n,r;if(this.activeServiceWorker=await O4(),!this.activeServiceWorker)return;this.sender=new j4(this.activeServiceWorker);const e=await this.sender._send("ping",{},800);e&&(n=e[0])!=null&&n.fulfilled&&(r=e[0])!=null&&r.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||M4()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;const e=await wp();return await yx(e,Mc,"1"),await vx(e,Mc),!0}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,n){return this._withPendingWrite(async()=>(await this._withRetries(r=>yx(r,e,n)),this.localCache[e]=n,this.notifyServiceWorker(e)))}async _get(e){const n=await this._withRetries(r=>z4(r,e));return this.localCache[e]=n,n}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(n=>vx(n,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){const e=await this._withRetries(i=>{const s=Rd(i,!1).getAll();return new Pl(s).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];const n=[],r=new Set;if(e.length!==0)for(const{fbase_key:i,value:s}of e)r.add(i),JSON.stringify(this.localCache[i])!==JSON.stringify(s)&&(this.notifyListeners(i,s),n.push(i));for(const i of Object.keys(this.localCache))this.localCache[i]&&!r.has(i)&&(this.notifyListeners(i,null),n.push(i));return n}notifyListeners(e,n){this.localCache[e]=n;const r=this.listeners[e];if(r)for(const i of Array.from(r))i(n)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),B4)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,n){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&this.stopPolling()}}gI.type="LOCAL";const H4=gI;new Nl(3e4,6e4);/** + * @license + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function q4(t,e){return e?Br(e):(Ee(t._popupRedirectResolver,t,"argument-error"),t._popupRedirectResolver)}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Pg extends oI{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return mo(e,this._buildIdpRequest())}_linkToIdToken(e,n){return mo(e,this._buildIdpRequest(n))}_getReauthenticationResolver(e){return mo(e,this._buildIdpRequest())}_buildIdpRequest(e){const n={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(n.idToken=e),n}}function W4(t){return k4(t.auth,new Pg(t),t.bypassAuthState)}function G4(t){const{auth:e,user:n}=t;return Ee(n,e,"internal-error"),T4(n,new Pg(t),t.bypassAuthState)}async function K4(t){const{auth:e,user:n}=t;return Ee(n,e,"internal-error"),S4(n,new Pg(t),t.bypassAuthState)}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class yI{constructor(e,n,r,i,s=!1){this.auth=e,this.resolver=r,this.user=i,this.bypassAuthState=s,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(n)?n:[n]}execute(){return new Promise(async(e,n)=>{this.pendingPromise={resolve:e,reject:n};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(r){this.reject(r)}})}async onAuthEvent(e){const{urlResponse:n,sessionId:r,postBody:i,tenantId:s,error:o,type:a}=e;if(o){this.reject(o);return}const u={auth:this.auth,requestUri:n,sessionId:r,tenantId:s||void 0,postBody:i||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(a)(u))}catch(c){this.reject(c)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return W4;case"linkViaPopup":case"linkViaRedirect":return K4;case"reauthViaPopup":case"reauthViaRedirect":return G4;default:ti(this.auth,"internal-error")}}resolve(e){ni(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){ni(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Q4=new Nl(2e3,1e4);class no extends yI{constructor(e,n,r,i,s){super(e,n,i,s),this.provider=r,this.authWindow=null,this.pollId=null,no.currentPopupAction&&no.currentPopupAction.cancel(),no.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return Ee(e,this.auth,"internal-error"),e}async onExecution(){ni(this.filter.length===1,"Popup operations only handle one event");const e=Ag();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(n=>{this.reject(n)}),this.resolver._isIframeWebStorageSupported(this.auth,n=>{n||this.reject(Cr(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return((e=this.authWindow)==null?void 0:e.associatedEvent)||null}cancel(){this.reject(Cr(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,no.currentPopupAction=null}pollUserCancellation(){const e=()=>{var n,r;if((r=(n=this.authWindow)==null?void 0:n.window)!=null&&r.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(Cr(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,Q4.get())};e()}}no.currentPopupAction=null;/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Y4="pendingRedirect",zu=new Map;class X4 extends yI{constructor(e,n,r=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,r),this.eventId=null}async execute(){let e=zu.get(this.auth._key());if(!e){try{const r=await J4(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(r)}catch(n){e=()=>Promise.reject(n)}zu.set(this.auth._key(),e)}return this.bypassAuthState||zu.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if(e.type==="signInViaRedirect")return super.onAuthEvent(e);if(e.type==="unknown"){this.resolve(null);return}if(e.eventId){const n=await this.auth._redirectUserForId(e.eventId);if(n)return this.user=n,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}}async function J4(t,e){const n=tD(e),r=eD(t);if(!await r._isAvailable())return!1;const i=await r._get(n)==="true";return await r._remove(n),i}function Z4(t,e){zu.set(t._key(),e)}function eD(t){return Br(t._redirectPersistence)}function tD(t){return Uu(Y4,t.config.apiKey,t.name)}async function nD(t,e,n=!1){if(rr(t.app))return Promise.reject(gs(t));const r=Cg(t),i=q4(r,e),o=await new X4(r,i,n).execute();return o&&!n&&(delete o.user._redirectEventId,await r._persistUserIfCurrent(o.user),await r._setRedirectUser(null,e)),o}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const rD=10*60*1e3;class iD{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let n=!1;return this.consumers.forEach(r=>{this.isEventForConsumer(e,r)&&(n=!0,this.sendToConsumer(e,r),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!sD(e)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=e,n=!0)),n}sendToConsumer(e,n){var r;if(e.error&&!vI(e)){const i=((r=e.error.code)==null?void 0:r.split("auth/")[1])||"internal-error";n.onError(Cr(this.auth,i))}else n.onAuthEvent(e)}isEventForConsumer(e,n){const r=n.eventId===null||!!e.eventId&&e.eventId===n.eventId;return n.filter.includes(e.type)&&r}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=rD&&this.cachedEventUids.clear(),this.cachedEventUids.has(xx(e))}saveEventToCache(e){this.cachedEventUids.add(xx(e)),this.lastProcessedEventTime=Date.now()}}function xx(t){return[t.type,t.eventId,t.sessionId,t.tenantId].filter(e=>e).join("-")}function vI({type:t,error:e}){return t==="unknown"&&(e==null?void 0:e.code)==="auth/no-auth-event"}function sD(t){switch(t.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return vI(t);default:return!1}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function oD(t,e={}){return Bo(t,"GET","/v1/projects",e)}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const aD=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,lD=/^https?/;async function uD(t){if(t.config.emulator)return;const{authorizedDomains:e}=await oD(t);for(const n of e)try{if(cD(n))return}catch{}ti(t,"unauthorized-domain")}function cD(t){const e=vp(),{protocol:n,hostname:r}=new URL(e);if(t.startsWith("chrome-extension://")){const o=new URL(t);return o.hostname===""&&r===""?n==="chrome-extension:"&&t.replace("chrome-extension://","")===e.replace("chrome-extension://",""):n==="chrome-extension:"&&o.hostname===r}if(!lD.test(n))return!1;if(aD.test(t))return r===t;const i=t.replace(/\./g,"\\.");return new RegExp("^(.+\\."+i+"|"+i+")$","i").test(r)}/** + * @license + * Copyright 2020 Google LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const dD=new Nl(3e4,6e4);function wx(){const t=Nr().___jsl;if(t!=null&&t.H){for(const e of Object.keys(t.H))if(t.H[e].r=t.H[e].r||[],t.H[e].L=t.H[e].L||[],t.H[e].r=[...t.H[e].L],t.CP)for(let n=0;n{var i,s,o;function r(){wx(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{wx(),n(Cr(t,"network-request-failed"))},timeout:dD.get()})}if((s=(i=Nr().gapi)==null?void 0:i.iframes)!=null&&s.Iframe)e(gapi.iframes.getContext());else if((o=Nr().gapi)!=null&&o.load)r();else{const a=v4("iframefcb");return Nr()[a]=()=>{gapi.load?r():n(Cr(t,"network-request-failed"))},g4(`${y4()}?onload=${a}`).catch(u=>n(u))}}).catch(e=>{throw Bu=null,e})}let Bu=null;function fD(t){return Bu=Bu||hD(t),Bu}/** + * @license + * Copyright 2020 Google LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const pD=new Nl(5e3,15e3),mD="__/auth/iframe",gD="emulator/auth/iframe",yD={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},vD=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function xD(t){const e=t.config;Ee(e.authDomain,t,"auth-domain-config-required");const n=e.emulator?Ig(e,gD):`https://${t.config.authDomain}/${mD}`,r={apiKey:e.apiKey,appName:t.name,v:Ps},i=vD.get(t.config.apiHost);i&&(r.eid=i);const s=t._getFrameworks();return s.length&&(r.fw=s.join(",")),`${n}?${bl(r).slice(1)}`}async function wD(t){const e=await fD(t),n=Nr().gapi;return Ee(n,t,"internal-error"),e.open({where:document.body,url:xD(t),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:yD,dontclear:!0},r=>new Promise(async(i,s)=>{await r.restyle({setHideOnLeave:!1});const o=Cr(t,"network-request-failed"),a=Nr().setTimeout(()=>{s(o)},pD.get());function u(){Nr().clearTimeout(a),i(r)}r.ping(u).then(u,()=>{s(o)})}))}/** + * @license + * Copyright 2020 Google LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const _D={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},bD=500,ED=600,ID="_blank",SD="http://localhost";class _x{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function TD(t,e,n,r=bD,i=ED){const s=Math.max((window.screen.availHeight-i)/2,0).toString(),o=Math.max((window.screen.availWidth-r)/2,0).toString();let a="";const u={..._D,width:r.toString(),height:i.toString(),top:s,left:o},c=un().toLowerCase();n&&(a=JE(c)?ID:n),YE(c)&&(e=e||SD,u.scrollbars="yes");const f=Object.entries(u).reduce((p,[m,b])=>`${p}${m}=${b},`,"");if(l4(c)&&a!=="_self")return kD(e||"",a),new _x(null);const h=window.open(e||"",a,f);Ee(h,t,"popup-blocked");try{h.focus()}catch{}return new _x(h)}function kD(t,e){const n=document.createElement("a");n.href=t,n.target=e;const r=document.createEvent("MouseEvent");r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(r)}/** + * @license + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const CD="__/auth/handler",ND="emulator/auth/handler",AD=encodeURIComponent("fac");async function bx(t,e,n,r,i,s){Ee(t.config.authDomain,t,"auth-domain-config-required"),Ee(t.config.apiKey,t,"invalid-api-key");const o={apiKey:t.config.apiKey,appName:t.name,authType:n,redirectUrl:r,v:Ps,eventId:i};if(e instanceof aI){e.setDefaultLanguage(t.languageCode),o.providerId=e.providerId||"",q2(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(const[f,h]of Object.entries({}))o[f]=h}if(e instanceof Al){const f=e.getScopes().filter(h=>h!=="");f.length>0&&(o.scopes=f.join(","))}t.tenantId&&(o.tid=t.tenantId);const a=o;for(const f of Object.keys(a))a[f]===void 0&&delete a[f];const u=await t._getAppCheckToken(),c=u?`#${AD}=${encodeURIComponent(u)}`:"";return`${PD(t)}?${bl(a).slice(1)}${c}`}function PD({config:t}){return t.emulator?Ig(t,ND):`https://${t.authDomain}/${CD}`}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Mh="webStorageSupport";class RD{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=hI,this._completeRedirectFn=nD,this._overrideRedirectResult=Z4}async _openPopup(e,n,r,i){var o;ni((o=this.eventManagers[e._key()])==null?void 0:o.manager,"_initialize() not called before _openPopup()");const s=await bx(e,n,r,vp(),i);return TD(e,s,Ag())}async _openRedirect(e,n,r,i){await this._originValidation(e);const s=await bx(e,n,r,vp(),i);return L4(s),new Promise(()=>{})}_initialize(e){const n=e._key();if(this.eventManagers[n]){const{manager:i,promise:s}=this.eventManagers[n];return i?Promise.resolve(i):(ni(s,"If manager is not set, promise should be"),s)}const r=this.initAndGetManager(e);return this.eventManagers[n]={promise:r},r.catch(()=>{delete this.eventManagers[n]}),r}async initAndGetManager(e){const n=await wD(e),r=new iD(e);return n.register("authEvent",i=>(Ee(i==null?void 0:i.authEvent,e,"invalid-auth-event"),{status:r.onEvent(i.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:r},this.iframes[e._key()]=n,r}_isIframeWebStorageSupported(e,n){this.iframes[e._key()].send(Mh,{type:Mh},i=>{var o;const s=(o=i==null?void 0:i[0])==null?void 0:o[Mh];s!==void 0&&n(!!s),ti(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const n=e._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=uD(e)),this.originValidationPromises[n]}get _shouldInitProactively(){return rI()||XE()||kg()}}const DD=RD;var Ex="@firebase/auth",Ix="1.11.1";/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class jD{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),((e=this.auth.currentUser)==null?void 0:e.uid)||null}async getToken(e){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;const n=this.auth.onIdTokenChanged(r=>{e((r==null?void 0:r.stsTokenManager.accessToken)||null)});this.internalListeners.set(e,n),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();const n=this.internalListeners.get(e);n&&(this.internalListeners.delete(e),n(),this.updateProactiveRefresh())}assertAuthConfigured(){Ee(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function LD(t){switch(t){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function OD(t){Is(new Fi("auth",(e,{options:n})=>{const r=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),s=e.getProvider("app-check-internal"),{apiKey:o,authDomain:a}=r.options;Ee(o&&!o.includes(":"),"invalid-api-key",{appName:r.name});const u={apiKey:o,authDomain:a,clientPlatform:t,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:iI(t)},c=new p4(r,i,s,u);return w4(c,n),c},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,n,r)=>{e.getProvider("auth-internal").initialize()})),Is(new Fi("auth-internal",e=>{const n=Cg(e.getProvider("auth").getImmediate());return(r=>new jD(r))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),Er(Ex,Ix,LD(t)),Er(Ex,Ix,"esm2020")}/** + * @license + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const MD=5*60,VD=eb("authIdTokenMaxAge")||MD;let Sx=null;const FD=t=>async e=>{const n=e&&await e.getIdTokenResult(),r=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(r&&r>VD)return;const i=n==null?void 0:n.token;Sx!==i&&(Sx=i,await fetch(t,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))};function UD(t=Mm()){const e=ld(t,"auth");if(e.isInitialized())return e.getImmediate();const n=x4(t,{popupRedirectResolver:DD,persistence:[H4,R4,hI]}),r=eb("authTokenSyncURL");if(r&&typeof isSecureContext=="boolean"&&isSecureContext){const s=new URL(r,location.origin);if(location.origin===s.origin){const o=FD(s.toString());N4(n,o,()=>o(n.currentUser)),C4(n,a=>o(a))}}const i=X1("auth");return i&&_4(n,`http://${i}`),n}function zD(){var t;return((t=document.getElementsByTagName("head"))==null?void 0:t[0])??document}m4({loadJS(t){return new Promise((e,n)=>{const r=document.createElement("script");r.setAttribute("src",t),r.onload=e,r.onerror=i=>{const s=Cr("internal-error");s.customData=i,n(s)},r.type="text/javascript",r.charset="UTF-8",zD().appendChild(r)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="});OD("Browser");const BD={apiKey:"AIzaSyAH3jvbe0_QLzIuuv5kTMK8246HNvohvfE",authDomain:"twistedbrody-9d163.firebaseapp.com",projectId:"twistedbrody-9d163",storageBucket:"twistedbrody-9d163.firebasestorage.app",messagingSenderId:"733213514129",appId:"1:733213514129:web:e9694684f5c3994ed06230",measurementId:"G-N8TQ7MY42W"},Rg=ib(BD),We=tR(Rg);UR(Rg);UD(Rg);new Vr;function fl(t){if(t!=null){if(Array.isArray(t)){const e=t.map(n=>fl(n)).filter(n=>n!=null&&n!=="");return e.length>0?e:void 0}if(typeof t=="object"&&!(t instanceof Qe)){const e={};for(const n in t)if(t.hasOwnProperty(n)){const r=fl(t[n]);r!=null&&(e[n]=r)}return Object.keys(e).length>0?e:void 0}return t}}const Rl={MANGA_PREFIX:"mangalib_detail_v2_"};function Dd(t,e){try{localStorage.setItem(t,JSON.stringify(e))}catch(n){console.warn(`Error saving ${t} to localStorage`,n)}}function $D(t){try{localStorage.removeItem(t)}catch(e){console.warn(`Error removing ${t} from localStorage`,e)}}async function jd(){const t=Zr(Tn(We,"mangas"),dR("created_at","desc")),e=await lr(t),r=(await lr(Tn(We,"categories"))).docs.reduce((o,a)=>(o[a.id]={id:a.id,...a.data()},o),{}),i=await Promise.all(e.docs.map(async o=>{var a,u;try{const c=o.data();let f=new Date().toISOString();(a=c.created_at)!=null&&a.toDate?f=c.created_at.toDate().toISOString():c.created_at&&(f=new Date(c.created_at).toISOString());let h=f;(u=c.updated_at)!=null&&u.toDate&&(h=c.updated_at.toDate().toISOString());const p=Zr(Tn(We,"chapters"),js("manga_id","==",o.id)),b=(await lr(p)).docs.map(y=>{var F,D;const w=y.data(),T=(F=w.created_at)!=null&&F.toDate?w.created_at.toDate().toISOString():new Date().toISOString(),L=(D=w.updated_at)!=null&&D.toDate?w.updated_at.toDate().toISOString():new Date().toISOString();return{id:y.id,manga_id:w.manga_id,number:w.number,title:w.title,pages:w.pages||[],page_formats:w.page_formats||[],original_pages:w.original_pages||[],created_at:T,updated_at:L}}).sort((y,w)=>y.number-w.number),P=(c.categories||[]).map(y=>r[y]).filter(y=>y!==void 0);return{id:o.id,...c,created_at:f,updated_at:h,categories:P,chapters:b}}catch(c){return console.error(`[DATA ERROR] Skipping corrupt manga ${o.id}:`,c),null}})),s=i.filter(o=>o!==null);return console.log(`[DATA] Loaded ${s.length} mangas (Skipped ${i.length-s.length} corrupt)`),s}const Do=new Map;async function xI(t){var f,h;const e=Dt(We,"mangas",t),n=await ei(e);if(!n.exists())return null;const r=n.data(),i=Zr(Tn(We,"chapters"),js("manga_id","==",t)),o=(await lr(i)).docs.map(p=>{const m=p.data();return{id:p.id,manga_id:m.manga_id,number:m.number,title:m.title,pages:m.pages||[],page_formats:m.page_formats||[],original_pages:m.original_pages||[],created_at:m.created_at.toDate().toISOString(),updated_at:m.updated_at.toDate().toISOString()}}).sort((p,m)=>p.number-m.number),a=r.categories||[],u=[];for(const p of a){const m=Dt(We,"categories",p),b=await ei(m);b.exists()&&u.push({id:b.id,...b.data(),created_at:((h=(f=b.data().created_at)==null?void 0:f.toDate)==null?void 0:h.call(f).toISOString())||new Date().toISOString()})}const c={id:n.id,...r,created_at:r.created_at.toDate().toISOString(),categories:u,chapters:o,updated_at:r.updated_at?r.updated_at.toDate().toISOString():r.created_at.toDate().toISOString()};return Do.set(t,c),Dd(`${Rl.MANGA_PREFIX}${t}`,c),c}function HD(t,e){const n=Dt(We,"mangas",t);return bg(n,async r=>{if(!r.exists()){e(null);return}const i=r.data();let s=Do.get(t),o=(s==null?void 0:s.chapters)||[],a=(s==null?void 0:s.categories)||[];if(!s){const c=Zr(Tn(We,"chapters"),js("manga_id","==",t));o=(await lr(c)).docs.map(p=>({id:p.id,...p.data(),created_at:p.data().created_at.toDate().toISOString(),updated_at:p.data().updated_at.toDate().toISOString()})).sort((p,m)=>p.number-m.number);const h=i.categories||[];a=[];for(const p of h){const m=await ei(Dt(We,"categories",p));m.exists()&&a.push({id:m.id,...m.data()})}}const u={id:r.id,...i,chapters:o,categories:a,created_at:i.created_at.toDate().toISOString(),updated_at:i.updated_at?i.updated_at.toDate().toISOString():i.created_at.toDate().toISOString()};Do.set(t,u),Dd(`${Rl.MANGA_PREFIX}${t}`,u),e(u)})}async function qD(t){const e=Qe.now(),n={title:t.title,author:t.author,description:t.description||"",status:t.status||"En curso",categories:t.categoryIds||[],views:0,rating:0,created_at:e,updated_at:e};t.thumbnail_url&&(n.thumbnail_url=t.thumbnail_url),t.cover_url&&(n.cover_url=t.cover_url);const r=await _g(Tn(We,"mangas"),n),i=new Date().toISOString(),s={id:r.id,title:t.title,author:t.author,description:t.description||"",status:t.status||"En curso",categories:t.categoryIds||[],chapters:[],views:0,rating:0,created_at:i,updated_at:i};return t.thumbnail_url&&(s.thumbnail_url=t.thumbnail_url),t.cover_url&&(s.cover_url=t.cover_url),Do.set(s.id,s),Dd(`${Rl.MANGA_PREFIX}${s.id}`,s),s}async function wI(){return(await lr(Tn(We,"categories"))).docs.map(e=>({id:e.id,...e.data()}))}async function _I(t,e="genre"){const n=await _g(Tn(We,"categories"),{name:t,type:e}),r=await ei(n);return{id:r.id,...r.data()}}async function bI(t){const e=Dt(We,"categories",t);await yp(e);const n=Zr(Tn(We,"mangas"),js("categories","array-contains",t)),i=(await lr(n)).docs.map(s=>{const u=(s.data().categories||[]).filter(c=>c!==t);return Ji(Dt(We,"mangas",s.id),{categories:u})});await Promise.all(i)}async function Tx(t){const e=Qe.now(),n=await _g(Tn(We,"chapters"),{manga_id:t.manga_id,number:t.number,title:t.title,pages:t.pages,page_formats:t.page_formats||[],original_pages:t.original_pages||[],created_at:e,updated_at:e}),r=await ei(n),i=r.data();return{id:r.id,manga_id:i.manga_id,number:i.number,title:i.title,pages:i.pages||[],page_formats:i.page_formats||[],original_pages:i.original_pages||[],created_at:i.created_at.toDate().toISOString(),updated_at:i.updated_at.toDate().toISOString()}}async function WD(){const e=(await jd()).map(n=>{const r=Dt(We,"mangas",n.id);return Ji(r,{views:0})});await Promise.all(e)}async function GD(t){const e=Dt(We,"mangas",t);await Ji(e,{views:pR(1)})}async function EI(t,e){var b,S;const n=Dt(We,"mangas",t),r=Qe.now(),i={title:e.title,author:e.author,categories:e.categoryIds||[],updated_at:r};e.status&&(i.status=e.status),e.description!==void 0&&e.description!==null&&(i.description=e.description),e.thumbnail_url&&(i.thumbnail_url=e.thumbnail_url),e.cover_url&&(i.cover_url=e.cover_url);const s=fl(i);await Ji(n,s);const o=await ei(n);if(!o.exists())throw new Error("Manga no encontrado");const a=o.data(),u=Zr(Tn(We,"chapters"),js("manga_id","==",t)),f=(await lr(u)).docs.map(P=>{const y=P.data();return{id:P.id,manga_id:y.manga_id,number:y.number,title:y.title,pages:y.pages||[],page_formats:y.page_formats||[],original_pages:y.original_pages||[],created_at:y.created_at.toDate().toISOString(),updated_at:y.updated_at.toDate().toISOString()}}).sort((P,y)=>P.number-y.number),h=a.categories||[],p=[];for(const P of h){const y=Dt(We,"categories",P),w=await ei(y);w.exists()&&p.push({id:w.id,...w.data(),created_at:((S=(b=w.data().created_at)==null?void 0:b.toDate)==null?void 0:S.call(b).toISOString())||new Date().toISOString()})}const m={id:o.id,...a,created_at:a.created_at.toDate().toISOString(),categories:p,chapters:f,updated_at:a.updated_at.toDate().toISOString()};return Do.set(m.id,m),Dd(`${Rl.MANGA_PREFIX}${m.id}`,m),m}async function KD(t){const e=Dt(We,"mangas",t),n=Zr(Tn(We,"chapters"),js("manga_id","==",t)),r=await lr(n);for(const i of r.docs)await yp(i.ref);await yp(e),Do.delete(t),$D(`${Rl.MANGA_PREFIX}${t}`)}async function QD(t,e){const n=Dt(We,"mangas",t),r=await ei(n);if(!r.exists())throw new Error("Manga no encontrado");const s={external_links:[...r.data().external_links||[],e]},o=fl(s);await Ji(n,o)}async function YD(t,e){const n=Dt(We,"mangas",t),r=await ei(n);if(!r.exists())throw new Error("Manga no encontrado");const s={external_links:(r.data().external_links||[]).filter((a,u)=>u!==e)},o=fl(s);await Ji(n,o)}async function XD(t,e,n,r){const s=(await jd()).filter(o=>o.id!==t).map(o=>{var S,P;let a=0;const u=((S=o.categories)==null?void 0:S.map(y=>y.id))||[],c=e.filter(y=>u.includes(y));a+=c.length*10;const f=n.toLowerCase().split(/\s+/).filter(y=>y.length>2),h=o.title.toLowerCase().split(/\s+/).filter(y=>y.length>2),p=f.filter(y=>h.includes(y));a+=p.length*5;const m=((P=o.author)==null?void 0:P.toLowerCase().split(/\s+/).filter(y=>y.length>2))||[],b=f.filter(y=>m.includes(y));return a+=b.length*3,{manga:o,score:a}}).filter(o=>o.score>0).sort((o,a)=>{const u=o.manga.title.toLowerCase(),c=a.manga.title.toLowerCase();return u.localeCompare(c)}).map(o=>o.manga);return r?s.slice(0,r):s}async function JD(t){const e=Zr(Tn(We,"mangas"),js("author","==",t)),r=(await lr(e)).docs.map(i=>Ji(Dt(We,"mangas",i.id),{author:""}));await Promise.all(r)}async function ZD(){const t=Zr(Tn(We,"mangas")),e=await lr(t),n=new Set;return e.forEach(r=>{const i=r.data();i&&i.author&&typeof i.author=="string"&&i.author.trim()!==""&&n.add(i.author.trim())}),Array.from(n).sort()}function ej(t){if(typeof document>"u")return;let e=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",e.appendChild(n),n.styleSheet?n.styleSheet.cssText=t:n.appendChild(document.createTextNode(t))}const tj=t=>{switch(t){case"success":return ij;case"info":return oj;case"warning":return sj;case"error":return aj;default:return null}},nj=Array(12).fill(0),rj=({visible:t,className:e})=>re.createElement("div",{className:["sonner-loading-wrapper",e].filter(Boolean).join(" "),"data-visible":t},re.createElement("div",{className:"sonner-spinner"},nj.map((n,r)=>re.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),ij=re.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},re.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),sj=re.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},re.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),oj=re.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},re.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),aj=re.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},re.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),lj=re.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},re.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),re.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),uj=()=>{const[t,e]=re.useState(document.hidden);return re.useEffect(()=>{const n=()=>{e(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),t};let _p=1;class cj{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{const n=this.subscribers.indexOf(e);this.subscribers.splice(n,1)}),this.publish=e=>{this.subscribers.forEach(n=>n(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var n;const{message:r,...i}=e,s=typeof(e==null?void 0:e.id)=="number"||((n=e.id)==null?void 0:n.length)>0?e.id:_p++,o=this.toasts.find(u=>u.id===s),a=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(s)&&this.dismissedToasts.delete(s),o?this.toasts=this.toasts.map(u=>u.id===s?(this.publish({...u,...e,id:s,title:r}),{...u,...e,id:s,dismissible:a,title:r}):u):this.addToast({title:r,...i,dismissible:a,id:s}),s},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(n=>n({id:e,dismiss:!0})))):this.toasts.forEach(n=>{this.subscribers.forEach(r=>r({id:n.id,dismiss:!0}))}),e),this.message=(e,n)=>this.create({...n,message:e}),this.error=(e,n)=>this.create({...n,message:e,type:"error"}),this.success=(e,n)=>this.create({...n,type:"success",message:e}),this.info=(e,n)=>this.create({...n,type:"info",message:e}),this.warning=(e,n)=>this.create({...n,type:"warning",message:e}),this.loading=(e,n)=>this.create({...n,type:"loading",message:e}),this.promise=(e,n)=>{if(!n)return;let r;n.loading!==void 0&&(r=this.create({...n,promise:e,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));const i=Promise.resolve(e instanceof Function?e():e);let s=r!==void 0,o;const a=i.then(async c=>{if(o=["resolve",c],re.isValidElement(c))s=!1,this.create({id:r,type:"default",message:c});else if(hj(c)&&!c.ok){s=!1;const h=typeof n.error=="function"?await n.error(`HTTP error! status: ${c.status}`):n.error,p=typeof n.description=="function"?await n.description(`HTTP error! status: ${c.status}`):n.description,b=typeof h=="object"&&!re.isValidElement(h)?h:{message:h};this.create({id:r,type:"error",description:p,...b})}else if(c instanceof Error){s=!1;const h=typeof n.error=="function"?await n.error(c):n.error,p=typeof n.description=="function"?await n.description(c):n.description,b=typeof h=="object"&&!re.isValidElement(h)?h:{message:h};this.create({id:r,type:"error",description:p,...b})}else if(n.success!==void 0){s=!1;const h=typeof n.success=="function"?await n.success(c):n.success,p=typeof n.description=="function"?await n.description(c):n.description,b=typeof h=="object"&&!re.isValidElement(h)?h:{message:h};this.create({id:r,type:"success",description:p,...b})}}).catch(async c=>{if(o=["reject",c],n.error!==void 0){s=!1;const f=typeof n.error=="function"?await n.error(c):n.error,h=typeof n.description=="function"?await n.description(c):n.description,m=typeof f=="object"&&!re.isValidElement(f)?f:{message:f};this.create({id:r,type:"error",description:h,...m})}}).finally(()=>{s&&(this.dismiss(r),r=void 0),n.finally==null||n.finally.call(n)}),u=()=>new Promise((c,f)=>a.then(()=>o[0]==="reject"?f(o[1]):c(o[1])).catch(f));return typeof r!="string"&&typeof r!="number"?{unwrap:u}:Object.assign(r,{unwrap:u})},this.custom=(e,n)=>{const r=(n==null?void 0:n.id)||_p++;return this.create({jsx:e(r),id:r,...n}),r},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const gn=new cj,dj=(t,e)=>{const n=(e==null?void 0:e.id)||_p++;return gn.addToast({title:t,...e,id:n}),n},hj=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",fj=dj,pj=()=>gn.toasts,mj=()=>gn.getActiveToasts(),Nt=Object.assign(fj,{success:gn.success,info:gn.info,warning:gn.warning,error:gn.error,custom:gn.custom,message:gn.message,promise:gn.promise,dismiss:gn.dismiss,loading:gn.loading},{getHistory:pj,getToasts:mj});ej("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function gu(t){return t.label!==void 0}const gj=3,yj="24px",vj="16px",kx=4e3,xj=356,wj=14,_j=45,bj=200;function pr(...t){return t.filter(Boolean).join(" ")}function Ej(t){const[e,n]=t.split("-"),r=[];return e&&r.push(e),n&&r.push(n),r}const Ij=t=>{var e,n,r,i,s,o,a,u,c;const{invert:f,toast:h,unstyled:p,interacting:m,setHeights:b,visibleToasts:S,heights:P,index:y,toasts:w,expanded:T,removeToast:L,defaultRichColors:F,closeButton:D,style:_,cancelButtonStyle:x,actionButtonStyle:E,className:k="",descriptionClassName:C="",duration:j,position:A,gap:de,expandByDefault:oe,classNames:le,icons:ve,closeButtonAriaLabel:K="Close toast"}=t,[ie,N]=re.useState(null),[fe,ye]=re.useState(null),[R,H]=re.useState(!1),[J,te]=re.useState(!1),[Ie,pe]=re.useState(!1),[Fe,ut]=re.useState(!1),[Je,bt]=re.useState(!1),[mt,gt]=re.useState(0),[Ht,Vt]=re.useState(0),Ze=re.useRef(h.duration||j||kx),Nn=re.useRef(null),W=re.useRef(null),ue=y===0,Ce=y+1<=S,we=h.type,He=h.dismissible!==!1,Et=h.className||"",Ft=h.descriptionClassName||"",z=re.useMemo(()=>P.findIndex(xe=>xe.toastId===h.id)||0,[P,h.id]),O=re.useMemo(()=>{var xe;return(xe=h.closeButton)!=null?xe:D},[h.closeButton,D]),B=re.useMemo(()=>h.duration||j||kx,[h.duration,j]),Q=re.useRef(0),Y=re.useRef(0),Ae=re.useRef(0),Oe=re.useRef(null),[Ne,et]=A.split("-"),$=re.useMemo(()=>P.reduce((xe,Te,yt)=>yt>=z?xe:xe+Te.height,0),[P,z]),Z=uj(),he=h.invert||f,me=we==="loading";Y.current=re.useMemo(()=>z*de+$,[z,$]),re.useEffect(()=>{Ze.current=B},[B]),re.useEffect(()=>{H(!0)},[]),re.useEffect(()=>{const xe=W.current;if(xe){const Te=xe.getBoundingClientRect().height;return Vt(Te),b(yt=>[{toastId:h.id,height:Te,position:h.position},...yt]),()=>b(yt=>yt.filter(qt=>qt.toastId!==h.id))}},[b,h.id]),re.useLayoutEffect(()=>{if(!R)return;const xe=W.current,Te=xe.style.height;xe.style.height="auto";const yt=xe.getBoundingClientRect().height;xe.style.height=Te,Vt(yt),b(qt=>qt.find(vt=>vt.toastId===h.id)?qt.map(vt=>vt.toastId===h.id?{...vt,height:yt}:vt):[{toastId:h.id,height:yt,position:h.position},...qt])},[R,h.title,h.description,b,h.id,h.jsx,h.action,h.cancel]);const Pe=re.useCallback(()=>{te(!0),gt(Y.current),b(xe=>xe.filter(Te=>Te.toastId!==h.id)),setTimeout(()=>{L(h)},bj)},[h,L,b,Y]);re.useEffect(()=>{if(h.promise&&we==="loading"||h.duration===1/0||h.type==="loading")return;let xe;return T||m||Z?(()=>{if(Ae.current{Ze.current!==1/0&&(Q.current=new Date().getTime(),xe=setTimeout(()=>{h.onAutoClose==null||h.onAutoClose.call(h,h),Pe()},Ze.current))})(),()=>clearTimeout(xe)},[T,m,h,we,Z,Pe]),re.useEffect(()=>{h.delete&&(Pe(),h.onDismiss==null||h.onDismiss.call(h,h))},[Pe,h.delete]);function Ge(){var xe;if(ve!=null&&ve.loading){var Te;return re.createElement("div",{className:pr(le==null?void 0:le.loader,h==null||(Te=h.classNames)==null?void 0:Te.loader,"sonner-loader"),"data-visible":we==="loading"},ve.loading)}return re.createElement(rj,{className:pr(le==null?void 0:le.loader,h==null||(xe=h.classNames)==null?void 0:xe.loader),visible:we==="loading"})}const It=h.icon||(ve==null?void 0:ve[we])||tj(we);var Me,Lr;return re.createElement("li",{tabIndex:0,ref:W,className:pr(k,Et,le==null?void 0:le.toast,h==null||(e=h.classNames)==null?void 0:e.toast,le==null?void 0:le.default,le==null?void 0:le[we],h==null||(n=h.classNames)==null?void 0:n[we]),"data-sonner-toast":"","data-rich-colors":(Me=h.richColors)!=null?Me:F,"data-styled":!(h.jsx||h.unstyled||p),"data-mounted":R,"data-promise":!!h.promise,"data-swiped":Je,"data-removed":J,"data-visible":Ce,"data-y-position":Ne,"data-x-position":et,"data-index":y,"data-front":ue,"data-swiping":Ie,"data-dismissible":He,"data-type":we,"data-invert":he,"data-swipe-out":Fe,"data-swipe-direction":fe,"data-expanded":!!(T||oe&&R),"data-testid":h.testId,style:{"--index":y,"--toasts-before":y,"--z-index":w.length-y,"--offset":`${J?mt:Y.current}px`,"--initial-height":oe?"auto":`${Ht}px`,..._,...h.style},onDragEnd:()=>{pe(!1),N(null),Oe.current=null},onPointerDown:xe=>{xe.button!==2&&(me||!He||(Nn.current=new Date,gt(Y.current),xe.target.setPointerCapture(xe.pointerId),xe.target.tagName!=="BUTTON"&&(pe(!0),Oe.current={x:xe.clientX,y:xe.clientY})))},onPointerUp:()=>{var xe,Te,yt;if(Fe||!He)return;Oe.current=null;const qt=Number(((xe=W.current)==null?void 0:xe.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),An=Number(((Te=W.current)==null?void 0:Te.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),vt=new Date().getTime()-((yt=Nn.current)==null?void 0:yt.getTime()),Wt=ie==="x"?qt:An,Bn=Math.abs(Wt)/vt;if(Math.abs(Wt)>=_j||Bn>.11){gt(Y.current),h.onDismiss==null||h.onDismiss.call(h,h),ye(ie==="x"?qt>0?"right":"left":An>0?"down":"up"),Pe(),ut(!0);return}else{var Gt,je;(Gt=W.current)==null||Gt.style.setProperty("--swipe-amount-x","0px"),(je=W.current)==null||je.style.setProperty("--swipe-amount-y","0px")}bt(!1),pe(!1),N(null)},onPointerMove:xe=>{var Te,yt,qt;if(!Oe.current||!He||((Te=window.getSelection())==null?void 0:Te.toString().length)>0)return;const vt=xe.clientY-Oe.current.y,Wt=xe.clientX-Oe.current.x;var Bn;const Gt=(Bn=t.swipeDirections)!=null?Bn:Ej(A);!ie&&(Math.abs(Wt)>1||Math.abs(vt)>1)&&N(Math.abs(Wt)>Math.abs(vt)?"x":"y");let je={x:0,y:0};const ii=Pn=>1/(1.5+Math.abs(Pn)/20);if(ie==="y"){if(Gt.includes("top")||Gt.includes("bottom"))if(Gt.includes("top")&&vt<0||Gt.includes("bottom")&&vt>0)je.y=vt;else{const Pn=vt*ii(vt);je.y=Math.abs(Pn)0)je.x=Wt;else{const Pn=Wt*ii(Wt);je.x=Math.abs(Pn)0||Math.abs(je.y)>0)&&bt(!0),(yt=W.current)==null||yt.style.setProperty("--swipe-amount-x",`${je.x}px`),(qt=W.current)==null||qt.style.setProperty("--swipe-amount-y",`${je.y}px`)}},O&&!h.jsx&&we!=="loading"?re.createElement("button",{"aria-label":K,"data-disabled":me,"data-close-button":!0,onClick:me||!He?()=>{}:()=>{Pe(),h.onDismiss==null||h.onDismiss.call(h,h)},className:pr(le==null?void 0:le.closeButton,h==null||(r=h.classNames)==null?void 0:r.closeButton)},(Lr=ve==null?void 0:ve.close)!=null?Lr:lj):null,(we||h.icon||h.promise)&&h.icon!==null&&((ve==null?void 0:ve[we])!==null||h.icon)?re.createElement("div",{"data-icon":"",className:pr(le==null?void 0:le.icon,h==null||(i=h.classNames)==null?void 0:i.icon)},h.promise||h.type==="loading"&&!h.icon?h.icon||Ge():null,h.type!=="loading"?It:null):null,re.createElement("div",{"data-content":"",className:pr(le==null?void 0:le.content,h==null||(s=h.classNames)==null?void 0:s.content)},re.createElement("div",{"data-title":"",className:pr(le==null?void 0:le.title,h==null||(o=h.classNames)==null?void 0:o.title)},h.jsx?h.jsx:typeof h.title=="function"?h.title():h.title),h.description?re.createElement("div",{"data-description":"",className:pr(C,Ft,le==null?void 0:le.description,h==null||(a=h.classNames)==null?void 0:a.description)},typeof h.description=="function"?h.description():h.description):null),re.isValidElement(h.cancel)?h.cancel:h.cancel&&gu(h.cancel)?re.createElement("button",{"data-button":!0,"data-cancel":!0,style:h.cancelButtonStyle||x,onClick:xe=>{gu(h.cancel)&&He&&(h.cancel.onClick==null||h.cancel.onClick.call(h.cancel,xe),Pe())},className:pr(le==null?void 0:le.cancelButton,h==null||(u=h.classNames)==null?void 0:u.cancelButton)},h.cancel.label):null,re.isValidElement(h.action)?h.action:h.action&&gu(h.action)?re.createElement("button",{"data-button":!0,"data-action":!0,style:h.actionButtonStyle||E,onClick:xe=>{gu(h.action)&&(h.action.onClick==null||h.action.onClick.call(h.action,xe),!xe.defaultPrevented&&Pe())},className:pr(le==null?void 0:le.actionButton,h==null||(c=h.classNames)==null?void 0:c.actionButton)},h.action.label):null)};function Cx(){if(typeof window>"u"||typeof document>"u")return"ltr";const t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}function Sj(t,e){const n={};return[t,e].forEach((r,i)=>{const s=i===1,o=s?"--mobile-offset":"--offset",a=s?vj:yj;function u(c){["top","right","bottom","left"].forEach(f=>{n[`${o}-${f}`]=typeof c=="number"?`${c}px`:c})}typeof r=="number"||typeof r=="string"?u(r):typeof r=="object"?["top","right","bottom","left"].forEach(c=>{r[c]===void 0?n[`${o}-${c}`]=a:n[`${o}-${c}`]=typeof r[c]=="number"?`${r[c]}px`:r[c]}):u(a)}),n}const Tj=re.forwardRef(function(e,n){const{id:r,invert:i,position:s="bottom-right",hotkey:o=["altKey","KeyT"],expand:a,closeButton:u,className:c,offset:f,mobileOffset:h,theme:p="light",richColors:m,duration:b,style:S,visibleToasts:P=gj,toastOptions:y,dir:w=Cx(),gap:T=wj,icons:L,containerAriaLabel:F="Notifications"}=e,[D,_]=re.useState([]),x=re.useMemo(()=>r?D.filter(R=>R.toasterId===r):D.filter(R=>!R.toasterId),[D,r]),E=re.useMemo(()=>Array.from(new Set([s].concat(x.filter(R=>R.position).map(R=>R.position)))),[x,s]),[k,C]=re.useState([]),[j,A]=re.useState(!1),[de,oe]=re.useState(!1),[le,ve]=re.useState(p!=="system"?p:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),K=re.useRef(null),ie=o.join("+").replace(/Key/g,"").replace(/Digit/g,""),N=re.useRef(null),fe=re.useRef(!1),ye=re.useCallback(R=>{_(H=>{var J;return(J=H.find(te=>te.id===R.id))!=null&&J.delete||gn.dismiss(R.id),H.filter(({id:te})=>te!==R.id)})},[]);return re.useEffect(()=>gn.subscribe(R=>{if(R.dismiss){requestAnimationFrame(()=>{_(H=>H.map(J=>J.id===R.id?{...J,delete:!0}:J))});return}setTimeout(()=>{e2.flushSync(()=>{_(H=>{const J=H.findIndex(te=>te.id===R.id);return J!==-1?[...H.slice(0,J),{...H[J],...R},...H.slice(J+1)]:[R,...H]})})})}),[D]),re.useEffect(()=>{if(p!=="system"){ve(p);return}if(p==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?ve("dark"):ve("light")),typeof window>"u")return;const R=window.matchMedia("(prefers-color-scheme: dark)");try{R.addEventListener("change",({matches:H})=>{ve(H?"dark":"light")})}catch{R.addListener(({matches:J})=>{try{ve(J?"dark":"light")}catch(te){console.error(te)}})}},[p]),re.useEffect(()=>{D.length<=1&&A(!1)},[D]),re.useEffect(()=>{const R=H=>{var J;if(o.every(pe=>H[pe]||H.code===pe)){var Ie;A(!0),(Ie=K.current)==null||Ie.focus()}H.code==="Escape"&&(document.activeElement===K.current||(J=K.current)!=null&&J.contains(document.activeElement))&&A(!1)};return document.addEventListener("keydown",R),()=>document.removeEventListener("keydown",R)},[o]),re.useEffect(()=>{if(K.current)return()=>{N.current&&(N.current.focus({preventScroll:!0}),N.current=null,fe.current=!1)}},[K.current]),re.createElement("section",{ref:n,"aria-label":`${F} ${ie}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},E.map((R,H)=>{var J;const[te,Ie]=R.split("-");return x.length?re.createElement("ol",{key:R,dir:w==="auto"?Cx():w,tabIndex:-1,ref:K,className:c,"data-sonner-toaster":!0,"data-sonner-theme":le,"data-y-position":te,"data-x-position":Ie,style:{"--front-toast-height":`${((J=k[0])==null?void 0:J.height)||0}px`,"--width":`${xj}px`,"--gap":`${T}px`,...S,...Sj(f,h)},onBlur:pe=>{fe.current&&!pe.currentTarget.contains(pe.relatedTarget)&&(fe.current=!1,N.current&&(N.current.focus({preventScroll:!0}),N.current=null))},onFocus:pe=>{pe.target instanceof HTMLElement&&pe.target.dataset.dismissible==="false"||fe.current||(fe.current=!0,N.current=pe.relatedTarget)},onMouseEnter:()=>A(!0),onMouseMove:()=>A(!0),onMouseLeave:()=>{de||A(!1)},onDragEnd:()=>A(!1),onPointerDown:pe=>{pe.target instanceof HTMLElement&&pe.target.dataset.dismissible==="false"||oe(!0)},onPointerUp:()=>oe(!1)},x.filter(pe=>!pe.position&&H===0||pe.position===R).map((pe,Fe)=>{var ut,Je;return re.createElement(Ij,{key:pe.id,icons:L,index:Fe,toast:pe,defaultRichColors:m,duration:(ut=y==null?void 0:y.duration)!=null?ut:b,className:y==null?void 0:y.className,descriptionClassName:y==null?void 0:y.descriptionClassName,invert:i,visibleToasts:P,closeButton:(Je=y==null?void 0:y.closeButton)!=null?Je:u,interacting:de,position:R,style:y==null?void 0:y.style,unstyled:y==null?void 0:y.unstyled,classNames:y==null?void 0:y.classNames,cancelButtonStyle:y==null?void 0:y.cancelButtonStyle,actionButtonStyle:y==null?void 0:y.actionButtonStyle,closeButtonAriaLabel:y==null?void 0:y.closeButtonAriaLabel,removeToast:ye,toasts:x.filter(bt=>bt.position==pe.position),heights:k.filter(bt=>bt.position==pe.position),setHeights:C,expandByDefault:a,gap:T,expanded:j,swipeDirections:e.swipeDirections})})):null}))});function Ii({label:t,type:e,categories:n,selectedIds:r,onSelect:i,onRemove:s,onCreate:o,onDeleteCategory:a,colorClass:u,placeholder:c="Añadir..."}){const[f,h]=V.useState(""),[p,m]=V.useState(!1),b=V.useRef(null),S=V.useMemo(()=>n.filter(D=>D.type===e||!D.type&&e==="genre"),[n,e]),P=V.useMemo(()=>f.trim()?S.filter(D=>D.name.toLowerCase().includes(f.toLowerCase())):S,[S,f]);V.useEffect(()=>{const D=_=>{b.current&&!b.current.contains(_.target)&&m(!1)};return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[]);const y=D=>{D.key==="Enter"&&(D.preventDefault(),w())},w=()=>{if(!f.trim())return;const D=S.find(_=>_.name.toLowerCase()===f.trim().toLowerCase());D?r.includes(D.id)||i(D.id):o(f.trim()),h(""),m(!1)},T=(D,_)=>{D.stopPropagation(),Nt("¿Eliminar esta categoría permanentemente?",{description:"Esta acción no se puede deshacer.",action:{label:"Eliminar",onClick:()=>a(_)},cancel:{label:"Cancelar",onClick:()=>{}},duration:5e3})},F=u.includes("blue")?{bg:"bg-blue-500/20",text:"text-blue-300",border:"border-blue-500/30"}:u.includes("green")?{bg:"bg-green-500/20",text:"text-green-300",border:"border-green-500/30"}:u.includes("purple")?{bg:"bg-purple-500/20",text:"text-purple-300",border:"border-purple-500/30"}:u.includes("pink")?{bg:"bg-pink-500/20",text:"text-pink-300",border:"border-pink-500/30"}:{bg:"bg-gray-500/20",text:"text-gray-300",border:"border-gray-500/30"};return d.jsxs("div",{className:"space-y-3 mb-6",ref:b,children:[d.jsx("label",{className:`text-xs uppercase font-bold tracking-wider ${u}`,children:t}),d.jsxs("div",{className:"relative",children:[d.jsxs("div",{className:"flex gap-2",children:[d.jsxs("div",{className:"relative flex-1",children:[d.jsx("input",{type:"text",value:f,onChange:D=>{h(D.target.value),m(!0)},onFocus:()=>m(!0),onKeyDown:y,placeholder:c,className:"w-full bg-[#1a1a1a] border border-gray-600/50 rounded-lg px-4 py-2 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-[#bb86fc] transition-all"}),f&&d.jsx("button",{onClick:()=>h(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-500 hover:text-white",children:d.jsx(In,{className:"w-3 h-3"})})]}),d.jsx("button",{onClick:w,disabled:!f.trim(),className:"bg-[#bb86fc]/20 hover:bg-[#bb86fc]/30 text-[#bb86fc] px-3 rounded-lg transition-all",children:d.jsx(co,{className:"w-5 h-5"})})]}),p&&(P.length>0||f)&&d.jsx("div",{className:"absolute top-full left-0 right-0 mt-1 bg-[#1a1a1a] border border-gray-700/50 rounded-lg shadow-xl z-50 max-h-60 overflow-y-auto w-full custom-scrollbar",children:P.length>0?P.map(D=>{const _=r.includes(D.id);return d.jsxs("div",{className:"flex items-center justify-between px-4 py-2 hover:bg-white/5 cursor-pointer group",onClick:()=>{_||(i(D.id),h(""),m(!1))},children:[d.jsx("span",{className:`text-sm ${_?"text-[#bb86fc]":"text-gray-300"}`,children:D.name}),d.jsxs("div",{className:"flex items-center gap-2",children:[_&&d.jsx(wl,{className:"w-4 h-4 text-[#bb86fc]"}),d.jsx("button",{onClick:x=>T(x,D.id),className:"opacity-0 group-hover:opacity-100 p-1 hover:bg-red-500/20 text-gray-500 hover:text-red-400 rounded transition-all",title:"Eliminar permanentemente",children:d.jsx(wr,{className:"w-3.5 h-3.5"})})]})]},D.id)}):d.jsxs("div",{className:"px-4 py-3 text-center",children:[d.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"No encontrado."}),d.jsxs("button",{onClick:w,className:"text-xs text-[#bb86fc] hover:underline font-semibold",children:['Crear "',f,'"']})]})})]}),d.jsx("div",{className:"flex gap-2 flex-wrap",children:r.map(D=>{const _=n.find(x=>x.id===D);return!_||_.type!==e&&!(e==="genre"&&!_.type)?null:d.jsxs("span",{className:`px-3 py-1 ${F.bg} ${F.text} text-xs rounded-full border ${F.border} flex items-center gap-2`,children:[_.name,d.jsx("button",{onClick:()=>s(D),className:"hover:text-white",children:d.jsx(In,{className:"w-3 h-3"})})]},D)})})]})}function ys({size:t=40,borderWidth:e=2,className:n=""}){return d.jsx("div",{className:`flex items-center justify-center ${n}`,children:d.jsx("div",{className:"relative",style:{width:`${t}px`,height:`${t}px`},children:d.jsx("div",{className:"rounded-full animate-spin",style:{width:`${t}px`,height:`${t}px`,borderWidth:`${e}px`,borderStyle:"solid",borderColor:"rgba(187, 134, 252, 0.3)",borderTopColor:"#bb86fc",animation:"spin 1.2s linear infinite",boxShadow:"0 0 20px rgba(139, 92, 246, 0.2)"}})})})}function kj({isOpen:t,onClose:e,onMangaCreated:n,editingManga:r,onDelete:i}){const[s,o]=V.useState({title:"",name:"",description:"",selectedCategories:[]}),[a,u]=V.useState(null),[c,f]=V.useState(!1),[h,p]=V.useState(null),[m,b]=V.useState([]),[S,P]=V.useState(!1),[y,w]=V.useState([]),[T,L]=V.useState(!1),[F,D]=V.useState(null),[_,x]=V.useState(0),[E,k]=V.useState(!1),[C,j]=V.useState(0),[A,de]=V.useState(0),[oe,le]=V.useState(0),[ve,K]=V.useState(0),[ie,N]=V.useState(0),[fe,ye]=V.useState(!1),[R,H]=V.useState(null),[J,te]=V.useState(null),[Ie,pe]=V.useState(!1),[Fe,ut]=V.useState(G1()),Je=!!r;V.useEffect(()=>{var O,B;if(t&&(bt(),r)){o({title:r.title,name:r.author,description:r.description||"",selectedCategories:((O=r.categories)==null?void 0:O.map(Y=>typeof Y=="string"?Y:Y.id))||[]}),r.thumbnail_url&&p(r.thumbnail_url);const Q=(B=r.chapters)==null?void 0:B[0];if(Q!=null&&Q.pages&&Q.pages.length>0){const Y=Q.pages,Ae=Q.original_pages||[],Oe=Y.map((Ne,et)=>{var $;return{thumbnail:Ne,original:Ae[et]||Ne,webpDisplay:Ne,webpCover:Ne,originalFormat:(($=Q.page_formats)==null?void 0:$[et])||"jpg",originalBase64:"",originalUnmodified:""}});w(Oe)}}},[t,r]);async function bt(){try{const O=await wI();b(O)}catch(O){console.error("Error loading categories:",O)}}const mt=async O=>{const{name:B,value:Q}=O.target;o(Y=>({...Y,[B]:Q}))},gt=O=>{o(B=>({...B,selectedCategories:B.selectedCategories.filter(Q=>Q!==O)}))},Ht=async(O,B)=>{if(O.trim()){if(B==="tag"){const Q=O.split(" ").map(Y=>Y.trim()).filter(Y=>Y.length>0);for(const Y of Q)await Vt(Y,B);return}await Vt(O,B)}},Vt=async(O,B)=>{try{const Q=m.find(Y=>Y.name.toLowerCase()===O.trim().toLowerCase()&&Y.type===B);if(Q)o(Y=>Y.selectedCategories.includes(Q.id)?Y:{...Y,selectedCategories:[...Y.selectedCategories,Q.id]});else{const Y=await _I(O.trim(),B);b(Ae=>Ae.find(Oe=>Oe.id===Y.id)?Ae:[...Ae,Y]),o(Ae=>Ae.selectedCategories.includes(Y.id)?Ae:{...Ae,selectedCategories:[...Ae.selectedCategories,Y.id]})}}catch(Q){console.error("Error creating category:",Q)}},Ze=async O=>{try{await bI(O),b(B=>B.filter(Q=>Q.id!==O)),o(B=>({...B,selectedCategories:B.selectedCategories.filter(Q=>Q!==O)}))}catch(B){console.error("Error deleting category:",B),alert("Error al eliminar la categoría")}},Nn=async O=>{var Q;const B=(Q=O.target.files)==null?void 0:Q[0];if(B){f(!0);try{const Y=await q0(B);u(Y),p(Y.originalUnmodified)}catch(Y){console.error("Error processing image:",Y),alert("Error al procesar la imagen. Intenta con otro archivo.")}finally{f(!1)}}},W=async O=>{const B=O.target.files;if(!(!B||B.length===0)){L(!0),le(0),K(0),N(B.length);try{const Q=Array.from(B);let Y=0;const Ae=10,Oe=[];let Ne=0;const et=async()=>{if(Ne>=Q.length)return;const me=Ne++,Pe=Q[me];try{const Ge=await q0(Pe,me+1,Q.length);Oe[me]=Ge}catch(Ge){console.error(`Error processing image ${Pe.name}:`,Ge),Oe[me]=null}finally{Y++,le(Math.round(Y/Q.length*100)),K(Y),await et()}},$=[];for(let me=0;meme!==null);w(me=>[...me,...he])}catch(Q){console.error("Error processing pages:",Q),alert("Error al procesar algunas imágenes.")}finally{L(!1),le(0),K(0),N(0),O.target.value=""}}},ue=O=>{w(B=>B.filter((Q,Y)=>Y!==O))},Ce=O=>{D(O)},we=(O,B)=>{if(O.preventDefault(),F===null||F===B)return;const Q=[...y],Y=Q[F];Q.splice(F,1),Q.splice(B,0,Y),w(Q),D(B)},He=()=>{D(null)},Et=async()=>{var O,B,Q,Y,Ae;if(!s.title||!s.title.trim()){alert("El título es requerido");return}P(!0);try{let Oe=[...s.selectedCategories],Ne=(r==null?void 0:r.thumbnail_url)||void 0,et=(r==null?void 0:r.cover_url)||void 0;if(J)Ne=J.thumbnail,et=J.original;else if(a)try{k(!0),de(2),j(1),x(0);const $=await yc(a.thumbnail,`${s.title}_thumb`);x(50),j(2);const Z=await yc(a.originalUnmodified,`${s.title}_cover`);x(100),Ne=$.data.url,et=Z.data.url}catch($){console.error("Error uploading cover images:",$),$.message==="API_BURNED"?alert("⚠️ API QUEMADA: La API de ImgBB ha alcanzado su límite. Por favor, usa otra API o intenta más tarde."):$.message==="API_INVALID_KEY"?alert("❌ Clave API inválida: La clave API que estás usando no es válida."):alert("Error al subir la portada. Continuar sin portada.")}finally{k(!1),x(0)}if(Je&&r){const $={title:s.title.trim(),author:((O=s.name)==null?void 0:O.trim())||"",description:((B=s.description)==null?void 0:B.trim())||"",categoryIds:Oe};if(Ne&&($.thumbnail_url=Ne),et&&($.cover_url=et),await EI(r.id,$),y.length>0){const Z=y.some(he=>he.originalBase64!=="");if(y.length>0)try{k(!0);const he=y.filter(je=>je.originalBase64!=="");de(he.length*2),j(0),x(0);const me=he.map(je=>je.webpDisplay),Pe=he.map(je=>je.originalUnmodified),Ge=he.map(je=>je.originalFormat),It=await lu(me,`${s.title}_updated_webp`,(je,ii)=>{j(je),x(Math.round(je/(he.length*2)*100))}),Me=await lu(Pe,`${s.title}_updated_original`,(je,ii)=>{j(he.length+je),x(Math.round((he.length+je)/(he.length*2)*100))}),Lr=It.map(je=>je.data.url),xe=Me.map(je=>je.data.url),Te=y.filter(je=>je.originalBase64===""),yt=Te.map(je=>je.webpDisplay),qt=Te.map(je=>je.original),An=Te.map(je=>je.originalFormat),vt=[...yt,...Lr],Wt=[...qt,...xe],Bn=[...An,...Ge];k(!1),x(0);const Gt=(Q=r.chapters)==null?void 0:Q[0];Gt?await Ji(Dt(We,"chapters",Gt.id),{pages:vt,page_formats:Bn,original_pages:Wt,updated_at:Qe.now()}):await Tx({manga_id:r.id,number:1,title:"Páginas",pages:vt,page_formats:Bn,original_pages:Wt})}catch(he){console.error("Error updating chapter:",he),he.message==="API_BURNED"?alert("⚠️ API QUEMADA: La API de ImgBB ha alcanzado su límite. Por favor, usa otra API o intenta más tarde."):he.message==="API_INVALID_KEY"?alert("❌ Clave API inválida: La clave API que estás usando no es válida."):alert("Error al actualizar las páginas.")}}n(r.id)}else{const $={title:s.title.trim(),author:((Y=s.name)==null?void 0:Y.trim())||"",categoryIds:Oe};(Ae=s.description)!=null&&Ae.trim()&&($.description=s.description.trim()),Ne&&($.thumbnail_url=Ne),et&&($.cover_url=et);const Z=await qD($);if(!Z.id)throw new Error("No se pudo obtener el ID del manga creado");const he=Z.id;if(y.length>0)try{k(!0),de(y.length*2),j(0),x(0);const me=y.map(Te=>Te.webpDisplay),Pe=y.map(Te=>Te.originalUnmodified),Ge=y.map(Te=>Te.originalFormat),It=await lu(me,`${s.title}_ch1_webp`,(Te,yt)=>{j(Te),x(Math.round(Te/(y.length*2)*100))}),Me=await lu(Pe,`${s.title}_ch1_original`,(Te,yt)=>{j(y.length+Te),x(Math.round((y.length+Te)/(y.length*2)*100))}),Lr=It.map(Te=>Te.data.url),xe=Me.map(Te=>Te.data.url);k(!1),x(0),await Tx({manga_id:he,number:1,title:"Páginas",pages:Lr,page_formats:Ge,original_pages:xe})}catch(me){console.error("Error creating chapter:",me),me.message==="API_BURNED"?alert("⚠️ API QUEMADA: La API de ImgBB ha alcanzado su límite. Por favor, usa otra API o intenta más tarde."):me.message==="API_INVALID_KEY"?alert("❌ Clave API inválida: La clave API que estás usando no es válida."):alert("Error al crear el capítulo. Por favor intenta de nuevo.")}n(he)}z()}catch(Oe){console.error("Error creating/updating manga:",Oe);let Ne="Error al guardar el manga. ";if(Oe.message)Ne+=Oe.message;else if(Oe.code)switch(Oe.code){case"permission-denied":Ne+="No tienes permisos para realizar esta operación.";break;case"unavailable":Ne+="El servicio no está disponible. Verifica tu conexión.";break;case"invalid-argument":Ne+="Algunos datos no son válidos. Revisa el formulario.";break;default:Ne+=`Código de error: ${Oe.code}`}else Ne+="Por favor intenta de nuevo.";alert(Ne)}finally{P(!1),k(!1),x(0)}},Ft=O=>{const B=y[O];if(!B.originalBase64)te({thumbnail:B.thumbnail,original:B.original}),u(null);else{const Y={thumbnail:B.thumbnail,original:B.originalUnmodified,webpDisplay:B.originalUnmodified,webpCover:B.originalUnmodified,originalFormat:B.originalFormat,originalBase64:B.originalBase64,originalUnmodified:B.originalUnmodified};u(Y),te(null)}p(B.thumbnail),H(O),ye(!1)},z=()=>{o({title:"",name:"",description:"",selectedCategories:[]}),u(null),te(null),p(null),w([]),x(0),k(!1),j(0),de(0),le(0),K(0),ye(!1),H(null),e()};return t?d.jsxs("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:[d.jsxs("div",{className:"bg-gradient-to-b from-[#1f1f1f] to-[#121212] rounded-2xl border border-gray-700/40 w-full max-w-2xl max-h-[90vh] overflow-y-auto shadow-2xl",children:[d.jsxs("div",{className:"sticky top-0 bg-gradient-to-b from-[#2a2a2a] to-[#1f1f1f] border-b border-gray-700/30 px-8 py-6 flex items-center justify-between z-10",children:[d.jsxs("div",{children:[d.jsxs("h2",{className:"text-2xl font-bold flex items-center gap-3",children:[d.jsx("div",{className:"p-2 bg-gradient-to-br from-[#bb86fc] to-[#9966dd] rounded-lg shadow-lg shadow-[#bb86fc]/30",children:d.jsx(nl,{className:"w-5 h-5 text-white"})}),Je?"Editar Manga":"Crear Manga"]}),d.jsx("p",{className:"text-sm text-gray-400 mt-1.5",children:Je?"Actualiza los detalles de tu obra":"Comparte tu historia con el mundo"})]}),d.jsx("button",{onClick:z,className:"text-gray-500 hover:text-white hover:bg-white/10 transition-all p-2 rounded-lg",children:d.jsx(In,{className:"w-6 h-6"})})]}),d.jsxs("div",{className:"p-8 space-y-5",children:[d.jsxs("div",{className:"bg-gradient-to-br from-[#242424] to-[#1a1a1a] rounded-xl p-6 border border-gray-700/40 shadow-lg hover:border-gray-700/60 transition-all",children:[d.jsxs("div",{className:"flex items-center gap-3 mb-5",children:[d.jsx("div",{className:"w-1 h-5 bg-gradient-to-b from-[#bb86fc] to-[#7744cc] rounded-full"}),d.jsx("h3",{className:"text-sm font-semibold text-white tracking-wide uppercase",children:"Información Principal"})]}),d.jsxs("div",{className:"space-y-3.5",children:[d.jsxs("div",{children:[d.jsxs("label",{className:"block text-xs font-semibold text-gray-200 mb-2",children:["Título del Manga ",d.jsx("span",{className:"text-red-400 font-bold",children:"*"})]}),d.jsx("input",{type:"text",name:"title",placeholder:"El nombre de tu obra maestra",value:s.title,onChange:mt,onKeyPress:O=>O.key==="Enter"&&Je&&!S&&Et(),className:"w-full bg-[#1a1a1a] border border-gray-600/50 rounded-lg px-4 py-3 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-[#bb86fc] focus:ring-2 focus:ring-[#bb86fc]/30 transition-all shadow-md hover:border-gray-600/70"})]}),d.jsxs("div",{children:[d.jsxs("label",{className:"block text-xs font-semibold text-gray-200 mb-2",children:["Autor ",d.jsx("span",{className:"text-gray-500 font-normal",children:"(opcional)"})]}),d.jsx("input",{type:"text",name:"name",placeholder:"Tu nombre o seudónimo",value:s.name,onChange:mt,onKeyPress:O=>O.key==="Enter"&&Je&&!S&&Et(),className:"w-full bg-[#1a1a1a] border border-gray-600/50 rounded-lg px-4 py-3 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-[#bb86fc] focus:ring-2 focus:ring-[#bb86fc]/30 transition-all shadow-md hover:border-gray-600/70"})]}),d.jsxs("div",{children:[d.jsxs("label",{className:"block text-xs font-semibold text-gray-200 mb-2",children:["Sinopsis ",d.jsx("span",{className:"text-gray-500 font-normal",children:"(opcional)"})]}),d.jsx("textarea",{name:"description",placeholder:"Cuéntanos de qué trata tu manga, qué lo hace especial...",value:s.description,onChange:mt,onKeyDown:O=>O.key==="Enter"&&O.ctrlKey&&Je&&!S&&Et(),rows:3,className:"w-full bg-[#1a1a1a] border border-gray-600/50 rounded-lg px-4 py-3 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-[#bb86fc] focus:ring-2 focus:ring-[#bb86fc]/30 transition-all shadow-md hover:border-gray-600/70 resize-none"})]})]})]}),d.jsxs("div",{className:"bg-gradient-to-br from-[#242424] to-[#1a1a1a] rounded-xl p-6 border border-gray-700/40 shadow-lg hover:border-gray-700/60 transition-all",children:[d.jsxs("div",{className:"flex items-center gap-3 mb-5",children:[d.jsx("div",{className:"w-1 h-5 bg-gradient-to-b from-[#bb86fc] to-[#7744cc] rounded-full"}),d.jsx("h3",{className:"text-sm font-semibold text-white tracking-wide uppercase",children:"Clasificación"})]}),d.jsx(Ii,{label:"Personajes",type:"character",categories:m,selectedIds:s.selectedCategories,onSelect:O=>{s.selectedCategories.includes(O)||o(B=>({...B,selectedCategories:[...B.selectedCategories,O]}))},onRemove:gt,onCreate:O=>Ht(O,"character"),onDeleteCategory:Ze,colorClass:"text-blue-400",placeholder:"Añadir personaje..."}),d.jsx(Ii,{label:"Series",type:"series",categories:m,selectedIds:s.selectedCategories,onSelect:O=>{s.selectedCategories.includes(O)||o(B=>({...B,selectedCategories:[...B.selectedCategories,O]}))},onRemove:gt,onCreate:O=>Ht(O,"series"),onDeleteCategory:Ze,colorClass:"text-green-400",placeholder:"Añadir serie..."}),d.jsx(Ii,{label:"Géneros",type:"genre",categories:m,selectedIds:s.selectedCategories,onSelect:O=>{s.selectedCategories.includes(O)||o(B=>({...B,selectedCategories:[...B.selectedCategories,O]}))},onRemove:gt,onCreate:O=>Ht(O,"genre"),onDeleteCategory:Ze,colorClass:"text-purple-400",placeholder:"Añadir género..."}),d.jsx(Ii,{label:"Etiquetas",type:"tag",categories:m,selectedIds:s.selectedCategories,onSelect:O=>{s.selectedCategories.includes(O)||o(B=>({...B,selectedCategories:[...B.selectedCategories,O]}))},onRemove:gt,onCreate:O=>Ht(O,"tag"),onDeleteCategory:Ze,colorClass:"text-pink-400",placeholder:"Añadir etiqueta..."})]}),d.jsxs("div",{className:"bg-gradient-to-br from-[#242424] to-[#1a1a1a] rounded-xl p-6 border border-gray-700/40 shadow-lg hover:border-gray-700/60 transition-all",children:[d.jsxs("div",{className:"flex items-center gap-3 mb-5",children:[d.jsx("div",{className:"w-1 h-5 bg-gradient-to-b from-[#bb86fc] to-[#7744cc] rounded-full"}),d.jsx("h3",{className:"text-sm font-semibold text-white tracking-wide uppercase",children:"Portada"}),d.jsx("span",{className:"text-xs text-gray-500 ml-auto",children:"Opcional"})]}),c&&d.jsxs("div",{className:"mb-4",children:[d.jsx("div",{className:"flex items-center justify-between mb-2",children:d.jsx("span",{className:"text-xs font-semibold text-[#bb86fc]",children:"Procesando portada..."})}),d.jsx("div",{className:"w-full bg-gray-700/40 rounded-full h-2 overflow-hidden border border-[#bb86fc]/30",children:d.jsx("div",{className:"bg-gradient-to-r from-[#bb86fc] to-[#9966dd] h-full transition-all duration-300 ease-out animate-pulse",style:{width:"100%"}})})]}),h&&!c&&d.jsxs("div",{className:"mb-4 relative group max-w-xs mx-auto",children:[d.jsx(Kn,{src:h,alt:"Preview",aspectRatio:"3/4",objectFit:"cover",loading:"eager",className:"rounded-xl border border-gray-600 shadow-2xl shadow-[#bb86fc]/20"}),d.jsx("div",{className:"absolute inset-0 rounded-xl bg-black/40 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center gap-2",children:d.jsx("button",{onClick:()=>{u(null),p(null),H(null)},className:"bg-red-600/80 hover:bg-red-600 text-white p-2 rounded-lg transition-all shadow-lg",children:d.jsx(wr,{className:"w-4 h-4"})})}),R!==null&&d.jsxs("div",{className:"absolute bottom-2 left-2 bg-green-600/90 text-white text-xs px-2.5 py-1 rounded-lg font-semibold",children:["Página ",R+1]})]}),d.jsxs("div",{className:"flex gap-3 mb-4",children:[d.jsxs("label",{className:"flex-1 border-2 border-dashed border-gray-600/50 rounded-xl p-6 cursor-pointer hover:border-[#bb86fc]/50 hover:bg-[#bb86fc]/5 transition-all block group",children:[d.jsxs("div",{className:"flex flex-col items-center gap-2",children:[d.jsx("div",{className:"w-12 h-12 bg-gradient-to-br from-[#bb86fc] to-[#9966dd] rounded-xl flex items-center justify-center shadow-lg shadow-[#bb86fc]/40 group-hover:scale-110 group-hover:shadow-[#bb86fc]/60 transition-all",children:c?d.jsx(ys,{size:24,borderWidth:2}):d.jsx(co,{className:"w-6 h-6 text-white"})}),d.jsxs("div",{className:"text-center",children:[d.jsx("p",{className:"text-xs font-semibold text-white mb-0.5",children:c?"Procesando...":"Subir portada"}),d.jsx("p",{className:"text-xs text-gray-400",children:"Archivo"})]})]}),d.jsx("input",{type:"file",accept:"image/*",onChange:Nn,disabled:c,className:"hidden"})]}),y.length>0&&d.jsxs("button",{onClick:()=>ye(!fe),className:"flex-1 border-2 border-dashed border-gray-600/50 rounded-xl p-6 hover:border-[#bb86fc]/50 hover:bg-[#bb86fc]/5 transition-all group flex flex-col items-center justify-center gap-2 bg-gradient-to-br from-[#1a1a1a] to-[#0f0f0f]",children:[d.jsx("div",{className:"w-12 h-12 bg-gradient-to-br from-[#9966dd] to-[#bb86fc] rounded-xl flex items-center justify-center shadow-lg shadow-[#bb86fc]/40 group-hover:scale-110 group-hover:shadow-[#bb86fc]/60 transition-all",children:d.jsx($0,{className:"w-6 h-6 text-white"})}),d.jsxs("div",{className:"text-center",children:[d.jsx("p",{className:"text-xs font-semibold text-white mb-0.5",children:"Elegir página"}),d.jsxs("p",{className:"text-xs text-gray-400",children:[y.length," disponibles"]})]})]})]})]}),d.jsxs("div",{className:"bg-gradient-to-br from-[#242424] to-[#1a1a1a] rounded-xl p-6 border border-gray-700/40 shadow-lg hover:border-gray-700/60 transition-all",children:[d.jsxs("div",{className:"flex items-center gap-3 mb-5",children:[d.jsx("div",{className:"w-1 h-5 bg-gradient-to-b from-[#bb86fc] to-[#7744cc] rounded-full"}),d.jsx("h3",{className:"text-sm font-semibold text-white tracking-wide uppercase",children:"Páginas del Capítulo"}),d.jsx("span",{className:"text-xs text-gray-500 ml-auto",children:"Opcional"}),d.jsxs("button",{onClick:()=>pe(!0),className:"bg-[#1a1a1a] hover:bg-[#242424] border border-gray-600/50 hover:border-[#bb86fc]/50 text-gray-300 hover:text-[#bb86fc] p-2 rounded-lg transition-all flex items-center gap-1.5 text-xs font-medium",title:"Configurar tamaño de lote de subida",children:[d.jsx(H0,{className:"w-3.5 h-3.5"}),d.jsxs("span",{className:"hidden sm:inline",children:["Subida: ",Fe===0?"Sin límite":`${Fe} por lote`]})]})]}),T&&d.jsxs("div",{className:"mb-5",children:[d.jsxs("div",{className:"flex items-center justify-between mb-2",children:[d.jsxs("span",{className:"text-xs font-semibold text-[#bb86fc]",children:["Procesadas ",ve," de ",ie]}),d.jsxs("span",{className:"text-xs font-bold text-[#bb86fc]",children:[oe,"%"]})]}),d.jsx("div",{className:"w-full bg-gray-700/40 rounded-full h-2 overflow-hidden border border-[#bb86fc]/30",children:d.jsx("div",{className:"bg-gradient-to-r from-[#bb86fc] to-[#9966dd] h-full transition-all duration-300 ease-out",style:{width:`${oe}%`}})})]}),y.length>0&&!T&&d.jsxs("div",{className:"mb-5",children:[d.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[d.jsx(B0,{className:"w-3.5 h-3.5 text-gray-500"}),d.jsxs("p",{className:"text-xs text-gray-400",children:[y.length," página",y.length!==1?"s":""," • Arrastra para reordenar"]})]}),d.jsx("div",{className:"grid grid-cols-4 gap-2",children:y.map((O,B)=>d.jsxs("div",{draggable:!0,onDragStart:()=>Ce(B),onDragOver:Q=>we(Q,B),onDragEnd:He,style:{animationDelay:`${B*40}ms`},className:`relative group cursor-move opacity-0 animate-[fadeIn_0.7s_ease-out_forwards] ${F===B?"opacity-50 scale-95":"hover:scale-105"} transition-all duration-200`,children:[d.jsxs("div",{className:"relative overflow-hidden w-full aspect-[3/4] rounded-lg border border-gray-600/50 shadow-md bg-black",children:[d.jsx("div",{className:"absolute inset-0 flex items-center justify-center z-10 transition-opacity duration-300",children:d.jsx("div",{className:"rounded-full animate-spin",style:{width:"24px",height:"24px",borderWidth:"2px",borderStyle:"solid",borderColor:"rgba(187, 134, 252, 0.2)",borderTopColor:"#bb86fc",animation:"spin 0.6s linear infinite"}})}),d.jsx("img",{src:O.thumbnail,alt:`Página ${B+1}`,className:"w-full h-full object-cover transition-all duration-700 ease-out transform-gpu group-hover:scale-[1.08] group-hover:shadow-[#bb86fc]/30 opacity-0 scale-95",onLoad:Q=>{var Ae;Q.currentTarget.classList.remove("opacity-0","scale-95"),Q.currentTarget.classList.add("opacity-100","scale-100");const Y=(Ae=Q.currentTarget.parentElement)==null?void 0:Ae.querySelector("div:nth-child(1)");Y&&Y.classList.add("opacity-0","pointer-events-none")}})]}),d.jsxs("div",{className:"absolute inset-0 bg-black/60 opacity-0 group-hover:opacity-100 transition-opacity rounded-lg flex items-center justify-center gap-2",children:[d.jsx(B0,{className:"w-4 h-4 text-white/70"}),d.jsx("button",{onClick:()=>ue(B),className:"bg-red-600/80 hover:bg-red-600 text-white p-1.5 rounded-lg transition-all shadow-lg",children:d.jsx(wr,{className:"w-3.5 h-3.5"})})]}),d.jsx("div",{className:"absolute top-1.5 left-1.5 bg-black/80 text-white text-xs px-2 py-0.5 rounded-md font-semibold",children:B+1})]},B))})]}),d.jsxs("label",{className:"border-2 border-dashed border-gray-600/50 rounded-xl p-8 text-center cursor-pointer hover:border-[#bb86fc]/50 hover:bg-[#bb86fc]/5 transition-all block group",children:[d.jsx("div",{className:"w-14 h-14 bg-gradient-to-br from-[#bb86fc] to-[#9966dd] rounded-xl flex items-center justify-center mx-auto mb-2.5 shadow-lg shadow-[#bb86fc]/40 group-hover:scale-110 group-hover:shadow-[#bb86fc]/60 transition-all",children:T?d.jsx(ys,{size:24,borderWidth:2}):d.jsx($0,{className:"w-7 h-7 text-white"})}),d.jsx("p",{className:"text-sm font-semibold text-white mb-1",children:T?`Procesando ${ve}...`:y.length>0?"Agregar más páginas":"Sube tus páginas"}),d.jsx("p",{className:"text-xs text-gray-400 mb-2",children:"Arrastra o selecciona múltiples imágenes"}),d.jsx("p",{className:"text-xs text-gray-500",children:"Se optimizan automáticamente para mejor rendimiento"}),d.jsx("input",{type:"file",accept:"image/*",multiple:!0,onChange:W,disabled:T,className:"hidden"})]})]}),E&&d.jsxs("div",{className:"mb-6 bg-gradient-to-br from-[#242424] to-[#1a1a1a] rounded-xl p-5 border border-[#bb86fc]/30 shadow-xl",children:[d.jsxs("div",{className:"flex items-center justify-between mb-3",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(ys,{size:16,borderWidth:2}),d.jsxs("span",{className:"text-sm font-semibold text-white",children:["Subiendo imagen ",C," de ",A]})]}),d.jsxs("span",{className:"text-sm font-bold text-[#bb86fc]",children:[_,"%"]})]}),d.jsx("div",{className:"w-full bg-gray-700/40 rounded-full h-3 overflow-hidden border border-[#bb86fc]/40 shadow-inner",children:d.jsx("div",{className:"bg-gradient-to-r from-[#bb86fc] via-[#9966dd] to-[#bb86fc] h-full transition-all duration-500 ease-out relative overflow-hidden",style:{width:`${_}%`},children:d.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent animate-pulse"})})}),d.jsx("p",{className:"text-xs text-gray-400 mt-2 text-center",children:"Por favor no cierres esta ventana..."})]}),d.jsxs("div",{className:"flex gap-3 pt-6 border-t border-gray-700/50",children:[Je&&i&&d.jsxs("button",{onClick:()=>{window.confirm("¿Estás seguro de que deseas eliminar este manga? Esta acción no se puede deshacer.")&&r&&(i(r.id),e())},className:"bg-red-500/10 border border-red-500/30 hover:bg-red-500/20 text-red-500 px-4 py-3 rounded-lg font-semibold text-sm transition-all flex items-center gap-2 mr-auto",children:[d.jsx(wr,{className:"w-4 h-4"}),"Eliminar"]}),d.jsx("button",{onClick:z,disabled:S||E,className:"flex-1 bg-[#1a1a1a] border border-gray-600/50 hover:border-gray-500 hover:bg-[#242424] text-white px-5 py-3 rounded-lg font-semibold text-sm transition-all shadow-md disabled:opacity-50 disabled:cursor-not-allowed",children:"Cancelar"}),d.jsx("button",{onClick:Et,className:"flex-1 bg-gradient-to-r from-[#bb86fc] to-[#9966dd] hover:from-[#9966dd] hover:to-[#7744cc] text-white px-5 py-3 rounded-lg font-semibold text-sm transition-all shadow-lg shadow-[#bb86fc]/40 hover:shadow-[#bb86fc]/60 disabled:opacity-50 disabled:cursor-not-allowed active:scale-95",disabled:c||S||E||!s.title.trim(),children:E?"Subiendo imágenes...":S?Je?"Actualizando...":"Creando...":Je?"Guardar Cambios":"Crear Manga"})]})]})]}),fe&&d.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:d.jsxs("div",{className:"bg-gradient-to-b from-[#1f1f1f] to-[#121212] rounded-2xl border border-gray-700/40 w-full max-w-2xl max-h-[80vh] shadow-2xl overflow-hidden flex flex-col",children:[d.jsxs("div",{className:"bg-gradient-to-b from-[#2a2a2a]/80 to-[#1f1f1f]/80 border-b border-gray-700/30 px-6 py-4 flex items-center justify-between flex-shrink-0",children:[d.jsxs("div",{children:[d.jsx("h2",{className:"text-xl font-bold text-white",children:"Selecciona portada"}),d.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Elige una página para usar como portada del manga"})]}),d.jsx("button",{onClick:()=>ye(!1),className:"text-gray-500 hover:text-white transition-colors p-1.5 rounded-lg hover:bg-white/10 flex-shrink-0",children:d.jsx(In,{className:"w-5 h-5"})})]}),d.jsx("div",{className:"overflow-y-auto flex-1 p-6",children:d.jsx("div",{className:"grid grid-cols-3 md:grid-cols-4 gap-3",children:y.map((O,B)=>d.jsxs("button",{onClick:()=>Ft(B),className:`group relative aspect-[3/4] rounded-lg overflow-hidden transition-all duration-300 hover:scale-105 border-2 ${R===B?"border-green-500 shadow-lg shadow-green-500/40":"border-gray-600/50 hover:border-[#bb86fc]/50"}`,children:[d.jsxs("div",{className:"absolute inset-0 overflow-hidden bg-black flex items-center justify-center",children:[d.jsx("div",{className:"absolute inset-0 flex items-center justify-center z-10 transition-opacity duration-300",children:d.jsx("div",{className:"rounded-full animate-spin",style:{width:"20px",height:"20px",borderWidth:"2px",borderStyle:"solid",borderColor:"rgba(187, 134, 252, 0.2)",borderTopColor:"#bb86fc",animation:"spin 0.6s linear infinite"}})}),d.jsx("img",{src:O.thumbnail,alt:`Página ${B+1}`,className:"w-full h-full object-cover transition-all duration-700 ease-out transform-gpu group-hover:scale-[1.10] opacity-0 scale-95",onLoad:Q=>{var Ae;Q.currentTarget.classList.remove("opacity-0","scale-95"),Q.currentTarget.classList.add("opacity-100","scale-100");const Y=(Ae=Q.currentTarget.parentElement)==null?void 0:Ae.querySelector("div:nth-child(1)");Y&&Y.classList.add("opacity-0","pointer-events-none")}})]}),d.jsx("div",{className:"absolute inset-0 bg-black/40 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center",children:d.jsx("div",{className:"bg-[#bb86fc]/90 text-white px-3 py-1.5 rounded-lg font-semibold text-sm",children:"Seleccionar"})}),d.jsx("div",{className:"absolute bottom-2 left-2 bg-black/80 text-white text-xs px-2 py-1 rounded-md font-semibold",children:B+1}),R===B&&d.jsxs("div",{className:"absolute top-2 right-2 bg-green-600/90 text-white px-2.5 py-1.5 rounded-lg flex items-center gap-1.5 font-semibold text-xs",children:[d.jsx("div",{className:"w-2 h-2 bg-white rounded-full"}),"Seleccionado"]})]},B))})}),d.jsxs("div",{className:"bg-gradient-to-b from-[#1f1f1f]/80 to-[#1a1a1a]/80 border-t border-gray-700/30 px-6 py-4 flex items-center justify-end gap-3 flex-shrink-0",children:[d.jsx("button",{onClick:()=>ye(!1),className:"bg-[#1a1a1a] border border-gray-600/50 hover:border-gray-500 hover:bg-[#242424] text-white px-4 py-2 rounded-lg font-semibold text-sm transition-all",children:"Cancelar"}),d.jsx("button",{onClick:()=>ye(!1),className:"bg-gradient-to-r from-[#bb86fc] to-[#9966dd] hover:from-[#9966dd] hover:to-[#7744cc] text-white px-4 py-2 rounded-lg font-semibold text-sm transition-all shadow-lg shadow-[#bb86fc]/40 hover:shadow-[#bb86fc]/60",children:"Confirmar"})]})]})}),Ie&&d.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:d.jsxs("div",{className:"bg-gradient-to-b from-[#1f1f1f] to-[#121212] rounded-2xl border border-gray-700/40 w-full max-w-md shadow-2xl",children:[d.jsxs("div",{className:"bg-gradient-to-b from-[#2a2a2a]/80 to-[#1f1f1f]/80 border-b border-gray-700/30 px-6 py-4 flex items-center justify-between",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx("div",{className:"p-2 bg-gradient-to-br from-[#bb86fc] to-[#9966dd] rounded-lg shadow-lg shadow-[#bb86fc]/30",children:d.jsx(H0,{className:"w-5 h-5 text-white"})}),d.jsxs("div",{children:[d.jsx("h2",{className:"text-xl font-bold text-white",children:"Configurar Subida"}),d.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:"Tamaño de lote de imágenes"})]})]}),d.jsx("button",{onClick:()=>pe(!1),className:"text-gray-500 hover:text-white transition-colors p-1.5 rounded-lg hover:bg-white/10",children:d.jsx(In,{className:"w-5 h-5"})})]}),d.jsxs("div",{className:"p-6 space-y-4",children:[d.jsxs("div",{className:"bg-[#1a1a1a] border border-gray-700/40 rounded-lg p-4 mb-4",children:[d.jsx("h3",{className:"text-xs font-semibold text-gray-300 mb-2",children:"Opciones disponibles:"}),d.jsxs("ul",{className:"text-xs text-gray-400 space-y-1.5",children:[d.jsx("li",{children:"• 1 por lote: Más lento pero más estable"}),d.jsx("li",{children:"• 10 por lote: Balance entre velocidad y estabilidad (predeterminado)"}),d.jsx("li",{children:"• 50 por lote: Más rápido para muchas imágenes"}),d.jsx("li",{children:"• Sin límite: Sube todas las imágenes simultáneamente"})]})]}),d.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[d.jsx("button",{onClick:()=>{ut(1),au(1)},className:`p-4 rounded-lg border-2 transition-all ${Fe===1?"border-[#bb86fc] bg-[#bb86fc]/10 shadow-lg shadow-[#bb86fc]/30":"border-gray-600/50 hover:border-gray-600 bg-[#1a1a1a]"}`,children:d.jsxs("div",{className:"text-center",children:[d.jsx("div",{className:"text-2xl font-bold text-white mb-1",children:"1"}),d.jsx("div",{className:"text-xs text-gray-400",children:"Por lote"})]})}),d.jsx("button",{onClick:()=>{ut(10),au(10)},className:`p-4 rounded-lg border-2 transition-all ${Fe===10?"border-[#bb86fc] bg-[#bb86fc]/10 shadow-lg shadow-[#bb86fc]/30":"border-gray-600/50 hover:border-gray-600 bg-[#1a1a1a]"}`,children:d.jsxs("div",{className:"text-center",children:[d.jsx("div",{className:"text-2xl font-bold text-white mb-1",children:"10"}),d.jsx("div",{className:"text-xs text-gray-400",children:"Por lote"})]})}),d.jsx("button",{onClick:()=>{ut(50),au(50)},className:`p-4 rounded-lg border-2 transition-all ${Fe===50?"border-[#bb86fc] bg-[#bb86fc]/10 shadow-lg shadow-[#bb86fc]/30":"border-gray-600/50 hover:border-gray-600 bg-[#1a1a1a]"}`,children:d.jsxs("div",{className:"text-center",children:[d.jsx("div",{className:"text-2xl font-bold text-white mb-1",children:"50"}),d.jsx("div",{className:"text-xs text-gray-400",children:"Por lote"})]})}),d.jsx("button",{onClick:()=>{ut(0),au(999999)},className:`p-4 rounded-lg border-2 transition-all ${Fe===0||Fe>=999999?"border-[#bb86fc] bg-[#bb86fc]/10 shadow-lg shadow-[#bb86fc]/30":"border-gray-600/50 hover:border-gray-600 bg-[#1a1a1a]"}`,children:d.jsxs("div",{className:"text-center",children:[d.jsx("div",{className:"text-2xl font-bold text-white mb-1",children:"∞"}),d.jsx("div",{className:"text-xs text-gray-400",children:"Sin límite"})]})})]}),d.jsx("div",{className:"bg-green-500/10 border border-green-500/30 rounded-lg p-3",children:d.jsxs("p",{className:"text-green-400 text-xs font-semibold",children:["Configuración guardada: ",Fe===0||Fe>=999999?"Sin límite":`${Fe} imagen${Fe!==1?"es":""} por lote`]})}),d.jsx("button",{onClick:()=>pe(!1),className:"w-full bg-gradient-to-r from-[#bb86fc] to-[#9966dd] hover:from-[#9966dd] hover:to-[#7744cc] text-white px-4 py-3 rounded-lg font-semibold text-sm transition-all shadow-lg shadow-[#bb86fc]/40 hover:shadow-[#bb86fc]/60",children:"Cerrar"})]})]})})]}):null}const II="settings",SI="announcement";async function Nx(t,e){const n=Dt(We,II,SI),r=new Date;let i=null;e&&(i=new Date(r.getTime()+e).toISOString());const s={text:t,updatedAt:r.toISOString(),expiresAt:i};await ME(n,s)}function Cj(t){const e=Dt(We,II,SI);return bg(e,n=>{n.exists()?t(n.data()):t(null)})}function Nj({isOpen:t,onClose:e,isAdmin:n,isCategoryPlusEnabled:r,onCategoryPlusChange:i}){const[s,o]=V.useState(""),[a,u]=V.useState(!1),[c,f]=V.useState(""),[h,p]=V.useState(24),[m,b]=V.useState("hours"),[S,P]=V.useState(!1),[y,w]=V.useState(!1);V.useEffect(()=>{if(t){const x=q1();x?(o(x),u(!0)):(o(""),u(!1))}},[t]);const T=()=>{if(!s.trim()){Nt.error("Por favor ingresa una API válida");return}y2(s.trim()),u(!0),Nt.success("API guardada exitosamente.")},L=()=>{v2(),o(""),u(!1),w(!1),Nt.success("API eliminada.")},F=()=>{w(!0)},D=async()=>{if(!c.trim()){Nt.error("El texto del anuncio no puede estar vacío");return}let x=0;m==="seconds"&&(x=h*1e3),m==="minutes"&&(x=h*60*1e3),m==="hours"&&(x=h*60*60*1e3),m==="days"&&(x=h*24*60*60*1e3);try{await Nx(c,x),Nt.success("Anuncio publicado exitosamente"),f(""),e()}catch(E){console.error(E),Nt.error("Error al publicar el anuncio")}},_=async()=>{try{await Nx("",null),f(""),P(!1),Nt.success("Anuncio eliminado.")}catch(x){console.error(x),Nt.error("Error al eliminar")}};return t?d.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50 p-4 animate-in fade-in duration-200",children:d.jsxs("div",{className:"bg-[#121212] rounded-2xl border border-gray-800 w-full max-w-lg shadow-2xl overflow-hidden flex flex-col max-h-[90vh]",children:[d.jsxs("div",{className:"bg-[#1a1a1a] border-b border-gray-800 px-6 py-4 flex items-center justify-between sticky top-0 z-10",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx("div",{className:"p-2 bg-[#bb86fc]/10 rounded-lg text-[#bb86fc]",children:d.jsx($1,{className:"w-5 h-5"})}),d.jsx("h2",{className:"text-xl font-bold text-white",children:"Ajustes de Administrador"})]}),d.jsx("button",{onClick:e,className:"text-gray-400 hover:text-white transition-colors p-2 hover:bg-white/5 rounded-lg",children:d.jsx(In,{className:"w-5 h-5"})})]}),d.jsxs("div",{className:"p-6 space-y-8 overflow-y-auto custom-scrollbar",children:[d.jsx("section",{className:"space-y-4",children:d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx("div",{className:`p-2 rounded-lg ${r?"bg-purple-500/10 text-purple-400":"bg-gray-800 text-gray-400"}`,children:d.jsx(U1,{className:"w-5 h-5"})}),d.jsxs("div",{children:[d.jsx("h3",{className:"text-sm font-semibold text-white",children:"Categorías Plus"}),d.jsx("p",{className:"text-xs text-gray-400",children:"Habilitar selección múltiple y edición masiva"})]})]}),d.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[d.jsx("input",{type:"checkbox",className:"sr-only peer",checked:r,onChange:x=>i(x.target.checked)}),d.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-purple-300 dark:peer-focus:ring-purple-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-[#bb86fc]"})]})]})}),d.jsxs("section",{className:"space-y-4 pt-4 border-t border-gray-800",children:[d.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[d.jsx("div",{className:"p-2 bg-red-500/10 rounded-lg text-red-500",children:d.jsx(Hf,{className:"w-5 h-5"})}),d.jsxs("div",{children:[d.jsx("h3",{className:"tex-sm font-semibold text-white",children:"Gestión de Vistas"}),d.jsx("p",{className:"text-xs text-gray-400",children:"Restablecer contadores de visualización"})]})]}),d.jsx("button",{onClick:async()=>{if(window.confirm("¿Seguro que quieres reiniciar las vistas de TODOS los mangas a 0? Esta acción no se puede deshacer."))try{await WD(),Nt.success("Vistas reiniciadas correctamente.")}catch(x){console.error(x),Nt.error("Error al reiniciar vistas.")}},className:"w-full bg-red-500/10 hover:bg-red-500/20 text-red-500 py-2.5 rounded-lg font-semibold text-sm transition-all border border-red-500/20 hover:border-red-500/40",children:"Reiniciar Vistas a 0"})]}),d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"h-px bg-gray-800"}),d.jsxs("section",{className:"space-y-4",children:[d.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[d.jsx("div",{className:"p-2 bg-purple-500/10 rounded-lg text-purple-400",children:d.jsx(z1,{className:"w-5 h-5"})}),d.jsxs("div",{children:[d.jsx("h3",{className:"tex-sm font-semibold text-white",children:"Publicar Anuncio"}),d.jsx("p",{className:"text-xs text-gray-400",children:"Visible para todos los usuarios"})]})]}),d.jsxs("div",{className:"space-y-3",children:[d.jsx("textarea",{value:c,onChange:x=>f(x.target.value),placeholder:"Escribe el mensaje del anuncio...",className:"w-full bg-[#1a1a1a] border border-gray-700 rounded-lg px-4 py-3 text-sm text-white placeholder-gray-600 focus:outline-none focus:border-[#bb86fc] min-h-[100px] resize-none"}),d.jsxs("div",{className:"flex gap-3",children:[d.jsxs("div",{className:"flex-1 bg-[#1a1a1a] border border-gray-700 rounded-lg px-3 py-2 flex items-center gap-2",children:[d.jsx(a2,{className:"w-4 h-4 text-gray-400"}),d.jsx("input",{type:"number",min:"1",value:h,onChange:x=>p(Number(x.target.value)),className:"bg-transparent text-white text-sm w-full focus:outline-none"})]}),d.jsxs("select",{value:m,onChange:x=>b(x.target.value),className:"bg-[#1a1a1a] border border-gray-700 rounded-lg px-3 py-2 text-sm text-white focus:outline-none focus:border-[#bb86fc]",children:[d.jsx("option",{value:"seconds",children:"Segundos"}),d.jsx("option",{value:"minutes",children:"Minutos"}),d.jsx("option",{value:"hours",children:"Horas"}),d.jsx("option",{value:"days",children:"Días"})]})]}),d.jsxs("div",{className:"flex gap-2",children:[d.jsx("button",{onClick:()=>P(!0),className:"px-4 py-2.5 rounded-lg font-semibold text-sm bg-red-500/10 text-red-500 border border-red-500/20 hover:bg-red-500/20 transition-colors",title:"Eliminar anuncio",children:d.jsx(wr,{className:"w-5 h-5"})}),d.jsx("button",{onClick:D,className:"flex-1 bg-gradient-to-r from-[#bb86fc] to-[#9966dd] hover:from-[#9966dd] hover:to-[#7744cc] text-white py-2.5 rounded-lg font-semibold text-sm transition-all shadow-lg shadow-[#bb86fc]/20",children:"Publicar Anuncio"})]})]})]})]}),d.jsx("div",{className:"h-px bg-gray-800"}),d.jsxs("section",{className:"space-y-4",children:[d.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[d.jsx("div",{className:"p-2 bg-blue-500/10 rounded-lg text-blue-400",children:d.jsx(l2,{className:"w-5 h-5"})}),d.jsxs("div",{children:[d.jsx("h3",{className:"tex-sm font-semibold text-white",children:"Configuración de API"}),d.jsx("p",{className:"text-xs text-gray-400",children:"Gestiona tu clave personal de ImgBB"})]})]}),a&&d.jsx("div",{className:"bg-green-500/10 border border-green-500/20 rounded-lg p-3",children:d.jsxs("p",{className:"text-green-400 text-xs font-medium flex items-center gap-2",children:[d.jsx(d2,{className:"w-3 h-3"}),"API personal activa"]})}),d.jsxs("div",{className:"space-y-2",children:[d.jsx("input",{type:"text",placeholder:"Pega tu API Key de ImgBB aquí...",value:s,onChange:x=>o(x.target.value),className:"w-full bg-[#1a1a1a] border border-gray-700 rounded-lg px-4 py-3 text-sm text-white placeholder-gray-600 focus:outline-none focus:border-[#bb86fc] focus:ring-1 focus:ring-[#bb86fc] transition-all font-mono"}),d.jsxs("p",{className:"text-xs text-gray-500",children:["Obtén tu API key gratuitamente en ",d.jsx("a",{href:"https://api.imgbb.com/",target:"_blank",rel:"noopener noreferrer",className:"text-[#bb86fc] hover:underline",children:"api.imgbb.com"})]})]}),d.jsxs("div",{className:"flex gap-3",children:[a&&d.jsxs("button",{onClick:F,className:"flex-1 bg-red-500/10 border border-red-500/30 hover:bg-red-500/20 text-red-500 px-4 py-2.5 rounded-lg font-medium text-sm transition-colors flex items-center justify-center gap-2",children:[d.jsx(wr,{className:"w-4 h-4"}),"Eliminar"]}),d.jsxs("button",{onClick:T,disabled:!s.trim(),className:"flex-1 bg-[#1a1a1a] border border-gray-700 hover:border-[#bb86fc] hover:text-[#bb86fc] disabled:opacity-50 disabled:hover:border-gray-700 disabled:hover:text-gray-500 text-gray-300 px-4 py-2.5 rounded-lg font-medium text-sm transition-all flex items-center justify-center gap-2 group",children:[d.jsx(Cm,{className:"w-4 h-4 group-hover:scale-110 transition-transform"}),"Guardar Cambios"]})]})]})]}),S&&d.jsx("div",{className:"absolute inset-0 bg-black/80 backdrop-blur-sm flex items-center justify-center z-50 p-6 animate-in fade-in duration-200",children:d.jsx("div",{className:"bg-[#1a1a1a] border border-gray-700 w-full max-w-sm rounded-xl shadow-2xl p-6 transform scale-100 animate-in zoom-in-95 duration-200",children:d.jsxs("div",{className:"flex flex-col items-center text-center gap-4",children:[d.jsx("div",{className:"p-3 bg-red-500/10 rounded-full text-red-500",children:d.jsx(wr,{className:"w-8 h-8"})}),d.jsxs("div",{children:[d.jsx("h3",{className:"text-lg font-bold text-white mb-1",children:"¿Eliminar anuncio?"}),d.jsx("p",{className:"text-sm text-gray-400",children:"Esta acción eliminará el anuncio actual inmediatamente. No se puede deshacer."})]}),d.jsxs("div",{className:"flex gap-3 w-full mt-2",children:[d.jsx("button",{onClick:()=>P(!1),className:"flex-1 px-4 py-2 rounded-lg text-sm font-semibold text-gray-300 hover:bg-gray-800 transition-colors",children:"Cancelar"}),d.jsx("button",{onClick:_,className:"flex-1 px-4 py-2 rounded-lg text-sm font-semibold bg-red-500 hover:bg-red-600 text-white transition-colors shadow-lg shadow-red-500/20",children:"Eliminar"})]})]})})}),y&&d.jsx("div",{className:"absolute inset-0 bg-black/80 backdrop-blur-sm flex items-center justify-center z-50 p-6 animate-in fade-in duration-200",children:d.jsx("div",{className:"bg-[#1a1a1a] border border-gray-700 w-full max-w-sm rounded-xl shadow-2xl p-6 transform scale-100 animate-in zoom-in-95 duration-200",children:d.jsxs("div",{className:"flex flex-col items-center text-center gap-4",children:[d.jsx("div",{className:"p-3 bg-red-500/10 rounded-full text-red-500",children:d.jsx(wr,{className:"w-8 h-8"})}),d.jsxs("div",{children:[d.jsx("h3",{className:"text-lg font-bold text-white mb-1",children:"¿Eliminar API personal?"}),d.jsx("p",{className:"text-sm text-gray-400",children:"Perderás el acceso a tus subidas privadas hasta que ingreses una clave válida."})]}),d.jsxs("div",{className:"flex gap-3 w-full mt-2",children:[d.jsx("button",{onClick:()=>w(!1),className:"flex-1 px-4 py-2 rounded-lg text-sm font-semibold text-gray-300 hover:bg-gray-800 transition-colors",children:"Cancelar"}),d.jsx("button",{onClick:L,className:"flex-1 px-4 py-2 rounded-lg text-sm font-semibold bg-red-500 hover:bg-red-600 text-white transition-colors shadow-lg shadow-red-500/20",children:"Eliminar"})]})]})})})]})}):null}function Aj({isAdmin:t}){const[e,n]=V.useState(""),[r,i]=V.useState(null),[s,o]=V.useState(""),[a,u]=V.useState(!0);return V.useEffect(()=>{const c=Cj(f=>{f?(n(f.text),i(f.expiresAt)):(n(""),i(null)),u(!1)});return()=>c()},[]),V.useEffect(()=>{if(!r){o("");return}const c=setInterval(()=>{const f=new Date().getTime(),p=new Date(r).getTime()-f;if(p<=0)n(""),i(null),clearInterval(c);else{const m=Math.floor(p/864e5),b=Math.floor(p%(1e3*60*60*24)/(1e3*60*60)),S=Math.floor(p%(1e3*60*60)/(1e3*60)),P=Math.floor(p%(1e3*60)/1e3);let y="";m>0&&(y+=`${m}d `),y+=`${b.toString().padStart(2,"0")}h ${S.toString().padStart(2,"0")}m ${P.toString().padStart(2,"0")}s`,o(y)}},1e3);return()=>clearInterval(c)},[r]),!e&&!a||!e?null:d.jsx("div",{className:"w-full max-w-[1800px] mx-auto px-4 sm:px-6 md:px-12 mt-6 mb-8 animate-in fade-in slide-in-from-top-4 duration-500 flex justify-center",children:d.jsxs("div",{className:"bg-gradient-to-r from-[#bb86fc]/20 to-[#121212] border border-[#bb86fc]/30 rounded-xl p-6 flex flex-col items-center gap-4 shadow-lg shadow-[#bb86fc]/10 relative group backdrop-blur-sm max-w-2xl w-full text-center",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx("div",{className:"p-2.5 bg-[#bb86fc]/20 rounded-lg animate-pulse",children:d.jsx(z1,{className:"w-6 h-6 text-[#bb86fc]"})}),d.jsxs("h3",{className:"text-sm font-bold text-[#bb86fc] uppercase tracking-wider flex items-center gap-2",children:["Información Importante",d.jsx("span",{className:"w-2 h-2 rounded-full bg-[#bb86fc] animate-ping"})]})]}),d.jsx("div",{className:"text-base text-gray-200 leading-relaxed whitespace-pre-wrap font-medium max-w-lg",children:e}),s&&d.jsxs("div",{className:"flex items-center gap-2 text-xs font-mono text-gray-400 bg-black/30 px-3 py-1.5 rounded-full border border-gray-800",children:[d.jsx(h2,{className:"w-3.5 h-3.5"}),d.jsxs("span",{children:["Expira en: ",s]})]})]})})}const TI=()=>"",Pj=t=>{if(!t)return;if(t.startsWith("blob:")||t.startsWith("data:"))return t;const e=TI(),n=new URLSearchParams({url:t,width:"600",quality:"85",format:"webp"});return`${e}/api/image-proxy?${n.toString()}`},Rj=(t,e)=>{if(!t)return"";if(t.startsWith("blob:")||t.startsWith("data:"))return t;const n=TI(),r=new URLSearchParams({url:t});return`${n}/api/image-proxy?${r.toString()}`};function kI({id:t,title:e,author:n,pageCount:r,thumbnail:i,manga:s,onSelect:o,onEdit:a,onDelete:u,isCategoryPlusEnabled:c,isSelected:f,onToggleSelect:h}){const[p,m]=V.useState(!1),b=i?Pj(i):void 0,S=w=>{w.stopPropagation(),m(!0)},P=w=>{w.stopPropagation(),u==null||u(t),m(!1)},y=w=>{w.stopPropagation(),s&&(a==null||a(s))};return d.jsxs("div",{className:"group cursor-pointer flex flex-col w-full max-w-xs",children:[d.jsxs("div",{onClick:()=>{c&&h?h():(GD(t),o==null||o(t))},className:`relative bg-black rounded-lg shadow-lg overflow-hidden transition-transform duration-300 hover:scale-[1.02] aspect-[2/3] ${f?"ring-4 ring-[#bb86fc]":""}`,children:[b?d.jsxs(d.Fragment,{children:[d.jsx(Kn,{src:b,alt:e,aspectRatio:"2/3",objectFit:"cover",loading:"lazy",imgClassName:"group-hover:scale-110"}),d.jsx("div",{className:"absolute inset-x-0 bottom-0 h-1/3 bg-gradient-to-t from-black/60 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300 pointer-events-none"})]}):d.jsx("div",{className:"w-full aspect-[2/3] flex items-center justify-center text-white/40 bg-gradient-to-br from-gray-800 to-gray-900 rounded-lg group-hover:text-white/60",children:d.jsx(nl,{className:"w-12 h-12"})}),d.jsxs("div",{className:"absolute bottom-2 left-2 bg-black/70 text-white text-xs px-2 py-1 rounded-md font-semibold opacity-0 group-hover:opacity-100 transition-opacity duration-300",children:[r," paginas"]}),c&&d.jsx("div",{className:`absolute top-2 left-2 w-6 h-6 rounded-md border-2 flex items-center justify-center transition-all ${f?"bg-[#bb86fc] border-[#bb86fc]":"bg-black/50 border-white/50 hover:border-white"}`,children:f&&d.jsx(wl,{className:"w-4 h-4 text-white"})}),!c&&d.jsxs("div",{className:"absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity duration-300 flex gap-1",children:[s&&a&&d.jsx("button",{onClick:y,className:"bg-black/60 hover:bg-purple-600 text-white p-1.5 rounded-full transition-colors backdrop-blur-sm",title:"Editar manga",children:d.jsx(B1,{className:"w-3 h-3"})}),u&&d.jsx("button",{onClick:S,className:"bg-black/60 hover:bg-red-600 text-white p-1.5 rounded-full transition-colors backdrop-blur-sm",title:"Eliminar manga",children:d.jsx(wr,{className:"w-3 h-3"})})]}),p&&d.jsxs("div",{className:"absolute inset-0 bg-black/80 backdrop-blur-sm flex flex-col items-center justify-center gap-3 rounded-lg z-20 animate-in fade-in duration-200",children:[d.jsx("p",{className:"text-white text-sm font-semibold text-center px-3",children:"Eliminar manga?"}),d.jsxs("div",{className:"flex gap-2",children:[d.jsx("button",{onClick:w=>{w.stopPropagation(),m(!1)},className:"bg-gray-600 hover:bg-gray-700 text-white px-3 py-1.5 rounded-md text-xs font-semibold transition-all duration-200 transform hover:scale-105 active:scale-95",children:"Cancelar"}),d.jsx("button",{onClick:P,className:"bg-red-600 hover:bg-red-700 text-white px-3 py-1.5 rounded-md text-xs font-semibold transition-all duration-200 transform hover:scale-105 active:scale-95",children:"Eliminar"})]})]})]}),d.jsxs("div",{className:"mt-1 sm:mt-2 flex flex-col gap-0.5 text-center mb-2",children:[d.jsx("h3",{onClick:()=>o==null?void 0:o(t),className:"font-semibold text-xs sm:text-sm text-white line-clamp-2 cursor-pointer text-center group-hover:text-purple-400 transition-colors duration-300 ease-out",children:e}),n&&n.trim()!==""&&n.toLowerCase()!=="anónimo"&&n.toLowerCase()!=="anonimo"&&d.jsx("p",{className:"text-xs text-gray-400 text-center group-hover:text-gray-300 transition-colors duration-300 ease-out",children:n})]})]})}function Dj({id:t,onBack:e,onNavigateToManga:n,onMangaLoaded:r,onSelectCategory:i,onSelectAuthor:s,isAdmin:o=!1}){var Y,Ae,Oe,Ne,et;const[a,u]=V.useState(null),[c,f]=V.useState(!0),[h,p]=V.useState(!1),[m,b]=V.useState(0),[S,P]=V.useState(!1),[y,w]=V.useState(!1),[T,L]=V.useState(!1),[F,D]=V.useState(0),[_,x]=V.useState(!1),[E,k]=V.useState({name:"",url:""}),[C,j]=V.useState([]),[A,de]=V.useState("portrait"),[oe,le]=V.useState("vertical"),[ve,K]=V.useState(!1),[ie,N]=V.useState(0),[fe,ye]=V.useState([]),[R,H]=V.useState(!1),[J,te]=V.useState(""),[Ie,pe]=V.useState([]),[Fe,ut]=V.useState(!1),[Je,bt]=V.useState(!1),[mt,gt]=V.useState(1),[Ht,Vt]=V.useState(1),Ze=6,Nn=()=>Vt($=>Math.min($+.25,3)),W=()=>Vt($=>Math.max($-.25,.5)),ue=()=>Vt(1);V.useEffect(()=>{Ft();const $=HD(t,he=>{he&&(u(()=>he),f(!1))});Ce(),te("");const Z=localStorage.getItem("manga-view-mode");return(Z==="vertical"||Z==="gallery"||Z==="grid")&&le(Z),()=>$()},[t]);async function Ce(){try{ut(!0);const $=await jd();pe($)}catch($){console.error("Error loading all mangas:",$)}finally{ut(!1)}}V.useEffect(()=>{function $(Z){const he=Z.target;S&&!he.closest(".download-menu-container")&&P(!1),y&&!he.closest(".pdf-menu-container")&&w(!1)}return document.addEventListener("mousedown",$),()=>document.removeEventListener("mousedown",$)},[S,y]);const we=async()=>{if(E.name.trim()&&E.url.trim()&&a)try{await QD(a.id,E),j([...C,E]),k({name:"",url:""}),x(!1)}catch($){console.error("Error al guardar el enlace:",$),alert("Error al guardar el enlace")}},He=async $=>{if(a)try{await YD(a.id,$),j(C.filter((Z,he)=>he!==$))}catch(Z){console.error("Error al eliminar el enlace:",Z),alert("Error al eliminar el enlace")}},Et=$=>{le($),localStorage.setItem("manga-view-mode",$)};async function Ft(){try{f(!0);const $=await xI(t);if($){if(u($),j($.external_links||[]),$.cover_url)try{const Z=await g2($.cover_url);de(Z)}catch(Z){console.warn("Failed to detect image orientation:",Z),de("portrait")}z($)}}catch($){console.error("Error loading manga:",$)}finally{}}async function z($){var Z;try{H(!0);const he=((Z=$.categories)==null?void 0:Z.map(Pe=>Pe.id))||[],me=await XD($.id,he,$.title);ye(me),gt(1)}catch(he){console.error("Error loading recommendations:",he)}finally{H(!1)}}async function O($){const Z=(a==null?void 0:a.id)||t;if(!Z){alert("Error: ID no encontrado.");return}const he=Z;console.log(`🚀 [CLIENTE] Suscribiendo a progreso: ${he}`);const me=new EventSource(`/api/download/progress/${he}`);me.onmessage=Pe=>{const Ge=JSON.parse(Pe.data);b(Ge.progress),Ge.progress>=100&&me.close()};try{console.log("🚀 [CLIENTE] Iniciando descarga para ID:",Z),p(!0),P(!1),b(0);const Pe=await fetch("/api/download/zip",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mangaId:Z,mangaTitle:(a==null?void 0:a.title)||"Descarga",format:$,jobId:he})});if(!Pe.ok)throw new Error("Error en el servidor");const Ge=await Pe.blob(),It=window.URL.createObjectURL(Ge),Me=document.createElement("a");Me.href=It,Me.download=`${(a==null?void 0:a.title)||"manga"}.zip`,document.body.appendChild(Me),Me.click(),Me.remove(),window.URL.revokeObjectURL(It),console.log("✅ [CLIENTE] Descarga disparada con éxito")}catch(Pe){console.error("❌ Error en la descarga:",Pe),alert("Hubo un fallo en la matriz de descarga.")}finally{p(!1),me.close()}}async function B($){const Z=(a==null?void 0:a.id)||t;if(!Z){alert("Error: ID no encontrado.");return}const he=Z;console.log(`🚀 [CLIENTE] Suscribiendo a progreso PDF: ${he}`);const me=new EventSource(`/api/download/progress/${he}`);me.onmessage=Pe=>{const Ge=JSON.parse(Pe.data);Ge.progress&&D(Ge.progress),Ge.progress>=100&&me.close()};try{console.log("🚀 [CLIENTE] Iniciando PDF para ID:",Z),L(!0),D(0),w(!1);const Pe=await fetch("/api/download/pdf",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mangaId:Z,mangaTitle:(a==null?void 0:a.title)||"Descarga",format:$,jobId:he})});if(!Pe.ok)throw new Error("Error en el servidor al generar PDF");const Ge=await Pe.blob(),It=window.URL.createObjectURL(Ge),Me=document.createElement("a");Me.href=It,Me.download=`${(a==null?void 0:a.title)||"manga"}.pdf`,document.body.appendChild(Me),Me.click(),Me.remove(),window.URL.revokeObjectURL(It),console.log("✅ [CLIENTE] PDF descargado con éxito")}catch(Pe){console.error("Error initiating PDF generation:",Pe),alert("Error al generar PDF (puede que el archivo sea muy grande o Python falló).")}finally{L(!1),me.close()}}if(c)return d.jsxs("div",{className:"h-screen bg-[#121212] flex flex-col items-center justify-center gap-4",children:[d.jsx(ys,{size:40,borderWidth:2}),d.jsx("div",{className:"text-gray-400 text-sm",children:"Cargando..."})]});if(!a)return d.jsx("div",{className:"h-screen bg-[#121212] flex items-center justify-center",children:d.jsx("div",{className:"text-gray-400 text-lg",children:"Manga no encontrado"})});const Q=J.trim()?Ie.filter($=>{var Ge;if(!$.id||!$.title||$.id===a.id)return!1;const Z=J.toLowerCase(),he=$.title.toLowerCase().includes(Z),me=$.author?$.author.toLowerCase().includes(Z):!1,Pe=((Ge=$.categories)==null?void 0:Ge.some(It=>{var Me;return(Me=It==null?void 0:It.name)==null?void 0:Me.toLowerCase().includes(Z)}))||!1;return he||me||Pe}):[];return d.jsxs("div",{className:"h-screen flex flex-col bg-[#121212] overflow-hidden",children:[d.jsx("header",{className:"border-b border-gray-800 z-40 bg-[#121212] flex-shrink-0",children:d.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 py-3 sm:py-4 flex items-center gap-3 sm:gap-4",children:[d.jsx("button",{onClick:e,className:"p-2 hover:bg-[#333] rounded-lg transition-colors text-gray-300 hover:text-white flex-shrink-0",children:d.jsx(So,{className:"w-5 h-5"})}),d.jsx("h1",{className:"text-base sm:text-lg font-bold text-white truncate flex-shrink-0",children:a.title}),d.jsx("div",{className:"flex-1 max-w-md ml-auto",children:d.jsxs("div",{className:"relative",children:[d.jsx(gc,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400"}),d.jsx("input",{type:"text",placeholder:"Buscar comics…",value:J,onChange:$=>te($.target.value),className:"w-full bg-[#1a1a1a] text-white rounded-lg pl-10 pr-3 py-2 text-sm placeholder-gray-400 focus:ring-2 focus:ring-[#bb86fc] focus:outline-none transition-all border border-gray-700/50 focus:border-[#bb86fc]"})]})})]})}),d.jsxs("main",{className:"flex-1 overflow-y-auto bg-[#121212]",children:[d.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 py-4 sm:py-8",children:[!J.trim()&&d.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 sm:gap-6",children:[d.jsx("div",{className:"flex-shrink-0 mx-auto sm:mx-0",children:d.jsx("div",{className:"group w-56 sm:w-64",children:d.jsx("div",{className:"relative bg-black rounded-lg shadow-lg overflow-hidden transition-transform duration-300 hover:scale-[1.02]",children:a.cover_url?d.jsxs(d.Fragment,{children:[d.jsx(Kn,{src:a.cover_url,alt:a.title,aspectRatio:"2/3",objectFit:"cover",loading:"eager",imgClassName:"group-hover:scale-110"}),d.jsx("div",{className:"absolute inset-x-0 bottom-0 h-1/3 bg-gradient-to-t from-black/60 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300 ease-in-out pointer-events-none"})]}):d.jsx("div",{className:"w-full aspect-[2/3] flex items-center justify-center text-white/40 bg-black",children:d.jsx(z0,{className:"w-16 h-16"})})})})}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsx("h2",{className:"text-2xl sm:text-4xl font-bold text-white mb-3 sm:mb-4",children:a.title}),d.jsx("div",{className:"mb-4",children:d.jsxs("div",{className:"flex items-center gap-2 text-gray-300",children:[a.author&&a.author.toLowerCase()!=="anónimo"&&a.author.toLowerCase()!=="anonimo"&&d.jsxs(d.Fragment,{children:[d.jsx(Nm,{className:"w-4 h-4 text-[#bb86fc]"}),d.jsx("button",{onClick:()=>s==null?void 0:s(a.author),className:"text-sm hover:text-[#bb86fc] hover:underline transition-colors",children:a.author}),d.jsx("div",{className:"w-1 h-1 bg-gray-600 rounded-full mx-2"})]}),d.jsx(Hf,{className:"w-4 h-4 text-[#bb86fc]"}),d.jsxs("span",{className:"text-sm",children:[((Y=a.views)==null?void 0:Y.toLocaleString())||0," vistas"]})]})}),d.jsxs("div",{className:"mb-6",children:[d.jsx("h3",{className:"text-sm font-semibold text-gray-300 mb-3",children:"Categorías"}),d.jsx("div",{className:"flex gap-2 flex-wrap",children:(Ae=a.categories)==null?void 0:Ae.sort(($,Z)=>{const he={series:1,character:2,genre:3,tag:4,other:5},me=$.type||"genre",Pe=Z.type||"genre";return(he[me]||5)-(he[Pe]||5)}).map($=>{let Z="bg-[#bb86fc]/20 text-[#bb86fc] border-[#bb86fc]/40";return $.type==="character"?Z="bg-blue-500/20 text-blue-300 border-blue-500/30":$.type==="series"?Z="bg-green-500/20 text-green-300 border-green-500/30":$.type==="tag"&&(Z="bg-pink-500/20 text-pink-300 border-pink-500/30"),d.jsx("button",{onClick:()=>i==null?void 0:i($.name),className:`px-3 py-1.5 text-xs rounded-full border ${Z} hover:opacity-80 transition-opacity cursor-pointer`,children:$.name},$.id)})})]}),a.description&&a.description.trim()!==""&&d.jsxs("div",{className:"mb-6",children:[d.jsx("h3",{className:"text-sm font-semibold text-gray-300 mb-2",children:"Sinopsis"}),d.jsx("p",{className:"text-sm text-gray-400 leading-relaxed whitespace-pre-wrap",children:a.description})]}),d.jsx("div",{className:"flex flex-col gap-3 sm:gap-4",children:a.chapters&&a.chapters.length>0&&a.chapters[0].pages&&a.chapters[0].pages.length>0&&d.jsxs(d.Fragment,{children:[h&&d.jsxs("div",{className:"w-full",children:[d.jsxs("div",{className:"flex items-center justify-between mb-2",children:[d.jsx("span",{className:"text-xs sm:text-sm font-semibold text-[#bb86fc]",children:"Descargando ZIP"}),d.jsxs("span",{className:"text-xs sm:text-sm font-bold text-[#bb86fc]",children:[m,"%"]})]}),d.jsx("div",{className:"w-full bg-gray-700/40 rounded-full h-2 overflow-hidden border border-[#bb86fc]/30",children:d.jsx("div",{className:"bg-gradient-to-r from-[#bb86fc] to-[#9966dd] h-full transition-all duration-300 ease-out",style:{width:`${m}%`}})})]}),T&&d.jsxs("div",{className:"w-full",children:[d.jsxs("div",{className:"flex items-center justify-between mb-2",children:[d.jsx("span",{className:"text-xs sm:text-sm font-semibold text-[#bb86fc]",children:"Generando PDF"}),d.jsxs("span",{className:"text-xs sm:text-sm font-bold text-[#bb86fc]",children:[F,"%"]})]}),d.jsx("div",{className:"w-full bg-gray-700/40 rounded-full h-2 overflow-hidden border border-[#bb86fc]/30",children:d.jsx("div",{className:"bg-gradient-to-r from-[#bb86fc] to-[#9966dd] h-full transition-all duration-300 ease-out",style:{width:`${F}%`}})})]}),d.jsxs("div",{className:"flex flex-wrap gap-2 items-center",children:[d.jsxs("div",{className:"relative download-menu-container",children:[d.jsxs("button",{onClick:()=>P(!S),disabled:h,className:"bg-[#121212] hover:bg-[#1f1f1f] border border-[#bb86fc]/50 hover:border-[#bb86fc] text-[#bb86fc] px-2 sm:px-3 py-1.5 sm:py-2 rounded-lg flex items-center gap-1 font-semibold text-xs sm:text-sm transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed",children:[d.jsx(ua,{className:"w-3 h-3 sm:w-4 sm:h-4 flex-shrink-0"}),d.jsx("span",{className:"hidden sm:inline",children:h?`Descargando (${m}%)`:"ZIP"}),d.jsx("span",{className:"sm:hidden",children:"ZIP"})]}),S&&!h&&d.jsxs("div",{className:"absolute top-full mt-2 left-0 bg-[#1f1f1f] border border-gray-700/60 rounded-lg shadow-2xl shadow-black/50 overflow-hidden z-50 min-w-[200px]",children:[d.jsxs("button",{onClick:()=>O("original"),className:"w-full px-3 py-2 text-left text-xs sm:text-sm text-white hover:bg-[#bb86fc]/20 transition-colors flex items-center gap-2 border-b border-gray-700/40",children:[d.jsx(ua,{className:"w-3 h-3 text-[#bb86fc]"}),d.jsxs("div",{children:[d.jsx("div",{className:"font-semibold",children:"Original"}),d.jsx("div",{className:"text-xs text-gray-400",children:"Sin cambios"})]})]}),d.jsxs("button",{onClick:()=>O("webp"),className:"w-full px-3 py-2 text-left text-xs sm:text-sm text-white hover:bg-[#bb86fc]/20 transition-colors flex items-center gap-2 border-b border-gray-700/40",children:[d.jsx(ua,{className:"w-3 h-3 text-[#bb86fc]"}),d.jsxs("div",{children:[d.jsx("div",{className:"font-semibold",children:"WebP"}),d.jsx("div",{className:"text-xs text-gray-400",children:"Optimizado"})]})]}),d.jsxs("button",{onClick:()=>O("png"),className:"w-full px-3 py-2 text-left text-xs sm:text-sm text-white hover:bg-[#bb86fc]/20 transition-colors flex items-center gap-2 border-b border-gray-700/40",children:[d.jsx(ua,{className:"w-3 h-3 text-[#bb86fc]"}),d.jsxs("div",{children:[d.jsx("div",{className:"font-semibold",children:"PNG"}),d.jsx("div",{className:"text-xs text-gray-400",children:"Sin pérdida"})]})]}),d.jsxs("button",{onClick:()=>O("jpg"),className:"w-full px-3 py-2 text-left text-xs sm:text-sm text-white hover:bg-[#bb86fc]/20 transition-colors flex items-center gap-2",children:[d.jsx(ua,{className:"w-3 h-3 text-[#bb86fc]"}),d.jsxs("div",{children:[d.jsx("div",{className:"font-semibold",children:"JPG"}),d.jsx("div",{className:"text-xs text-gray-400",children:"Comprimido"})]})]})]})]}),d.jsxs("div",{className:"relative pdf-menu-container",children:[d.jsxs("button",{onClick:()=>w(!y),disabled:T,className:"bg-[#121212] hover:bg-[#1f1f1f] border border-[#bb86fc]/50 hover:border-[#bb86fc] text-[#bb86fc] px-2 sm:px-3 py-1.5 sm:py-2 rounded-lg flex items-center gap-1 font-semibold text-xs sm:text-sm transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed",children:[d.jsx(ca,{className:"w-3 h-3 sm:w-4 sm:h-4 flex-shrink-0"}),d.jsx("span",{className:"hidden sm:inline",children:T?`Generando (${F}%)`:"PDF"}),d.jsx("span",{className:"sm:hidden",children:"PDF"})]}),y&&!T&&d.jsxs("div",{className:"absolute top-full mt-2 left-0 bg-[#1f1f1f] border border-gray-700/60 rounded-lg shadow-2xl shadow-black/50 overflow-hidden z-50 min-w-[200px]",children:[d.jsxs("button",{onClick:()=>B("original"),className:"w-full px-3 py-2 text-left text-xs sm:text-sm text-white hover:bg-[#bb86fc]/20 transition-colors flex items-center gap-2 border-b border-gray-700/40",children:[d.jsx(ca,{className:"w-3 h-3 text-[#bb86fc]"}),d.jsxs("div",{children:[d.jsx("div",{className:"font-semibold",children:"Original"}),d.jsx("div",{className:"text-xs text-gray-400",children:"Sin cambios"})]})]}),d.jsxs("button",{onClick:()=>B("webp"),className:"w-full px-3 py-2 text-left text-xs sm:text-sm text-white hover:bg-[#bb86fc]/20 transition-colors flex items-center gap-2 border-b border-gray-700/40",children:[d.jsx(ca,{className:"w-3 h-3 text-[#bb86fc]"}),d.jsxs("div",{children:[d.jsx("div",{className:"font-semibold",children:"WebP"}),d.jsx("div",{className:"text-xs text-gray-400",children:"Optimizado"})]})]}),d.jsxs("button",{onClick:()=>B("png"),className:"w-full px-3 py-2 text-left text-xs sm:text-sm text-white hover:bg-[#bb86fc]/20 transition-colors flex items-center gap-2 border-b border-gray-700/40",children:[d.jsx(ca,{className:"w-3 h-3 text-[#bb86fc]"}),d.jsxs("div",{children:[d.jsx("div",{className:"font-semibold",children:"PNG"}),d.jsx("div",{className:"text-xs text-gray-400",children:"Sin pérdida"})]})]}),d.jsxs("button",{onClick:()=>B("jpg"),className:"w-full px-3 py-2 text-left text-xs sm:text-sm text-white hover:bg-[#bb86fc]/20 transition-colors flex items-center gap-2",children:[d.jsx(ca,{className:"w-3 h-3 text-[#bb86fc]"}),d.jsxs("div",{children:[d.jsx("div",{className:"font-semibold",children:"JPG"}),d.jsx("div",{className:"text-xs text-gray-400",children:"Comprimido"})]})]})]})]}),d.jsxs("button",{onClick:()=>{a!=null&&a.id&&(window.location.hash=`manga/${a.id}/hd`)},className:"bg-[#121212] hover:bg-[#1f1f1f] border border-[#bb86fc]/50 hover:border-[#bb86fc] text-[#bb86fc] px-2 sm:px-3 py-1.5 sm:py-2 rounded-lg flex items-center gap-1 font-semibold text-xs sm:text-sm transition-all duration-200",children:[d.jsx(Hf,{className:"w-3 h-3 sm:w-4 sm:h-4 flex-shrink-0"}),d.jsx("span",{className:"hidden sm:inline",children:"Ver HD"}),d.jsx("span",{className:"sm:hidden",children:"HD"})]}),d.jsxs("button",{onClick:async()=>{try{await navigator.clipboard.writeText(a.id),bt(!0),setTimeout(()=>bt(!1),2e3),window.open("https://t.me/waifuofbrodybot","_blank")}catch($){console.error("Failed to copy:",$)}},className:"bg-[#121212] hover:bg-[#1f1f1f] border border-[#bb86fc]/50 hover:border-[#bb86fc] text-[#bb86fc] px-2 sm:px-3 py-1.5 sm:py-2 rounded-lg flex items-center gap-1 font-semibold text-xs sm:text-sm transition-all duration-200",children:[Je?d.jsx(wl,{className:"w-3 h-3 sm:w-4 sm:h-4 flex-shrink-0"}):d.jsx(c2,{className:"w-3 h-3 sm:w-4 sm:h-4 flex-shrink-0"}),d.jsx("span",{className:"hidden sm:inline",children:Je?"ID Copiado":"Bot Telegram"}),d.jsx("span",{className:"sm:hidden",children:Je?"Copiado":"Bot"})]}),C.map(($,Z)=>d.jsxs("a",{href:$.url,target:"_blank",rel:"noopener noreferrer",className:"bg-[#121212] hover:bg-[#1f1f1f] border border-[#bb86fc]/50 hover:border-[#bb86fc] text-[#bb86fc] px-2 sm:px-3 py-1.5 sm:py-2 rounded-lg flex items-center gap-1.5 font-semibold text-xs sm:text-sm transition-all duration-200 group",children:[d.jsx(u2,{className:"w-3 h-3 sm:w-4 sm:h-4 flex-shrink-0"}),d.jsx("span",{className:"truncate max-w-[150px]",children:$.name}),o&&d.jsx("button",{onClick:he=>{he.preventDefault(),he.stopPropagation(),He(Z)},className:"opacity-0 group-hover:opacity-100 hover:text-red-400 transition-all flex-shrink-0",children:d.jsx(In,{className:"w-3 h-3 sm:w-4 sm:h-4"})})]},Z)),o&&d.jsx("button",{onClick:()=>x(!0),className:"bg-[#121212] hover:bg-[#1f1f1f] border border-[#bb86fc]/50 hover:border-[#bb86fc] text-[#bb86fc] p-1.5 sm:p-2 rounded-lg transition-all duration-200 flex items-center justify-center",title:"Añadir enlace externo",children:d.jsx(co,{className:"w-4 h-4 sm:w-5 sm:h-5"})})]})]})})]})]}),J.trim()?d.jsxs("div",{className:"mt-2",children:[d.jsxs("h3",{className:"text-lg font-semibold text-white mb-4",children:["Resultados de búsqueda",Q.length>0&&d.jsxs("span",{className:"text-sm text-gray-400 ml-2",children:["(",Q.length," ",Q.length===1?"resultado":"resultados",")"]})]}),Fe?d.jsx("div",{className:"flex justify-center py-12",children:d.jsx(ys,{size:40,borderWidth:2})}):Q.length===0?d.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[d.jsx(gc,{className:"w-12 h-12 text-gray-600 mb-3"}),d.jsxs("p",{className:"text-gray-400 text-sm",children:['No se encontraron comics que coincidan con "',J,'"']})]}):d.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 gap-1.5 sm:gap-2 md:gap-3",children:Q.map($=>{var he,me;if(!$.id||!$.title)return null;(he=$.chapters)!=null&&he.length;const Z=((me=$.chapters)==null?void 0:me.reduce((Pe,Ge)=>{var It;return Pe+(((It=Ge.pages)==null?void 0:It.length)||0)},0))||0;return d.jsx(kI,{id:$.id,title:$.title,author:$.author||"Desconocido",pageCount:Z,thumbnail:$.cover_url||$.thumbnail_url||void 0,manga:$,onSelect:Pe=>{n&&(window.scrollTo({top:0,behavior:"smooth"}),n(Pe))}},$.id)})})]}):a.chapters&&a.chapters.length>0&&a.chapters[0].pages&&a.chapters[0].pages.length>0&&d.jsxs("div",{className:"mt-6 sm:mt-8 border-t border-gray-800 pt-6 sm:pt-8",children:[d.jsxs("div",{className:"flex items-center justify-between mb-4 sm:mb-6",children:[d.jsx("h3",{className:"text-lg font-semibold text-white",children:"Páginas"}),d.jsxs("div",{className:"flex items-center gap-1 bg-[#0a0a0a] border border-gray-800 rounded-lg p-1",children:[d.jsxs("button",{onClick:()=>Et("vertical"),className:`px-3 py-2 rounded-md flex items-center gap-2 text-xs sm:text-sm font-medium transition-all duration-200 ${oe==="vertical"?"bg-gradient-to-r from-[#bb86fc] to-[#9966dd] text-white shadow-lg shadow-[#bb86fc]/30":"text-gray-400 hover:text-white hover:bg-[#242424]"}`,title:"Vista vertical",children:[d.jsx(Gf,{className:"w-4 h-4"}),d.jsx("span",{className:"hidden sm:inline",children:"Vertical"})]}),d.jsxs("button",{onClick:()=>Et("gallery"),className:`px-3 py-2 rounded-md flex items-center gap-2 text-xs sm:text-sm font-medium transition-all duration-200 ${oe==="gallery"?"bg-gradient-to-r from-[#bb86fc] to-[#9966dd] text-white shadow-lg shadow-[#bb86fc]/30":"text-gray-400 hover:text-white hover:bg-[#242424]"}`,title:"Vista galería",children:[d.jsx(qf,{className:"w-4 h-4"}),d.jsx("span",{className:"hidden sm:inline",children:"Galería"})]}),d.jsxs("button",{onClick:()=>Et("grid"),className:`px-3 py-2 rounded-md flex items-center gap-2 text-xs sm:text-sm font-medium transition-all duration-200 ${oe==="grid"?"bg-gradient-to-r from-[#bb86fc] to-[#9966dd] text-white shadow-lg shadow-[#bb86fc]/30":"text-gray-400 hover:text-white hover:bg-[#242424]"}`,title:"Vista cuadrícula",children:[d.jsx(Wf,{className:"w-4 h-4"}),d.jsx("span",{className:"hidden sm:inline",children:"Cuadrícula"})]}),oe==="vertical"&&d.jsxs("div",{className:"flex items-center gap-1 ml-2 border-l border-gray-700 pl-2",children:[d.jsx("button",{onClick:W,className:"p-2 text-gray-400 hover:text-white hover:bg-[#242424] rounded-md transition-colors",title:"Reducir",children:d.jsx(Pm,{className:"w-4 h-4"})}),d.jsxs("span",{className:"text-xs text-gray-300 w-8 text-center hidden sm:inline-block",children:[Math.round(Ht*100),"%"]}),d.jsx("button",{onClick:Nn,className:"p-2 text-gray-400 hover:text-white hover:bg-[#242424] rounded-md transition-colors",title:"Aumentar",children:d.jsx(Am,{className:"w-4 h-4"})}),d.jsx("button",{onClick:ue,className:"p-2 text-gray-400 hover:text-white hover:bg-[#242424] rounded-md transition-colors",title:"Restablecer",children:d.jsx(km,{className:"w-3 h-3"})})]})]})]}),d.jsx("div",{className:`bg-[#121212] rounded-lg p-2 sm:p-4 transition-all duration-150 ease-out ${oe==="vertical"?"flex flex-col items-center gap-4":oe==="gallery"?"masonry-container":"grid grid-cols-3 md:grid-cols-5 gap-2"}`,children:oe==="gallery"?a.chapters[0].pages.map(($,Z)=>({pageUrl:$,index:Z})).map(({pageUrl:$,index:Z})=>d.jsx("div",{className:"masonry-item group cursor-pointer relative bg-black rounded-lg shadow-lg overflow-hidden transition-transform duration-300 hover:scale-[1.02]",onClick:()=>{N(Z),K(!0)},children:d.jsx(Kn,{src:$,alt:`Página ${Z+1}`,aspectRatio:"auto",objectFit:"contain",loading:Z>2?"lazy":"eager",className:"rounded-lg",imgClassName:"group-hover:scale-110"})},Z)):a.chapters[0].pages.map(($,Z)=>({pageUrl:$,index:Z})).map(({pageUrl:$,index:Z})=>d.jsx("div",{className:oe==="vertical"?"relative transition-all duration-200 mx-auto":"group cursor-pointer relative bg-black rounded-lg shadow-lg overflow-hidden transition-transform duration-300 hover:scale-[1.02]",style:oe==="vertical"?{width:`${Math.min(100*Ht,100)}%`,maxWidth:Ht>1?"none":void 0}:void 0,onClick:()=>{oe==="grid"&&(N(Z),K(!0))},children:d.jsx(Kn,{src:$,alt:`Página ${Z+1}`,aspectRatio:oe==="vertical"?"auto":"1/1",objectFit:oe==="vertical"?"contain":"cover",loading:Z>2?"lazy":"eager",className:oe==="vertical"?"rounded-lg shadow-2xl w-full":"rounded-lg",imgClassName:oe==="vertical"?"w-full":"group-hover:scale-110"})},Z))})]}),!J.trim()&&fe.length>0&&d.jsxs("div",{className:"mt-8 sm:mt-12 border-t border-gray-800 pt-8 sm:pt-12",children:[d.jsx("h3",{className:"text-xl sm:text-2xl font-bold text-white mb-6",children:"Recomendaciones"}),R?d.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 gap-1.5 sm:gap-2 md:gap-3",children:Array.from({length:6}).map(($,Z)=>d.jsxs("div",{className:"animate-pulse",children:[d.jsx("div",{className:"bg-gray-800 rounded-lg aspect-[2/3] w-full mb-2"}),d.jsx("div",{className:"h-3 bg-gray-800 rounded w-3/4 mx-auto mb-1"}),d.jsx("div",{className:"h-2 bg-gray-800 rounded w-1/2 mx-auto"})]},Z))}):d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 gap-1.5 sm:gap-2 md:gap-3 mb-6 animate-slide-in-right",children:fe.slice((mt-1)*Ze,mt*Ze).map(($,Z)=>d.jsx("div",{children:d.jsxs("div",{onClick:()=>{window.scrollTo({top:0,behavior:"smooth"}),n&&n($.id)},className:"group cursor-pointer flex flex-col",children:[d.jsx("div",{className:"relative bg-black rounded-lg shadow-lg overflow-hidden transition-transform duration-300 hover:scale-[1.02]",children:$.cover_url||$.thumbnail_url?d.jsxs(d.Fragment,{children:[d.jsx(Kn,{src:$.cover_url||$.thumbnail_url||"",alt:$.title,aspectRatio:"2/3",objectFit:"cover",loading:"lazy",imgClassName:"group-hover:scale-110"}),d.jsx("div",{className:"absolute inset-x-0 bottom-0 h-1/3 bg-gradient-to-t from-black/60 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300 ease-in-out pointer-events-none"})]}):d.jsx("div",{className:"w-full aspect-[2/3] flex items-center justify-center text-white/40 bg-black",children:d.jsx(z0,{className:"w-8 h-8"})})}),d.jsxs("div",{className:"mt-2 flex flex-col gap-0.5",children:[d.jsx("h4",{className:"font-semibold text-xs text-white line-clamp-2 text-center group-hover:text-[#bb86fc] transition-colors duration-300",children:$.title}),$.categories&&$.categories.length>0&&d.jsx("p",{className:"text-xs text-gray-500 text-center truncate",children:($.categories.find(he=>he.type==="series")||$.categories[0]).name})]})]})},$.id))},mt),fe.length>Ze&&d.jsxs("div",{className:"flex items-center justify-center gap-2 mt-4 flex-wrap",children:[d.jsx("button",{onClick:()=>gt(1),disabled:mt===1,className:"p-2 rounded-lg bg-[#1a1a1a] text-white hover:bg-[#bb86fc] disabled:opacity-50 disabled:hover:bg-[#1a1a1a] transition-colors",children:d.jsx(O1,{className:"w-4 h-4"})}),d.jsx("button",{onClick:()=>gt($=>Math.max(1,$-1)),disabled:mt===1,className:"p-2 rounded-lg bg-[#1a1a1a] text-white hover:bg-[#bb86fc] disabled:opacity-50 disabled:hover:bg-[#1a1a1a] transition-colors",children:d.jsx(id,{className:"w-4 h-4"})}),d.jsxs("span",{className:"text-sm text-gray-400 px-2",children:["Página ",mt," de ",Math.ceil(fe.length/Ze)]}),d.jsx("button",{onClick:()=>gt($=>Math.min(Math.ceil(fe.length/Ze),$+1)),disabled:mt===Math.ceil(fe.length/Ze),className:"p-2 rounded-lg bg-[#1a1a1a] text-white hover:bg-[#bb86fc] disabled:opacity-50 disabled:hover:bg-[#1a1a1a] transition-colors",children:d.jsx(sd,{className:"w-4 h-4"})}),d.jsx("button",{onClick:()=>gt(Math.ceil(fe.length/Ze)),disabled:mt===Math.ceil(fe.length/Ze),className:"p-2 rounded-lg bg-[#1a1a1a] text-white hover:bg-[#bb86fc] disabled:opacity-50 disabled:hover:bg-[#1a1a1a] transition-colors",children:d.jsx(M1,{className:"w-4 h-4"})})]})]})]})]}),d.jsx(od,{})]}),ve&&((Ne=(Oe=a.chapters)==null?void 0:Oe[0])==null?void 0:Ne.pages)&&d.jsx(H1,{images:((et=a.chapters)==null?void 0:et[0].pages)||[],initialIndex:ie,onClose:()=>K(!1)}),_&&d.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:d.jsxs("div",{className:"bg-gradient-to-b from-[#1f1f1f] to-[#121212] rounded-2xl border border-gray-700/40 w-full max-w-md shadow-2xl",children:[d.jsxs("div",{className:"bg-gradient-to-b from-[#2a2a2a]/80 to-[#1f1f1f]/80 border-b border-gray-700/30 px-6 py-4 flex items-center justify-between",children:[d.jsx("h2",{className:"text-xl font-bold text-white",children:"Añadir Enlace Externo"}),d.jsx("button",{onClick:()=>x(!1),className:"text-gray-500 hover:text-white transition-colors p-1.5 rounded-lg hover:bg-white/10",children:d.jsx(In,{className:"w-5 h-5"})})]}),d.jsxs("div",{className:"p-6 space-y-4",children:[d.jsxs("div",{children:[d.jsx("label",{className:"block text-sm font-semibold text-gray-200 mb-2",children:"Nombre del Enlace"}),d.jsx("input",{type:"text",placeholder:"Ej: Servidor Alternativo",value:E.name,onChange:$=>k({...E,name:$.target.value}),className:"w-full bg-[#1a1a1a] border border-gray-600/50 rounded-lg px-4 py-3 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-[#bb86fc] focus:ring-2 focus:ring-[#bb86fc]/30 transition-all"})]}),d.jsxs("div",{children:[d.jsx("label",{className:"block text-sm font-semibold text-gray-200 mb-2",children:"URL del Enlace"}),d.jsx("input",{type:"url",placeholder:"https://ejemplo.com/descarga",value:E.url,onChange:$=>k({...E,url:$.target.value}),className:"w-full bg-[#1a1a1a] border border-gray-600/50 rounded-lg px-4 py-3 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-[#bb86fc] focus:ring-2 focus:ring-[#bb86fc]/30 transition-all"})]}),d.jsxs("div",{className:"flex gap-3 pt-2",children:[d.jsx("button",{onClick:()=>x(!1),className:"flex-1 bg-[#1a1a1a] border border-gray-600/50 hover:border-gray-500 hover:bg-[#242424] text-white px-4 py-3 rounded-lg font-semibold text-sm transition-all",children:"Cancelar"}),d.jsx("button",{onClick:we,disabled:!E.name.trim()||!E.url.trim(),className:"flex-1 bg-gradient-to-r from-[#bb86fc] to-[#9966dd] hover:from-[#9966dd] hover:to-[#7744cc] disabled:opacity-50 disabled:cursor-not-allowed text-white px-4 py-3 rounded-lg font-semibold text-sm transition-all shadow-lg shadow-[#bb86fc]/40 hover:shadow-[#bb86fc]/60",children:"Añadir Enlace"})]})]})]})})]})}function jj({manga:t,chapter:e,onBack:n}){const[r,i]=V.useState(0);if(!e.pages||e.pages.length===0)return d.jsxs("div",{className:"h-screen bg-[#121212] flex flex-col items-center justify-center",children:[d.jsx("button",{onClick:n,className:"absolute top-6 left-6 p-2 hover:bg-[#333] rounded-lg transition-colors text-gray-300 hover:text-white",children:d.jsx(So,{className:"w-5 h-5"})}),d.jsx("div",{className:"text-gray-400 text-lg",children:"No hay páginas disponibles"})]});const s=()=>{r>0&&i(r-1)},o=()=>{r{const c=u<2,f=Rj(a);return d.jsx("div",{className:"w-full flex justify-center",children:d.jsx(Kn,{src:f,alt:`Página ${u+1}`,aspectRatio:"auto",objectFit:"contain",loading:c?"eager":"lazy",className:"max-w-full shadow-2xl",showPlaceholder:u>0})},u)}),d.jsx("div",{className:"w-full mt-8",children:d.jsx(od,{})})]})}),d.jsx("div",{className:"border-t border-gray-700/60 bg-gradient-to-r from-[#2a2a2a] to-[#252525] px-6 py-6 flex-shrink-0",children:d.jsxs("div",{className:"max-w-7xl mx-auto flex items-center justify-between",children:[d.jsxs("button",{onClick:s,disabled:r===0,className:"flex items-center gap-2 px-4 py-2 rounded-lg bg-gray-800 hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed text-white transition-all",children:[d.jsx(id,{className:"w-5 h-5"}),"Anterior"]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("input",{type:"range",min:"0",max:e.pages.length-1,value:r,onChange:a=>i(parseInt(a.target.value)),className:"w-64 h-2 bg-gray-700 rounded-lg appearance-none cursor-pointer accent-[#bb86fc]"}),d.jsxs("span",{className:"text-sm text-gray-400 w-12 text-right",children:[r+1,"/",e.pages.length]})]}),d.jsxs("button",{onClick:o,disabled:r===e.pages.length-1,className:"flex items-center gap-2 px-4 py-2 rounded-lg bg-gray-800 hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed text-white transition-all",children:["Siguiente",d.jsx(sd,{className:"w-5 h-5"})]})]})})]})}const CI="settings",NI="info",Lj=`# Bienvenid@ a Twisted Brody MangaFlow +¡Tu plataforma definitiva para la gestión y lectura de mangas! + +Este proyecto nació con la misión de ofrecer una experiencia de lectura fluida, moderna y sin interrupciones, diseñada por fans para fans. + +## 🌟 Características Principales + +* **⚡ Lectura sin límites:** Disfruta de una interfaz optimizada, rápida y responsiva. +* **📥 Descargas Flexibles:** Baja tus capítulos favoritos en formato **ZIP** o **PDF** para leer offline. +* **🔄 Conversión Inteligente:** Nuestro servidor procesa las imágenes para darte la mejor calidad y compatibilidad. + +## 🤝 Comunidad y Apoyo + +Este es un proyecto **sin fines de lucro**, desarrollado por pura pasión. + +Sin embargo, si valoras mi trabajo y quieres apoyarme para mantener el proyecto vivo, puedes suscribirte a mi **Patreon**. ¡Tu apoyo significa mucho! + +* [**💜 Apóyame en Patreon**](https://www.patreon.com/cw/Twistedbrody) + +### 💡 ¿Tienes nuevas ideas? +¡Quiero escucharlas! Si tienes sugerencias, feedback o ideas locas, háblame directamente: + +* **Telegram:** [@twistedbrodyoficial](https://t.me/twistedbrodyoficial) + +También puedes unirte a nuestros canales: +* [Canal Principal](https://t.me/twistedbrody) +* [Canal Hub](https://t.me/+CmmZFHM9hpViYzMx) +* [X (Twitter)](https://x.com/TwistedBrody) + +--- +> **Disclaimer:** Todo el contenido es propiedad de sus respectivos autores. Apoya el material original siempre que sea posible. + + +`;async function Oj(t){const e=Dt(We,CI,NI),n={content:t,updatedAt:new Date().toISOString()};await ME(e,n)}function Mj(t){const e=Dt(We,CI,NI);return bg(e,n=>{n.exists()?t(n.data()):t({content:Lj,updatedAt:new Date().toISOString()})})}function Vj(t,e){const n={};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Fj=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Uj=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,zj={};function Ax(t,e){return(zj.jsx?Uj:Fj).test(t)}const Bj=/[ \t\n\f\r]/g;function $j(t){return typeof t=="object"?t.type==="text"?Px(t.value):!1:Px(t)}function Px(t){return t.replace(Bj,"")===""}class Dl{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}Dl.prototype.normal={};Dl.prototype.property={};Dl.prototype.space=void 0;function AI(t,e){const n={},r={};for(const i of t)Object.assign(n,i.property),Object.assign(r,i.normal);return new Dl(n,r,e)}function bp(t){return t.toLowerCase()}class Cn{constructor(e,n){this.attribute=n,this.property=e}}Cn.prototype.attribute="";Cn.prototype.booleanish=!1;Cn.prototype.boolean=!1;Cn.prototype.commaOrSpaceSeparated=!1;Cn.prototype.commaSeparated=!1;Cn.prototype.defined=!1;Cn.prototype.mustUseProperty=!1;Cn.prototype.number=!1;Cn.prototype.overloadedBoolean=!1;Cn.prototype.property="";Cn.prototype.spaceSeparated=!1;Cn.prototype.space=void 0;let Hj=0;const De=Ls(),Ct=Ls(),Ep=Ls(),ee=Ls(),nt=Ls(),go=Ls(),Dn=Ls();function Ls(){return 2**++Hj}const Ip=Object.freeze(Object.defineProperty({__proto__:null,boolean:De,booleanish:Ct,commaOrSpaceSeparated:Dn,commaSeparated:go,number:ee,overloadedBoolean:Ep,spaceSeparated:nt},Symbol.toStringTag,{value:"Module"})),Vh=Object.keys(Ip);class Dg extends Cn{constructor(e,n,r,i){let s=-1;if(super(e,n),Rx(this,"space",i),typeof r=="number")for(;++s4&&n.slice(0,4)==="data"&&Qj.test(e)){if(e.charAt(4)==="-"){const s=e.slice(5).replace(Dx,Jj);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=e.slice(4);if(!Dx.test(s)){let o=s.replace(Kj,Xj);o.charAt(0)!=="-"&&(o="-"+o),e="data"+o}}i=Dg}return new i(r,e)}function Xj(t){return"-"+t.toLowerCase()}function Jj(t){return t.charAt(1).toUpperCase()}const Zj=AI([PI,qj,jI,LI,OI],"html"),jg=AI([PI,Wj,jI,LI,OI],"svg");function e3(t){return t.join(" ").trim()}var Lg={},jx=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t3=/\n/g,n3=/^\s*/,r3=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i3=/^:\s*/,s3=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,o3=/^[;\s]*/,a3=/^\s+|\s+$/g,l3=` +`,Lx="/",Ox="*",as="",u3="comment",c3="declaration";function d3(t,e){if(typeof t!="string")throw new TypeError("First argument must be a string");if(!t)return[];e=e||{};var n=1,r=1;function i(b){var S=b.match(t3);S&&(n+=S.length);var P=b.lastIndexOf(l3);r=~P?b.length-P:r+b.length}function s(){var b={line:n,column:r};return function(S){return S.position=new o(b),c(),S}}function o(b){this.start=b,this.end={line:n,column:r},this.source=e.source}o.prototype.content=t;function a(b){var S=new Error(e.source+":"+n+":"+r+": "+b);if(S.reason=b,S.filename=e.source,S.line=n,S.column=r,S.source=t,!e.silent)throw S}function u(b){var S=b.exec(t);if(S){var P=S[0];return i(P),t=t.slice(P.length),S}}function c(){u(n3)}function f(b){var S;for(b=b||[];S=h();)S!==!1&&b.push(S);return b}function h(){var b=s();if(!(Lx!=t.charAt(0)||Ox!=t.charAt(1))){for(var S=2;as!=t.charAt(S)&&(Ox!=t.charAt(S)||Lx!=t.charAt(S+1));)++S;if(S+=2,as===t.charAt(S-1))return a("End of comment missing");var P=t.slice(2,S-2);return r+=2,i(P),t=t.slice(S),r+=2,b({type:u3,comment:P})}}function p(){var b=s(),S=u(r3);if(S){if(h(),!u(i3))return a("property missing ':'");var P=u(s3),y=b({type:c3,property:Mx(S[0].replace(jx,as)),value:P?Mx(P[0].replace(jx,as)):as});return u(o3),y}}function m(){var b=[];f(b);for(var S;S=p();)S!==!1&&(b.push(S),f(b));return b}return c(),m()}function Mx(t){return t?t.replace(a3,as):as}var h3=d3,f3=qu&&qu.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Lg,"__esModule",{value:!0});Lg.default=m3;const p3=f3(h3);function m3(t,e){let n=null;if(!t||typeof t!="string")return n;const r=(0,p3.default)(t),i=typeof e=="function";return r.forEach(s=>{if(s.type!=="declaration")return;const{property:o,value:a}=s;i?e(o,a,s):a&&(n=n||{},n[o]=a)}),n}var Ld={};Object.defineProperty(Ld,"__esModule",{value:!0});Ld.camelCase=void 0;var g3=/^--[a-zA-Z0-9_-]+$/,y3=/-([a-z])/g,v3=/^[^-]+$/,x3=/^-(webkit|moz|ms|o|khtml)-/,w3=/^-(ms)-/,_3=function(t){return!t||v3.test(t)||g3.test(t)},b3=function(t,e){return e.toUpperCase()},Vx=function(t,e){return"".concat(e,"-")},E3=function(t,e){return e===void 0&&(e={}),_3(t)?t:(t=t.toLowerCase(),e.reactCompat?t=t.replace(w3,Vx):t=t.replace(x3,Vx),t.replace(y3,b3))};Ld.camelCase=E3;var I3=qu&&qu.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},S3=I3(Lg),T3=Ld;function Sp(t,e){var n={};return!t||typeof t!="string"||(0,S3.default)(t,function(r,i){r&&i&&(n[(0,T3.camelCase)(r,e)]=i)}),n}Sp.default=Sp;var k3=Sp;const C3=zc(k3),MI=VI("end"),Og=VI("start");function VI(t){return e;function e(n){const r=n&&n.position&&n.position[t]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function N3(t){const e=Og(t),n=MI(t);if(e&&n)return{start:e,end:n}}function Oa(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?Fx(t.position):"start"in t||"end"in t?Fx(t):"line"in t||"column"in t?Tp(t):""}function Tp(t){return Ux(t&&t.line)+":"+Ux(t&&t.column)}function Fx(t){return Tp(t&&t.start)+"-"+Tp(t&&t.end)}function Ux(t){return t&&typeof t=="number"?t:1}class cn extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",s={},o=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof e=="string"?i=e:!s.cause&&e&&(o=!0,i=e.message,s.cause=e),!s.ruleId&&!s.source&&typeof r=="string"){const u=r.indexOf(":");u===-1?s.ruleId=r:(s.source=r.slice(0,u),s.ruleId=r.slice(u+1))}if(!s.place&&s.ancestors&&s.ancestors){const u=s.ancestors[s.ancestors.length-1];u&&(s.place=u.position)}const a=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=a?a.line:void 0,this.name=Oa(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}cn.prototype.file="";cn.prototype.name="";cn.prototype.reason="";cn.prototype.message="";cn.prototype.stack="";cn.prototype.column=void 0;cn.prototype.line=void 0;cn.prototype.ancestors=void 0;cn.prototype.cause=void 0;cn.prototype.fatal=void 0;cn.prototype.place=void 0;cn.prototype.ruleId=void 0;cn.prototype.source=void 0;const Mg={}.hasOwnProperty,A3=new Map,P3=/[A-Z]/g,R3=new Set(["table","tbody","thead","tfoot","tr"]),D3=new Set(["td","th"]),FI="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function j3(t,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=e.filePath||void 0;let r;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=B3(n,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=z3(n,e.jsx,e.jsxs)}const i={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:r,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?jg:Zj,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},s=UI(i,t,void 0);return s&&typeof s!="string"?s:i.create(t,i.Fragment,{children:s||void 0},void 0)}function UI(t,e,n){if(e.type==="element")return L3(t,e,n);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return O3(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return V3(t,e,n);if(e.type==="mdxjsEsm")return M3(t,e);if(e.type==="root")return F3(t,e,n);if(e.type==="text")return U3(t,e)}function L3(t,e,n){const r=t.schema;let i=r;e.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=jg,t.schema=i),t.ancestors.push(e);const s=BI(t,e.tagName,!1),o=$3(t,e);let a=Fg(t,e);return R3.has(e.tagName)&&(a=a.filter(function(u){return typeof u=="string"?!$j(u):!0})),zI(t,o,s,e),Vg(o,a),t.ancestors.pop(),t.schema=r,t.create(e,s,o,n)}function O3(t,e){if(e.data&&e.data.estree&&t.evaluater){const r=e.data.estree.body[0];return r.type,t.evaluater.evaluateExpression(r.expression)}pl(t,e.position)}function M3(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);pl(t,e.position)}function V3(t,e,n){const r=t.schema;let i=r;e.name==="svg"&&r.space==="html"&&(i=jg,t.schema=i),t.ancestors.push(e);const s=e.name===null?t.Fragment:BI(t,e.name,!0),o=H3(t,e),a=Fg(t,e);return zI(t,o,s,e),Vg(o,a),t.ancestors.pop(),t.schema=r,t.create(e,s,o,n)}function F3(t,e,n){const r={};return Vg(r,Fg(t,e)),t.create(e,t.Fragment,r,n)}function U3(t,e){return e.value}function zI(t,e,n,r){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=r)}function Vg(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function z3(t,e,n){return r;function r(i,s,o,a){const c=Array.isArray(o.children)?n:e;return a?c(s,o,a):c(s,o)}}function B3(t,e){return n;function n(r,i,s,o){const a=Array.isArray(s.children),u=Og(r);return e(i,s,o,a,{columnNumber:u?u.column-1:void 0,fileName:t,lineNumber:u?u.line:void 0},void 0)}}function $3(t,e){const n={};let r,i;for(i in e.properties)if(i!=="children"&&Mg.call(e.properties,i)){const s=q3(t,i,e.properties[i]);if(s){const[o,a]=s;t.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&D3.has(e.tagName)?r=a:n[o]=a}}if(r){const s=n.style||(n.style={});s[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function H3(t,e){const n={};for(const r of e.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&t.evaluater){const s=r.data.estree.body[0];s.type;const o=s.expression;o.type;const a=o.properties[0];a.type,Object.assign(n,t.evaluater.evaluateExpression(a.argument))}else pl(t,e.position);else{const i=r.name;let s;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&t.evaluater){const a=r.value.data.estree.body[0];a.type,s=t.evaluater.evaluateExpression(a.expression)}else pl(t,e.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function Fg(t,e){const n=[];let r=-1;const i=t.passKeys?new Map:A3;for(;++ri?0:i+e:e=e>i?i:e,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(e,n),t.splice(...o);else for(n&&t.splice(e,n);s0?(Rr(t,t.length,0,e),t):e}const $x={}.hasOwnProperty;function Z3(t){const e={};let n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function yo(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const xr=Zi(/[A-Za-z]/),Mn=Zi(/[\dA-Za-z]/),n5=Zi(/[#-'*+\--9=?A-Z^-~]/);function kp(t){return t!==null&&(t<32||t===127)}const Cp=Zi(/\d/),r5=Zi(/[\dA-Fa-f]/),i5=Zi(/[!-/:-@[-`{-~]/);function be(t){return t!==null&&t<-2}function kn(t){return t!==null&&(t<0||t===32)}function Ke(t){return t===-2||t===-1||t===32}const s5=Zi(new RegExp("\\p{P}|\\p{S}","u")),o5=Zi(/\s/);function Zi(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function Ho(t){const e=[];let n=-1,r=0,i=0;for(;++n55295&&s<57344){const a=t.charCodeAt(n+1);s<56320&&a>56319&&a<57344?(o=String.fromCharCode(s,a),i=1):o="�"}else o=String.fromCharCode(s);o&&(e.push(t.slice(r,n),encodeURIComponent(o)),r=n+i+1,o=""),i&&(n+=i,i=0)}return e.join("")+t.slice(r)}function st(t,e,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(u){return Ke(u)?(t.enter(n),a(u)):e(u)}function a(u){return Ke(u)&&s++o))return;const _=e.events.length;let x=_,E,k;for(;x--;)if(e.events[x][0]==="exit"&&e.events[x][1].type==="chunkFlow"){if(E){k=e.events[x][1].end;break}E=!0}for(y(r),D=_;DT;){const F=n[L];e.containerState=F[1],F[0].exit.call(e,t)}n.length=T}function w(){i.write([null]),s=void 0,i=void 0,e.containerState._closeFlow=void 0}}function d5(t,e,n){return st(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function qx(t){if(t===null||kn(t)||o5(t))return 1;if(s5(t))return 2}function zg(t,e,n){const r=[];let i=-1;for(;++i1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const h={...t[r][1].end},p={...t[n][1].start};Wx(h,-u),Wx(p,u),o={type:u>1?"strongSequence":"emphasisSequence",start:h,end:{...t[r][1].end}},a={type:u>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:p},s={type:u>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},i={type:u>1?"strong":"emphasis",start:{...o.start},end:{...a.end}},t[r][1].end={...o.start},t[n][1].start={...a.end},c=[],t[r][1].end.offset-t[r][1].start.offset&&(c=qn(c,[["enter",t[r][1],e],["exit",t[r][1],e]])),c=qn(c,[["enter",i,e],["enter",o,e],["exit",o,e],["enter",s,e]]),c=qn(c,zg(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),c=qn(c,[["exit",s,e],["enter",a,e],["exit",a,e],["exit",i,e]]),t[n][1].end.offset-t[n][1].start.offset?(f=2,c=qn(c,[["enter",t[n][1],e],["exit",t[n][1],e]])):f=0,Rr(t,r-1,n-r+3,c),n=r+c.length-f-2;break}}for(n=-1;++n0&&Ke(D)?st(t,w,"linePrefix",s+1)(D):w(D)}function w(D){return D===null||be(D)?t.check(Gx,S,L)(D):(t.enter("codeFlowValue"),T(D))}function T(D){return D===null||be(D)?(t.exit("codeFlowValue"),w(D)):(t.consume(D),T)}function L(D){return t.exit("codeFenced"),e(D)}function F(D,_,x){let E=0;return k;function k(oe){return D.enter("lineEnding"),D.consume(oe),D.exit("lineEnding"),C}function C(oe){return D.enter("codeFencedFence"),Ke(oe)?st(D,j,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(oe):j(oe)}function j(oe){return oe===a?(D.enter("codeFencedFenceSequence"),A(oe)):x(oe)}function A(oe){return oe===a?(E++,D.consume(oe),A):E>=o?(D.exit("codeFencedFenceSequence"),Ke(oe)?st(D,de,"whitespace")(oe):de(oe)):x(oe)}function de(oe){return oe===null||be(oe)?(D.exit("codeFencedFence"),_(oe)):x(oe)}}}function E5(t,e,n){const r=this;return i;function i(o){return o===null?n(o):(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s)}function s(o){return r.parser.lazy[r.now().line]?n(o):e(o)}}const Uh={name:"codeIndented",tokenize:S5},I5={partial:!0,tokenize:T5};function S5(t,e,n){const r=this;return i;function i(c){return t.enter("codeIndented"),st(t,s,"linePrefix",5)(c)}function s(c){const f=r.events[r.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?o(c):n(c)}function o(c){return c===null?u(c):be(c)?t.attempt(I5,o,u)(c):(t.enter("codeFlowValue"),a(c))}function a(c){return c===null||be(c)?(t.exit("codeFlowValue"),o(c)):(t.consume(c),a)}function u(c){return t.exit("codeIndented"),e(c)}}function T5(t,e,n){const r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):be(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),i):st(t,s,"linePrefix",5)(o)}function s(o){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(o):be(o)?i(o):n(o)}}const k5={name:"codeText",previous:N5,resolve:C5,tokenize:A5};function C5(t){let e=t.length-4,n=3,r,i;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(r=n;++r=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return ethis.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(e,n,r){const i=n||0;this.setCursor(Math.trunc(e));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&da(this.left,r),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),da(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),da(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e=4?e(o):t.interrupt(r.parser.constructs.flow,n,e)(o)}}function QI(t,e,n,r,i,s,o,a,u){const c=u||Number.POSITIVE_INFINITY;let f=0;return h;function h(y){return y===60?(t.enter(r),t.enter(i),t.enter(s),t.consume(y),t.exit(s),p):y===null||y===32||y===41||kp(y)?n(y):(t.enter(r),t.enter(o),t.enter(a),t.enter("chunkString",{contentType:"string"}),S(y))}function p(y){return y===62?(t.enter(s),t.consume(y),t.exit(s),t.exit(i),t.exit(r),e):(t.enter(a),t.enter("chunkString",{contentType:"string"}),m(y))}function m(y){return y===62?(t.exit("chunkString"),t.exit(a),p(y)):y===null||y===60||be(y)?n(y):(t.consume(y),y===92?b:m)}function b(y){return y===60||y===62||y===92?(t.consume(y),m):m(y)}function S(y){return!f&&(y===null||y===41||kn(y))?(t.exit("chunkString"),t.exit(a),t.exit(o),t.exit(r),e(y)):f999||m===null||m===91||m===93&&!u||m===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?n(m):m===93?(t.exit(s),t.enter(i),t.consume(m),t.exit(i),t.exit(r),e):be(m)?(t.enter("lineEnding"),t.consume(m),t.exit("lineEnding"),f):(t.enter("chunkString",{contentType:"string"}),h(m))}function h(m){return m===null||m===91||m===93||be(m)||a++>999?(t.exit("chunkString"),f(m)):(t.consume(m),u||(u=!Ke(m)),m===92?p:h)}function p(m){return m===91||m===92||m===93?(t.consume(m),a++,h):h(m)}}function XI(t,e,n,r,i,s){let o;return a;function a(p){return p===34||p===39||p===40?(t.enter(r),t.enter(i),t.consume(p),t.exit(i),o=p===40?41:p,u):n(p)}function u(p){return p===o?(t.enter(i),t.consume(p),t.exit(i),t.exit(r),e):(t.enter(s),c(p))}function c(p){return p===o?(t.exit(s),u(o)):p===null?n(p):be(p)?(t.enter("lineEnding"),t.consume(p),t.exit("lineEnding"),st(t,c,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===o||p===null||be(p)?(t.exit("chunkString"),c(p)):(t.consume(p),p===92?h:f)}function h(p){return p===o||p===92?(t.consume(p),f):f(p)}}function Ma(t,e){let n;return r;function r(i){return be(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),n=!0,r):Ke(i)?st(t,r,n?"linePrefix":"lineSuffix")(i):e(i)}}const V5={name:"definition",tokenize:U5},F5={partial:!0,tokenize:z5};function U5(t,e,n){const r=this;let i;return s;function s(m){return t.enter("definition"),o(m)}function o(m){return YI.call(r,t,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(m)}function a(m){return i=yo(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),m===58?(t.enter("definitionMarker"),t.consume(m),t.exit("definitionMarker"),u):n(m)}function u(m){return kn(m)?Ma(t,c)(m):c(m)}function c(m){return QI(t,f,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(m)}function f(m){return t.attempt(F5,h,h)(m)}function h(m){return Ke(m)?st(t,p,"whitespace")(m):p(m)}function p(m){return m===null||be(m)?(t.exit("definition"),r.parser.defined.push(i),e(m)):n(m)}}function z5(t,e,n){return r;function r(a){return kn(a)?Ma(t,i)(a):n(a)}function i(a){return XI(t,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function s(a){return Ke(a)?st(t,o,"whitespace")(a):o(a)}function o(a){return a===null||be(a)?e(a):n(a)}}const B5={name:"hardBreakEscape",tokenize:$5};function $5(t,e,n){return r;function r(s){return t.enter("hardBreakEscape"),t.consume(s),i}function i(s){return be(s)?(t.exit("hardBreakEscape"),e(s)):n(s)}}const H5={name:"headingAtx",resolve:q5,tokenize:W5};function q5(t,e){let n=t.length-2,r=3,i,s;return t[r][1].type==="whitespace"&&(r+=2),n-2>r&&t[n][1].type==="whitespace"&&(n-=2),t[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&t[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:t[r][1].start,end:t[n][1].end},s={type:"chunkText",start:t[r][1].start,end:t[n][1].end,contentType:"text"},Rr(t,r,n-r+1,[["enter",i,e],["enter",s,e],["exit",s,e],["exit",i,e]])),t}function W5(t,e,n){let r=0;return i;function i(f){return t.enter("atxHeading"),s(f)}function s(f){return t.enter("atxHeadingSequence"),o(f)}function o(f){return f===35&&r++<6?(t.consume(f),o):f===null||kn(f)?(t.exit("atxHeadingSequence"),a(f)):n(f)}function a(f){return f===35?(t.enter("atxHeadingSequence"),u(f)):f===null||be(f)?(t.exit("atxHeading"),e(f)):Ke(f)?st(t,a,"whitespace")(f):(t.enter("atxHeadingText"),c(f))}function u(f){return f===35?(t.consume(f),u):(t.exit("atxHeadingSequence"),a(f))}function c(f){return f===null||f===35||kn(f)?(t.exit("atxHeadingText"),a(f)):(t.consume(f),c)}}const G5=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Qx=["pre","script","style","textarea"],K5={concrete:!0,name:"htmlFlow",resolveTo:X5,tokenize:J5},Q5={partial:!0,tokenize:e6},Y5={partial:!0,tokenize:Z5};function X5(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function J5(t,e,n){const r=this;let i,s,o,a,u;return c;function c(R){return f(R)}function f(R){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(R),h}function h(R){return R===33?(t.consume(R),p):R===47?(t.consume(R),s=!0,S):R===63?(t.consume(R),i=3,r.interrupt?e:N):xr(R)?(t.consume(R),o=String.fromCharCode(R),P):n(R)}function p(R){return R===45?(t.consume(R),i=2,m):R===91?(t.consume(R),i=5,a=0,b):xr(R)?(t.consume(R),i=4,r.interrupt?e:N):n(R)}function m(R){return R===45?(t.consume(R),r.interrupt?e:N):n(R)}function b(R){const H="CDATA[";return R===H.charCodeAt(a++)?(t.consume(R),a===H.length?r.interrupt?e:j:b):n(R)}function S(R){return xr(R)?(t.consume(R),o=String.fromCharCode(R),P):n(R)}function P(R){if(R===null||R===47||R===62||kn(R)){const H=R===47,J=o.toLowerCase();return!H&&!s&&Qx.includes(J)?(i=1,r.interrupt?e(R):j(R)):G5.includes(o.toLowerCase())?(i=6,H?(t.consume(R),y):r.interrupt?e(R):j(R)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(R):s?w(R):T(R))}return R===45||Mn(R)?(t.consume(R),o+=String.fromCharCode(R),P):n(R)}function y(R){return R===62?(t.consume(R),r.interrupt?e:j):n(R)}function w(R){return Ke(R)?(t.consume(R),w):k(R)}function T(R){return R===47?(t.consume(R),k):R===58||R===95||xr(R)?(t.consume(R),L):Ke(R)?(t.consume(R),T):k(R)}function L(R){return R===45||R===46||R===58||R===95||Mn(R)?(t.consume(R),L):F(R)}function F(R){return R===61?(t.consume(R),D):Ke(R)?(t.consume(R),F):T(R)}function D(R){return R===null||R===60||R===61||R===62||R===96?n(R):R===34||R===39?(t.consume(R),u=R,_):Ke(R)?(t.consume(R),D):x(R)}function _(R){return R===u?(t.consume(R),u=null,E):R===null||be(R)?n(R):(t.consume(R),_)}function x(R){return R===null||R===34||R===39||R===47||R===60||R===61||R===62||R===96||kn(R)?F(R):(t.consume(R),x)}function E(R){return R===47||R===62||Ke(R)?T(R):n(R)}function k(R){return R===62?(t.consume(R),C):n(R)}function C(R){return R===null||be(R)?j(R):Ke(R)?(t.consume(R),C):n(R)}function j(R){return R===45&&i===2?(t.consume(R),le):R===60&&i===1?(t.consume(R),ve):R===62&&i===4?(t.consume(R),fe):R===63&&i===3?(t.consume(R),N):R===93&&i===5?(t.consume(R),ie):be(R)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(Q5,ye,A)(R)):R===null||be(R)?(t.exit("htmlFlowData"),A(R)):(t.consume(R),j)}function A(R){return t.check(Y5,de,ye)(R)}function de(R){return t.enter("lineEnding"),t.consume(R),t.exit("lineEnding"),oe}function oe(R){return R===null||be(R)?A(R):(t.enter("htmlFlowData"),j(R))}function le(R){return R===45?(t.consume(R),N):j(R)}function ve(R){return R===47?(t.consume(R),o="",K):j(R)}function K(R){if(R===62){const H=o.toLowerCase();return Qx.includes(H)?(t.consume(R),fe):j(R)}return xr(R)&&o.length<8?(t.consume(R),o+=String.fromCharCode(R),K):j(R)}function ie(R){return R===93?(t.consume(R),N):j(R)}function N(R){return R===62?(t.consume(R),fe):R===45&&i===2?(t.consume(R),N):j(R)}function fe(R){return R===null||be(R)?(t.exit("htmlFlowData"),ye(R)):(t.consume(R),fe)}function ye(R){return t.exit("htmlFlow"),e(R)}}function Z5(t,e,n){const r=this;return i;function i(o){return be(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s):n(o)}function s(o){return r.parser.lazy[r.now().line]?n(o):e(o)}}function e6(t,e,n){return r;function r(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(Od,e,n)}}const t6={name:"htmlText",tokenize:n6};function n6(t,e,n){const r=this;let i,s,o;return a;function a(N){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(N),u}function u(N){return N===33?(t.consume(N),c):N===47?(t.consume(N),F):N===63?(t.consume(N),T):xr(N)?(t.consume(N),x):n(N)}function c(N){return N===45?(t.consume(N),f):N===91?(t.consume(N),s=0,b):xr(N)?(t.consume(N),w):n(N)}function f(N){return N===45?(t.consume(N),m):n(N)}function h(N){return N===null?n(N):N===45?(t.consume(N),p):be(N)?(o=h,ve(N)):(t.consume(N),h)}function p(N){return N===45?(t.consume(N),m):h(N)}function m(N){return N===62?le(N):N===45?p(N):h(N)}function b(N){const fe="CDATA[";return N===fe.charCodeAt(s++)?(t.consume(N),s===fe.length?S:b):n(N)}function S(N){return N===null?n(N):N===93?(t.consume(N),P):be(N)?(o=S,ve(N)):(t.consume(N),S)}function P(N){return N===93?(t.consume(N),y):S(N)}function y(N){return N===62?le(N):N===93?(t.consume(N),y):S(N)}function w(N){return N===null||N===62?le(N):be(N)?(o=w,ve(N)):(t.consume(N),w)}function T(N){return N===null?n(N):N===63?(t.consume(N),L):be(N)?(o=T,ve(N)):(t.consume(N),T)}function L(N){return N===62?le(N):T(N)}function F(N){return xr(N)?(t.consume(N),D):n(N)}function D(N){return N===45||Mn(N)?(t.consume(N),D):_(N)}function _(N){return be(N)?(o=_,ve(N)):Ke(N)?(t.consume(N),_):le(N)}function x(N){return N===45||Mn(N)?(t.consume(N),x):N===47||N===62||kn(N)?E(N):n(N)}function E(N){return N===47?(t.consume(N),le):N===58||N===95||xr(N)?(t.consume(N),k):be(N)?(o=E,ve(N)):Ke(N)?(t.consume(N),E):le(N)}function k(N){return N===45||N===46||N===58||N===95||Mn(N)?(t.consume(N),k):C(N)}function C(N){return N===61?(t.consume(N),j):be(N)?(o=C,ve(N)):Ke(N)?(t.consume(N),C):E(N)}function j(N){return N===null||N===60||N===61||N===62||N===96?n(N):N===34||N===39?(t.consume(N),i=N,A):be(N)?(o=j,ve(N)):Ke(N)?(t.consume(N),j):(t.consume(N),de)}function A(N){return N===i?(t.consume(N),i=void 0,oe):N===null?n(N):be(N)?(o=A,ve(N)):(t.consume(N),A)}function de(N){return N===null||N===34||N===39||N===60||N===61||N===96?n(N):N===47||N===62||kn(N)?E(N):(t.consume(N),de)}function oe(N){return N===47||N===62||kn(N)?E(N):n(N)}function le(N){return N===62?(t.consume(N),t.exit("htmlTextData"),t.exit("htmlText"),e):n(N)}function ve(N){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(N),t.exit("lineEnding"),K}function K(N){return Ke(N)?st(t,ie,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):ie(N)}function ie(N){return t.enter("htmlTextData"),o(N)}}const Bg={name:"labelEnd",resolveAll:o6,resolveTo:a6,tokenize:l6},r6={tokenize:u6},i6={tokenize:c6},s6={tokenize:d6};function o6(t){let e=-1;const n=[];for(;++e=3&&(c===null||be(c))?(t.exit("thematicBreak"),e(c)):n(c)}function u(c){return c===i?(t.consume(c),r++,u):(t.exit("thematicBreakSequence"),Ke(c)?st(t,a,"whitespace")(c):a(c))}}const mn={continuation:{tokenize:_6},exit:E6,name:"list",tokenize:w6},v6={partial:!0,tokenize:I6},x6={partial:!0,tokenize:b6};function w6(t,e,n){const r=this,i=r.events[r.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return a;function a(m){const b=r.containerState.type||(m===42||m===43||m===45?"listUnordered":"listOrdered");if(b==="listUnordered"?!r.containerState.marker||m===r.containerState.marker:Cp(m)){if(r.containerState.type||(r.containerState.type=b,t.enter(b,{_container:!0})),b==="listUnordered")return t.enter("listItemPrefix"),m===42||m===45?t.check($u,n,c)(m):c(m);if(!r.interrupt||m===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),u(m)}return n(m)}function u(m){return Cp(m)&&++o<10?(t.consume(m),u):(!r.interrupt||o<2)&&(r.containerState.marker?m===r.containerState.marker:m===41||m===46)?(t.exit("listItemValue"),c(m)):n(m)}function c(m){return t.enter("listItemMarker"),t.consume(m),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||m,t.check(Od,r.interrupt?n:f,t.attempt(v6,p,h))}function f(m){return r.containerState.initialBlankLine=!0,s++,p(m)}function h(m){return Ke(m)?(t.enter("listItemPrefixWhitespace"),t.consume(m),t.exit("listItemPrefixWhitespace"),p):n(m)}function p(m){return r.containerState.size=s+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(m)}}function _6(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(Od,i,s);function i(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,st(t,e,"listItemIndent",r.containerState.size+1)(a)}function s(a){return r.containerState.furtherBlankLines||!Ke(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(x6,e,o)(a))}function o(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,st(t,t.attempt(mn,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function b6(t,e,n){const r=this;return st(t,i,"listItemIndent",r.containerState.size+1);function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?e(s):n(s)}}function E6(t){t.exit(this.containerState.type)}function I6(t,e,n){const r=this;return st(t,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const o=r.events[r.events.length-1];return!Ke(s)&&o&&o[1].type==="listItemPrefixWhitespace"?e(s):n(s)}}const Yx={name:"setextUnderline",resolveTo:S6,tokenize:T6};function S6(t,e){let n=t.length,r,i,s;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){r=n;break}t[n][1].type==="paragraph"&&(i=n)}else t[n][1].type==="content"&&t.splice(n,1),!s&&t[n][1].type==="definition"&&(s=n);const o={type:"setextHeading",start:{...t[r][1].start},end:{...t[t.length-1][1].end}};return t[i][1].type="setextHeadingText",s?(t.splice(i,0,["enter",o,e]),t.splice(s+1,0,["exit",t[r][1],e]),t[r][1].end={...t[s][1].end}):t[r][1]=o,t.push(["exit",o,e]),t}function T6(t,e,n){const r=this;let i;return s;function s(c){let f=r.events.length,h;for(;f--;)if(r.events[f][1].type!=="lineEnding"&&r.events[f][1].type!=="linePrefix"&&r.events[f][1].type!=="content"){h=r.events[f][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||h)?(t.enter("setextHeadingLine"),i=c,o(c)):n(c)}function o(c){return t.enter("setextHeadingLineSequence"),a(c)}function a(c){return c===i?(t.consume(c),a):(t.exit("setextHeadingLineSequence"),Ke(c)?st(t,u,"lineSuffix")(c):u(c))}function u(c){return c===null||be(c)?(t.exit("setextHeadingLine"),e(c)):n(c)}}const k6={tokenize:C6};function C6(t){const e=this,n=t.attempt(Od,r,t.attempt(this.parser.constructs.flowInitial,i,st(t,t.attempt(this.parser.constructs.flow,i,t.attempt(D5,i)),"linePrefix")));return n;function r(s){if(s===null){t.consume(s);return}return t.enter("lineEndingBlank"),t.consume(s),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n}function i(s){if(s===null){t.consume(s);return}return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),e.currentConstruct=void 0,n}}const N6={resolveAll:ZI()},A6=JI("string"),P6=JI("text");function JI(t){return{resolveAll:ZI(t==="text"?R6:void 0),tokenize:e};function e(n){const r=this,i=this.parser.constructs[t],s=n.attempt(i,o,a);return o;function o(f){return c(f)?s(f):a(f)}function a(f){if(f===null){n.consume(f);return}return n.enter("data"),n.consume(f),u}function u(f){return c(f)?(n.exit("data"),s(f)):(n.consume(f),u)}function c(f){if(f===null)return!0;const h=i[f];let p=-1;if(h)for(;++p-1){const a=o[0];typeof a=="string"?o[0]=a.slice(r):o.shift()}s>0&&o.push(t[i].slice(0,s))}return o}function q6(t,e){let n=-1;const r=[];let i;for(;++n0){const Ae=B.tokenStack[B.tokenStack.length-1];(Ae[1]||Jx).call(B,void 0,Ae[0])}for(O.position={start:fi(z.length>0?z[0][1].start:{line:1,column:1,offset:0}),end:fi(z.length>0?z[z.length-2][1].end:{line:1,column:1,offset:0})},Y=-1;++Y0&&(r.className=["language-"+i[0]]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return e.meta&&(s.data={meta:e.meta}),t.patch(e,s),s=t.applyData(e,s),s={type:"element",tagName:"pre",properties:{},children:[s]},t.patch(e,s),s}function sL(t,e){const n={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function oL(t,e){const n={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function aL(t,e){const n=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=String(e.identifier).toUpperCase(),i=Ho(r.toLowerCase()),s=t.footnoteOrder.indexOf(r);let o,a=t.footnoteCounts.get(r);a===void 0?(a=0,t.footnoteOrder.push(r),o=t.footnoteOrder.length):o=s+1,a+=1,t.footnoteCounts.set(r,a);const u={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};t.patch(e,u);const c={type:"element",tagName:"sup",properties:{},children:[u]};return t.patch(e,c),t.applyData(e,c)}function lL(t,e){const n={type:"element",tagName:"h"+e.depth,properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function uL(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}}function nS(t,e){const n=e.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+r}];const i=t.all(e),s=i[0];s&&s.type==="text"?s.value="["+s.value:i.unshift({type:"text",value:"["});const o=i[i.length-1];return o&&o.type==="text"?o.value+=r:i.push({type:"text",value:r}),i}function cL(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return nS(t,e);const i={src:Ho(r.url||""),alt:e.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"img",properties:i,children:[]};return t.patch(e,s),t.applyData(e,s)}function dL(t,e){const n={src:Ho(e.url)};e.alt!==null&&e.alt!==void 0&&(n.alt=e.alt),e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"img",properties:n,children:[]};return t.patch(e,r),t.applyData(e,r)}function hL(t,e){const n={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};t.patch(e,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return t.patch(e,r),t.applyData(e,r)}function fL(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return nS(t,e);const i={href:Ho(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"a",properties:i,children:t.all(e)};return t.patch(e,s),t.applyData(e,s)}function pL(t,e){const n={href:Ho(e.url)};e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"a",properties:n,children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function mL(t,e,n){const r=t.all(e),i=n?gL(n):rS(e),s={},o=[];if(typeof e.checked=="boolean"){const f=r[0];let h;f&&f.type==="element"&&f.tagName==="p"?h=f:(h={type:"element",tagName:"p",properties:{},children:[]},r.unshift(h)),h.children.length>0&&h.children.unshift({type:"text",value:" "}),h.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let a=-1;for(;++a1}function yL(t,e){const n={},r=t.all(e);let i=-1;for(typeof e.start=="number"&&e.start!==1&&(n.start=e.start);++i0){const o={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},a=Og(e.children[1]),u=MI(e.children[e.children.length-1]);a&&u&&(o.position={start:a,end:u}),i.push(o)}const s={type:"element",tagName:"table",properties:{},children:t.wrap(i,!0)};return t.patch(e,s),t.applyData(e,s)}function bL(t,e,n){const r=n?n.children:void 0,s=(r?r.indexOf(e):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,a=o?o.length:e.children.length;let u=-1;const c=[];for(;++u0,!0),r[0]),i=r.index+r[0].length,r=n.exec(e);return s.push(tw(e.slice(i),i>0,!1)),s.join("")}function tw(t,e,n){let r=0,i=t.length;if(e){let s=t.codePointAt(r);for(;s===Zx||s===ew;)r++,s=t.codePointAt(r)}if(n){let s=t.codePointAt(i-1);for(;s===Zx||s===ew;)i--,s=t.codePointAt(i-1)}return i>r?t.slice(r,i):""}function SL(t,e){const n={type:"text",value:IL(String(e.value))};return t.patch(e,n),t.applyData(e,n)}function TL(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)}const kL={blockquote:nL,break:rL,code:iL,delete:sL,emphasis:oL,footnoteReference:aL,heading:lL,html:uL,imageReference:cL,image:dL,inlineCode:hL,linkReference:fL,link:pL,listItem:mL,list:yL,paragraph:vL,root:xL,strong:wL,table:_L,tableCell:EL,tableRow:bL,text:SL,thematicBreak:TL,toml:yu,yaml:yu,definition:yu,footnoteDefinition:yu};function yu(){}const iS=-1,Md=0,Va=1,Fc=2,$g=3,Hg=4,qg=5,Wg=6,sS=7,oS=8,nw=typeof self=="object"?self:globalThis,CL=(t,e)=>{const n=(i,s)=>(t.set(s,i),i),r=i=>{if(t.has(i))return t.get(i);const[s,o]=e[i];switch(s){case Md:case iS:return n(o,i);case Va:{const a=n([],i);for(const u of o)a.push(r(u));return a}case Fc:{const a=n({},i);for(const[u,c]of o)a[r(u)]=r(c);return a}case $g:return n(new Date(o),i);case Hg:{const{source:a,flags:u}=o;return n(new RegExp(a,u),i)}case qg:{const a=n(new Map,i);for(const[u,c]of o)a.set(r(u),r(c));return a}case Wg:{const a=n(new Set,i);for(const u of o)a.add(r(u));return a}case sS:{const{name:a,message:u}=o;return n(new nw[a](u),i)}case oS:return n(BigInt(o),i);case"BigInt":return n(Object(BigInt(o)),i);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:a}=new Uint8Array(o);return n(new DataView(a),o)}}return n(new nw[s](o),i)};return r},rw=t=>CL(new Map,t)(0),Fs="",{toString:NL}={},{keys:AL}=Object,ha=t=>{const e=typeof t;if(e!=="object"||!t)return[Md,e];const n=NL.call(t).slice(8,-1);switch(n){case"Array":return[Va,Fs];case"Object":return[Fc,Fs];case"Date":return[$g,Fs];case"RegExp":return[Hg,Fs];case"Map":return[qg,Fs];case"Set":return[Wg,Fs];case"DataView":return[Va,n]}return n.includes("Array")?[Va,n]:n.includes("Error")?[sS,n]:[Fc,n]},vu=([t,e])=>t===Md&&(e==="function"||e==="symbol"),PL=(t,e,n,r)=>{const i=(o,a)=>{const u=r.push(o)-1;return n.set(a,u),u},s=o=>{if(n.has(o))return n.get(o);let[a,u]=ha(o);switch(a){case Md:{let f=o;switch(u){case"bigint":a=oS,f=o.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+u);f=null;break;case"undefined":return i([iS],o)}return i([a,f],o)}case Va:{if(u){let p=o;return u==="DataView"?p=new Uint8Array(o.buffer):u==="ArrayBuffer"&&(p=new Uint8Array(o)),i([u,[...p]],o)}const f=[],h=i([a,f],o);for(const p of o)f.push(s(p));return h}case Fc:{if(u)switch(u){case"BigInt":return i([u,o.toString()],o);case"Boolean":case"Number":case"String":return i([u,o.valueOf()],o)}if(e&&"toJSON"in o)return s(o.toJSON());const f=[],h=i([a,f],o);for(const p of AL(o))(t||!vu(ha(o[p])))&&f.push([s(p),s(o[p])]);return h}case $g:return i([a,o.toISOString()],o);case Hg:{const{source:f,flags:h}=o;return i([a,{source:f,flags:h}],o)}case qg:{const f=[],h=i([a,f],o);for(const[p,m]of o)(t||!(vu(ha(p))||vu(ha(m))))&&f.push([s(p),s(m)]);return h}case Wg:{const f=[],h=i([a,f],o);for(const p of o)(t||!vu(ha(p)))&&f.push(s(p));return h}}const{message:c}=o;return i([a,{name:u,message:c}],o)};return s},iw=(t,{json:e,lossy:n}={})=>{const r=[];return PL(!(e||n),!!e,new Map,r)(t),r},Uc=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?rw(iw(t,e)):structuredClone(t):(t,e)=>rw(iw(t,e));function RL(t,e){const n=[{type:"text",value:"↩"}];return e>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),n}function DL(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function jL(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=t.options.footnoteBackContent||RL,r=t.options.footnoteBackLabel||DL,i=t.options.footnoteLabel||"Footnotes",s=t.options.footnoteLabelTagName||"h2",o=t.options.footnoteLabelProperties||{className:["sr-only"]},a=[];let u=-1;for(;++u0&&b.push({type:"text",value:" "});let w=typeof n=="string"?n:n(u,m);typeof w=="string"&&(w={type:"text",value:w}),b.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+p+(m>1?"-"+m:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(u,m),className:["data-footnote-backref"]},children:Array.isArray(w)?w:[w]})}const P=f[f.length-1];if(P&&P.type==="element"&&P.tagName==="p"){const w=P.children[P.children.length-1];w&&w.type==="text"?w.value+=" ":P.children.push({type:"text",value:" "}),P.children.push(...b)}else f.push(...b);const y={type:"element",tagName:"li",properties:{id:e+"fn-"+p},children:t.wrap(f,!0)};t.patch(c,y),a.push(y)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...Uc(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:` +`},{type:"element",tagName:"ol",properties:{},children:t.wrap(a,!0)},{type:"text",value:` +`}]}}const aS=function(t){if(t==null)return VL;if(typeof t=="function")return Vd(t);if(typeof t=="object")return Array.isArray(t)?LL(t):OL(t);if(typeof t=="string")return ML(t);throw new Error("Expected function, string, or object as test")};function LL(t){const e=[];let n=-1;for(;++n":""))+")"})}return p;function p(){let m=lS,b,S,P;if((!e||s(u,c,f[f.length-1]||void 0))&&(m=$L(n(u,f)),m[0]===sw))return m;if("children"in u&&u.children){const y=u;if(y.children&&m[0]!==zL)for(S=(r?y.children.length:-1)+o,P=f.concat(y);S>-1&&S0&&n.push({type:"text",value:` +`}),n}function ow(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function aw(t,e){const n=qL(t,e),r=n.one(t,void 0),i=jL(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&s.children.push({type:"text",value:` +`},i),s}function YL(t,e){return t&&"run"in t?async function(n,r){const i=aw(n,{file:r,...e});await t.run(i,r)}:function(n,r){return aw(n,{file:r,...t||e})}}function lw(t){if(t)throw t}var Hu=Object.prototype.hasOwnProperty,cS=Object.prototype.toString,uw=Object.defineProperty,cw=Object.getOwnPropertyDescriptor,dw=function(e){return typeof Array.isArray=="function"?Array.isArray(e):cS.call(e)==="[object Array]"},hw=function(e){if(!e||cS.call(e)!=="[object Object]")return!1;var n=Hu.call(e,"constructor"),r=e.constructor&&e.constructor.prototype&&Hu.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!r)return!1;var i;for(i in e);return typeof i>"u"||Hu.call(e,i)},fw=function(e,n){uw&&n.name==="__proto__"?uw(e,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):e[n.name]=n.newValue},pw=function(e,n){if(n==="__proto__")if(Hu.call(e,n)){if(cw)return cw(e,n).value}else return;return e[n]},XL=function t(){var e,n,r,i,s,o,a=arguments[0],u=1,c=arguments.length,f=!1;for(typeof a=="boolean"&&(f=a,a=arguments[1]||{},u=2),(a==null||typeof a!="object"&&typeof a!="function")&&(a={});uo.length;let u;a&&o.push(i);try{u=t.apply(this,o)}catch(c){const f=c;if(a&&n)throw f;return i(f)}a||(u&&u.then&&typeof u.then=="function"?u.then(s,i):u instanceof Error?i(u):s(u))}function i(o,...a){n||(n=!0,e(o,...a))}function s(o){i(null,o)}}const gr={basename:eO,dirname:tO,extname:nO,join:rO,sep:"/"};function eO(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');jl(t);let n=0,r=-1,i=t.length,s;if(e===void 0||e.length===0||e.length>t.length){for(;i--;)if(t.codePointAt(i)===47){if(s){n=i+1;break}}else r<0&&(s=!0,r=i+1);return r<0?"":t.slice(n,r)}if(e===t)return"";let o=-1,a=e.length-1;for(;i--;)if(t.codePointAt(i)===47){if(s){n=i+1;break}}else o<0&&(s=!0,o=i+1),a>-1&&(t.codePointAt(i)===e.codePointAt(a--)?a<0&&(r=i):(a=-1,r=o));return n===r?r=o:r<0&&(r=t.length),t.slice(n,r)}function tO(t){if(jl(t),t.length===0)return".";let e=-1,n=t.length,r;for(;--n;)if(t.codePointAt(n)===47){if(r){e=n;break}}else r||(r=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function nO(t){jl(t);let e=t.length,n=-1,r=0,i=-1,s=0,o;for(;e--;){const a=t.codePointAt(e);if(a===47){if(o){r=e+1;break}continue}n<0&&(o=!0,n=e+1),a===46?i<0?i=e:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||n<0||s===0||s===1&&i===n-1&&i===r+1?"":t.slice(i,n)}function rO(...t){let e=-1,n;for(;++e0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function sO(t,e){let n="",r=0,i=-1,s=0,o=-1,a,u;for(;++o<=t.length;){if(o2){if(u=n.lastIndexOf("/"),u!==n.length-1){u<0?(n="",r=0):(n=n.slice(0,u),r=n.length-1-n.lastIndexOf("/")),i=o,s=0;continue}}else if(n.length>0){n="",r=0,i=o,s=0;continue}}e&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+t.slice(i+1,o):n=t.slice(i+1,o),r=o-i-1;i=o,s=0}else a===46&&s>-1?s++:s=-1}return n}function jl(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const oO={cwd:aO};function aO(){return"/"}function Rp(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function lO(t){if(typeof t=="string")t=new URL(t);else if(!Rp(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return uO(t)}function uO(t){if(t.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const e=t.pathname;let n=-1;for(;++n0){let[m,...b]=f;const S=r[p][1];Pp(S)&&Pp(m)&&(m=Bh(!0,S,m)),r[p]=[c,m,...b]}}}}const fO=new Gg().freeze();function Wh(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function Gh(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function Kh(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function gw(t){if(!Pp(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function yw(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function xu(t){return pO(t)?t:new dS(t)}function pO(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function mO(t){return typeof t=="string"||gO(t)}function gO(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const yO="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",vw=[],xw={allowDangerousHtml:!0},vO=/^(https?|ircs?|mailto|xmpp)$/i,xO=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function wO(t){const e=_O(t),n=bO(t);return EO(e.runSync(e.parse(n),n),t)}function _O(t){const e=t.rehypePlugins||vw,n=t.remarkPlugins||vw,r=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...xw}:xw;return fO().use(tL).use(n).use(YL,r).use(e)}function bO(t){const e=t.children||"",n=new dS;return typeof e=="string"&&(n.value=e),n}function EO(t,e){const n=e.allowedElements,r=e.allowElement,i=e.components,s=e.disallowedElements,o=e.skipHtml,a=e.unwrapDisallowed,u=e.urlTransform||IO;for(const f of xO)Object.hasOwn(e,f.from)&&(""+f.from+(f.to?"use `"+f.to+"` instead":"remove it")+yO+f.id,void 0);return uS(t,c),j3(t,{Fragment:d.Fragment,components:i,ignoreInvalidStyle:!0,jsx:d.jsx,jsxs:d.jsxs,passKeys:!0,passNode:!0});function c(f,h,p){if(f.type==="raw"&&p&&typeof h=="number")return o?p.children.splice(h,1):p.children[h]={type:"text",value:f.value},h;if(f.type==="element"){let m;for(m in Fh)if(Object.hasOwn(Fh,m)&&Object.hasOwn(f.properties,m)){const b=f.properties[m],S=Fh[m];(S===null||S.includes(f.tagName))&&(f.properties[m]=u(String(b||""),m,f))}}if(f.type==="element"){let m=n?!n.includes(f.tagName):s?s.includes(f.tagName):!1;if(!m&&r&&typeof h=="number"&&(m=!r(f,h,p)),m&&p&&typeof h=="number")return a&&f.children?p.children.splice(h,1,...f.children):p.children.splice(h,1),h}}}function IO(t){const e=t.indexOf(":"),n=t.indexOf("?"),r=t.indexOf("#"),i=t.indexOf("/");return e===-1||i!==-1&&e>i||n!==-1&&e>n||r!==-1&&e>r||vO.test(t.slice(0,e))?t:""}function SO({onBack:t,isAdmin:e}){const[n,r]=V.useState(""),[i,s]=V.useState(!1),[o,a]=V.useState(""),[u,c]=V.useState(!0);V.useEffect(()=>{const p=Mj(m=>{m&&r(m.content),c(!1)});return()=>p()},[]);const f=async()=>{try{await Oj(o),s(!1)}catch(p){console.error("Error saving info:",p),alert("Error al guardar la información.")}},h=()=>{a(n),s(!0)};return d.jsx("div",{className:"min-h-screen bg-[#0a0a0a] text-white p-4 sm:p-6 md:p-12 animate-in fade-in slide-in-from-bottom-4 duration-300",children:d.jsxs("div",{className:"max-w-4xl mx-auto",children:[d.jsxs("button",{onClick:t,className:"flex items-center gap-2 text-gray-400 hover:text-white transition-colors mb-8 group",children:[d.jsx(So,{className:"w-5 h-5 group-hover:-translate-x-1 transition-transform"}),d.jsx("span",{className:"font-medium",children:"Volver al inicio"})]}),d.jsxs("div",{className:"bg-[#1a1a1a] rounded-2xl border border-gray-800 p-8 sm:p-12 shadow-2xl relative",children:[e&&!i&&d.jsx("button",{onClick:h,className:"absolute top-8 right-8 p-2 rounded-lg bg-gray-800 text-gray-400 hover:text-[#bb86fc] hover:bg-[#bb86fc]/10 transition-colors",title:"Editar información",children:d.jsx(B1,{className:"w-5 h-5"})}),d.jsxs("div",{className:"flex items-center gap-4 mb-8 border-b border-gray-800 pb-8",children:[d.jsx("div",{className:"p-3 bg-gradient-to-br from-[#bb86fc] to-[#9966dd] rounded-xl shadow-lg shadow-[#bb86fc]/20",children:d.jsx(F1,{className:"w-8 h-8 text-white"})}),d.jsxs("div",{children:[d.jsx("h1",{className:"text-3xl font-bold bg-gradient-to-r from-white to-gray-400 bg-clip-text text-transparent",children:"Información"}),d.jsx("p",{className:"text-gray-400 mt-1",children:"Sobre Twisted Brody MangaFlow"})]})]}),i?d.jsxs("div",{className:"space-y-4",children:[d.jsx("textarea",{value:o,onChange:p=>a(p.target.value),className:"w-full h-[500px] bg-black/50 border border-[#bb86fc]/50 rounded-lg p-4 text-sm text-white focus:outline-none focus:border-[#bb86fc] font-mono",placeholder:"Escribe el contenido en Markdown..."}),d.jsxs("div",{className:"flex gap-3 justify-end",children:[d.jsxs("button",{onClick:()=>s(!1),className:"px-4 py-2 rounded-lg font-semibold text-gray-400 hover:text-white hover:bg-white/10 transition-colors flex items-center gap-2",children:[d.jsx(In,{className:"w-4 h-4"}),"Cancelar"]}),d.jsxs("button",{onClick:f,className:"px-4 py-2 rounded-lg font-semibold bg-[#bb86fc] hover:bg-[#9966dd] text-white transition-colors shadow-lg shadow-[#bb86fc]/20 flex items-center gap-2",children:[d.jsx(Cm,{className:"w-4 h-4"}),"Guardar Cambios"]})]})]}):d.jsx("div",{className:"prose prose-invert prose-p:text-gray-300 prose-headings:text-white prose-a:no-underline max-w-none",children:d.jsx(wO,{components:{h1:({node:p,...m})=>d.jsx("h1",{className:"text-3xl font-bold bg-gradient-to-r from-[#bb86fc] to-[#7744cc] bg-clip-text text-transparent mb-6 pb-2 border-b border-gray-800",...m}),h2:({node:p,...m})=>d.jsx("h2",{className:"text-xl font-semibold text-white mt-8 mb-4 flex items-center gap-2",...m}),p:({node:p,...m})=>d.jsx("p",{className:"text-gray-300 leading-relaxed mb-4",...m}),ul:({node:p,...m})=>d.jsx("ul",{className:"space-y-2 mb-6",...m}),li:({node:p,...m})=>d.jsx("li",{className:"flex items-start gap-2 text-gray-300",...m}),a:({node:p,href:m,children:b,...S})=>{const P=m==null?void 0:m.startsWith("http");if((m==null?void 0:m.includes("t.me"))||(m==null?void 0:m.includes("patreon.com"))||(m==null?void 0:m.includes("x.com"))){let w="bg-[#1a1a1a] border border-gray-700 hover:border-gray-500",T="text-gray-300 hover:text-white";return m!=null&&m.includes("patreon")&&(w="bg-[#1a1a1a] border border-gray-700 hover:border-[#FF424D] hover:text-[#FF424D]"),m!=null&&m.includes("t.me")&&(w="bg-[#1a1a1a] border border-gray-700 hover:border-[#24A1DE] hover:text-[#24A1DE]"),m!=null&&m.includes("x.com")&&(w="bg-[#1a1a1a] border border-gray-700 hover:border-white hover:text-white"),d.jsx("a",{href:m,target:P?"_blank":void 0,rel:P?"noopener noreferrer":void 0,className:`inline-flex items-center gap-2 px-3 py-1.5 rounded-lg transition-all transform hover:scale-105 shadow-sm my-1 mr-2 no-underline text-xs sm:text-sm font-medium ${w} ${T}`,...S,children:b})}return d.jsx("a",{href:m,className:"text-[#bb86fc] hover:underline",target:P?"_blank":void 0,rel:P?"noopener noreferrer":void 0,...S,children:b})},blockquote:({node:p,...m})=>d.jsx("blockquote",{className:"border-l-4 border-[#bb86fc] pl-4 py-2 bg-[#bb86fc]/10 rounded-r-lg italic text-gray-400 my-6",...m}),hr:({node:p,...m})=>d.jsx("hr",{className:"border-gray-800 my-8",...m}),img:()=>null},children:n})}),!i&&d.jsxs("div",{className:"pt-8 border-t border-gray-800 text-center text-sm text-gray-500 mt-8",children:["© ",new Date().getFullYear()," Twisted Brody. Todos los derechos reservados."]})]})]})})}function TO({label:t,authors:e,value:n,onChange:r,onDelete:i,placeholder:s="Añadir autor...",colorClass:o="text-gray-400"}){const[a,u]=V.useState(""),[c,f]=V.useState(!1),h=V.useRef(null);V.useEffect(()=>{n&&n!==a&&!c?u(n):!n&&!c&&u("")},[n]);const p=V.useMemo(()=>a.trim()?e.filter(y=>y.toLowerCase().includes(a.toLowerCase())):e,[e,a]);V.useEffect(()=>{const y=w=>{h.current&&!h.current.contains(w.target)&&f(!1)};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[]);const m=y=>{y.key==="Enter"&&(y.preventDefault(),b(a))},b=y=>{const w=y.trim();w&&(r(w),u(w),f(!1))},S=()=>{r(""),u(""),f(!1)},P=(y,w)=>{y.stopPropagation(),y.preventDefault(),i&&i(w)};return d.jsxs("div",{className:"space-y-3 mb-6",ref:h,children:[d.jsx("label",{className:`text-xs uppercase font-bold tracking-wider ${o}`,children:t}),d.jsxs("div",{className:"relative",children:[d.jsxs("div",{className:"relative",children:[d.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:d.jsx(Nm,{className:"h-4 w-4 text-gray-500"})}),d.jsx("input",{type:"text",value:a,onChange:y=>{u(y.target.value),f(!0)},onFocus:()=>f(!0),onKeyDown:m,placeholder:s,className:"w-full bg-[#1a1a1a] border border-gray-600/50 rounded-lg pl-10 pr-10 py-2.5 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-[#bb86fc] transition-all"}),a&&d.jsx("button",{onClick:S,className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-500 hover:text-white",children:d.jsx(In,{className:"w-3.5 h-3.5"})})]}),c&&p.length>0&&d.jsx("div",{className:"absolute top-full left-0 right-0 mt-1 bg-[#1a1a1a] border border-gray-700/50 rounded-lg shadow-xl z-50 max-h-60 overflow-y-auto w-full custom-scrollbar",children:p.map((y,w)=>{const T=n===y;return d.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5 hover:bg-white/5 cursor-pointer group",onMouseDown:L=>{L.preventDefault(),b(y)},children:[d.jsx("span",{className:`text-sm ${T?"text-[#bb86fc]":"text-gray-300"}`,children:y}),d.jsxs("div",{className:"flex items-center gap-2",children:[T&&d.jsx(wl,{className:"w-4 h-4 text-[#bb86fc]"}),i&&d.jsx("button",{onMouseDown:L=>P(L,y),className:"opacity-0 group-hover:opacity-100 p-1 hover:bg-red-500/20 text-gray-500 hover:text-red-400 rounded transition-all",title:"Eliminar autor de todos los mangas",children:d.jsx(wr,{className:"w-3.5 h-3.5"})})]})]},w)})})]}),d.jsx("p",{className:"text-[10px] text-gray-500 mt-1",children:n?`Se actualizará el autor a: "${n}"`:"Deja en blanco para no modificar el autor."})]})}function kO({isOpen:t,onClose:e,selectedMangaIds:n,onSaveComplete:r}){const[i,s]=V.useState([]),[o,a]=V.useState([]),[u,c]=V.useState([]),[f,h]=V.useState(""),[p,m]=V.useState(!1),[b,S]=V.useState(!1);V.useEffect(()=>{t&&(P(),a([]),h(""))},[t]);const P=async()=>{try{S(!0);const _=await wI();s(_);const x=await ZD();c(x)}catch(_){console.error("Error loading categories:",_)}finally{S(!1)}},y=async(_,x)=>{if(_.trim()){if(x==="tag"){const E=_.split(" ").map(k=>k.trim()).filter(k=>k.length>0);for(const k of E)await w(k,x);return}await w(_,x)}},w=async(_,x)=>{try{const E=i.find(k=>k.name.toLowerCase()===_.trim().toLowerCase()&&k.type===x);if(E)a(k=>k.includes(E.id)?k:[...k,E.id]);else{const k=await _I(_.trim(),x);s(C=>C.find(j=>j.id===k.id)?C:[...C,k]),a(C=>C.includes(k.id)?C:[...C,k.id])}}catch(E){console.error("Error creating category:",E)}},T=_=>{a(x=>x.filter(E=>E!==_))},L=async _=>{try{await bI(_),s(x=>x.filter(E=>E.id!==_)),a(x=>x.filter(E=>E!==_))}catch(x){console.error("Error deleting category:",x),Nt.error("Error al eliminar la categoría")}},F=_=>{Nt(`¿Eliminar al autor "${_}" permanentemente?`,{description:"Se eliminará este autor de TODOS los mangas. Esta acción no se puede deshacer.",action:{label:"Eliminar",onClick:async()=>{try{S(!0),await JD(_),Nt.success(`Autor "${_}" eliminado correctamente.`),c(x=>x.filter(E=>E!==_)),f===_&&h("")}catch(x){console.error("Error deleting author:",x),Nt.error("Error al eliminar el autor.")}finally{S(!1)}}},cancel:{label:"Cancelar",onClick:()=>{}},duration:5e3})},D=async()=>{if(o.length===0&&!f.trim()){Nt.error("Selecciona al menos una categoría o un autor para aplicar.");return}m(!0);try{const _=n.map(async x=>{var E;try{const k=await xI(x);if(!k)return;const C=((E=k.categories)==null?void 0:E.map(de=>de.id))||[],j=Array.from(new Set([...C,...o])),A={title:k.title,author:k.author,categoryIds:j};f.trim()&&(A.author=f.trim()),await EI(x,A)}catch(k){console.error(`Error updating manga ${x}`,k)}});await Promise.all(_),Nt.success("Categorías aplicadas correctamente."),r(),e()}catch(_){console.error("Error bulk updating mangas:",_),Nt.error("Error al aplicar cambios.")}finally{m(!1)}};return t?d.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50 p-4 animate-in fade-in duration-200",children:d.jsxs("div",{className:"bg-[#121212] rounded-2xl border border-gray-800 w-full max-w-2xl shadow-2xl overflow-hidden flex flex-col max-h-[90vh]",children:[d.jsxs("div",{className:"bg-[#1a1a1a] border-b border-gray-800 px-6 py-4 flex items-center justify-between sticky top-0 z-10",children:[d.jsxs("h2",{className:"text-xl font-bold text-white",children:["Aplicar Categorías a ",n.length," Mangas"]}),d.jsx("button",{onClick:e,className:"text-gray-400 hover:text-white transition-colors p-2 hover:bg-white/5 rounded-lg",children:d.jsx(In,{className:"w-5 h-5"})})]}),d.jsx("div",{className:"p-6 overflow-y-auto custom-scrollbar flex-1",children:b?d.jsx("div",{className:"flex justify-center p-8",children:d.jsx(ys,{size:32})}):d.jsxs("div",{className:"space-y-6",children:[d.jsx("div",{className:"bg-[#1f1f1f] p-4 rounded-xl border border-gray-800",children:d.jsx(TO,{label:"Autor",authors:u,value:f,onChange:h,onDelete:F,placeholder:"Seleccionar o escribir autor..."})}),d.jsx(Ii,{label:"Personajes",type:"character",categories:i,selectedIds:o,onSelect:_=>{o.includes(_)||a(x=>[...x,_])},onRemove:T,onCreate:_=>y(_,"character"),onDeleteCategory:L,colorClass:"text-blue-400",placeholder:"Añadir personaje..."}),d.jsx(Ii,{label:"Series",type:"series",categories:i,selectedIds:o,onSelect:_=>{o.includes(_)||a(x=>[...x,_])},onRemove:T,onCreate:_=>y(_,"series"),onDeleteCategory:L,colorClass:"text-green-400",placeholder:"Añadir serie..."}),d.jsx(Ii,{label:"Géneros",type:"genre",categories:i,selectedIds:o,onSelect:_=>{o.includes(_)||a(x=>[...x,_])},onRemove:T,onCreate:_=>y(_,"genre"),onDeleteCategory:L,colorClass:"text-purple-400",placeholder:"Añadir género..."}),d.jsx(Ii,{label:"Etiquetas",type:"tag",categories:i,selectedIds:o,onSelect:_=>{o.includes(_)||a(x=>[...x,_])},onRemove:T,onCreate:_=>y(_,"tag"),onDeleteCategory:L,colorClass:"text-pink-400",placeholder:"Añadir etiqueta..."})]})}),d.jsxs("div",{className:"p-6 border-t border-gray-800 flex justify-end gap-3 bg-[#1a1a1a]",children:[d.jsx("button",{onClick:e,className:"px-4 py-2 rounded-lg text-sm font-semibold text-gray-300 hover:text-white transition-colors",children:"Cancelar"}),d.jsx("button",{onClick:D,disabled:p||o.length===0&&!f.trim(),className:"bg-[#bb86fc] hover:bg-[#9966dd] text-white px-6 py-2 rounded-lg font-semibold text-sm transition-all shadow-lg shadow-[#bb86fc]/20 flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",children:p?d.jsxs(d.Fragment,{children:[d.jsx(ys,{size:16}),"Guardando..."]}):d.jsxs(d.Fragment,{children:[d.jsx(Cm,{className:"w-4 h-4"}),"Aplicar Cambios"]})})]})]})}):null}const ww=["series","character","genre","tag","other"],CO={series:"Series",character:"Personajes",genre:"Géneros",tag:"Etiquetas",other:"Otros"};function NO({isOpen:t,onClose:e,categories:n,selectedCategories:r,onToggleCategory:i,onClearFilters:s}){const[o,a]=V.useState(""),u=V.useMemo(()=>{const c=n.filter(h=>h.name.toLowerCase().includes(o.toLowerCase())),f={};return ww.forEach(h=>{f[h]=[]}),f.other=[],c.forEach(h=>{const p=h.type||"other";f[p]||(f[p]=[]),f[p].push(h)}),f},[n,o]);return t?d.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/80 backdrop-blur-sm animate-in fade-in duration-200",children:d.jsxs("div",{className:"bg-[#1a1a1a] w-full max-w-4xl max-h-[85vh] rounded-2xl border border-gray-800 shadow-2xl flex flex-col overflow-hidden animate-in zoom-in-95 duration-200",onClick:c=>c.stopPropagation(),children:[d.jsxs("div",{className:"p-4 sm:p-6 border-b border-gray-800 flex items-center justify-between bg-[#1a1a1a]",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx("div",{className:"bg-purple-500/20 p-2 rounded-lg",children:d.jsx(V1,{className:"w-5 h-5 text-purple-400"})}),d.jsxs("div",{children:[d.jsx("h2",{className:"text-xl font-bold text-white",children:"Filtrar por Categorías"}),d.jsx("p",{className:"text-sm text-gray-400",children:"Selecciona múltiples opciones para refinar tu búsqueda"})]})]}),d.jsx("button",{onClick:e,className:"text-gray-400 hover:text-white hover:bg-gray-800 p-2 rounded-lg transition-all",children:d.jsx(In,{className:"w-5 h-5"})})]}),d.jsx("div",{className:"p-4 border-b border-gray-800 bg-[#151515]",children:d.jsxs("div",{className:"relative",children:[d.jsx(gc,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400"}),d.jsx("input",{type:"text",placeholder:"Buscar categorías...",value:o,onChange:c=>a(c.target.value),className:"w-full bg-[#0f0f0f] border border-gray-700/50 rounded-lg pl-10 pr-4 py-2.5 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-purple-500/50 focus:ring-1 focus:ring-purple-500/50 transition-all"})]})}),d.jsx("div",{className:"flex-1 overflow-y-auto p-4 sm:p-6 space-y-8 custom-scrollbar",children:ww.map(c=>{const f=u[c];return!f||f.length===0?null:d.jsxs("div",{className:"animate-in slide-in-from-bottom-2 duration-300",children:[d.jsxs("h3",{className:"text-sm font-bold text-purple-400 uppercase tracking-wider mb-3 flex items-center gap-2",children:[d.jsx("span",{className:"w-1 h-4 bg-purple-500 rounded-full"}),CO[c]||c]}),d.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-2",children:f.sort((h,p)=>h.name.localeCompare(p.name)).map(h=>{const p=r.includes(h.name);return d.jsxs("button",{onClick:()=>i(h.name),className:` + relative group flex items-center justify-between px-3 py-2 rounded-lg text-sm text-left transition-all duration-200 border + ${p?"bg-purple-500/20 border-purple-500/50 text-purple-100 shadow-[0_0_15px_-3px_rgba(168,85,247,0.3)]":"bg-[#252525] border-transparent text-gray-300 hover:bg-[#2a2a2a] hover:border-gray-700"} + `,children:[d.jsx("span",{className:"truncate mr-2 font-medium",children:h.name}),p&&d.jsx("div",{className:"bg-purple-500 rounded-full p-0.5 animate-in zoom-in duration-200",children:d.jsx(wl,{className:"w-3 h-3 text-white"})})]},h.id)})})]},c)})}),d.jsxs("div",{className:"p-4 border-t border-gray-800 bg-[#1a1a1a] flex items-center justify-between",children:[d.jsxs("div",{className:"text-sm text-gray-400",children:[r.length," seleccionada",r.length!==1?"s":""]}),d.jsxs("div",{className:"flex items-center gap-3",children:[r.length>0&&d.jsx("button",{onClick:s,className:"px-4 py-2 text-sm text-gray-400 hover:text-white transition-colors",children:"Limpiar todo"}),d.jsx("button",{onClick:e,className:"px-6 py-2 bg-purple-600 hover:bg-purple-700 text-white rounded-lg text-sm font-semibold shadow-lg shadow-purple-900/20 transition-all hover:scale-105 active:scale-95",children:"Listo"})]})]})]})}):null}const _w={random:"Aleatorio",name:"Nombre",date:"Fecha de creación",modified:"Última modificación",pages:"Páginas",views:"Vistas"};function AO({value:t,onChange:e,placeholder:n="Buscar manga...",sortType:r="random",onSortTypeChange:i,sortDirection:s="asc",onSortDirectionChange:o,onOpenFilter:a}){const[u,c]=V.useState(!1),f=()=>{e("")},h=()=>{const b=["modified","name","date","pages","views","random"],P=(b.indexOf(r)+1)%b.length,y=b[P];i==null||i(y),window.innerWidth<640&&Nt.success(`Ordenado por: ${_w[y]}`,{position:"top-center",duration:1500,className:"bg-purple-900/90 text-white border-purple-500/50"})},p=()=>{const b=s==="asc"?"desc":"asc";if(o==null||o(b),window.innerWidth<640){let S=b==="asc"?"Ascendente (A-Z)":"Descendente (Z-A)";r==="views"?S=b==="asc"?"Menos vistos primero":"Más vistos primero":r==="date"||r==="modified"?S=b==="asc"?"Más antiguos primero":"Más recientes primero":r==="pages"&&(S=b==="asc"?"Menos páginas":"Más páginas"),Nt.success(`Orden: ${S}`,{position:"top-center",duration:1500,className:"bg-purple-900/90 text-white border-purple-500/50"})}},m=()=>r==="views"?s==="asc"?"Menos vistos":"Más vistos":s==="asc"?"ASC":"DESC";return d.jsxs("div",{className:"w-full flex gap-2 items-center",children:[d.jsxs("div",{className:"relative flex-1",children:[d.jsx(gc,{className:`absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 pointer-events-none ${u?"text-purple-400":"text-gray-400"}`}),d.jsx("input",{type:"text",placeholder:n,value:t,onChange:b=>e(b.target.value),onFocus:()=>c(!0),onBlur:()=>c(!1),className:"w-full bg-[#1a1a1a] text-white rounded-lg pl-10 pr-10 py-2.5 text-sm placeholder-gray-400 border border-gray-700/50 focus:border-purple-500 focus:outline-none"}),t&&d.jsx("button",{onClick:f,className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-400 hover:text-purple-400 transition-all p-1 hover:scale-125 hover:rotate-90 duration-300",title:"Limpiar búsqueda",children:d.jsx(In,{className:"w-4 h-4"})})]}),d.jsx("button",{onClick:a,className:"bg-gray-800 hover:bg-gray-700 border border-gray-700 hover:border-purple-500/50 text-white p-2.5 rounded-lg transition-all duration-300 hover:shadow-lg hover:shadow-purple-500/10 group",title:"Filtrar por categorías",children:d.jsx(V1,{className:"w-4 h-4 text-gray-400 group-hover:text-purple-400 transition-colors"})}),d.jsxs("button",{onClick:h,className:"bg-gradient-to-r from-gray-700/40 to-gray-600/40 hover:from-gray-700/60 hover:to-gray-600/60 border border-gray-600/50 hover:border-purple-500/50 text-white px-2.5 py-2.5 rounded-lg flex items-center justify-center gap-1.5 font-medium text-xs transition-all duration-300 active:scale-95 whitespace-nowrap hover:scale-110 hover:shadow-lg hover:shadow-purple-500/20 hover:border-purple-500",title:"Cambiar tipo de ordenamiento",children:[d.jsx(o2,{className:"w-3.5 h-3.5 transition-transform duration-300 hover:rotate-180"}),d.jsx("span",{className:"hidden sm:inline",children:_w[r]})]}),d.jsxs("button",{onClick:p,className:"bg-gradient-to-r from-gray-700/40 to-gray-600/40 hover:from-gray-700/60 hover:to-gray-600/60 border border-gray-600/50 hover:border-purple-500/50 text-white px-2.5 py-2.5 rounded-lg flex items-center justify-center gap-1.5 font-medium text-xs transition-all duration-300 active:scale-95 whitespace-nowrap hover:scale-110 hover:shadow-lg hover:shadow-purple-500/20 hover:border-purple-500",title:s==="asc"?"Cambiar a descendente":"Cambiar a ascendente",children:[d.jsx(i2,{className:`w-3.5 h-3.5 transition-all duration-500 ${s==="desc"?"rotate-180":""} hover:scale-125`}),d.jsx("span",{className:"hidden sm:inline text-[10px]",children:m()})]})]})}function PO(){return d.jsxs("div",{className:"flex flex-col w-full max-w-xs",children:[d.jsx("div",{className:"relative bg-black rounded-lg shadow-lg overflow-hidden aspect-[2/3] mb-2",children:d.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:d.jsx("div",{className:"rounded-full animate-spin",style:{width:"30px",height:"30px",borderWidth:"2px",borderStyle:"solid",borderColor:"rgba(187, 134, 252, 0.2)",borderTopColor:"#bb86fc",animation:"spin 0.6s linear infinite"}})})}),d.jsxs("div",{className:"flex flex-col gap-2 items-center animate-pulse",children:[d.jsx("div",{className:"h-4 bg-gray-800 rounded w-3/4"}),d.jsx("div",{className:"h-3 bg-gray-800 rounded w-1/2"})]})]})}const Qh=24;function RO({items:t,searchTerm:e,isSearching:n,onSelectComic:r,onEditManga:i,onDeleteManga:s,isLoading:o=!1,isCategoryPlusEnabled:a=!1,selectedMangaIds:u=[],onToggleSelectManga:c}){const[f,h]=V.useState(()=>{const y=new URLSearchParams(window.location.search).get("page");return y?Math.max(1,Number(y)):1});V.useEffect(()=>{const P=()=>{const w=new URLSearchParams(window.location.search).get("page");h(w?Math.max(1,Number(w)):1)};return window.addEventListener("popstate",P),()=>window.removeEventListener("popstate",P)},[]);const p=Math.ceil(t.length/Qh);V.useEffect(()=>{if(p>0&&f>p){h(p);const P=new URL(window.location.href);P.searchParams.set("page",String(p)),window.history.replaceState({},"",P)}},[p,f]),V.useEffect(()=>{if(e){h(1);const P=new URL(window.location.href);P.searchParams.delete("page"),window.history.replaceState({},"",P)}},[e]);const m=t.slice((f-1)*Qh,f*Qh),b=P=>{h(P);const y=new URL(window.location.href);y.searchParams.set("page",String(P)),window.history.pushState({},"",y),window.scrollTo({top:0,behavior:"smooth"})},S=()=>{if(p<=1)return null;const P=[],y=5;let w=Math.max(1,f-Math.floor(y/2)),T=Math.min(p,w+y-1);T-w+1b(1),disabled:f===1,className:"p-2 rounded-lg bg-[#1a1a1a] text-white hover:bg-[#bb86fc] disabled:opacity-50 disabled:hover:bg-[#1a1a1a] transition-colors",title:"Primera página",children:d.jsx(O1,{className:"w-4 h-4"})}),d.jsx("button",{onClick:()=>b(f-1),disabled:f===1,className:"p-2 rounded-lg bg-[#1a1a1a] text-white hover:bg-[#bb86fc] disabled:opacity-50 disabled:hover:bg-[#1a1a1a] transition-colors",title:"Anterior",children:d.jsx(id,{className:"w-4 h-4"})}),w>1&&d.jsx("span",{className:"text-gray-500 px-1",children:"..."}),P.map(L=>d.jsx("button",{onClick:()=>b(L),className:`w-8 h-8 rounded-lg text-sm font-medium transition-colors ${f===L?"bg-[#bb86fc] text-white":"bg-[#1a1a1a] text-gray-400 hover:bg-[#333] hover:text-white"}`,children:L},L)),Tb(f+1),disabled:f===p,className:"p-2 rounded-lg bg-[#1a1a1a] text-white hover:bg-[#bb86fc] disabled:opacity-50 disabled:hover:bg-[#1a1a1a] transition-colors",title:"Siguiente",children:d.jsx(sd,{className:"w-4 h-4"})}),d.jsx("button",{onClick:()=>b(p),disabled:f===p,className:"p-2 rounded-lg bg-[#1a1a1a] text-white hover:bg-[#bb86fc] disabled:opacity-50 disabled:hover:bg-[#1a1a1a] transition-colors",title:"Última página",children:d.jsx(M1,{className:"w-4 h-4"})})]})};return n&&e?d.jsx("div",{className:"flex flex-col items-center justify-center py-16 animate-in fade-in duration-300",children:d.jsxs("div",{className:"text-gray-400 text-sm animate-pulse",children:['Buscando "',e,'"...']})}):o?d.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 2xl:grid-cols-6 gap-1.5 sm:gap-2 md:gap-3 justify-center items-start animate-in fade-in duration-300",children:Array.from({length:12}).map((P,y)=>d.jsx(PO,{},y))}):e&&t.length===0?d.jsxs("div",{className:"flex flex-col items-center justify-center py-16 animate-in fade-in duration-300",children:[d.jsx(nl,{className:"w-16 h-16 text-gray-600 mb-4 animate-bounce"}),d.jsx("p",{className:"text-gray-400 text-lg mb-2",children:"No se encontraron resultados"}),d.jsx("p",{className:"text-gray-500 text-sm",children:"Intenta con otros términos de búsqueda"})]}):!e&&t.length===0?d.jsxs("div",{className:"flex flex-col items-center justify-center py-20 animate-in fade-in duration-300",children:[d.jsx(nl,{className:"w-16 h-16 text-gray-600 mb-4 animate-bounce"}),d.jsx("p",{className:"text-gray-400 text-lg mb-2",children:"No hay mangas disponibles"}),d.jsx("p",{className:"text-gray-500 text-sm",children:'Crea tu primer manga usando el botón "Nuevo"'})]}):d.jsxs("div",{className:"flex flex-col gap-6",children:[d.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 2xl:grid-cols-6 gap-1.5 sm:gap-2 md:gap-3 justify-center items-start",children:m.map(P=>d.jsx("div",{children:d.jsx(kI,{id:P.id,title:P.title,author:P.author,pageCount:P.pageCount,thumbnail:P.thumbnail,manga:P.manga,onSelect:()=>r(P.id),onEdit:i,onDelete:s?()=>s(P.id):void 0,isCategoryPlusEnabled:a,isSelected:u.includes(P.id),onToggleSelect:c?()=>c(P.id):void 0})},P.id))}),S()]})}function ro(t){return t.toLowerCase().trim().normalize("NFD").replace(/[\u0300-\u036f]/g,"")}function Yh(t,e){const n=ro(t),r=ro(e);if(n===r)return 1;if(n.length<2||r.length<2)return n.includes(r)?.8:0;const i=n.length>r.length?n:r,s=n.length>r.length?r:n,o=DO(s,i);return(i.length-o)/i.length}function DO(t,e){const n=[];for(let r=0;r<=t.length;r++){let i=r;for(let s=0;s<=e.length;s++)if(r===0)n[s]=s;else if(s>0){let o=n[s-1];t.charAt(r-1)!==e.charAt(s-1)&&(o=Math.min(Math.min(o,i),n[s])+1),n[s-1]=i,i=o}r>0&&(n[e.length]=i)}return n[e.length]}function jO(t,e,n={}){const{minChars:r=1,fuzzyMatch:i=!0}=n;if(!e.trim()||e.length{let u=0;const c=Yh(a.title,e),f=Yh(a.author,e),h=ro(a.title).includes(s)?.3:0,p=ro(a.author).includes(s)?.2:0;let m=0,b=0;if(a.categories&&a.categories.length>0){const S=a.categories.map(y=>Yh(y,e));m=Math.max(...S),b=a.categories.some(y=>ro(y).includes(s))?.3:0}return u=Math.max(c*.6+h,f*.4+p,m*.5+b),{item:a,score:u}}).filter(a=>i?a.score>.3:a.score>.7).sort((a,u)=>u.score-a.score).map(a=>a.item);return{items:o,query:e,resultCount:o.length}}function LO(){const[t,e]=V.useState(!1),[n,r]=V.useState(!1),[i,s]=V.useState(!1),[o,a]=V.useState(!1),[u,c]=V.useState(null),[f,h]=V.useState(!1),[p,m]=V.useState([]),[b,S]=V.useState(!1),[P,y]=V.useState(null),[w,T]=V.useState([]),[L,F]=V.useState(null),[D,_]=V.useState([]),[x,E]=V.useState(!1),[k,C]=V.useState(!1),[j,A]=V.useState(!0),[de,oe]=V.useState(""),[le,ve]=V.useState([]),[K,ie]=V.useState([]),[N,fe]=V.useState(()=>localStorage.getItem("sortType")||"modified"),[ye,R]=V.useState(()=>localStorage.getItem("sortDirection")||"desc");V.useEffect(()=>{const ue=new URLSearchParams(window.location.search).get("admin")==="true";a(ue)},[]),V.useEffect(()=>{localStorage.setItem("sortType",N)},[N]),V.useEffect(()=>{localStorage.setItem("sortDirection",ye)},[ye]),V.useEffect(()=>{var Ce;(Ce=window.Telegram)!=null&&Ce.WebApp&&window.Telegram.WebApp.ready(),H();const W=window.location.hash.slice(1);if(W&&W.startsWith("manga/"))if(W.endsWith("/hd")){const we=W.replace("manga/","").replace("/hd","");y(we),E(!0)}else{const we=W.replace("manga/","");y(we),E(!1)}else W==="info"&&C(!0);const ue=()=>{const we=window.location.hash.slice(1);if(!we)y(null),F(null),C(!1),E(!1);else if(we.startsWith("manga/")){if(we.endsWith("/hd")){const He=we.replace("manga/","").replace("/hd","");y(He),E(!0)}else{const He=we.replace("manga/","");y(He),E(!1)}F(null),C(!1)}else we==="info"&&(C(!0),y(null),F(null))};return window.addEventListener("hashchange",ue),()=>window.removeEventListener("hashchange",ue)},[]),V.useEffect(()=>{f||m([])},[f]);async function H(){try{A(!0);const W=await jd();_(W)}catch(W){console.error("Error loading mangas:",W)}finally{A(!1)}}const J=V.useMemo(()=>{const W=new Map;return D.forEach(ue=>{var Ce;(Ce=ue.categories)==null||Ce.forEach(we=>{W.has(we.id)||W.set(we.id,we)})}),Array.from(W.values())},[D]),te=V.useMemo(()=>de.trim()?jO(D.map(W=>({id:W.id,title:W.title,author:W.author,categories:W.categories?W.categories.map(ue=>ue.name):[]})),de,{fuzzyMatch:!0,minChars:1}):{items:D,query:"",resultCount:D.length},[D,de]),Ie=V.useMemo(()=>{let W=te.items.length>0?te.items.map(Ce=>D.find(we=>we.id===Ce.id)).filter(Boolean):[];le.length>0&&(W=W.filter(Ce=>le.some(we=>{var He;return(He=Ce.categories)==null?void 0:He.some(Et=>Et.name===we)}))),K.length>0&&(W=W.filter(Ce=>K.includes(Ce.author)));const ue=[...W];return N==="random"?ue.sort(()=>Math.random()-.5):(ue.sort((Ce,we)=>{var Et,Ft;let He=0;if(N==="name")He=Ce.title.localeCompare(we.title);else if(N==="date"){const z=new Date(Ce.created_at||0).getTime(),O=new Date(we.created_at||0).getTime();He=z-O}else if(N==="modified"){const z=new Date(Ce.updated_at||Ce.created_at||0).getTime(),O=new Date(we.updated_at||we.created_at||0).getTime();He=z-O}else if(N==="pages"){const z=((Et=Ce.chapters)==null?void 0:Et.reduce((B,Q)=>{var Y;return B+(((Y=Q.pages)==null?void 0:Y.length)||0)},0))||0,O=((Ft=we.chapters)==null?void 0:Ft.reduce((B,Q)=>{var Y;return B+(((Y=Q.pages)==null?void 0:Y.length)||0)},0))||0;He=z-O}else N==="views"&&(He=(Ce.views||0)-(we.views||0));return ye==="asc"?He:-He}),ue)},[D,de,te.items,N,ye,le,K]),pe=W=>{c(W),e(!0)},Fe=async W=>{try{await KD(W),await H()}catch(ue){console.error("Error deleting manga:",ue),alert("Error al eliminar el manga. Por favor intenta de nuevo.")}},ut=W=>{m(ue=>ue.includes(W)?ue.filter(Ce=>Ce!==W):[...ue,W])},Je=W=>{if(f){ut(W);return}window.location.hash=`manga/${W}`,y(W),E(!1)},bt=()=>{window.location.hash="",y(null),C(!1)},mt=W=>{P&&T([...w,P]),window.location.hash=`manga / ${W} `,y(W)},gt=W=>{ve(ue=>ue.includes(W)?ue.filter(Ce=>Ce!==W):[...ue,W]),bt()},Ht=W=>{ve(ue=>ue.filter(Ce=>Ce!==W))},Vt=W=>{ie(ue=>ue.includes(W)?ue.filter(Ce=>Ce!==W):[...ue,W]),bt()},Ze=W=>{ie(ue=>ue.filter(Ce=>Ce!==W))},Nn=V.useMemo(()=>Ie.map(W=>{var we,He;const ue=((we=W.chapters)==null?void 0:we.length)||0,Ce=((He=W.chapters)==null?void 0:He.reduce((Et,Ft)=>{var z;return Et+(((z=Ft.pages)==null?void 0:z.length)||0)},0))||0;return{id:W.id,title:W.title,author:W.author,chapterCount:ue,pageCount:Ce,thumbnail:W.cover_url||W.thumbnail_url||void 0,manga:W}}),[Ie]);if(L)return d.jsx(jj,{manga:L.manga,chapter:L.chapter,onBack:()=>F(null)});if(k)return d.jsx(SO,{onBack:bt,isAdmin:o});if(P!==null){let W=D.find(ue=>ue.id===P);return x&&W?d.jsx(f2,{manga:W,onBack:()=>{window.history.back()}}):d.jsx(Dj,{id:P,onBack:()=>{if(w.length>0){const ue=w[w.length-1];T(w.slice(0,-1)),window.location.hash=`manga / ${ue} `,y(ue)}else bt()},onReadChapter:ue=>{W&&F({manga:W,chapter:ue})},onMangaLoaded:ue=>{W||(W=ue)},onNavigateToManga:mt,onSelectCategory:gt,onSelectAuthor:Vt,isAdmin:o})}return d.jsxs("div",{className:"min-h-screen bg-[#121212] text-white flex flex-col",children:[d.jsx("header",{className:"border-b border-gray-800/50 px-3 sm:px-6 md:px-12 py-4 sm:py-6 flex-shrink-0 transition-all duration-300",children:d.jsxs("div",{className:"max-w-[1800px] mx-auto flex items-center justify-between gap-2 sm:gap-0",children:[d.jsxs("div",{className:"flex items-center gap-1 sm:gap-1.5 group cursor-pointer",children:[d.jsx("img",{src:"/icons/icones.png",alt:"Twisted Brody Logo",className:"w-10 h-10 sm:w-14 sm:h-14 object-contain transition-all duration-300 group-hover:rotate-12 group-hover:scale-110"}),d.jsx("h1",{className:"text-lg sm:text-2xl font-bold text-white transition-colors duration-300 group-hover:text-[#bb86fc]",children:"Twisted Brody MangaFlow"})]}),d.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-3",children:[f&&d.jsxs("div",{className:"hidden sm:flex items-center gap-2 mr-2 px-3 py-1.5 bg-purple-500/10 rounded-lg border border-purple-500/20",children:[d.jsx(U1,{className:"w-4 h-4 text-purple-400"}),d.jsx("span",{className:"text-xs font-semibold text-purple-300",children:"Modo Plus Activo"}),d.jsx("span",{className:"text-xs bg-purple-500/20 px-2 py-0.5 rounded text-purple-200",children:p.length})]}),o&&d.jsxs(d.Fragment,{children:[d.jsxs("button",{onClick:()=>r(!0),className:"bg-gray-800 hover:bg-gray-700 active:scale-95 text-white px-2 py-2 sm:px-4 sm:py-2.5 rounded-lg flex items-center gap-1.5 sm:gap-2 font-semibold transition-all duration-300 border border-gray-700/50 hover:border-gray-600 text-xs sm:text-sm hover:scale-110 hover:shadow-lg hover:shadow-700/50",title:"Ajustes y Admin",children:[d.jsx($1,{className:"w-4 h-4 sm:w-5 sm:h-5 transition-transform duration-300 hover:rotate-180"}),d.jsx("span",{className:"hidden sm:inline",children:"Ajustes"})]}),d.jsxs("button",{onClick:()=>e(!0),className:"bg-purple-600 hover:bg-purple-700 active:scale-95 text-white px-2 py-2 sm:px-4 sm:py-2.5 rounded-lg flex items-center gap-1.5 sm:gap-2 font-semibold transition-all duration-300 shadow-lg shadow-purple-600/30 hover:shadow-purple-600/50 text-xs sm:text-sm hover:scale-110",children:[d.jsx(co,{className:"w-4 h-4 sm:w-5 sm:h-5 transition-transform duration-300 hover:rotate-180"}),d.jsx("span",{className:"hidden sm:inline",children:"Nuevo Manga"})]})]})]})]})}),d.jsxs("main",{className:"flex-1 px-4 sm:px-6 md:px-12 py-8",children:[d.jsx(Aj,{isAdmin:o}),d.jsxs("div",{className:"max-w-[1800px] mx-auto mb-8 flex-shrink-0",children:[d.jsx(AO,{value:de,onChange:oe,placeholder:"Buscar por título, autor...",sortType:N,onSortTypeChange:fe,sortDirection:ye,onSortDirectionChange:R,onOpenFilter:()=>s(!0)}),de&&d.jsxs("div",{className:"mt-2 text-sm text-gray-400",children:[te.resultCount," resultado",te.resultCount!==1?"s":""," encontrado",te.resultCount!==1?"s":""]}),(le.length>0||K.length>0)&&d.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-2 animate-in fade-in slide-in-from-top-2 duration-300",children:[d.jsx("span",{className:"text-sm text-gray-400",children:"Filtrado por:"}),le.map(W=>d.jsxs("button",{onClick:()=>Ht(W),className:"bg-purple-500/20 hover:bg-purple-500/30 text-purple-300 px-3 py-1 rounded-full text-sm font-medium flex items-center gap-2 border border-purple-500/30 hover:border-purple-500/50 transition-all group",children:[W,d.jsx("div",{className:"bg-purple-500/20 rounded-full p-0.5 group-hover:bg-purple-500/40 transition-colors",children:d.jsx(co,{className:"w-3 h-3 transform rotate-45"})})]},W)),K.map(W=>d.jsxs("button",{onClick:()=>Ze(W),className:"bg-[#bb86fc]/20 hover:bg-[#bb86fc]/30 text-[#bb86fc] px-3 py-1 rounded-full text-sm font-medium flex items-center gap-2 border border-[#bb86fc]/30 hover:border-[#bb86fc]/50 transition-all group",children:[d.jsx(Nm,{size:14}),W,d.jsx("div",{className:"bg-[#bb86fc]/20 rounded-full p-0.5 group-hover:bg-[#bb86fc]/40 transition-colors",children:d.jsx(co,{className:"w-3 h-3 transform rotate-45"})})]},W)),(le.length>0||K.length>0)&&d.jsx("button",{onClick:()=>{ve([]),ie([])},className:"text-xs text-gray-400 hover:text-white underline decoration-gray-600 hover:decoration-white transition-colors ml-2",children:"Limpiar todo"})]})]}),d.jsx("div",{className:"max-w-[1800px] mx-auto",children:d.jsxs(d.Fragment,{children:[d.jsx("link",{rel:"preconnect",href:"https://i.ibb.co"}),d.jsx(RO,{items:Nn,searchTerm:de,isSearching:!1,isLoading:j,onSelectComic:Je,onEditManga:o?pe:void 0,onDeleteManga:o?Fe:void 0,isCategoryPlusEnabled:f,selectedMangaIds:p,onToggleSelectManga:ut})]})})]}),f&&p.length>0&&d.jsx("div",{className:"fixed bottom-6 left-1/2 transform -translate-x-1/2 z-40 animate-in slide-in-from-bottom-4 duration-200",children:d.jsxs("div",{className:"bg-[#1a1a1a] border border-gray-700/50 shadow-2xl rounded-xl px-6 py-3 flex items-center gap-4",children:[d.jsxs("div",{className:"flex flex-col",children:[d.jsxs("span",{className:"text-sm font-bold text-white",children:[p.length," seleccionados"]}),d.jsx("span",{className:"text-xs text-gray-400",children:"Listos para editar"})]}),d.jsx("div",{className:"h-8 w-px bg-gray-700"}),d.jsx("button",{onClick:()=>m([]),className:"text-gray-400 hover:text-white text-sm font-semibold transition-colors",children:"Cancelar"}),d.jsx("button",{onClick:()=>S(!0),className:"bg-[#bb86fc] hover:bg-[#9966dd] text-white px-4 py-2 rounded-lg text-sm font-bold shadow-lg shadow-purple-500/20 transition-all transform hover:scale-105 active:scale-95",children:"Aplicar Categorías"})]})}),d.jsx(od,{}),d.jsx(kj,{isOpen:t,onClose:()=>{e(!1),c(null)},editingManga:u,onMangaCreated:W=>{H(),c(null),W&&!u&&setTimeout(()=>{Je(W)},500)},onDelete:o?Fe:void 0}),d.jsx(kO,{isOpen:b,onClose:()=>S(!1),selectedMangaIds:p,onSaveComplete:()=>{H(),m([])}}),d.jsx(Nj,{isOpen:n,onClose:()=>r(!1),isAdmin:o,onAdminChange:a,isCategoryPlusEnabled:f,onCategoryPlusChange:h}),d.jsx(NO,{isOpen:i,onClose:()=>s(!1),categories:J,selectedCategories:le,onToggleCategory:gt,onClearFilters:()=>ve([])}),d.jsx(Tj,{position:"top-center",richColors:!0,theme:"dark"})]})}L1(document.getElementById("root")).render(d.jsx(V.StrictMode,{children:d.jsx(LO,{})})); diff --git a/dist/assets/index-BJjvndWC.css b/dist/assets/index-BJjvndWC.css new file mode 100644 index 0000000000000000000000000000000000000000..7f92ab8ec193d37068a9af3dfd9025918a7e5302 --- /dev/null +++ b/dist/assets/index-BJjvndWC.css @@ -0,0 +1 @@ +:root{--swiper-theme-color: #007aff}:host{position:relative;display:block;margin-left:auto;margin-right:auto;z-index:1}.swiper{margin-left:auto;margin-right:auto;position:relative;overflow:hidden;list-style:none;padding:0;z-index:1;display:block}.swiper-vertical>.swiper-wrapper{flex-direction:column}.swiper-wrapper{position:relative;width:100%;height:100%;z-index:1;display:flex;transition-property:transform;transition-timing-function:var(--swiper-wrapper-transition-timing-function, initial);box-sizing:content-box}.swiper-android .swiper-slide,.swiper-ios .swiper-slide,.swiper-wrapper{transform:translateZ(0)}.swiper-horizontal{touch-action:pan-y}.swiper-vertical{touch-action:pan-x}.swiper-slide{flex-shrink:0;width:100%;height:100%;position:relative;transition-property:transform;display:block}.swiper-slide-invisible-blank{visibility:hidden}.swiper-autoheight,.swiper-autoheight .swiper-slide{height:auto}.swiper-autoheight .swiper-wrapper{align-items:flex-start;transition-property:transform,height}.swiper-backface-hidden .swiper-slide{transform:translateZ(0);backface-visibility:hidden}.swiper-3d.swiper-css-mode .swiper-wrapper{perspective:1200px}.swiper-3d .swiper-wrapper{transform-style:preserve-3d}.swiper-3d{perspective:1200px}.swiper-3d .swiper-slide,.swiper-3d .swiper-cube-shadow{transform-style:preserve-3d}.swiper-css-mode>.swiper-wrapper{overflow:auto;scrollbar-width:none;-ms-overflow-style:none}.swiper-css-mode>.swiper-wrapper::-webkit-scrollbar{display:none}.swiper-css-mode>.swiper-wrapper>.swiper-slide{scroll-snap-align:start start}.swiper-css-mode.swiper-horizontal>.swiper-wrapper{scroll-snap-type:x mandatory}.swiper-css-mode.swiper-horizontal>.swiper-wrapper>.swiper-slide:first-child{margin-inline-start:var(--swiper-slides-offset-before);scroll-margin-inline-start:var(--swiper-slides-offset-before)}.swiper-css-mode.swiper-horizontal>.swiper-wrapper>.swiper-slide:last-child{margin-inline-end:var(--swiper-slides-offset-after)}.swiper-css-mode.swiper-vertical>.swiper-wrapper{scroll-snap-type:y mandatory}.swiper-css-mode.swiper-vertical>.swiper-wrapper>.swiper-slide:first-child{margin-block-start:var(--swiper-slides-offset-before);scroll-margin-block-start:var(--swiper-slides-offset-before)}.swiper-css-mode.swiper-vertical>.swiper-wrapper>.swiper-slide:last-child{margin-block-end:var(--swiper-slides-offset-after)}.swiper-css-mode.swiper-free-mode>.swiper-wrapper{scroll-snap-type:none}.swiper-css-mode.swiper-free-mode>.swiper-wrapper>.swiper-slide{scroll-snap-align:none}.swiper-css-mode.swiper-centered>.swiper-wrapper:before{content:"";flex-shrink:0;order:9999}.swiper-css-mode.swiper-centered>.swiper-wrapper>.swiper-slide{scroll-snap-align:center center;scroll-snap-stop:always}.swiper-css-mode.swiper-centered.swiper-horizontal>.swiper-wrapper>.swiper-slide:first-child{margin-inline-start:var(--swiper-centered-offset-before)}.swiper-css-mode.swiper-centered.swiper-horizontal>.swiper-wrapper:before{height:100%;min-height:1px;width:var(--swiper-centered-offset-after)}.swiper-css-mode.swiper-centered.swiper-vertical>.swiper-wrapper>.swiper-slide:first-child{margin-block-start:var(--swiper-centered-offset-before)}.swiper-css-mode.swiper-centered.swiper-vertical>.swiper-wrapper:before{width:100%;min-width:1px;height:var(--swiper-centered-offset-after)}.swiper-3d .swiper-slide-shadow,.swiper-3d .swiper-slide-shadow-left,.swiper-3d .swiper-slide-shadow-right,.swiper-3d .swiper-slide-shadow-top,.swiper-3d .swiper-slide-shadow-bottom{position:absolute;left:0;top:0;width:100%;height:100%;pointer-events:none;z-index:10}.swiper-3d .swiper-slide-shadow{background:#00000026}.swiper-3d .swiper-slide-shadow-left{background-image:linear-gradient(to left,#00000080,#0000)}.swiper-3d .swiper-slide-shadow-right{background-image:linear-gradient(to right,#00000080,#0000)}.swiper-3d .swiper-slide-shadow-top{background-image:linear-gradient(to top,#00000080,#0000)}.swiper-3d .swiper-slide-shadow-bottom{background-image:linear-gradient(to bottom,#00000080,#0000)}.swiper-lazy-preloader{width:42px;height:42px;position:absolute;left:50%;top:50%;margin-left:-21px;margin-top:-21px;z-index:10;transform-origin:50%;box-sizing:border-box;border:4px solid var(--swiper-preloader-color, var(--swiper-theme-color));border-radius:50%;border-top-color:transparent}.swiper:not(.swiper-watch-progress) .swiper-lazy-preloader,.swiper-watch-progress .swiper-slide-visible .swiper-lazy-preloader{animation:swiper-preloader-spin 1s infinite linear}.swiper-lazy-preloader-white{--swiper-preloader-color: #fff}.swiper-lazy-preloader-black{--swiper-preloader-color: #000}@keyframes swiper-preloader-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.swiper-creative .swiper-slide{backface-visibility:hidden;overflow:hidden;transition-property:transform,opacity,height}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.visible{visibility:visible}.invisible{visibility:hidden}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.-left-6{left:-1.5rem}.bottom-0{bottom:0}.bottom-2{bottom:.5rem}.bottom-6{bottom:1.5rem}.left-0{left:0}.left-0\.5{left:.125rem}.left-1\.5{left:.375rem}.left-1\/2{left:50%}.left-2{left:.5rem}.left-3{left:.75rem}.left-4{left:1rem}.left-6{left:1.5rem}.right-0{right:0}.right-2{right:.5rem}.right-3{right:.75rem}.right-4{right:1rem}.right-6{right:1.5rem}.right-8{right:2rem}.top-0{top:0}.top-0\.5{top:.125rem}.top-1\.5{top:.375rem}.top-1\/2{top:50%}.top-2{top:.5rem}.top-4{top:1rem}.top-6{top:1.5rem}.top-8{top:2rem}.top-full{top:100%}.z-0{z-index:0}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.z-40{z-index:40}.z-50{z-index:50}.z-\[100\]{z-index:100}.z-\[45\]{z-index:45}.z-\[60\]{z-index:60}.z-\[70\]{z-index:70}.z-\[80\]{z-index:80}.col-span-2{grid-column:span 2 / span 2}.col-span-full{grid-column:1 / -1}.mx-1{margin-left:.25rem;margin-right:.25rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-auto{margin-left:auto;margin-right:auto}.my-1{margin-top:.25rem;margin-bottom:.25rem}.my-4{margin-top:1rem;margin-bottom:1rem}.my-6{margin-top:1.5rem;margin-bottom:1.5rem}.my-8{margin-top:2rem;margin-bottom:2rem}.mb-0\.5{margin-bottom:.125rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-5{margin-bottom:1.25rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-2{margin-left:.5rem}.ml-auto{margin-left:auto}.mr-2{margin-right:.5rem}.mr-auto{margin-right:auto}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-8{margin-top:2rem}.mt-auto{margin-top:auto}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.block{display:block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.grid{display:grid}.hidden{display:none}.aspect-\[2\/3\]{aspect-ratio:2/3}.aspect-\[3\/4\]{aspect-ratio:3/4}.aspect-square{aspect-ratio:1 / 1}.h-1{height:.25rem}.h-1\/3{height:33.333333%}.h-10{height:2.5rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-32{height:8rem}.h-4{height:1rem}.h-48{height:12rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-\[20px\]{height:20px}.h-\[40\%\]{height:40%}.h-\[500px\]{height:500px}.h-\[90vh\]{height:90vh}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.max-h-20{max-height:5rem}.max-h-60{max-height:15rem}.max-h-\[80vh\]{max-height:80vh}.max-h-\[85vh\]{max-height:85vh}.max-h-\[90vh\]{max-height:90vh}.max-h-screen{max-height:100vh}.min-h-0{min-height:0px}.min-h-\[100px\]{min-height:100px}.min-h-\[300px\]{min-height:300px}.min-h-\[60vh\]{min-height:60vh}.min-h-screen{min-height:100vh}.w-1{width:.25rem}.w-1\/2{width:50%}.w-1\/3{width:33.333333%}.w-10{width:2.5rem}.w-11{width:2.75rem}.w-12{width:3rem}.w-14{width:3.5rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-3\/4{width:75%}.w-4{width:1rem}.w-5{width:1.25rem}.w-56{width:14rem}.w-6{width:1.5rem}.w-64{width:16rem}.w-7{width:1.75rem}.w-72{width:18rem}.w-8{width:2rem}.w-9{width:2.25rem}.w-\[20px\]{width:20px}.w-\[300\%\]{width:300%}.w-\[40\%\]{width:40%}.w-\[55\%\]{width:55%}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.w-max{width:-moz-max-content;width:max-content}.w-px{width:1px}.min-w-0{min-width:0px}.min-w-\[200px\]{min-width:200px}.min-w-\[3ch\]{min-width:3ch}.max-w-2xl{max-width:42rem}.max-w-4xl{max-width:56rem}.max-w-5xl{max-width:64rem}.max-w-6xl{max-width:72rem}.max-w-7xl{max-width:80rem}.max-w-\[150px\]{max-width:150px}.max-w-\[1800px\]{max-width:1800px}.max-w-\[1920px\]{max-width:1920px}.max-w-\[200px\]{max-width:200px}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-none{max-width:none}.max-w-sm{max-width:24rem}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.flex-shrink-0,.shrink-0{flex-shrink:0}.origin-center{transform-origin:center}.origin-left{transform-origin:left}.origin-right{transform-origin:right}.-translate-x-1\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-x-full{--tw-translate-x: -100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-4{--tw-translate-x: 1rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-45{--tw-rotate: 45deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-90{--tw-rotate: 90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-100{--tw-scale-x: 1;--tw-scale-y: 1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-110{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-95{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-\[0\.80\]{--tw-scale-x: .8;--tw-scale-y: .8;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform-gpu{transform:translate3d(var(--tw-translate-x),var(--tw-translate-y),0) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.animate-\[fadeIn_0\.2s_ease-out\]{animation:fadeIn .2s ease-out}.animate-\[fadeIn_0\.7s_ease-out_forwards\]{animation:fadeIn .7s ease-out forwards}.animate-\[scaleIn_0\.2s_ease-out\]{animation:scaleIn .2s ease-out}@keyframes bounce{0%,to{transform:translateY(-25%);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;animation-timing-function:cubic-bezier(0,0,.2,1)}}.animate-bounce{animation:bounce 1s infinite}@keyframes ping{75%,to{transform:scale(2);opacity:0}}.animate-ping{animation:ping 1s cubic-bezier(0,0,.2,1) infinite}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.cursor-move{cursor:move}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-none{resize:none}.resize{resize:both}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0{gap:0px}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.gap-\[3px\]{gap:3px}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-3\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.875rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.875rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse: 0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse))}.divide-gray-800>:not([hidden])~:not([hidden]){--tw-divide-opacity: 1;border-color:rgb(31 41 55 / var(--tw-divide-opacity, 1))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-y-auto{overflow-y:auto}.overscroll-contain{overscroll-behavior:contain}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-normal{white-space:normal}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-\[3px\]{border-radius:3px}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-none{border-radius:0}.rounded-sm{border-radius:.125rem}.rounded-xl{border-radius:.75rem}.rounded-r-lg{border-top-right-radius:.5rem;border-bottom-right-radius:.5rem}.border{border-width:1px}.border-2{border-width:2px}.border-y{border-top-width:1px;border-bottom-width:1px}.border-b{border-bottom-width:1px}.border-l{border-left-width:1px}.border-l-4{border-left-width:4px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-\[\#00AFF0\]{--tw-border-opacity: 1;border-color:rgb(0 175 240 / var(--tw-border-opacity, 1))}.border-\[\#00AFF0\]\/20{border-color:#00aff033}.border-\[\#1D9BF0\]{--tw-border-opacity: 1;border-color:rgb(29 155 240 / var(--tw-border-opacity, 1))}.border-\[\#1D9BF0\]\/20{border-color:#1d9bf033}.border-\[\#333\]{--tw-border-opacity: 1;border-color:rgb(51 51 51 / var(--tw-border-opacity, 1))}.border-\[\#bb86fc\]{--tw-border-opacity: 1;border-color:rgb(187 134 252 / var(--tw-border-opacity, 1))}.border-\[\#bb86fc\]\/20{border-color:#bb86fc33}.border-\[\#bb86fc\]\/30{border-color:#bb86fc4d}.border-\[\#bb86fc\]\/40{border-color:#bb86fc66}.border-\[\#bb86fc\]\/50{border-color:#bb86fc80}.border-\[\#f96854\]{--tw-border-opacity: 1;border-color:rgb(249 104 84 / var(--tw-border-opacity, 1))}.border-\[\#f96854\]\/20{border-color:#f9685433}.border-amber-500{--tw-border-opacity: 1;border-color:rgb(245 158 11 / var(--tw-border-opacity, 1))}.border-blue-500{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.border-blue-500\/20{border-color:#3b82f633}.border-blue-500\/30{border-color:#3b82f64d}.border-emerald-500\/10{border-color:#10b9811a}.border-emerald-500\/20{border-color:#10b98133}.border-emerald-500\/30{border-color:#10b9814d}.border-gray-300{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.border-gray-500\/30{border-color:#6b72804d}.border-gray-500\/50{border-color:#6b728080}.border-gray-600{--tw-border-opacity: 1;border-color:rgb(75 85 99 / var(--tw-border-opacity, 1))}.border-gray-600\/40{border-color:#4b556366}.border-gray-600\/50{border-color:#4b556380}.border-gray-700{--tw-border-opacity: 1;border-color:rgb(55 65 81 / var(--tw-border-opacity, 1))}.border-gray-700\/30{border-color:#3741514d}.border-gray-700\/40{border-color:#37415166}.border-gray-700\/50{border-color:#37415180}.border-gray-700\/60{border-color:#37415199}.border-gray-800{--tw-border-opacity: 1;border-color:rgb(31 41 55 / var(--tw-border-opacity, 1))}.border-gray-800\/50{border-color:#1f293780}.border-green-500{--tw-border-opacity: 1;border-color:rgb(34 197 94 / var(--tw-border-opacity, 1))}.border-green-500\/30{border-color:#22c55e4d}.border-indigo-500\/20{border-color:#6366f133}.border-pink-500{--tw-border-opacity: 1;border-color:rgb(236 72 153 / var(--tw-border-opacity, 1))}.border-pink-500\/30{border-color:#ec48994d}.border-purple-500\/20{border-color:#a855f733}.border-purple-500\/30{border-color:#a855f74d}.border-purple-500\/50{border-color:#a855f780}.border-red-500\/20{border-color:#ef444433}.border-red-500\/30{border-color:#ef44444d}.border-red-500\/50{border-color:#ef444480}.border-transparent{border-color:transparent}.border-white\/10{border-color:#ffffff1a}.border-white\/30{border-color:#ffffff4d}.border-white\/5{border-color:#ffffff0d}.border-white\/50{border-color:#ffffff80}.border-yellow-500\/20{border-color:#eab30833}.border-t-emerald-500{--tw-border-opacity: 1;border-top-color:rgb(16 185 129 / var(--tw-border-opacity, 1))}.border-t-transparent{border-top-color:transparent}.border-t-white{--tw-border-opacity: 1;border-top-color:rgb(255 255 255 / var(--tw-border-opacity, 1))}.bg-\[\#00AFF0\]\/10{background-color:#00aff01a}.bg-\[\#00AFF0\]\/20{background-color:#00aff033}.bg-\[\#050505\]{--tw-bg-opacity: 1;background-color:rgb(5 5 5 / var(--tw-bg-opacity, 1))}.bg-\[\#0a0a0a\]{--tw-bg-opacity: 1;background-color:rgb(10 10 10 / var(--tw-bg-opacity, 1))}.bg-\[\#0f0f0f\]{--tw-bg-opacity: 1;background-color:rgb(15 15 15 / var(--tw-bg-opacity, 1))}.bg-\[\#111\]{--tw-bg-opacity: 1;background-color:rgb(17 17 17 / var(--tw-bg-opacity, 1))}.bg-\[\#121212\]{--tw-bg-opacity: 1;background-color:rgb(18 18 18 / var(--tw-bg-opacity, 1))}.bg-\[\#121212\]\/90{background-color:#121212e6}.bg-\[\#151515\]{--tw-bg-opacity: 1;background-color:rgb(21 21 21 / var(--tw-bg-opacity, 1))}.bg-\[\#1D9BF0\]\/10{background-color:#1d9bf01a}.bg-\[\#1D9BF0\]\/20{background-color:#1d9bf033}.bg-\[\#1a1a1a\]{--tw-bg-opacity: 1;background-color:rgb(26 26 26 / var(--tw-bg-opacity, 1))}.bg-\[\#1a1a1a\]\/50{background-color:#1a1a1a80}.bg-\[\#1f1f1f\]{--tw-bg-opacity: 1;background-color:rgb(31 31 31 / var(--tw-bg-opacity, 1))}.bg-\[\#252525\]{--tw-bg-opacity: 1;background-color:rgb(37 37 37 / var(--tw-bg-opacity, 1))}.bg-\[\#2a2a2a\]{--tw-bg-opacity: 1;background-color:rgb(42 42 42 / var(--tw-bg-opacity, 1))}.bg-\[\#bb86fc\]{--tw-bg-opacity: 1;background-color:rgb(187 134 252 / var(--tw-bg-opacity, 1))}.bg-\[\#bb86fc\]\/10{background-color:#bb86fc1a}.bg-\[\#bb86fc\]\/20{background-color:#bb86fc33}.bg-\[\#bb86fc\]\/5{background-color:#bb86fc0d}.bg-\[\#bb86fc\]\/90{background-color:#bb86fce6}.bg-\[\#f96854\]\/10{background-color:#f968541a}.bg-\[\#f96854\]\/20{background-color:#f9685433}.bg-amber-500{--tw-bg-opacity: 1;background-color:rgb(245 158 11 / var(--tw-bg-opacity, 1))}.bg-amber-500\/10{background-color:#f59e0b1a}.bg-amber-500\/20{background-color:#f59e0b33}.bg-amber-600{--tw-bg-opacity: 1;background-color:rgb(217 119 6 / var(--tw-bg-opacity, 1))}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-black\/20{background-color:#0003}.bg-black\/30{background-color:#0000004d}.bg-black\/40{background-color:#0006}.bg-black\/50{background-color:#00000080}.bg-black\/60{background-color:#0009}.bg-black\/70{background-color:#000000b3}.bg-black\/80{background-color:#000c}.bg-black\/95{background-color:#000000f2}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.bg-blue-500\/10{background-color:#3b82f61a}.bg-blue-500\/20{background-color:#3b82f633}.bg-blue-600{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.bg-blue-900\/10{background-color:#1e3a8a1a}.bg-cyan-500\/10{background-color:#06b6d41a}.bg-emerald-500\/10{background-color:#10b9811a}.bg-emerald-500\/5{background-color:#10b9810d}.bg-emerald-600{--tw-bg-opacity: 1;background-color:rgb(5 150 105 / var(--tw-bg-opacity, 1))}.bg-gray-500\/20{background-color:#6b728033}.bg-gray-600{--tw-bg-opacity: 1;background-color:rgb(75 85 99 / var(--tw-bg-opacity, 1))}.bg-gray-700{--tw-bg-opacity: 1;background-color:rgb(55 65 81 / var(--tw-bg-opacity, 1))}.bg-gray-700\/40{background-color:#37415166}.bg-gray-700\/50{background-color:#37415180}.bg-gray-800{--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.bg-gray-800\/40{background-color:#1f293766}.bg-gray-800\/50{background-color:#1f293780}.bg-gray-800\/70{background-color:#1f2937b3}.bg-gray-900{--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity, 1))}.bg-gray-900\/50{background-color:#11182780}.bg-green-500\/10{background-color:#22c55e1a}.bg-green-500\/20{background-color:#22c55e33}.bg-green-600\/90{background-color:#16a34ae6}.bg-indigo-500\/10{background-color:#6366f11a}.bg-indigo-600{--tw-bg-opacity: 1;background-color:rgb(79 70 229 / var(--tw-bg-opacity, 1))}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.bg-orange-500\/10{background-color:#f973161a}.bg-pink-500{--tw-bg-opacity: 1;background-color:rgb(236 72 153 / var(--tw-bg-opacity, 1))}.bg-pink-500\/10{background-color:#ec48991a}.bg-pink-500\/20{background-color:#ec489933}.bg-pink-600{--tw-bg-opacity: 1;background-color:rgb(219 39 119 / var(--tw-bg-opacity, 1))}.bg-purple-500{--tw-bg-opacity: 1;background-color:rgb(168 85 247 / var(--tw-bg-opacity, 1))}.bg-purple-500\/10{background-color:#a855f71a}.bg-purple-500\/20{background-color:#a855f733}.bg-purple-600{--tw-bg-opacity: 1;background-color:rgb(147 51 234 / var(--tw-bg-opacity, 1))}.bg-purple-900\/10{background-color:#581c871a}.bg-purple-900\/90{background-color:#581c87e6}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-500\/10{background-color:#ef44441a}.bg-red-500\/20{background-color:#ef444433}.bg-red-600{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.bg-red-600\/80{background-color:#dc2626cc}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-white\/10{background-color:#ffffff1a}.bg-white\/20{background-color:#fff3}.bg-yellow-500\/10{background-color:#eab3081a}.bg-\[url\(\'data\:image\/svg\+xml\;base64\,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI\+PGNpcmNsZSBjeD0iMSIgY3k9IjEiIHI9IjEiIGZpbGw9IiMzMzMiLz48L3N2Zz4\=\'\)\]{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGNpcmNsZSBjeD0iMSIgY3k9IjEiIHI9IjEiIGZpbGw9IiMzMzMiLz48L3N2Zz4=)}.bg-gradient-to-b{background-image:linear-gradient(to bottom,var(--tw-gradient-stops))}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.bg-gradient-to-t{background-image:linear-gradient(to top,var(--tw-gradient-stops))}.from-\[\#1a1a1a\]{--tw-gradient-from: #1a1a1a var(--tw-gradient-from-position);--tw-gradient-to: rgb(26 26 26 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-\[\#1f1f1f\]{--tw-gradient-from: #1f1f1f var(--tw-gradient-from-position);--tw-gradient-to: rgb(31 31 31 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-\[\#1f1f1f\]\/80{--tw-gradient-from: rgb(31 31 31 / .8) var(--tw-gradient-from-position);--tw-gradient-to: rgb(31 31 31 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-\[\#242424\]{--tw-gradient-from: #242424 var(--tw-gradient-from-position);--tw-gradient-to: rgb(36 36 36 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-\[\#2a2a2a\]{--tw-gradient-from: #2a2a2a var(--tw-gradient-from-position);--tw-gradient-to: rgb(42 42 42 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-\[\#2a2a2a\]\/80{--tw-gradient-from: rgb(42 42 42 / .8) var(--tw-gradient-from-position);--tw-gradient-to: rgb(42 42 42 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-\[\#9966dd\]{--tw-gradient-from: #9966dd var(--tw-gradient-from-position);--tw-gradient-to: rgb(153 102 221 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-\[\#bb86fc\]{--tw-gradient-from: #bb86fc var(--tw-gradient-from-position);--tw-gradient-to: rgb(187 134 252 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-\[\#bb86fc\]\/20{--tw-gradient-from: rgb(187 134 252 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(187 134 252 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-black\/60{--tw-gradient-from: rgb(0 0 0 / .6) var(--tw-gradient-from-position);--tw-gradient-to: rgb(0 0 0 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-blue-500{--tw-gradient-from: #3b82f6 var(--tw-gradient-from-position);--tw-gradient-to: rgb(59 130 246 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-gray-700\/40{--tw-gradient-from: rgb(55 65 81 / .4) var(--tw-gradient-from-position);--tw-gradient-to: rgb(55 65 81 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-gray-800{--tw-gradient-from: #1f2937 var(--tw-gradient-from-position);--tw-gradient-to: rgb(31 41 55 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-red-500{--tw-gradient-from: #ef4444 var(--tw-gradient-from-position);--tw-gradient-to: rgb(239 68 68 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-transparent{--tw-gradient-from: transparent var(--tw-gradient-from-position);--tw-gradient-to: rgb(0 0 0 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-white{--tw-gradient-from: #fff var(--tw-gradient-from-position);--tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.via-\[\#9966dd\]{--tw-gradient-to: rgb(153 102 221 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), #9966dd var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-white\/20{--tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), rgb(255 255 255 / .2) var(--tw-gradient-via-position), var(--tw-gradient-to)}.to-\[\#0f0f0f\]{--tw-gradient-to: #0f0f0f var(--tw-gradient-to-position)}.to-\[\#121212\]{--tw-gradient-to: #121212 var(--tw-gradient-to-position)}.to-\[\#1a1a1a\]{--tw-gradient-to: #1a1a1a var(--tw-gradient-to-position)}.to-\[\#1a1a1a\]\/80{--tw-gradient-to: rgb(26 26 26 / .8) var(--tw-gradient-to-position)}.to-\[\#1f1f1f\]{--tw-gradient-to: #1f1f1f var(--tw-gradient-to-position)}.to-\[\#1f1f1f\]\/80{--tw-gradient-to: rgb(31 31 31 / .8) var(--tw-gradient-to-position)}.to-\[\#252525\]{--tw-gradient-to: #252525 var(--tw-gradient-to-position)}.to-\[\#2a2a2a\]{--tw-gradient-to: #2a2a2a var(--tw-gradient-to-position)}.to-\[\#7744cc\]{--tw-gradient-to: #7744cc var(--tw-gradient-to-position)}.to-\[\#9966dd\]{--tw-gradient-to: #9966dd var(--tw-gradient-to-position)}.to-\[\#bb86fc\]{--tw-gradient-to: #bb86fc var(--tw-gradient-to-position)}.to-blue-600{--tw-gradient-to: #2563eb var(--tw-gradient-to-position)}.to-gray-400{--tw-gradient-to: #9ca3af var(--tw-gradient-to-position)}.to-gray-600\/40{--tw-gradient-to: rgb(75 85 99 / .4) var(--tw-gradient-to-position)}.to-gray-900{--tw-gradient-to: #111827 var(--tw-gradient-to-position)}.to-red-600{--tw-gradient-to: #dc2626 var(--tw-gradient-to-position)}.to-transparent{--tw-gradient-to: transparent var(--tw-gradient-to-position)}.bg-clip-text{-webkit-background-clip:text;background-clip:text}.fill-black\/20{fill:#0003}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.object-left{-o-object-position:left;object-position:left}.object-right{-o-object-position:right;object-position:right}.p-0{padding:0}.p-0\.5{padding:.125rem}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-2{padding:.5rem}.p-2\.5{padding:.625rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.p-\[3px\]{padding:3px}.px-0{padding-left:0;padding-right:0}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-8{padding-left:2rem;padding-right:2rem}.py-0{padding-top:0;padding-bottom:0}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-16{padding-top:4rem;padding-bottom:4rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-20{padding-top:5rem;padding-bottom:5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-5{padding-top:1.25rem;padding-bottom:1.25rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-2{padding-bottom:.5rem}.pb-8{padding-bottom:2rem}.pl-10{padding-left:2.5rem}.pl-2{padding-left:.5rem}.pl-3{padding-left:.75rem}.pl-4{padding-left:1rem}.pr-10{padding-right:2.5rem}.pr-3{padding-right:.75rem}.pr-4{padding-right:1rem}.pt-2{padding-top:.5rem}.pt-4{padding-top:1rem}.pt-5{padding-top:1.25rem}.pt-6{padding-top:1.5rem}.pt-8{padding-top:2rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-\[10px\]{font-size:10px}.text-\[9px\]{font-size:9px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.italic{font-style:italic}.leading-relaxed{line-height:1.625}.leading-tight{line-height:1.25}.tracking-tight{letter-spacing:-.025em}.tracking-wide{letter-spacing:.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-\[\#00AFF0\]{--tw-text-opacity: 1;color:rgb(0 175 240 / var(--tw-text-opacity, 1))}.text-\[\#1D9BF0\]{--tw-text-opacity: 1;color:rgb(29 155 240 / var(--tw-text-opacity, 1))}.text-\[\#bb86fc\]{--tw-text-opacity: 1;color:rgb(187 134 252 / var(--tw-text-opacity, 1))}.text-\[\#f96854\]{--tw-text-opacity: 1;color:rgb(249 104 84 / var(--tw-text-opacity, 1))}.text-amber-300{--tw-text-opacity: 1;color:rgb(252 211 77 / var(--tw-text-opacity, 1))}.text-amber-400{--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.text-amber-500{--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}.text-blue-300{--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-cyan-400{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.text-emerald-400{--tw-text-opacity: 1;color:rgb(52 211 153 / var(--tw-text-opacity, 1))}.text-emerald-500{--tw-text-opacity: 1;color:rgb(16 185 129 / var(--tw-text-opacity, 1))}.text-emerald-500\/50{color:#10b98180}.text-gray-200{--tw-text-opacity: 1;color:rgb(229 231 235 / var(--tw-text-opacity, 1))}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-green-300{--tw-text-opacity: 1;color:rgb(134 239 172 / var(--tw-text-opacity, 1))}.text-green-400{--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.text-indigo-400{--tw-text-opacity: 1;color:rgb(129 140 248 / var(--tw-text-opacity, 1))}.text-orange-400{--tw-text-opacity: 1;color:rgb(251 146 60 / var(--tw-text-opacity, 1))}.text-pink-300{--tw-text-opacity: 1;color:rgb(249 168 212 / var(--tw-text-opacity, 1))}.text-pink-400{--tw-text-opacity: 1;color:rgb(244 114 182 / var(--tw-text-opacity, 1))}.text-purple-100{--tw-text-opacity: 1;color:rgb(243 232 255 / var(--tw-text-opacity, 1))}.text-purple-200{--tw-text-opacity: 1;color:rgb(233 213 255 / var(--tw-text-opacity, 1))}.text-purple-300{--tw-text-opacity: 1;color:rgb(216 180 254 / var(--tw-text-opacity, 1))}.text-purple-400{--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-red-500\/80{color:#ef4444cc}.text-transparent{color:transparent}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-white\/40{color:#fff6}.text-white\/50{color:#ffffff80}.text-white\/70{color:#ffffffb3}.text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.no-underline{text-decoration-line:none}.decoration-\[\#bb86fc\]\/30{text-decoration-color:#bb86fc4d}.decoration-gray-600{text-decoration-color:#4b5563}.underline-offset-2{text-underline-offset:2px}.placeholder-gray-400::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(156 163 175 / var(--tw-placeholder-opacity, 1))}.placeholder-gray-400::placeholder{--tw-placeholder-opacity: 1;color:rgb(156 163 175 / var(--tw-placeholder-opacity, 1))}.placeholder-gray-500::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(107 114 128 / var(--tw-placeholder-opacity, 1))}.placeholder-gray-500::placeholder{--tw-placeholder-opacity: 1;color:rgb(107 114 128 / var(--tw-placeholder-opacity, 1))}.placeholder-gray-600::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(75 85 99 / var(--tw-placeholder-opacity, 1))}.placeholder-gray-600::placeholder{--tw-placeholder-opacity: 1;color:rgb(75 85 99 / var(--tw-placeholder-opacity, 1))}.accent-\[\#bb86fc\]{accent-color:#bb86fc}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-30{opacity:.3}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.opacity-70{opacity:.7}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\[0_0_15px_-3px_rgba\(168\,85\,247\,0\.3\)\]{--tw-shadow: 0 0 15px -3px rgba(168,85,247,.3);--tw-shadow-colored: 0 0 15px -3px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\[0_0_15px_rgba\(245\,158\,11\,0\.4\)\]{--tw-shadow: 0 0 15px rgba(245,158,11,.4);--tw-shadow-colored: 0 0 15px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\[0_8px_32px_0_rgba\(0\,0\,0\,0\.5\)\]{--tw-shadow: 0 8px 32px 0 rgba(0,0,0,.5);--tw-shadow-colored: 0 8px 32px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-inner{--tw-shadow: inset 0 2px 4px 0 rgb(0 0 0 / .05);--tw-shadow-colored: inset 0 2px 4px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-none{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\[\#bb86fc\]\/10{--tw-shadow-color: rgb(187 134 252 / .1);--tw-shadow: var(--tw-shadow-colored)}.shadow-\[\#bb86fc\]\/20{--tw-shadow-color: rgb(187 134 252 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-\[\#bb86fc\]\/30{--tw-shadow-color: rgb(187 134 252 / .3);--tw-shadow: var(--tw-shadow-colored)}.shadow-\[\#bb86fc\]\/40{--tw-shadow-color: rgb(187 134 252 / .4);--tw-shadow: var(--tw-shadow-colored)}.shadow-amber-500\/20{--tw-shadow-color: rgb(245 158 11 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-black\/50{--tw-shadow-color: rgb(0 0 0 / .5);--tw-shadow: var(--tw-shadow-colored)}.shadow-blue-500\/20{--tw-shadow-color: rgb(59 130 246 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-emerald-500\/20{--tw-shadow-color: rgb(16 185 129 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-green-500\/40{--tw-shadow-color: rgb(34 197 94 / .4);--tw-shadow: var(--tw-shadow-colored)}.shadow-indigo-500\/20{--tw-shadow-color: rgb(99 102 241 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-orange-500\/20{--tw-shadow-color: rgb(249 115 22 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-pink-500\/20{--tw-shadow-color: rgb(236 72 153 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-purple-500\/20{--tw-shadow-color: rgb(168 85 247 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-purple-600\/30{--tw-shadow-color: rgb(147 51 234 / .3);--tw-shadow: var(--tw-shadow-colored)}.shadow-purple-900\/20{--tw-shadow-color: rgb(88 28 135 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-red-500\/20{--tw-shadow-color: rgb(239 68 68 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-red-600\/20{--tw-shadow-color: rgb(220 38 38 / .2);--tw-shadow: var(--tw-shadow-colored)}.ring-4{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-\[\#bb86fc\]{--tw-ring-opacity: 1;--tw-ring-color: rgb(187 134 252 / var(--tw-ring-opacity, 1))}.blur-0{--tw-blur: blur(0);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.blur-md{--tw-blur: blur(12px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.drop-shadow-\[0_0_5px_rgba\(255\,255\,255\,0\.5\)\]{--tw-drop-shadow: drop-shadow(0 0 5px rgba(255,255,255,.5));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.drop-shadow-\[0_2px_4px_rgba\(0\,0\,0\,0\.6\)\]{--tw-drop-shadow: drop-shadow(0 2px 4px rgba(0,0,0,.6));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.grayscale{--tw-grayscale: grayscale(100%);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-\[8px\]{--tw-backdrop-blur: blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-md{--tw-backdrop-blur: blur(12px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-none{transition-property:none}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-1000{transition-duration:1s}.duration-150{transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}.duration-700{transition-duration:.7s}.duration-\[400ms\]{transition-duration:.4s}.duration-\[600ms\]{transition-duration:.6s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.ease-linear{transition-timing-function:linear}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}.will-change-transform{will-change:transform}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}@keyframes fadeIn{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}@keyframes fadeOut{0%{opacity:1}to{opacity:0}}@keyframes fadeInUp{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}@keyframes quickFadeIn{0%{opacity:0;transform:scale(.98)}to{opacity:1;transform:scale(1)}}.animate-quick-fade-in{animation:quickFadeIn .15s ease-out forwards}@keyframes smoothFadeIn{0%{opacity:0;transform:scale(.98)}50%{opacity:.5}to{opacity:1;transform:scale(1)}}.animate-smooth-fade-in{animation:smoothFadeIn 1.2s ease-out forwards}.masonry-container{-moz-column-count:2;column-count:2;-moz-column-gap:4px;column-gap:4px}@media (min-width: 640px){.masonry-container{-moz-column-count:3;column-count:3}}@media (min-width: 768px){.masonry-container{-moz-column-count:4;column-count:4}}@media (min-width: 1024px){.masonry-container{-moz-column-count:5;column-count:5}}@media (min-width: 1280px){.masonry-container{-moz-column-count:6;column-count:6}}@keyframes shimmer{0%{background-position:-1000px 0}to{background-position:1000px 0}}.animate-shimmer{animation:shimmer 2.5s infinite}.masonry-item{-moz-column-break-inside:avoid;break-inside:avoid;margin-bottom:4px;display:inline-block;width:100%}@keyframes slideInUp{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}@keyframes slideInDown{0%{opacity:0;transform:translateY(-20px)}to{opacity:1;transform:translateY(0)}}@keyframes slideInLeft{0%{opacity:0;transform:translate(-20px)}to{opacity:1;transform:translate(0)}}@keyframes slideInRight{0%{opacity:0;transform:translate(20px)}to{opacity:1;transform:translate(0)}}@keyframes glow{0%,to{box-shadow:0 0 5px #8b5cf61a}50%{box-shadow:0 0 20px #8b5cf64d}}@keyframes pulse-color{0%,to{color:currentColor}50%{color:#8b5cf699}}.animate-slide-in-up{animation:slideInUp .5s ease-out forwards}.animate-slide-in-down{animation:slideInDown .5s ease-out forwards}.animate-slide-in-left{animation:slideInLeft .5s ease-out forwards}.animate-slide-in-right{animation:slideInRight .5s ease-out forwards}.animate-glow{animation:glow 2s ease-in-out infinite}.animate-pulse-color{animation:pulse-color 2s ease-in-out infinite}::-webkit-scrollbar,html::-webkit-scrollbar,body::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-track,html::-webkit-scrollbar-track,body::-webkit-scrollbar-track{background:transparent}::-webkit-scrollbar-thumb,html::-webkit-scrollbar-thumb,body::-webkit-scrollbar-thumb{background-color:#4b5563;border-radius:10px;border:2px solid transparent;background-clip:padding-box}::-webkit-scrollbar-thumb:hover,html::-webkit-scrollbar-thumb:hover,body::-webkit-scrollbar-thumb:hover{background-color:#bb86fc;border:2px solid transparent;background-clip:padding-box}*{scrollbar-width:thin;scrollbar-color:#4b5563 transparent}html,body{scrollbar-width:thin;scrollbar-color:#4b5563 #121212}.after\:absolute:after{content:var(--tw-content);position:absolute}.after\:left-\[2px\]:after{content:var(--tw-content);left:2px}.after\:top-\[2px\]:after{content:var(--tw-content);top:2px}.after\:h-4:after{content:var(--tw-content);height:1rem}.after\:h-5:after{content:var(--tw-content);height:1.25rem}.after\:w-4:after{content:var(--tw-content);width:1rem}.after\:w-5:after{content:var(--tw-content);width:1.25rem}.after\:rounded-full:after{content:var(--tw-content);border-radius:9999px}.after\:border:after{content:var(--tw-content);border-width:1px}.after\:border-gray-300:after{content:var(--tw-content);--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.after\:bg-white:after{content:var(--tw-content);--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.after\:transition-all:after{content:var(--tw-content);transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.after\:content-\[\'\'\]:after{--tw-content: "";content:var(--tw-content)}.hover\:rotate-180:hover{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:rotate-90:hover{--tw-rotate: 90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:scale-105:hover{--tw-scale-x: 1.05;--tw-scale-y: 1.05;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:scale-110:hover{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:scale-125:hover{--tw-scale-x: 1.25;--tw-scale-y: 1.25;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:scale-\[1\.02\]:hover{--tw-scale-x: 1.02;--tw-scale-y: 1.02;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:border-\[\#24A1DE\]:hover{--tw-border-opacity: 1;border-color:rgb(36 161 222 / var(--tw-border-opacity, 1))}.hover\:border-\[\#FF424D\]:hover{--tw-border-opacity: 1;border-color:rgb(255 66 77 / var(--tw-border-opacity, 1))}.hover\:border-\[\#bb86fc\]:hover{--tw-border-opacity: 1;border-color:rgb(187 134 252 / var(--tw-border-opacity, 1))}.hover\:border-\[\#bb86fc\]\/50:hover{border-color:#bb86fc80}.hover\:border-blue-500:hover{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.hover\:border-blue-500\/40:hover{border-color:#3b82f666}.hover\:border-emerald-500\/40:hover{border-color:#10b98166}.hover\:border-gray-500:hover{--tw-border-opacity: 1;border-color:rgb(107 114 128 / var(--tw-border-opacity, 1))}.hover\:border-gray-600:hover{--tw-border-opacity: 1;border-color:rgb(75 85 99 / var(--tw-border-opacity, 1))}.hover\:border-gray-600\/70:hover{border-color:#4b5563b3}.hover\:border-gray-700:hover{--tw-border-opacity: 1;border-color:rgb(55 65 81 / var(--tw-border-opacity, 1))}.hover\:border-gray-700\/60:hover{border-color:#37415199}.hover\:border-indigo-500\/40:hover{border-color:#6366f166}.hover\:border-purple-500:hover{--tw-border-opacity: 1;border-color:rgb(168 85 247 / var(--tw-border-opacity, 1))}.hover\:border-purple-500\/50:hover{border-color:#a855f780}.hover\:border-red-500:hover{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.hover\:border-red-500\/40:hover{border-color:#ef444466}.hover\:border-white:hover{--tw-border-opacity: 1;border-color:rgb(255 255 255 / var(--tw-border-opacity, 1))}.hover\:border-yellow-500\/40:hover{border-color:#eab30866}.hover\:bg-\[\#00AFF0\]\/20:hover{background-color:#00aff033}.hover\:bg-\[\#1D9BF0\]\/20:hover{background-color:#1d9bf033}.hover\:bg-\[\#1f1f1f\]:hover{--tw-bg-opacity: 1;background-color:rgb(31 31 31 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#242424\]:hover{--tw-bg-opacity: 1;background-color:rgb(36 36 36 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#2a2a2a\]:hover{--tw-bg-opacity: 1;background-color:rgb(42 42 42 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#333\]:hover{--tw-bg-opacity: 1;background-color:rgb(51 51 51 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#9966dd\]:hover{--tw-bg-opacity: 1;background-color:rgb(153 102 221 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#bb86fc\]:hover{--tw-bg-opacity: 1;background-color:rgb(187 134 252 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#bb86fc\]\/10:hover{background-color:#bb86fc1a}.hover\:bg-\[\#bb86fc\]\/20:hover{background-color:#bb86fc33}.hover\:bg-\[\#bb86fc\]\/30:hover{background-color:#bb86fc4d}.hover\:bg-\[\#bb86fc\]\/5:hover{background-color:#bb86fc0d}.hover\:bg-\[\#f96854\]\/20:hover{background-color:#f9685433}.hover\:bg-amber-600:hover{--tw-bg-opacity: 1;background-color:rgb(217 119 6 / var(--tw-bg-opacity, 1))}.hover\:bg-amber-700:hover{--tw-bg-opacity: 1;background-color:rgb(180 83 9 / var(--tw-bg-opacity, 1))}.hover\:bg-blue-500\/20:hover{background-color:#3b82f633}.hover\:bg-blue-500\/5:hover{background-color:#3b82f60d}.hover\:bg-blue-700:hover{--tw-bg-opacity: 1;background-color:rgb(29 78 216 / var(--tw-bg-opacity, 1))}.hover\:bg-emerald-500\/20:hover{background-color:#10b98133}.hover\:bg-emerald-700:hover{--tw-bg-opacity: 1;background-color:rgb(4 120 87 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-600:hover{--tw-bg-opacity: 1;background-color:rgb(75 85 99 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-700:hover{--tw-bg-opacity: 1;background-color:rgb(55 65 81 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-800:hover{--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.hover\:bg-indigo-500\/20:hover{background-color:#6366f133}.hover\:bg-indigo-700:hover{--tw-bg-opacity: 1;background-color:rgb(67 56 202 / var(--tw-bg-opacity, 1))}.hover\:bg-orange-600:hover{--tw-bg-opacity: 1;background-color:rgb(234 88 12 / var(--tw-bg-opacity, 1))}.hover\:bg-pink-600:hover{--tw-bg-opacity: 1;background-color:rgb(219 39 119 / var(--tw-bg-opacity, 1))}.hover\:bg-pink-700:hover{--tw-bg-opacity: 1;background-color:rgb(190 24 93 / var(--tw-bg-opacity, 1))}.hover\:bg-purple-500\/30:hover{background-color:#a855f74d}.hover\:bg-purple-600:hover{--tw-bg-opacity: 1;background-color:rgb(147 51 234 / var(--tw-bg-opacity, 1))}.hover\:bg-purple-700:hover{--tw-bg-opacity: 1;background-color:rgb(126 34 206 / var(--tw-bg-opacity, 1))}.hover\:bg-red-500\/20:hover{background-color:#ef444433}.hover\:bg-red-500\/30:hover{background-color:#ef44444d}.hover\:bg-red-600:hover{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.hover\:bg-red-700:hover{--tw-bg-opacity: 1;background-color:rgb(185 28 28 / var(--tw-bg-opacity, 1))}.hover\:bg-white\/10:hover{background-color:#ffffff1a}.hover\:bg-white\/20:hover{background-color:#fff3}.hover\:bg-white\/5:hover{background-color:#ffffff0d}.hover\:bg-yellow-500\/20:hover{background-color:#eab30833}.hover\:from-\[\#9966dd\]:hover{--tw-gradient-from: #9966dd var(--tw-gradient-from-position);--tw-gradient-to: rgb(153 102 221 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.hover\:from-gray-700\/60:hover{--tw-gradient-from: rgb(55 65 81 / .6) var(--tw-gradient-from-position);--tw-gradient-to: rgb(55 65 81 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.hover\:to-\[\#7744cc\]:hover{--tw-gradient-to: #7744cc var(--tw-gradient-to-position)}.hover\:to-gray-600\/60:hover{--tw-gradient-to: rgb(75 85 99 / .6) var(--tw-gradient-to-position)}.hover\:text-\[\#24A1DE\]:hover{--tw-text-opacity: 1;color:rgb(36 161 222 / var(--tw-text-opacity, 1))}.hover\:text-\[\#FF424D\]:hover{--tw-text-opacity: 1;color:rgb(255 66 77 / var(--tw-text-opacity, 1))}.hover\:text-\[\#bb86fc\]:hover{--tw-text-opacity: 1;color:rgb(187 134 252 / var(--tw-text-opacity, 1))}.hover\:text-blue-300:hover{--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.hover\:text-purple-400:hover{--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.hover\:text-red-400:hover{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.hover\:text-white:hover{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:decoration-white:hover{text-decoration-color:#fff}.hover\:opacity-100:hover{opacity:1}.hover\:opacity-80:hover{opacity:.8}.hover\:shadow-lg:hover{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-\[\#bb86fc\]\/60:hover{--tw-shadow-color: rgb(187 134 252 / .6);--tw-shadow: var(--tw-shadow-colored)}.hover\:shadow-purple-500\/10:hover{--tw-shadow-color: rgb(168 85 247 / .1);--tw-shadow: var(--tw-shadow-colored)}.hover\:shadow-purple-500\/20:hover{--tw-shadow-color: rgb(168 85 247 / .2);--tw-shadow: var(--tw-shadow-colored)}.hover\:shadow-purple-600\/50:hover{--tw-shadow-color: rgb(147 51 234 / .5);--tw-shadow: var(--tw-shadow-colored)}.hover\:brightness-110:hover{--tw-brightness: brightness(1.1);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.hover\:grayscale-0:hover{--tw-grayscale: grayscale(0);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.focus\:border-\[\#bb86fc\]:focus{--tw-border-opacity: 1;border-color:rgb(187 134 252 / var(--tw-border-opacity, 1))}.focus\:border-blue-500:focus{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.focus\:border-gray-600:focus{--tw-border-opacity: 1;border-color:rgb(75 85 99 / var(--tw-border-opacity, 1))}.focus\:border-pink-500:focus{--tw-border-opacity: 1;border-color:rgb(236 72 153 / var(--tw-border-opacity, 1))}.focus\:border-purple-500:focus{--tw-border-opacity: 1;border-color:rgb(168 85 247 / var(--tw-border-opacity, 1))}.focus\:border-purple-500\/50:focus{border-color:#a855f780}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-\[\#bb86fc\]:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(187 134 252 / var(--tw-ring-opacity, 1))}.focus\:ring-\[\#bb86fc\]\/30:focus{--tw-ring-color: rgb(187 134 252 / .3)}.focus\:ring-purple-500\/50:focus{--tw-ring-color: rgb(168 85 247 / .5)}.active\:scale-95:active{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:text-gray-600:disabled{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.disabled\:opacity-50:disabled{opacity:.5}.disabled\:hover\:bg-\[\#1a1a1a\]:hover:disabled{--tw-bg-opacity: 1;background-color:rgb(26 26 26 / var(--tw-bg-opacity, 1))}.group:hover .group-hover\:-translate-x-1{--tw-translate-x: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:rotate-12{--tw-rotate: 12deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:scale-105{--tw-scale-x: 1.05;--tw-scale-y: 1.05;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:scale-110{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:scale-\[1\.08\]{--tw-scale-x: 1.08;--tw-scale-y: 1.08;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:scale-\[1\.10\]{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:border-amber-500\/50{border-color:#f59e0b80}.group:hover .group-hover\:border-purple-500\/50{border-color:#a855f780}.group:hover .group-hover\:bg-\[\#bb86fc\]\/40{background-color:#bb86fc66}.group:hover .group-hover\:bg-blue-500\/20{background-color:#3b82f633}.group:hover .group-hover\:bg-gray-700\/80{background-color:#374151cc}.group:hover .group-hover\:bg-purple-500\/40{background-color:#a855f766}.group:hover .group-hover\:text-\[\#bb86fc\]{--tw-text-opacity: 1;color:rgb(187 134 252 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-purple-400{--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-white\/60{color:#fff9}.group:hover .group-hover\:opacity-100{opacity:1}.group:hover .group-hover\:shadow-\[\#bb86fc\]\/30{--tw-shadow-color: rgb(187 134 252 / .3);--tw-shadow: var(--tw-shadow-colored)}.group:hover .group-hover\:shadow-\[\#bb86fc\]\/60{--tw-shadow-color: rgb(187 134 252 / .6);--tw-shadow: var(--tw-shadow-colored)}.peer:checked~.peer-checked\:bg-\[\#bb86fc\]{--tw-bg-opacity: 1;background-color:rgb(187 134 252 / var(--tw-bg-opacity, 1))}.peer:checked~.peer-checked\:bg-amber-500{--tw-bg-opacity: 1;background-color:rgb(245 158 11 / var(--tw-bg-opacity, 1))}.peer:checked~.peer-checked\:bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.peer:checked~.peer-checked\:bg-cyan-500{--tw-bg-opacity: 1;background-color:rgb(6 182 212 / var(--tw-bg-opacity, 1))}.peer:checked~.peer-checked\:bg-emerald-500{--tw-bg-opacity: 1;background-color:rgb(16 185 129 / var(--tw-bg-opacity, 1))}.peer:checked~.peer-checked\:bg-indigo-500{--tw-bg-opacity: 1;background-color:rgb(99 102 241 / var(--tw-bg-opacity, 1))}.peer:checked~.peer-checked\:bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.peer:checked~.peer-checked\:bg-pink-500{--tw-bg-opacity: 1;background-color:rgb(236 72 153 / var(--tw-bg-opacity, 1))}.peer:checked~.peer-checked\:bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.peer:checked~.peer-checked\:after\:translate-x-full:after{content:var(--tw-content);--tw-translate-x: 100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.peer:checked~.peer-checked\:after\:border-white:after{content:var(--tw-content);--tw-border-opacity: 1;border-color:rgb(255 255 255 / var(--tw-border-opacity, 1))}.peer:focus~.peer-focus\:outline-none{outline:2px solid transparent;outline-offset:2px}.peer:focus~.peer-focus\:ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.peer:focus~.peer-focus\:ring-\[\#bb86fc\]\/30{--tw-ring-color: rgb(187 134 252 / .3)}.peer:focus~.peer-focus\:ring-amber-300{--tw-ring-opacity: 1;--tw-ring-color: rgb(252 211 77 / var(--tw-ring-opacity, 1))}.peer:focus~.peer-focus\:ring-blue-300{--tw-ring-opacity: 1;--tw-ring-color: rgb(147 197 253 / var(--tw-ring-opacity, 1))}.peer:focus~.peer-focus\:ring-cyan-300{--tw-ring-opacity: 1;--tw-ring-color: rgb(103 232 249 / var(--tw-ring-opacity, 1))}.peer:focus~.peer-focus\:ring-emerald-300{--tw-ring-opacity: 1;--tw-ring-color: rgb(110 231 183 / var(--tw-ring-opacity, 1))}.peer:focus~.peer-focus\:ring-indigo-300{--tw-ring-opacity: 1;--tw-ring-color: rgb(165 180 252 / var(--tw-ring-opacity, 1))}.peer:focus~.peer-focus\:ring-orange-300{--tw-ring-opacity: 1;--tw-ring-color: rgb(253 186 116 / var(--tw-ring-opacity, 1))}.peer:focus~.peer-focus\:ring-pink-300{--tw-ring-opacity: 1;--tw-ring-color: rgb(249 168 212 / var(--tw-ring-opacity, 1))}.peer:focus~.peer-focus\:ring-purple-300{--tw-ring-opacity: 1;--tw-ring-color: rgb(216 180 254 / var(--tw-ring-opacity, 1))}.peer:focus~.peer-focus\:ring-red-300{--tw-ring-opacity: 1;--tw-ring-color: rgb(252 165 165 / var(--tw-ring-opacity, 1))}@media (min-width: 640px){.sm\:left-8{left:2rem}.sm\:right-8{right:2rem}.sm\:mx-0{margin-left:0;margin-right:0}.sm\:mb-4{margin-bottom:1rem}.sm\:mb-6{margin-bottom:1.5rem}.sm\:mt-0{margin-top:0}.sm\:mt-12{margin-top:3rem}.sm\:mt-2{margin-top:.5rem}.sm\:mt-8{margin-top:2rem}.sm\:inline-block{display:inline-block}.sm\:inline{display:inline}.sm\:flex{display:flex}.sm\:hidden{display:none}.sm\:h-10{height:2.5rem}.sm\:h-14{height:3.5rem}.sm\:h-4{height:1rem}.sm\:h-5{height:1.25rem}.sm\:h-6{height:1.5rem}.sm\:w-10{width:2.5rem}.sm\:w-14{width:3.5rem}.sm\:w-4{width:1rem}.sm\:w-5{width:1.25rem}.sm\:w-6{width:1.5rem}.sm\:w-64{width:16rem}.sm\:w-auto{width:auto}.sm\:flex-none{flex:none}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:justify-start{justify-content:flex-start}.sm\:gap-0{gap:0px}.sm\:gap-1{gap:.25rem}.sm\:gap-2{gap:.5rem}.sm\:gap-3{gap:.75rem}.sm\:gap-4{gap:1rem}.sm\:gap-6{gap:1.5rem}.sm\:rounded-lg{border-radius:.5rem}.sm\:p-12{padding:3rem}.sm\:p-2{padding:.5rem}.sm\:p-2\.5{padding:.625rem}.sm\:p-4{padding:1rem}.sm\:p-6{padding:1.5rem}.sm\:px-10{padding-left:2.5rem;padding-right:2.5rem}.sm\:px-2{padding-left:.5rem;padding-right:.5rem}.sm\:px-3{padding-left:.75rem;padding-right:.75rem}.sm\:px-4{padding-left:1rem;padding-right:1rem}.sm\:px-6{padding-left:1.5rem;padding-right:1.5rem}.sm\:py-1{padding-top:.25rem;padding-bottom:.25rem}.sm\:py-2{padding-top:.5rem;padding-bottom:.5rem}.sm\:py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.sm\:py-4{padding-top:1rem;padding-bottom:1rem}.sm\:py-6{padding-top:1.5rem;padding-bottom:1.5rem}.sm\:py-8{padding-top:2rem;padding-bottom:2rem}.sm\:pt-12{padding-top:3rem}.sm\:pt-8{padding-top:2rem}.sm\:text-left{text-align:left}.sm\:text-2xl{font-size:1.5rem;line-height:2rem}.sm\:text-4xl{font-size:2.25rem;line-height:2.5rem}.sm\:text-\[11px\]{font-size:11px}.sm\:text-base{font-size:1rem;line-height:1.5rem}.sm\:text-lg{font-size:1.125rem;line-height:1.75rem}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}.sm\:text-xs{font-size:.75rem;line-height:1rem}.sm\:shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}}@media (min-width: 768px){.md\:absolute{position:absolute}.md\:relative{position:relative}.md\:right-8{right:2rem}.md\:top-0{top:0}.md\:block{display:block}.md\:flex{display:flex}.md\:hidden{display:none}.md\:w-24{width:6rem}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:flex-col{flex-direction:column}.md\:gap-3{gap:.75rem}.md\:border-y-0{border-top-width:0px;border-bottom-width:0px}.md\:p-12{padding:3rem}.md\:px-12{padding-left:3rem;padding-right:3rem}.md\:py-0{padding-top:0;padding-bottom:0}}@media (min-width: 1024px){.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.lg\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}}@media (min-width: 1280px){.xl\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.xl\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.xl\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}}@media (min-width: 1536px){.\32xl\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}}@media (prefers-color-scheme: dark){.dark\:border-gray-600{--tw-border-opacity: 1;border-color:rgb(75 85 99 / var(--tw-border-opacity, 1))}.dark\:bg-gray-700{--tw-bg-opacity: 1;background-color:rgb(55 65 81 / var(--tw-bg-opacity, 1))}.peer:focus~.dark\:peer-focus\:ring-\[\#bb86fc\]\/80{--tw-ring-color: rgb(187 134 252 / .8)}.peer:focus~.dark\:peer-focus\:ring-amber-800{--tw-ring-opacity: 1;--tw-ring-color: rgb(146 64 14 / var(--tw-ring-opacity, 1))}.peer:focus~.dark\:peer-focus\:ring-blue-800{--tw-ring-opacity: 1;--tw-ring-color: rgb(30 64 175 / var(--tw-ring-opacity, 1))}.peer:focus~.dark\:peer-focus\:ring-cyan-800{--tw-ring-opacity: 1;--tw-ring-color: rgb(21 94 117 / var(--tw-ring-opacity, 1))}.peer:focus~.dark\:peer-focus\:ring-emerald-800{--tw-ring-opacity: 1;--tw-ring-color: rgb(6 95 70 / var(--tw-ring-opacity, 1))}.peer:focus~.dark\:peer-focus\:ring-indigo-800{--tw-ring-opacity: 1;--tw-ring-color: rgb(55 48 163 / var(--tw-ring-opacity, 1))}.peer:focus~.dark\:peer-focus\:ring-orange-800{--tw-ring-opacity: 1;--tw-ring-color: rgb(154 52 18 / var(--tw-ring-opacity, 1))}.peer:focus~.dark\:peer-focus\:ring-pink-800{--tw-ring-opacity: 1;--tw-ring-color: rgb(157 23 77 / var(--tw-ring-opacity, 1))}.peer:focus~.dark\:peer-focus\:ring-purple-800{--tw-ring-opacity: 1;--tw-ring-color: rgb(107 33 168 / var(--tw-ring-opacity, 1))}.peer:focus~.dark\:peer-focus\:ring-red-800{--tw-ring-opacity: 1;--tw-ring-color: rgb(153 27 27 / var(--tw-ring-opacity, 1))}} diff --git a/dist/assets/index-BYDpuO3_.js b/dist/assets/index-BYDpuO3_.js new file mode 100644 index 0000000000000000000000000000000000000000..0b4cfd5c46fc1387549f0201dc86bb15a0bc407d --- /dev/null +++ b/dist/assets/index-BYDpuO3_.js @@ -0,0 +1,3722 @@ +(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var ih=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function mf(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var CE={exports:{}},gf={},IE={exports:{}},ze={};/** + * @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 iu=Symbol.for("react.element"),VP=Symbol.for("react.portal"),OP=Symbol.for("react.fragment"),FP=Symbol.for("react.strict_mode"),zP=Symbol.for("react.profiler"),BP=Symbol.for("react.provider"),UP=Symbol.for("react.context"),$P=Symbol.for("react.forward_ref"),HP=Symbol.for("react.suspense"),GP=Symbol.for("react.memo"),qP=Symbol.for("react.lazy"),ow=Symbol.iterator;function WP(t){return t===null||typeof t!="object"?null:(t=ow&&t[ow]||t["@@iterator"],typeof t=="function"?t:null)}var NE={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},AE=Object.assign,PE={};function tl(t,e,n){this.props=t,this.context=e,this.refs=PE,this.updater=n||NE}tl.prototype.isReactComponent={};tl.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=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,t,e,"setState")};tl.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function RE(){}RE.prototype=tl.prototype;function Ky(t,e,n){this.props=t,this.context=e,this.refs=PE,this.updater=n||NE}var Yy=Ky.prototype=new RE;Yy.constructor=Ky;AE(Yy,tl.prototype);Yy.isPureReactComponent=!0;var aw=Array.isArray,jE=Object.prototype.hasOwnProperty,Qy={current:null},DE={key:!0,ref:!0,__self:!0,__source:!0};function ME(t,e,n){var r,s={},i=null,o=null;if(e!=null)for(r in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(i=""+e.key),e)jE.call(e,r)&&!DE.hasOwnProperty(r)&&(s[r]=e[r]);var a=arguments.length-2;if(a===1)s.children=n;else if(1>>1,se=O[Y];if(0>>1;Ys(ee,R))Js(ae,ee)?(O[Y]=ae,O[J]=R,Y=J):(O[Y]=ee,O[$]=R,Y=$);else if(Js(ae,R))O[Y]=ae,O[J]=R,Y=J;else break e}}return H}function s(O,H){var R=O.sortIndex-H.sortIndex;return R!==0?R:O.id-H.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;t.unstable_now=function(){return i.now()}}else{var o=Date,a=o.now();t.unstable_now=function(){return o.now()-a}}var l=[],c=[],d=1,h=null,m=3,p=!1,g=!1,b=!1,E=typeof setTimeout=="function"?setTimeout:null,y=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function _(O){for(var H=n(c);H!==null;){if(H.callback===null)r(c);else if(H.startTime<=O)r(c),H.sortIndex=H.expirationTime,e(l,H);else break;H=n(c)}}function P(O){if(b=!1,_(O),!g)if(n(l)!==null)g=!0,q(D);else{var H=n(c);H!==null&&X(P,H.startTime-O)}}function D(O,H){g=!1,b&&(b=!1,y(w),w=-1),p=!0;var R=m;try{for(_(H),h=n(l);h!==null&&(!(h.expirationTime>H)||O&&!N());){var Y=h.callback;if(typeof Y=="function"){h.callback=null,m=h.priorityLevel;var se=Y(h.expirationTime<=H);H=t.unstable_now(),typeof se=="function"?h.callback=se:h===n(l)&&r(l),_(H)}else r(l);h=n(l)}if(h!==null)var M=!0;else{var $=n(c);$!==null&&X(P,$.startTime-H),M=!1}return M}finally{h=null,m=R,p=!1}}var k=!1,T=null,w=-1,C=5,I=-1;function N(){return!(t.unstable_now()-IO||125Y?(O.sortIndex=R,e(c,O),n(l)===null&&O===n(c)&&(b?(y(w),w=-1):b=!0,X(P,R-Y))):(O.sortIndex=se,e(l,O),g||p||(g=!0,q(D))),O},t.unstable_shouldYield=N,t.unstable_wrapCallback=function(O){var H=m;return function(){var R=m;m=H;try{return O.apply(this,arguments)}finally{m=R}}}})(zE);FE.exports=zE;var sR=FE.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 iR=V,wr=sR;function re(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Um=Object.prototype.hasOwnProperty,oR=/^[: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]*$/,cw={},uw={};function aR(t){return Um.call(uw,t)?!0:Um.call(cw,t)?!1:oR.test(t)?uw[t]=!0:(cw[t]=!0,!1)}function lR(t,e,n,r){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function cR(t,e,n,r){if(e===null||typeof e>"u"||lR(t,e,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function On(t,e,n,r,s,i,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=i,this.removeEmptyString=o}var yn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){yn[t]=new On(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];yn[e]=new On(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){yn[t]=new On(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){yn[t]=new On(t,2,!1,t,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(t){yn[t]=new On(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){yn[t]=new On(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){yn[t]=new On(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){yn[t]=new On(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){yn[t]=new On(t,5,!1,t.toLowerCase(),null,!1,!1)});var Jy=/[\-:]([a-z])/g;function Zy(t){return t[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(t){var e=t.replace(Jy,Zy);yn[e]=new On(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(Jy,Zy);yn[e]=new On(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(Jy,Zy);yn[e]=new On(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){yn[t]=new On(t,1,!1,t.toLowerCase(),null,!1,!1)});yn.xlinkHref=new On("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){yn[t]=new On(t,1,!1,t.toLowerCase(),null,!0,!0)});function e0(t,e,n,r){var s=yn.hasOwnProperty(e)?yn[e]:null;(s!==null?s.type!==0:r||!(2a||s[o]!==i[a]){var l=` +`+s[o].replace(" at new "," at ");return t.displayName&&l.includes("")&&(l=l.replace("",t.displayName)),l}while(1<=o&&0<=a);break}}}finally{wp=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?$l(t):""}function uR(t){switch(t.tag){case 5:return $l(t.type);case 16:return $l("Lazy");case 13:return $l("Suspense");case 19:return $l("SuspenseList");case 0:case 2:case 15:return t=bp(t.type,!1),t;case 11:return t=bp(t.type.render,!1),t;case 1:return t=bp(t.type,!0),t;default:return""}}function qm(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case ua:return"Fragment";case ca:return"Portal";case $m:return"Profiler";case t0:return"StrictMode";case Hm:return"Suspense";case Gm:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case $E:return(t.displayName||"Context")+".Consumer";case UE:return(t._context.displayName||"Context")+".Provider";case n0:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case r0:return e=t.displayName||null,e!==null?e:qm(t.type)||"Memo";case li:e=t._payload,t=t._init;try{return qm(t(e))}catch{}}return null}function dR(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return qm(e);case 8:return e===t0?"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 e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function ji(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function GE(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function hR(t){var e=GE(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,i=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return s.call(this)},set:function(o){r=""+o,i.call(this,o)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function Ku(t){t._valueTracker||(t._valueTracker=hR(t))}function qE(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=GE(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function oh(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function Wm(t,e){var n=e.checked;return Tt({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function hw(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=ji(e.value!=null?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function WE(t,e){e=e.checked,e!=null&&e0(t,"checked",e,!1)}function Km(t,e){WE(t,e);var n=ji(e.value),r=e.type;if(n!=null)r==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?Ym(t,e.type,n):e.hasOwnProperty("defaultValue")&&Ym(t,e.type,ji(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function fw(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function Ym(t,e,n){(e!=="number"||oh(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var Hl=Array.isArray;function ka(t,e,n,r){if(t=t.options,e){e={};for(var s=0;s"+e.valueOf().toString()+"",e=Yu.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function kc(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var ec={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},fR=["Webkit","ms","Moz","O"];Object.keys(ec).forEach(function(t){fR.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),ec[e]=ec[t]})});function XE(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||ec.hasOwnProperty(t)&&ec[t]?(""+e).trim():e+"px"}function JE(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=XE(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,s):t[n]=s}}var pR=Tt({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 Jm(t,e){if(e){if(pR[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(re(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(re(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(re(61))}if(e.style!=null&&typeof e.style!="object")throw Error(re(62))}}function Zm(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){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 eg=null;function s0(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var tg=null,Ca=null,Ia=null;function gw(t){if(t=lu(t)){if(typeof tg!="function")throw Error(re(280));var e=t.stateNode;e&&(e=bf(e),tg(t.stateNode,t.type,e))}}function ZE(t){Ca?Ia?Ia.push(t):Ia=[t]:Ca=t}function eT(){if(Ca){var t=Ca,e=Ia;if(Ia=Ca=null,gw(t),e)for(t=0;t>>=0,t===0?32:31-(TR(t)/kR|0)|0}var Qu=64,Xu=4194304;function Gl(t){switch(t&-t){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 t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function uh(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,s=t.suspendedLanes,i=t.pingedLanes,o=n&268435455;if(o!==0){var a=o&~s;a!==0?r=Gl(a):(i&=o,i!==0&&(r=Gl(i)))}else o=n&~s,o!==0?r=Gl(o):i!==0&&(r=Gl(i));if(r===0)return 0;if(e!==0&&e!==r&&!(e&s)&&(s=r&-r,i=e&-e,s>=i||s===16&&(i&4194240)!==0))return e;if(r&4&&(r|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0n;n++)e.push(t);return e}function ou(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-qr(e),t[e]=n}function AR(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var r=t.eventTimes;for(t=t.expirationTimes;0=nc),Tw=" ",kw=!1;function wT(t,e){switch(t){case"keyup":return sj.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function bT(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var da=!1;function oj(t,e){switch(t){case"compositionend":return bT(e);case"keypress":return e.which!==32?null:(kw=!0,Tw);case"textInput":return t=e.data,t===Tw&&kw?null:t;default:return null}}function aj(t,e){if(da)return t==="compositionend"||!h0&&wT(t,e)?(t=xT(),Ad=c0=gi=null,da=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Aw(n)}}function TT(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?TT(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function kT(){for(var t=window,e=oh();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=oh(t.document)}return e}function f0(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function gj(t){var e=kT(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&TT(n.ownerDocument.documentElement,n)){if(r!==null&&f0(n)){if(e=r.start,t=r.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var s=n.textContent.length,i=Math.min(r.start,s);r=r.end===void 0?i:Math.min(r.end,s),!t.extend&&i>r&&(s=r,r=i,i=s),s=Pw(n,i);var o=Pw(n,r);s&&o&&(t.rangeCount!==1||t.anchorNode!==s.node||t.anchorOffset!==s.offset||t.focusNode!==o.node||t.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(s.node,s.offset),t.removeAllRanges(),i>r?(t.addRange(e),t.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,ha=null,ag=null,sc=null,lg=!1;function Rw(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;lg||ha==null||ha!==oh(r)||(r=ha,"selectionStart"in r&&f0(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),sc&&Rc(sc,r)||(sc=r,r=fh(ag,"onSelect"),0ma||(t.current=pg[ma],pg[ma]=null,ma--)}function ct(t,e){ma++,pg[ma]=t.current,t.current=e}var Di={},Cn=Hi(Di),Zn=Hi(!1),ko=Di;function Ua(t,e){var n=t.type.contextTypes;if(!n)return Di;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var s={},i;for(i in n)s[i]=e[i];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=s),s}function er(t){return t=t.childContextTypes,t!=null}function mh(){pt(Zn),pt(Cn)}function Fw(t,e,n){if(Cn.current!==Di)throw Error(re(168));ct(Cn,e),ct(Zn,n)}function MT(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in e))throw Error(re(108,dR(t)||"Unknown",s));return Tt({},n,r)}function gh(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Di,ko=Cn.current,ct(Cn,t),ct(Zn,Zn.current),!0}function zw(t,e,n){var r=t.stateNode;if(!r)throw Error(re(169));n?(t=MT(t,e,ko),r.__reactInternalMemoizedMergedChildContext=t,pt(Zn),pt(Cn),ct(Cn,t)):pt(Zn),ct(Zn,n)}var Rs=null,_f=!1,Mp=!1;function LT(t){Rs===null?Rs=[t]:Rs.push(t)}function Ij(t){_f=!0,LT(t)}function Gi(){if(!Mp&&Rs!==null){Mp=!0;var t=0,e=Je;try{var n=Rs;for(Je=1;t>=o,s-=o,Ds=1<<32-qr(e)+s|n<w?(C=T,T=null):C=T.sibling;var I=m(y,T,_[w],P);if(I===null){T===null&&(T=C);break}t&&T&&I.alternate===null&&e(y,T),v=i(I,v,w),k===null?D=I:k.sibling=I,k=I,T=C}if(w===_.length)return n(y,T),vt&&ao(y,w),D;if(T===null){for(;w<_.length;w++)T=h(y,_[w],P),T!==null&&(v=i(T,v,w),k===null?D=T:k.sibling=T,k=T);return vt&&ao(y,w),D}for(T=r(y,T);w<_.length;w++)C=p(T,y,w,_[w],P),C!==null&&(t&&C.alternate!==null&&T.delete(C.key===null?w:C.key),v=i(C,v,w),k===null?D=C:k.sibling=C,k=C);return t&&T.forEach(function(N){return e(y,N)}),vt&&ao(y,w),D}function b(y,v,_,P){var D=Pl(_);if(typeof D!="function")throw Error(re(150));if(_=D.call(_),_==null)throw Error(re(151));for(var k=D=null,T=v,w=v=0,C=null,I=_.next();T!==null&&!I.done;w++,I=_.next()){T.index>w?(C=T,T=null):C=T.sibling;var N=m(y,T,I.value,P);if(N===null){T===null&&(T=C);break}t&&T&&N.alternate===null&&e(y,T),v=i(N,v,w),k===null?D=N:k.sibling=N,k=N,T=C}if(I.done)return n(y,T),vt&&ao(y,w),D;if(T===null){for(;!I.done;w++,I=_.next())I=h(y,I.value,P),I!==null&&(v=i(I,v,w),k===null?D=I:k.sibling=I,k=I);return vt&&ao(y,w),D}for(T=r(y,T);!I.done;w++,I=_.next())I=p(T,y,w,I.value,P),I!==null&&(t&&I.alternate!==null&&T.delete(I.key===null?w:I.key),v=i(I,v,w),k===null?D=I:k.sibling=I,k=I);return t&&T.forEach(function(j){return e(y,j)}),vt&&ao(y,w),D}function E(y,v,_,P){if(typeof _=="object"&&_!==null&&_.type===ua&&_.key===null&&(_=_.props.children),typeof _=="object"&&_!==null){switch(_.$$typeof){case Wu:e:{for(var D=_.key,k=v;k!==null;){if(k.key===D){if(D=_.type,D===ua){if(k.tag===7){n(y,k.sibling),v=s(k,_.props.children),v.return=y,y=v;break e}}else if(k.elementType===D||typeof D=="object"&&D!==null&&D.$$typeof===li&&$w(D)===k.type){n(y,k.sibling),v=s(k,_.props),v.ref=Ll(y,k,_),v.return=y,y=v;break e}n(y,k);break}else e(y,k);k=k.sibling}_.type===ua?(v=wo(_.props.children,y.mode,P,_.key),v.return=y,y=v):(P=Od(_.type,_.key,_.props,null,y.mode,P),P.ref=Ll(y,v,_),P.return=y,y=P)}return o(y);case ca:e:{for(k=_.key;v!==null;){if(v.key===k)if(v.tag===4&&v.stateNode.containerInfo===_.containerInfo&&v.stateNode.implementation===_.implementation){n(y,v.sibling),v=s(v,_.children||[]),v.return=y,y=v;break e}else{n(y,v);break}else e(y,v);v=v.sibling}v=$p(_,y.mode,P),v.return=y,y=v}return o(y);case li:return k=_._init,E(y,v,k(_._payload),P)}if(Hl(_))return g(y,v,_,P);if(Pl(_))return b(y,v,_,P);sd(y,_)}return typeof _=="string"&&_!==""||typeof _=="number"?(_=""+_,v!==null&&v.tag===6?(n(y,v.sibling),v=s(v,_),v.return=y,y=v):(n(y,v),v=Up(_,y.mode,P),v.return=y,y=v),o(y)):n(y,v)}return E}var Ha=zT(!0),BT=zT(!1),vh=Hi(null),wh=null,xa=null,y0=null;function x0(){y0=xa=wh=null}function v0(t){var e=vh.current;pt(vh),t._currentValue=e}function yg(t,e,n){for(;t!==null;){var r=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),t===n)break;t=t.return}}function Aa(t,e){wh=t,y0=xa=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(Jn=!0),t.firstContext=null)}function jr(t){var e=t._currentValue;if(y0!==t)if(t={context:t,memoizedValue:e,next:null},xa===null){if(wh===null)throw Error(re(308));xa=t,wh.dependencies={lanes:0,firstContext:t}}else xa=xa.next=t;return e}var po=null;function w0(t){po===null?po=[t]:po.push(t)}function UT(t,e,n,r){var s=e.interleaved;return s===null?(n.next=n,w0(e)):(n.next=s.next,s.next=n),e.interleaved=n,$s(t,r)}function $s(t,e){t.lanes|=e;var n=t.alternate;for(n!==null&&(n.lanes|=e),n=t,t=t.return;t!==null;)t.childLanes|=e,n=t.alternate,n!==null&&(n.childLanes|=e),n=t,t=t.return;return n.tag===3?n.stateNode:null}var ci=!1;function b0(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function $T(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function Fs(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function Ti(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,We&2){var s=r.pending;return s===null?e.next=e:(e.next=s.next,s.next=e),r.pending=e,$s(t,n)}return s=r.interleaved,s===null?(e.next=e,w0(r)):(e.next=s.next,s.next=e),r.interleaved=e,$s(t,n)}function Rd(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,o0(t,n)}}function Hw(t,e){var n=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?s=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?s=i=e:i=i.next=e}else s=i=e;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:r.shared,effects:r.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function bh(t,e,n,r){var s=t.updateQueue;ci=!1;var i=s.firstBaseUpdate,o=s.lastBaseUpdate,a=s.shared.pending;if(a!==null){s.shared.pending=null;var l=a,c=l.next;l.next=null,o===null?i=c:o.next=c,o=l;var d=t.alternate;d!==null&&(d=d.updateQueue,a=d.lastBaseUpdate,a!==o&&(a===null?d.firstBaseUpdate=c:a.next=c,d.lastBaseUpdate=l))}if(i!==null){var h=s.baseState;o=0,d=c=l=null,a=i;do{var m=a.lane,p=a.eventTime;if((r&m)===m){d!==null&&(d=d.next={eventTime:p,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var g=t,b=a;switch(m=e,p=n,b.tag){case 1:if(g=b.payload,typeof g=="function"){h=g.call(p,h,m);break e}h=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=b.payload,m=typeof g=="function"?g.call(p,h,m):g,m==null)break e;h=Tt({},h,m);break e;case 2:ci=!0}}a.callback!==null&&a.lane!==0&&(t.flags|=64,m=s.effects,m===null?s.effects=[a]:m.push(a))}else p={eventTime:p,lane:m,tag:a.tag,payload:a.payload,callback:a.callback,next:null},d===null?(c=d=p,l=h):d=d.next=p,o|=m;if(a=a.next,a===null){if(a=s.shared.pending,a===null)break;m=a,a=m.next,m.next=null,s.lastBaseUpdate=m,s.shared.pending=null}}while(!0);if(d===null&&(l=h),s.baseState=l,s.firstBaseUpdate=c,s.lastBaseUpdate=d,e=s.shared.interleaved,e!==null){s=e;do o|=s.lane,s=s.next;while(s!==e)}else i===null&&(s.shared.lanes=0);No|=o,t.lanes=o,t.memoizedState=h}}function Gw(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;en?n:4,t(!0);var r=Vp.transition;Vp.transition={};try{t(!1),e()}finally{Je=n,Vp.transition=r}}function ok(){return Dr().memoizedState}function Rj(t,e,n){var r=Ci(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},ak(t))lk(e,n);else if(n=UT(t,e,n,r),n!==null){var s=Dn();Wr(n,t,r,s),ck(n,e,r)}}function jj(t,e,n){var r=Ci(t),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(ak(t))lk(e,s);else{var i=t.alternate;if(t.lanes===0&&(i===null||i.lanes===0)&&(i=e.lastRenderedReducer,i!==null))try{var o=e.lastRenderedState,a=i(o,n);if(s.hasEagerState=!0,s.eagerState=a,Qr(a,o)){var l=e.interleaved;l===null?(s.next=s,w0(e)):(s.next=l.next,l.next=s),e.interleaved=s;return}}catch{}finally{}n=UT(t,e,s,r),n!==null&&(s=Dn(),Wr(n,t,r,s),ck(n,e,r))}}function ak(t){var e=t.alternate;return t===Et||e!==null&&e===Et}function lk(t,e){ic=Sh=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function ck(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,o0(t,n)}}var Eh={readContext:jr,useCallback:wn,useContext:wn,useEffect:wn,useImperativeHandle:wn,useInsertionEffect:wn,useLayoutEffect:wn,useMemo:wn,useReducer:wn,useRef:wn,useState:wn,useDebugValue:wn,useDeferredValue:wn,useTransition:wn,useMutableSource:wn,useSyncExternalStore:wn,useId:wn,unstable_isNewReconciler:!1},Dj={readContext:jr,useCallback:function(t,e){return rs().memoizedState=[t,e===void 0?null:e],t},useContext:jr,useEffect:Ww,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,Dd(4194308,4,tk.bind(null,e,t),n)},useLayoutEffect:function(t,e){return Dd(4194308,4,t,e)},useInsertionEffect:function(t,e){return Dd(4,2,t,e)},useMemo:function(t,e){var n=rs();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=rs();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=Rj.bind(null,Et,t),[r.memoizedState,t]},useRef:function(t){var e=rs();return t={current:t},e.memoizedState=t},useState:qw,useDebugValue:N0,useDeferredValue:function(t){return rs().memoizedState=t},useTransition:function(){var t=qw(!1),e=t[0];return t=Pj.bind(null,t[1]),rs().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=Et,s=rs();if(vt){if(n===void 0)throw Error(re(407));n=n()}else{if(n=e(),un===null)throw Error(re(349));Io&30||WT(r,e,n)}s.memoizedState=n;var i={value:n,getSnapshot:e};return s.queue=i,Ww(YT.bind(null,r,i,t),[t]),r.flags|=2048,zc(9,KT.bind(null,r,i,n,e),void 0,null),n},useId:function(){var t=rs(),e=un.identifierPrefix;if(vt){var n=Ms,r=Ds;n=(r&~(1<<32-qr(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=Oc++,0<\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=o.createElement(n,{is:r.is}):(t=o.createElement(n),n==="select"&&(o=t,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):t=o.createElementNS(t,n),t[cs]=e,t[Mc]=r,vk(t,e,!1,!1),e.stateNode=t;e:{switch(o=Zm(n,r),n){case"dialog":ft("cancel",t),ft("close",t),s=r;break;case"iframe":case"object":case"embed":ft("load",t),s=r;break;case"video":case"audio":for(s=0;sWa&&(e.flags|=128,r=!0,Vl(i,!1),e.lanes=4194304)}else{if(!r)if(t=_h(o),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),Vl(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!vt)return bn(e),null}else 2*Vt()-i.renderingStartTime>Wa&&n!==1073741824&&(e.flags|=128,r=!0,Vl(i,!1),e.lanes=4194304);i.isBackwards?(o.sibling=e.child,e.child=o):(n=i.last,n!==null?n.sibling=o:e.child=o,i.last=o)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=Vt(),e.sibling=null,n=St.current,ct(St,r?n&1|2:n&1),e):(bn(e),null);case 22:case 23:return M0(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?dr&1073741824&&(bn(e),e.subtreeFlags&6&&(e.flags|=8192)):bn(e),null;case 24:return null;case 25:return null}throw Error(re(156,e.tag))}function Uj(t,e){switch(m0(e),e.tag){case 1:return er(e.type)&&mh(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Ga(),pt(Zn),pt(Cn),E0(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return S0(e),null;case 13:if(pt(St),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(re(340));$a()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return pt(St),null;case 4:return Ga(),null;case 10:return v0(e.type._context),null;case 22:case 23:return M0(),null;case 24:return null;default:return null}}var od=!1,En=!1,$j=typeof WeakSet=="function"?WeakSet:Set,pe=null;function va(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){jt(t,e,r)}else n.current=null}function kg(t,e,n){try{n()}catch(r){jt(t,e,r)}}var sb=!1;function Hj(t,e){if(cg=dh,t=kT(),f0(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,a=-1,l=-1,c=0,d=0,h=t,m=null;t:for(;;){for(var p;h!==n||s!==0&&h.nodeType!==3||(a=o+s),h!==i||r!==0&&h.nodeType!==3||(l=o+r),h.nodeType===3&&(o+=h.nodeValue.length),(p=h.firstChild)!==null;)m=h,h=p;for(;;){if(h===t)break t;if(m===n&&++c===s&&(a=o),m===i&&++d===r&&(l=o),(p=h.nextSibling)!==null)break;h=m,m=h.parentNode}h=p}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(ug={focusedElem:t,selectionRange:n},dh=!1,pe=e;pe!==null;)if(e=pe,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,pe=t;else for(;pe!==null;){e=pe;try{var g=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var b=g.memoizedProps,E=g.memoizedState,y=e.stateNode,v=y.getSnapshotBeforeUpdate(e.elementType===e.type?b:zr(e.type,b),E);y.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var _=e.stateNode.containerInfo;_.nodeType===1?_.textContent="":_.nodeType===9&&_.documentElement&&_.removeChild(_.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(re(163))}}catch(P){jt(e,e.return,P)}if(t=e.sibling,t!==null){t.return=e.return,pe=t;break}pe=e.return}return g=sb,sb=!1,g}function oc(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&t)===t){var i=s.destroy;s.destroy=void 0,i!==void 0&&kg(e,n,i)}s=s.next}while(s!==r)}}function Tf(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function Cg(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function _k(t){var e=t.alternate;e!==null&&(t.alternate=null,_k(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[cs],delete e[Mc],delete e[fg],delete e[kj],delete e[Cj])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function Sk(t){return t.tag===5||t.tag===3||t.tag===4}function ib(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Sk(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Ig(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=ph));else if(r!==4&&(t=t.child,t!==null))for(Ig(t,e,n),t=t.sibling;t!==null;)Ig(t,e,n),t=t.sibling}function Ng(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(Ng(t,e,n),t=t.sibling;t!==null;)Ng(t,e,n),t=t.sibling}var dn=null,Br=!1;function ri(t,e,n){for(n=n.child;n!==null;)Ek(t,e,n),n=n.sibling}function Ek(t,e,n){if(ds&&typeof ds.onCommitFiberUnmount=="function")try{ds.onCommitFiberUnmount(yf,n)}catch{}switch(n.tag){case 5:En||va(n,e);case 6:var r=dn,s=Br;dn=null,ri(t,e,n),dn=r,Br=s,dn!==null&&(Br?(t=dn,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):dn.removeChild(n.stateNode));break;case 18:dn!==null&&(Br?(t=dn,n=n.stateNode,t.nodeType===8?Dp(t.parentNode,n):t.nodeType===1&&Dp(t,n),Ac(t)):Dp(dn,n.stateNode));break;case 4:r=dn,s=Br,dn=n.stateNode.containerInfo,Br=!0,ri(t,e,n),dn=r,Br=s;break;case 0:case 11:case 14:case 15:if(!En&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var i=s,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&kg(n,e,o),s=s.next}while(s!==r)}ri(t,e,n);break;case 1:if(!En&&(va(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){jt(n,e,a)}ri(t,e,n);break;case 21:ri(t,e,n);break;case 22:n.mode&1?(En=(r=En)||n.memoizedState!==null,ri(t,e,n),En=r):ri(t,e,n);break;default:ri(t,e,n)}}function ob(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new $j),e.forEach(function(r){var s=Zj.bind(null,t,r);n.has(r)||(n.add(r),r.then(s,s))})}}function Vr(t,e){var n=e.deletions;if(n!==null)for(var r=0;rs&&(s=o),r&=~i}if(r=s,r=Vt()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*qj(r/1960))-r,10t?16:t,yi===null)var r=!1;else{if(t=yi,yi=null,Ch=0,We&6)throw Error(re(331));var s=We;for(We|=4,pe=t.current;pe!==null;){var i=pe,o=i.child;if(pe.flags&16){var a=i.deletions;if(a!==null){for(var l=0;lVt()-j0?vo(t,0):R0|=n),tr(t,e)}function Rk(t,e){e===0&&(t.mode&1?(e=Xu,Xu<<=1,!(Xu&130023424)&&(Xu=4194304)):e=1);var n=Dn();t=$s(t,e),t!==null&&(ou(t,e,n),tr(t,n))}function Jj(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),Rk(t,n)}function Zj(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,s=t.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(re(314))}r!==null&&r.delete(e),Rk(t,n)}var jk;jk=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||Zn.current)Jn=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return Jn=!1,zj(t,e,n);Jn=!!(t.flags&131072)}else Jn=!1,vt&&e.flags&1048576&&VT(e,xh,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;Md(t,e),t=e.pendingProps;var s=Ua(e,Cn.current);Aa(e,n),s=k0(null,e,r,t,s,n);var i=C0();return e.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,er(r)?(i=!0,gh(e)):i=!1,e.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,b0(e),s.updater=Ef,e.stateNode=s,s._reactInternals=e,vg(e,r,t,n),e=_g(null,e,r,!0,i,n)):(e.tag=0,vt&&i&&p0(e),Pn(null,e,s,n),e=e.child),e;case 16:r=e.elementType;e:{switch(Md(t,e),t=e.pendingProps,s=r._init,r=s(r._payload),e.type=r,s=e.tag=tD(r),t=zr(r,t),s){case 0:e=bg(null,e,r,t,n);break e;case 1:e=tb(null,e,r,t,n);break e;case 11:e=Zw(null,e,r,t,n);break e;case 14:e=eb(null,e,r,zr(r.type,t),n);break e}throw Error(re(306,r,""))}return e;case 0:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:zr(r,s),bg(t,e,r,s,n);case 1:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:zr(r,s),tb(t,e,r,s,n);case 3:e:{if(gk(e),t===null)throw Error(re(387));r=e.pendingProps,i=e.memoizedState,s=i.element,$T(t,e),bh(e,r,null,n);var o=e.memoizedState;if(r=o.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=i,e.memoizedState=i,e.flags&256){s=qa(Error(re(423)),e),e=nb(t,e,r,n,s);break e}else if(r!==s){s=qa(Error(re(424)),e),e=nb(t,e,r,n,s);break e}else for(mr=Ei(e.stateNode.containerInfo.firstChild),xr=e,vt=!0,Ur=null,n=BT(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if($a(),r===s){e=Hs(t,e,n);break e}Pn(t,e,r,n)}e=e.child}return e;case 5:return HT(e),t===null&&gg(e),r=e.type,s=e.pendingProps,i=t!==null?t.memoizedProps:null,o=s.children,dg(r,s)?o=null:i!==null&&dg(r,i)&&(e.flags|=32),mk(t,e),Pn(t,e,o,n),e.child;case 6:return t===null&&gg(e),null;case 13:return yk(t,e,n);case 4:return _0(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=Ha(e,null,r,n):Pn(t,e,r,n),e.child;case 11:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:zr(r,s),Zw(t,e,r,s,n);case 7:return Pn(t,e,e.pendingProps,n),e.child;case 8:return Pn(t,e,e.pendingProps.children,n),e.child;case 12:return Pn(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,s=e.pendingProps,i=e.memoizedProps,o=s.value,ct(vh,r._currentValue),r._currentValue=o,i!==null)if(Qr(i.value,o)){if(i.children===s.children&&!Zn.current){e=Hs(t,e,n);break e}}else for(i=e.child,i!==null&&(i.return=e);i!==null;){var a=i.dependencies;if(a!==null){o=i.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(i.tag===1){l=Fs(-1,n&-n),l.tag=2;var c=i.updateQueue;if(c!==null){c=c.shared;var d=c.pending;d===null?l.next=l:(l.next=d.next,d.next=l),c.pending=l}}i.lanes|=n,l=i.alternate,l!==null&&(l.lanes|=n),yg(i.return,n,e),a.lanes|=n;break}l=l.next}}else if(i.tag===10)o=i.type===e.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(re(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),yg(o,n,e),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===e){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}Pn(t,e,s.children,n),e=e.child}return e;case 9:return s=e.type,r=e.pendingProps.children,Aa(e,n),s=jr(s),r=r(s),e.flags|=1,Pn(t,e,r,n),e.child;case 14:return r=e.type,s=zr(r,e.pendingProps),s=zr(r.type,s),eb(t,e,r,s,n);case 15:return fk(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:zr(r,s),Md(t,e),e.tag=1,er(r)?(t=!0,gh(e)):t=!1,Aa(e,n),uk(e,r,s),vg(e,r,s,n),_g(null,e,r,!0,t,n);case 19:return xk(t,e,n);case 22:return pk(t,e,n)}throw Error(re(156,e.tag))};function Dk(t,e){return aT(t,e)}function eD(t,e,n,r){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ir(t,e,n,r){return new eD(t,e,n,r)}function V0(t){return t=t.prototype,!(!t||!t.isReactComponent)}function tD(t){if(typeof t=="function")return V0(t)?1:0;if(t!=null){if(t=t.$$typeof,t===n0)return 11;if(t===r0)return 14}return 2}function Ii(t,e){var n=t.alternate;return n===null?(n=Ir(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function Od(t,e,n,r,s,i){var o=2;if(r=t,typeof t=="function")V0(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case ua:return wo(n.children,s,i,e);case t0:o=8,s|=8;break;case $m:return t=Ir(12,n,e,s|2),t.elementType=$m,t.lanes=i,t;case Hm:return t=Ir(13,n,e,s),t.elementType=Hm,t.lanes=i,t;case Gm:return t=Ir(19,n,e,s),t.elementType=Gm,t.lanes=i,t;case HE:return Cf(n,s,i,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case UE:o=10;break e;case $E:o=9;break e;case n0:o=11;break e;case r0:o=14;break e;case li:o=16,r=null;break e}throw Error(re(130,t==null?t:typeof t,""))}return e=Ir(o,n,e,s),e.elementType=t,e.type=r,e.lanes=i,e}function wo(t,e,n,r){return t=Ir(7,t,r,e),t.lanes=n,t}function Cf(t,e,n,r){return t=Ir(22,t,r,e),t.elementType=HE,t.lanes=n,t.stateNode={isHidden:!1},t}function Up(t,e,n){return t=Ir(6,t,null,e),t.lanes=n,t}function $p(t,e,n){return e=Ir(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function nD(t,e,n,r,s){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Sp(0),this.expirationTimes=Sp(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Sp(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function O0(t,e,n,r,s,i,o,a,l){return t=new nD(t,e,n,a,l),e===1?(e=1,i===!0&&(e|=8)):e=0,i=Ir(3,null,null,e),t.current=i,i.stateNode=t,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},b0(i),t}function rD(t,e,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Ok)}catch(t){console.error(t)}}Ok(),OE.exports=br;var Fk=OE.exports;const lD=mf(Fk);var zk,pb=Fk;zk=pb.createRoot,pb.hydrateRoot;/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */var cD={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"};/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const uD=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),ye=(t,e)=>{const n=V.forwardRef(({color:r="currentColor",size:s=24,strokeWidth:i=2,absoluteStrokeWidth:o,className:a="",children:l,...c},d)=>V.createElement("svg",{ref:d,...cD,width:s,height:s,stroke:r,strokeWidth:o?Number(i)*24/Number(s):i,className:["lucide",`lucide-${uD(t)}`,a].join(" "),...c},[...e.map(([h,m])=>V.createElement(h,m)),...Array.isArray(l)?l:[l]]));return n.displayName=`${t}`,n};/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const dD=ye("AlertCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const hD=ye("AlertTriangle",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z",key:"c3ski4"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Nr=ye("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const mb=ye("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const fD=ye("ArrowUpDown",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Bk=ye("BookOpen",[["path",{d:"M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z",key:"vv98re"}],["path",{d:"M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z",key:"1cyq3y"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const pD=ye("Book",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H20v20H6.5a2.5 2.5 0 0 1 0-5H20",key:"t4utmx"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const gb=ye("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Rf=ye("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const mD=ye("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const U0=ye("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const uu=ye("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const gD=ye("ChevronsLeft",[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const yD=ye("ChevronsRight",[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const xD=ye("ChevronsUpDown",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const vD=ye("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Uk=ye("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const wD=ye("Eraser",[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const $k=ye("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const yb=ye("Eye",[["path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z",key:"rwhkz3"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Dg=ye("Film",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 3v18",key:"bbkbws"}],["path",{d:"M3 7.5h4",key:"zfgn84"}],["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 16.5h4",key:"1230mu"}],["path",{d:"M17 3v18",key:"in4fa5"}],["path",{d:"M17 7.5h4",key:"myr1c1"}],["path",{d:"M17 16.5h4",key:"go4c1d"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const bD=ye("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const xb=ye("FolderInput",[["path",{d:"M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1",key:"fm4g5t"}],["path",{d:"M2 13h10",key:"pgb2dq"}],["path",{d:"m9 16 3-3-3-3",key:"6m91ic"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Hk=ye("FolderPlus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const hr=ye("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const vb=ye("Grid2x2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M12 3v18",key:"108xh3"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const wb=ye("Grid3x3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const _D=ye("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const SD=ye("ImagePlus",[["path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7",key:"31hg93"}],["line",{x1:"16",x2:"22",y1:"5",y2:"5",key:"ez7e4s"}],["line",{x1:"19",x2:"19",y1:"2",y2:"8",key:"1gkr8c"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Gk=ye("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const qk=ye("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ra=ye("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const bb=ye("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const _b=ye("Loader2",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Wk=ye("Megaphone",[["path",{d:"m3 11 18-5v12L3 14v-3z",key:"n962bs"}],["path",{d:"M11.6 16.8a3 3 0 1 1-5.8-1.6",key:"1yl0tm"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ED=ye("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const TD=ye("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const jf=ye("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z",key:"ymcmye"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Kk=ye("Pen",[["path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z",key:"5qss01"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Hp=ye("PlayCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polygon",{points:"10 8 16 12 10 16 10 8",key:"1cimsy"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const kD=ye("PlaySquare",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m9 8 6 4-6 4Z",key:"f1r3lt"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const as=ye("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const CD=ye("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Yk=ye("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Sb=ye("Rows2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 12h18",key:"1i2n21"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const sl=ye("Save",[["path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z",key:"1owoqh"}],["polyline",{points:"17 21 17 13 7 13 7 21",key:"1md35c"}],["polyline",{points:"7 3 7 8 15 8",key:"8nz8an"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const il=ye("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Eb=ye("Send",[["path",{d:"m22 2-7 20-4-9-9-4Z",key:"1q3vgg"}],["path",{d:"M22 2 11 13",key:"nzbqef"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ID=ye("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Qk=ye("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Mg=ye("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ND=ye("Timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const pn=ye("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const AD=ye("Tv",[["rect",{width:"20",height:"15",x:"2",y:"7",rx:"2",ry:"2",key:"10ag99"}],["polyline",{points:"17 2 12 7 7 2",key:"11pgbg"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const PD=ye("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Xk=ye("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Jk=ye("Video",[["path",{d:"m22 8-6 4 6 4V8Z",key:"50v9me"}],["rect",{width:"14",height:"12",x:"2",y:"6",rx:"2",ry:"2",key:"1rqjg6"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const mt=ye("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Zk=ye("ZoomIn",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const e2=ye("ZoomOut",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]),Gp=new Set;function pr({src:t,alt:e,className:n="",imgClassName:r="",objectFit:s="contain",aspectRatio:i,loading:o,draggable:a,showControls:l=!1,objectPosition:c}){const d=Gp.has(t),[h,m]=V.useState(d),[p,g]=V.useState(!1),[b,E]=V.useState(0);V.useEffect(()=>{Gp.has(t)?(m(!0),g(!1)):(m(!1),g(!1)),E(0)},[t]);const y=()=>{g(!1),m(!1),E(D=>D+1)},v=()=>{m(!0),g(!1),Gp.add(t)},_=b>0?`${t}${t.includes("?")?"&":"?"}retry=${b}`:t,P=_.includes("format=mp4")||_.toLowerCase().endsWith(".mp4")||_.toLowerCase().endsWith(".webm");return u.jsxs("div",{className:`relative w-full h-full overflow-hidden ${p?"bg-[#1a1a1a]/50 rounded-lg min-h-[300px]":""} ${n}`,style:i&&i!=="auto"?{aspectRatio:i}:void 0,children:[u.jsx("div",{className:`absolute inset-0 flex items-center justify-center transition-opacity duration-500 ${h?"opacity-0 pointer-events-none":"opacity-100"}`,children:p?u.jsxs("div",{className:"flex flex-col items-center justify-center p-6 text-center max-w-sm w-full h-full",children:[u.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center mb-3",children:u.jsx(dD,{className:"w-6 h-6 text-red-500"})}),u.jsx("p",{className:"text-sm text-gray-400 mb-4",children:"La imagen no cargó. El servidor podría tener problemas."}),u.jsxs("button",{onClick:y,className:"flex items-center justify-center gap-2 px-4 py-2 bg-gray-800 hover:bg-gray-700 text-white rounded-lg transition-colors border border-gray-700 w-full max-w-[200px]",children:[u.jsx(Yk,{className:"w-4 h-4"}),u.jsxs("span",{children:["Reintentar (",b,")"]})]})]}):u.jsx("div",{className:"w-8 h-8 border-2 border-[#bb86fc] border-t-transparent rounded-full animate-spin"})}),!p&&(P?u.jsx("video",{src:_,autoPlay:!l,loop:!l,muted:!l,playsInline:!0,controls:l,className:`w-full h-full object-${s} transition-all duration-1000 ease-linear ${r} ${h?"opacity-100":"opacity-0"}`,style:{objectPosition:c},onLoadedData:v,onError:()=>{g(!0),m(!1)}}):u.jsx("img",{src:_,alt:e,loading:o,draggable:a,className:`w-full h-full object-${s} transition-all duration-1000 ease-linear ${r} ${h?"opacity-100":"opacity-0"}`,style:{objectPosition:c},onLoad:v,onError:()=>{g(!0),m(!1)}}))]})}function RD({images:t,initialIndex:e,onClose:n}){const[r,s]=V.useState(e),[i,o]=V.useState(!1),[a,l]=V.useState(0),[c,d]=V.useState(1),[h,m]=V.useState({x:0,y:0}),[p,g]=V.useState(!1),[b,E]=V.useState({x:0,y:0}),[y,v]=V.useState(null),[_,P]=V.useState(1),D=V.useRef(null);V.useEffect(()=>(document.body.style.overflow="hidden",()=>{document.body.style.overflow="unset"}),[]);const k=$=>{const ee=t.length;return($%ee+ee)%ee},T=$=>Math.hypot($[0].clientX-$[1].clientX,$[0].clientY-$[1].clientY),w=($,ee)=>{const J=window.innerWidth,ae=window.innerHeight,ce=(J*ee-J)/2,Ze=(ae*ee-ae)/2;return{x:Math.min(Math.max($.x,-ce),ce),y:Math.min(Math.max($.y,-Ze),Ze)}},C=i?2:1,I=()=>{s($=>k($-C)),l(0),d(1),m({x:0,y:0})},N=()=>{s($=>k($+C)),l(0),d(1),m({x:0,y:0})},j=($,ee)=>{g(!0),E({x:$,y:ee})},A=($,ee)=>{if(p)if(c>1){const J=$-b.x,ae=ee-b.y;m(ce=>({x:ce.x+J,y:ce.y+ae})),E({x:$,y:ee})}else{const J=$-b.x;l(J)}},z=()=>{var J;if(g(!1),v(null),c>1)return;const ee=(((J=D.current)==null?void 0:J.clientWidth)||window.innerWidth)*.25;Math.abs(a)>ee?a>0?I():N():l(0)},B=$=>{$.preventDefault(),j($.clientX,$.clientY)},q=$=>{$.preventDefault(),A($.clientX,$.clientY)},X=()=>z(),O=$=>{if($.touches.length===2){const ee=T($.touches);v(ee),P(c),g(!1)}else $.touches.length===1&&j($.touches[0].clientX,$.touches[0].clientY)},H=$=>{if($.touches.length===2&&y!==null){const J=T($.touches)/y,ae=Math.min(Math.max(_*J,1),4);d(ae),m(ce=>w(ce,ae))}else $.touches.length===1&&A($.touches[0].clientX,$.touches[0].clientY)},R=$=>{if(y!==null&&$.touches.length<2){v(null);return}z()};V.useEffect(()=>{function $(ee){ee.key==="Escape"?n():ee.key==="ArrowLeft"?I():ee.key==="ArrowRight"?N():ee.key==="+"||ee.key==="="?d(J=>{const ae=Math.min(J+.5,4);return m(ce=>w(ce,ae)),ae}):ee.key==="-"&&d(J=>{const ae=Math.max(J-.5,1);return m(ce=>w(ce,ae)),ae})}return window.addEventListener("keydown",$),()=>window.removeEventListener("keydown",$)},[c,i]);let Y=`translateX(calc(-33.333333% + ${a}px))`,se=p?"none":"transform 0.1s ease-out";a===0&&(se="none");const M=$=>{const ee=k($);if(i){const J=k($+1);return u.jsxs("div",{className:"flex w-full h-full items-center justify-center px-2 sm:px-10",children:[u.jsx("div",{className:"flex-1 h-full flex items-center justify-end",children:u.jsx(pr,{src:t[ee],alt:`Página ${ee+1}`,aspectRatio:"auto",objectFit:"contain",loading:"lazy",draggable:!1,imgClassName:"max-w-full max-h-screen object-contain select-none shadow-lg origin-right object-right transition-none",showControls:!0})}),u.jsx("div",{className:"flex-1 h-full flex items-center justify-start",children:u.jsx(pr,{src:t[J],alt:`Página ${J+1}`,aspectRatio:"auto",objectFit:"contain",loading:"lazy",draggable:!1,imgClassName:"max-w-full max-h-screen object-contain select-none shadow-lg origin-left object-left transition-none",showControls:!0})})]})}else return u.jsx(pr,{src:t[ee],alt:`Página ${ee+1}`,aspectRatio:"auto",objectFit:"contain",loading:"lazy",draggable:!1,imgClassName:"max-w-full max-h-screen object-contain select-none shadow-2xl transition-none",showControls:!0})};return u.jsxs("div",{className:"fixed inset-0 bg-black/95 flex items-center justify-center z-50 select-none touch-none overflow-hidden",style:{touchAction:"none"},ref:D,onWheel:$=>{$.stopPropagation();const ee=$.deltaY<0?.5:-.5;d(J=>{const ae=Math.min(Math.max(J+ee,1),4);return m(ce=>w(ce,ae)),ae})},onMouseDown:B,onMouseMove:q,onMouseUp:X,onMouseLeave:()=>{g(!1),c===1&&l(0)},onTouchStart:O,onTouchMove:H,onTouchEnd:R,children:[u.jsxs("div",{className:"absolute top-6 right-6 flex items-center gap-4 z-50",children:[u.jsxs("div",{className:"flex items-center gap-2 bg-black/50 rounded-lg p-1",children:[u.jsx("button",{onClick:()=>o(!i),className:`p-2 transition-colors ${i?"text-[#bb86fc]":"text-white hover:text-[#bb86fc]"}`,title:i?"Vista Individual":"Vista de Libro",children:i?u.jsx(Bk,{className:"w-5 h-5"}):u.jsx(pD,{className:"w-5 h-5"})}),u.jsx("div",{className:"w-px h-4 bg-white/20 mx-1"}),u.jsx("button",{onClick:()=>d($=>{const ee=Math.max($-.5,1);return m(J=>w(J,ee)),ee}),className:"p-2 text-white hover:text-[#bb86fc] transition-colors",children:u.jsx(e2,{className:"w-5 h-5"})}),u.jsxs("span",{className:"text-white text-sm min-w-[3ch] text-center",children:[Math.round(c*100),"%"]}),u.jsx("button",{onClick:()=>d($=>{const ee=Math.min($+.5,4);return m(J=>w(J,ee)),ee}),className:"p-2 text-white hover:text-[#bb86fc] transition-colors",children:u.jsx(Zk,{className:"w-5 h-5"})})]}),u.jsx("button",{onClick:n,className:"p-2 rounded-lg bg-white/10 hover:bg-white/20 text-white transition-all duration-200",children:u.jsx(mt,{className:"w-6 h-6"})})]}),u.jsxs("div",{className:"flex h-full w-[300%] absolute top-0 left-0",style:{transform:Y,transition:se},children:[u.jsx("div",{className:"w-1/3 h-full flex items-center justify-center relative",children:M(r-C)}),u.jsx("div",{className:"w-1/3 h-full flex items-center justify-center relative",children:u.jsx("div",{className:"relative flex items-center justify-center w-full h-full",style:{transform:`translate(${h.x}px, ${h.y}px) scale(${c})`,transition:p?"none":"transform 0.1s ease-out",cursor:c>1?p?"grabbing":"grab":"default"},onDoubleClick:$=>{$.stopPropagation(),d(ee=>ee>1?1:2.5),m({x:0,y:0})},children:M(r)})}),u.jsx("div",{className:"w-1/3 h-full flex items-center justify-center relative",children:M(r+C)})]}),c===1&&u.jsxs(u.Fragment,{children:[u.jsx("button",{onClick:$=>{$.stopPropagation(),I()},className:"absolute left-4 sm:left-8 top-1/2 -translate-y-1/2 p-3 sm:p-4 rounded-lg text-white opacity-40 hover:opacity-100 transition-opacity duration-200 z-40",children:u.jsx(U0,{className:"w-8 h-8 sm:w-10 sm:h-10"})}),u.jsx("button",{onClick:$=>{$.stopPropagation(),N()},className:"absolute right-4 sm:right-8 top-1/2 -translate-y-1/2 p-3 sm:p-4 rounded-lg text-white opacity-40 hover:opacity-100 transition-opacity duration-200 z-40",children:u.jsx(uu,{className:"w-8 h-8 sm:w-10 sm:h-10"})})]}),u.jsx("div",{className:"absolute bottom-6 left-1/2 -translate-x-1/2 bg-black/60 text-white px-4 py-2 rounded-lg text-sm font-medium z-40 pointer-events-none",children:i?`${r+1}-${Math.min(r+2,t.length)} / ${t.length}`:`${r+1} / ${t.length}`})]})}function Df({isAdmin:t,onOpenTrash:e}){return u.jsxs("footer",{className:"py-6 border-t border-gray-800/50 flex flex-col md:flex-row items-center justify-between gap-4 text-gray-400 text-sm mt-auto w-full px-8 relative",children:[u.jsxs("div",{className:"flex flex-wrap justify-center gap-6 mx-auto",children:[u.jsxs("a",{href:"https://t.me/twistedbrody",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 hover:text-[#bb86fc] transition-colors",children:[u.jsx("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"currentColor",children:u.jsx("path",{d:"M12 0C5.373 0 0 5.373 0 12s5.373 12 12 12 12-5.373 12-12S18.627 0 12 0zm5.894 8.221l-1.97 9.28c-.145.658-.537.818-1.084.508l-3-2.21-1.446 1.394c-.16.16-.295.295-.605.295l.213-3.054 5.56-5.022c.242-.213-.054-.333-.373-.121l-6.869 4.326-2.96-.924c-.64-.203-.658-.64.135-.954l11.566-4.458c.538-.196 1.006.128.832.941z"})}),"Twisted Streaming Brody"]}),u.jsxs("a",{href:"https://t.me/+CmmZFHM9hpViYzMx",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 hover:text-[#bb86fc] transition-colors",children:[u.jsx("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"currentColor",children:u.jsx("path",{d:"M12 0C5.373 0 0 5.373 0 12s5.373 12 12 12 12-5.373 12-12S18.627 0 12 0zm5.894 8.221l-1.97 9.28c-.145.658-.537.818-1.084.508l-3-2.21-1.446 1.394c-.16.16-.295.295-.605.295l.213-3.054 5.56-5.022c.242-.213-.054-.333-.373-.121l-6.869 4.326-2.96-.924c-.64-.203-.658-.64.135-.954l11.566-4.458c.538-.196 1.006.128.832.941z"})}),"Canal Hub"]}),u.jsxs("a",{href:"https://x.com/TwistedBrody",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 hover:text-[#bb86fc] transition-colors",children:[u.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:u.jsx("path",{d:"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"})}),"X"]}),u.jsxs("a",{href:"https://www.patreon.com/cw/Twistedbrody",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 hover:text-[#bb86fc] transition-colors",children:[u.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:u.jsx("path",{d:"M0 .48v23.04h4.22V.48zm15.385 0c-4.764 0-8.641 3.88-8.641 8.65 0 4.755 3.877 8.623 8.641 8.623 4.75 0 8.615-3.868 8.615-8.623C24 4.36 20.136.48 15.385.48z"})}),"Patreon"]}),u.jsxs("button",{onClick:()=>{window.location.hash="info"},className:"flex items-center gap-2 hover:text-[#bb86fc] transition-colors",children:[u.jsx(qk,{className:"w-4 h-4"}),u.jsx("span",{children:"Info"})]}),t&&e&&u.jsxs("button",{onClick:e,className:"flex items-center gap-2 text-gray-400 hover:text-red-400 transition-colors",children:[u.jsx(pn,{className:"w-4 h-4"}),u.jsx("span",{children:"Papelera"})]})]}),u.jsxs("div",{className:"md:absolute md:right-8 text-xs opacity-50",children:["Twisted Streaming Brody © ",new Date().getFullYear()]})]})}function jD({children:t,rootMargin:e="150% 0px 150% 0px",minHeight:n,className:r=""}){const s=V.useRef(null),[i,o]=V.useState(!1);return V.useEffect(()=>{if(i)return;const a=new IntersectionObserver(l=>{const[c]=l;c.isIntersecting&&o(!0)},{rootMargin:e});return s.current&&a.observe(s.current),()=>{a.disconnect()}},[i,e]),u.jsx("div",{ref:s,style:n?{minHeight:n}:void 0,className:`w-full flex items-center justify-center ${r}`,children:i?t(!0):null})}function DD({manga:t,onBack:e}){const n=t.chapters&&t.chapters.length>0?t.chapters[0]:null,r=n?n.original_pages&&n.original_pages.length>0?n.original_pages:n.pages:[],[s,i]=V.useState("vertical"),[o,a]=V.useState(1),[l,c]=V.useState(!1),[d,h]=V.useState(0);if(!r||r.length===0)return u.jsxs("div",{className:"min-h-screen bg-[#121212] flex flex-col items-center justify-center",children:[u.jsx("button",{onClick:e,className:"absolute top-6 left-6 p-2 hover:bg-[#333] rounded-lg transition-colors text-white",children:u.jsx(Nr,{className:"w-6 h-6"})}),u.jsx("div",{className:"text-gray-400 text-lg",children:"No hay páginas disponibles"})]});const m=()=>a(b=>Math.min(b+.25,3)),p=()=>a(b=>Math.max(b-.25,.5)),g=()=>a(1);return u.jsxs("div",{className:"min-h-screen flex flex-col bg-[#121212]",children:[u.jsxs("header",{className:"sticky top-0 z-50 bg-[#121212]/90 backdrop-blur-md border-b border-gray-800 px-4 py-3 flex items-center justify-between gap-4",children:[u.jsx("div",{className:"flex items-center gap-2 flex-shrink-0",children:u.jsxs("button",{onClick:e,className:"p-2 hover:bg-[#333] rounded-lg transition-colors text-white flex items-center gap-2",children:[u.jsx(Nr,{className:"w-5 h-5"}),u.jsx("span",{className:"font-semibold text-sm hidden sm:inline",children:"Volver"})]})}),u.jsx("div",{className:"flex-1 flex justify-center min-w-0",children:u.jsxs("h1",{className:"text-white font-bold truncate text-center max-w-full",children:[t.title," ",u.jsx("span",{className:"text-[#bb86fc] text-xs ml-2 border border-[#bb86fc] px-1 rounded",children:"HD"})]})}),u.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[u.jsxs("div",{className:"flex items-center gap-1 bg-[#0a0a0a] border border-gray-800 rounded-lg p-1 hidden md:flex",children:[u.jsx("button",{onClick:()=>i("vertical"),className:`p-2 rounded-md transition-all duration-200 ${s==="vertical"?"bg-[#bb86fc] text-white":"text-gray-400 hover:text-white"}`,title:"Vertical",children:u.jsx(Sb,{className:"w-4 h-4"})}),u.jsx("button",{onClick:()=>i("gallery"),className:`p-2 rounded-md transition-all duration-200 ${s==="gallery"?"bg-[#bb86fc] text-white":"text-gray-400 hover:text-white"}`,title:"Galería",children:u.jsx(vb,{className:"w-4 h-4"})}),u.jsx("button",{onClick:()=>i("grid"),className:`p-2 rounded-md transition-all duration-200 ${s==="grid"?"bg-[#bb86fc] text-white":"text-gray-400 hover:text-white"}`,title:"Cuadrícula",children:u.jsx(wb,{className:"w-4 h-4"})})]}),s==="vertical"&&u.jsxs("div",{className:"flex items-center gap-1 bg-[#0a0a0a] border border-gray-800 rounded-lg p-1",children:[u.jsx("button",{onClick:p,className:"p-2 text-gray-400 hover:text-white hover:bg-[#333] rounded",children:u.jsx(e2,{className:"w-4 h-4"})}),u.jsxs("span",{className:"text-xs text-gray-300 w-8 text-center",children:[Math.round(o*100),"%"]}),u.jsx("button",{onClick:m,className:"p-2 text-gray-400 hover:text-white hover:bg-[#333] rounded",children:u.jsx(Zk,{className:"w-4 h-4"})}),u.jsx("button",{onClick:g,className:"p-2 text-gray-400 hover:text-white hover:bg-[#333] rounded",title:"Reset",children:u.jsx(Yk,{className:"w-3 h-3"})})]})]})]}),u.jsx("div",{className:"md:hidden px-4 py-2 border-b border-gray-800 bg-[#121212] flex justify-center",children:u.jsxs("div",{className:"flex items-center gap-1 bg-[#0a0a0a] border border-gray-800 rounded-lg p-1",children:[u.jsxs("button",{onClick:()=>i("vertical"),className:`px-3 py-1.5 rounded-md flex items-center gap-2 text-xs font-medium ${s==="vertical"?"bg-[#bb86fc] text-white":"text-gray-400"}`,children:[u.jsx(Sb,{className:"w-3 h-3"})," Vertical"]}),u.jsxs("button",{onClick:()=>i("gallery"),className:`px-3 py-1.5 rounded-md flex items-center gap-2 text-xs font-medium ${s==="gallery"?"bg-[#bb86fc] text-white":"text-gray-400"}`,children:[u.jsx(vb,{className:"w-3 h-3"})," Galería"]}),u.jsxs("button",{onClick:()=>i("grid"),className:`px-3 py-1.5 rounded-md flex items-center gap-2 text-xs font-medium ${s==="grid"?"bg-[#bb86fc] text-white":"text-gray-400"}`,children:[u.jsx(wb,{className:"w-3 h-3"})," Cuadrícula"]})]})}),u.jsx("main",{className:"flex-1 w-full max-w-[1920px] mx-auto px-0 sm:px-4 py-0 sm:py-6",children:u.jsx("div",{className:` + bg-[#050505] min-h-screen transition-all duration-150 ease-out + ${s==="vertical"?"flex flex-col items-center gap-0 sm:gap-1":""} + ${s==="gallery"?"masonry-container p-2":""} + ${s==="grid"?"grid grid-cols-3 md:grid-cols-5 gap-2 p-2":""} + `,children:r.map((b,E)=>{const y=b;return s==="vertical"?u.jsx("div",{className:"relative transition-all duration-200",style:{width:o===1?"100%":`${100*o}%`,maxWidth:o>1?"none":"80rem"},children:u.jsx("div",{className:`mx-auto ${o<=1?"max-w-5xl":""}`,children:u.jsx(jD,{minHeight:"50vh",children:()=>u.jsx(pr,{src:y,alt:`Página ${E+1}`,aspectRatio:"auto",objectFit:"contain",loading:"eager",className:"w-full h-auto",imgClassName:"w-full h-auto block",showControls:!0})})})},E):u.jsx("div",{className:` + group cursor-pointer relative bg-black rounded-lg shadow-lg overflow-hidden transition-transform duration-300 hover:scale-[1.02] + ${s==="gallery"?"masonry-item":""} + `,onClick:()=>{h(E),c(!0)},children:u.jsx(pr,{src:y,alt:`Página ${E+1}`,aspectRatio:s==="grid"?"1/1":"auto",objectFit:s==="grid"?"cover":"contain",loading:E<5?"eager":"lazy",className:"w-full h-auto rounded-lg",imgClassName:"group-hover:scale-110"})},E)})})}),u.jsx(Df,{}),l&&u.jsx(RD,{images:r,initialIndex:d,onClose:()=>c(!1)})]})}const t2=V.createContext({});function du(t){const e=V.useRef(null);return e.current===null&&(e.current=t()),e.current}const MD=typeof window<"u",n2=MD?V.useLayoutEffect:V.useEffect,$0=V.createContext(null);function H0(t,e){t.indexOf(e)===-1&&t.push(e)}function Ah(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}function LD([...t],e,n){const r=e<0?t.length+e:e;if(r>=0&&rn>e?e:n{};const Mi={},r2=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);function s2(t){return typeof t=="object"&&t!==null}const i2=t=>/^0[^.\s]+$/u.test(t);function o2(t){let e;return()=>(e===void 0&&(e=t()),e)}const Rr=t=>t,VD=(t,e)=>n=>e(t(n)),hu=(...t)=>t.reduce(VD),Uc=(t,e,n)=>{const r=e-t;return r===0?1:(n-t)/r};class q0{constructor(){this.subscriptions=[]}add(e){return H0(this.subscriptions,e),()=>Ah(this.subscriptions,e)}notify(e,n,r){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](e,n,r);else for(let i=0;it*1e3,Ar=t=>t/1e3;function a2(t,e){return e?t*(1e3/e):0}const l2=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,OD=1e-7,FD=12;function zD(t,e,n,r,s){let i,o,a=0;do o=e+(n-e)/2,i=l2(o,r,s)-t,i>0?n=o:e=o;while(Math.abs(i)>OD&&++azD(i,0,1,t,n);return i=>i===0||i===1?i:l2(s(i),e,r)}const c2=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,u2=t=>e=>1-t(1-e),d2=fu(.33,1.53,.69,.99),W0=u2(d2),h2=c2(W0),f2=t=>t>=1?1:(t*=2)<1?.5*W0(t):.5*(2-Math.pow(2,-10*(t-1))),K0=t=>1-Math.sin(Math.acos(t)),p2=u2(K0),m2=c2(K0),BD=fu(.42,0,1,1),UD=fu(0,0,.58,1),g2=fu(.42,0,.58,1),$D=t=>Array.isArray(t)&&typeof t[0]!="number",y2=t=>Array.isArray(t)&&typeof t[0]=="number",HD={linear:Rr,easeIn:BD,easeInOut:g2,easeOut:UD,circIn:K0,circInOut:m2,circOut:p2,backIn:W0,backInOut:h2,backOut:d2,anticipate:f2},GD=t=>typeof t=="string",Tb=t=>{if(y2(t)){G0(t.length===4);const[e,n,r,s]=t;return fu(e,n,r,s)}else if(GD(t))return HD[t];return t},cd=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function qD(t,e){let n=new Set,r=new Set,s=!1,i=!1;const o=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function l(d){o.has(d)&&(c.schedule(d),t()),d(a)}const c={schedule:(d,h=!1,m=!1)=>{const g=m&&s?n:r;return h&&o.add(d),g.add(d),d},cancel:d=>{r.delete(d),o.delete(d)},process:d=>{if(a=d,s){i=!0;return}s=!0;const h=n;n=r,r=h,n.forEach(l),n.clear(),s=!1,i&&(i=!1,c.process(d))}};return c}const WD=40;function x2(t,e){let n=!1,r=!0;const s={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,o=cd.reduce((_,P)=>(_[P]=qD(i),_),{}),{setup:a,read:l,resolveKeyframes:c,preUpdate:d,update:h,preRender:m,render:p,postRender:g}=o,b=()=>{const _=Mi.useManualTiming,P=_?s.timestamp:performance.now();n=!1,_||(s.delta=r?1e3/60:Math.max(Math.min(P-s.timestamp,WD),1)),s.timestamp=P,s.isProcessing=!0,a.process(s),l.process(s),c.process(s),d.process(s),h.process(s),m.process(s),p.process(s),g.process(s),s.isProcessing=!1,n&&e&&(r=!1,t(b))},E=()=>{n=!0,r=!0,s.isProcessing||t(b)};return{schedule:cd.reduce((_,P)=>{const D=o[P];return _[P]=(k,T=!1,w=!1)=>(n||E(),D.schedule(k,T,w)),_},{}),cancel:_=>{for(let P=0;P(Fd===void 0&&Rn.set(hn.isProcessing||Mi.useManualTiming?hn.timestamp:performance.now()),Fd),set:t=>{Fd=t,queueMicrotask(KD)}},v2=t=>e=>typeof e=="string"&&e.startsWith(t),w2=v2("--"),YD=v2("var(--"),Y0=t=>YD(t)?QD.test(t.split("/*")[0].trim()):!1,QD=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function kb(t){return typeof t!="string"?!1:t.split("/*")[0].includes("var(--")}const ol={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},$c={...ol,transform:t=>ws(0,1,t)},ud={...ol,default:1},cc=t=>Math.round(t*1e5)/1e5,Q0=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function XD(t){return t==null}const JD=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,X0=(t,e)=>n=>!!(typeof n=="string"&&JD.test(n)&&n.startsWith(t)||e&&!XD(n)&&Object.prototype.hasOwnProperty.call(n,e)),b2=(t,e,n)=>r=>{if(typeof r!="string")return r;const[s,i,o,a]=r.match(Q0);return{[t]:parseFloat(s),[e]:parseFloat(i),[n]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},ZD=t=>ws(0,255,t),Wp={...ol,transform:t=>Math.round(ZD(t))},go={test:X0("rgb","red"),parse:b2("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+Wp.transform(t)+", "+Wp.transform(e)+", "+Wp.transform(n)+", "+cc($c.transform(r))+")"};function eM(t){let e="",n="",r="",s="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),r=t.substring(5,7),s=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),r=t.substring(3,4),s=t.substring(4,5),e+=e,n+=n,r+=r,s+=s),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:s?parseInt(s,16)/255:1}}const Lg={test:X0("#"),parse:eM,transform:go.transform},pu=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),oi=pu("deg"),fs=pu("%"),me=pu("px"),tM=pu("vh"),nM=pu("vw"),Cb={...fs,parse:t=>fs.parse(t)/100,transform:t=>fs.transform(t*100)},ba={test:X0("hsl","hue"),parse:b2("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+fs.transform(cc(e))+", "+fs.transform(cc(n))+", "+cc($c.transform(r))+")"},Ht={test:t=>go.test(t)||Lg.test(t)||ba.test(t),parse:t=>go.test(t)?go.parse(t):ba.test(t)?ba.parse(t):Lg.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?go.transform(t):ba.transform(t),getAnimatableNone:t=>{const e=Ht.parse(t);return e.alpha=0,Ht.transform(e)}},rM=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function sM(t){var e,n;return isNaN(t)&&typeof t=="string"&&(((e=t.match(Q0))==null?void 0:e.length)||0)+(((n=t.match(rM))==null?void 0:n.length)||0)>0}const _2="number",S2="color",iM="var",oM="var(",Ib="${}",aM=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Ka(t){const e=t.toString(),n=[],r={color:[],number:[],var:[]},s=[];let i=0;const a=e.replace(aM,l=>(Ht.test(l)?(r.color.push(i),s.push(S2),n.push(Ht.parse(l))):l.startsWith(oM)?(r.var.push(i),s.push(iM),n.push(l)):(r.number.push(i),s.push(_2),n.push(parseFloat(l))),++i,Ib)).split(Ib);return{values:n,split:a,indexes:r,types:s}}function lM(t){return Ka(t).values}function E2({split:t,types:e}){const n=t.length;return r=>{let s="";for(let i=0;itypeof t=="number"?0:Ht.test(t)?Ht.getAnimatableNone(t):t,dM=(t,e)=>typeof t=="number"?e!=null&&e.trim().endsWith("/")?t:0:uM(t);function hM(t){const e=Ka(t);return E2(e)(e.values.map((r,s)=>dM(r,e.split[s])))}const Kr={test:sM,parse:lM,createTransformer:cM,getAnimatableNone:hM};function Kp(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function fM({hue:t,saturation:e,lightness:n,alpha:r}){t/=360,e/=100,n/=100;let s=0,i=0,o=0;if(!e)s=i=o=n;else{const a=n<.5?n*(1+e):n+e-n*e,l=2*n-a;s=Kp(l,a,t+1/3),i=Kp(l,a,t),o=Kp(l,a,t-1/3)}return{red:Math.round(s*255),green:Math.round(i*255),blue:Math.round(o*255),alpha:r}}function Ph(t,e){return n=>n>0?e:t}const ut=(t,e,n)=>t+(e-t)*n,Yp=(t,e,n)=>{const r=t*t,s=n*(e*e-r)+r;return s<0?0:Math.sqrt(s)},pM=[Lg,go,ba],mM=t=>pM.find(e=>e.test(t));function Nb(t){const e=mM(t);if(!e)return!1;let n=e.parse(t);return e===ba&&(n=fM(n)),n}const Ab=(t,e)=>{const n=Nb(t),r=Nb(e);if(!n||!r)return Ph(t,e);const s={...n};return i=>(s.red=Yp(n.red,r.red,i),s.green=Yp(n.green,r.green,i),s.blue=Yp(n.blue,r.blue,i),s.alpha=ut(n.alpha,r.alpha,i),go.transform(s))},Vg=new Set(["none","hidden"]);function gM(t,e){return Vg.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function yM(t,e){return n=>ut(t,e,n)}function J0(t){return typeof t=="number"?yM:typeof t=="string"?Y0(t)?Ph:Ht.test(t)?Ab:wM:Array.isArray(t)?T2:typeof t=="object"?Ht.test(t)?Ab:xM:Ph}function T2(t,e){const n=[...t],r=n.length,s=t.map((i,o)=>J0(i)(i,e[o]));return i=>{for(let o=0;o{for(const i in r)n[i]=r[i](s);return n}}function vM(t,e){const n=[],r={color:0,var:0,number:0};for(let s=0;s{const n=Kr.createTransformer(e),r=Ka(t),s=Ka(e);return r.indexes.var.length===s.indexes.var.length&&r.indexes.color.length===s.indexes.color.length&&r.indexes.number.length>=s.indexes.number.length?Vg.has(t)&&!s.values.length||Vg.has(e)&&!r.values.length?gM(t,e):hu(T2(vM(r,s),s.values),n):Ph(t,e)};function k2(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?ut(t,e,n):J0(t)(t,e)}const bM=t=>{const e=({timestamp:n})=>t(n);return{start:(n=!0)=>nt.update(e,n),stop:()=>Gs(e),now:()=>hn.isProcessing?hn.timestamp:Rn.now()}},C2=(t,e,n=10)=>{let r="";const s=Math.max(Math.round(e/n),2);for(let i=0;i=Rh?1/0:e}function _M(t,e=100,n){const r=n({...t,keyframes:[0,e]}),s=Math.min(Z0(r),Rh);return{type:"keyframes",ease:i=>r.next(s*i).value/e,duration:Ar(s)}}const Rt={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function Og(t,e){return t*Math.sqrt(1-e*e)}const SM=12;function EM(t,e,n){let r=n;for(let s=1;s{const d=c*o,h=d*t,m=d-n,p=Og(c,o),g=Math.exp(-h);return Qp-m/p*g},i=c=>{const h=c*o*t,m=h*n+n,p=Math.pow(o,2)*Math.pow(c,2)*t,g=Math.exp(-h),b=Og(Math.pow(c,2),o);return(-s(c)+Qp>0?-1:1)*((m-p)*g)/b}):(s=c=>{const d=Math.exp(-c*t),h=(c-n)*t+1;return-Qp+d*h},i=c=>{const d=Math.exp(-c*t),h=(n-c)*(t*t);return d*h});const a=5/t,l=EM(s,i,a);if(t=vr(t),isNaN(l))return{stiffness:Rt.stiffness,damping:Rt.damping,duration:t};{const c=Math.pow(l,2)*r;return{stiffness:c,damping:o*2*Math.sqrt(r*c),duration:t}}}const kM=["duration","bounce"],CM=["stiffness","damping","mass"];function Pb(t,e){return e.some(n=>t[n]!==void 0)}function IM(t){let e={velocity:Rt.velocity,stiffness:Rt.stiffness,damping:Rt.damping,mass:Rt.mass,isResolvedFromDuration:!1,...t};if(!Pb(t,CM)&&Pb(t,kM))if(e.velocity=0,t.visualDuration){const n=t.visualDuration,r=2*Math.PI/(n*1.2),s=r*r,i=2*ws(.05,1,1-(t.bounce||0))*Math.sqrt(s);e={...e,mass:Rt.mass,stiffness:s,damping:i}}else{const n=TM({...t,velocity:0});e={...e,...n,mass:Rt.mass},e.isResolvedFromDuration=!0}return e}function jh(t=Rt.visualDuration,e=Rt.bounce){const n=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:r,restDelta:s}=n;const i=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],a={done:!1,value:i},{stiffness:l,damping:c,mass:d,duration:h,velocity:m,isResolvedFromDuration:p}=IM({...n,velocity:-Ar(n.velocity||0)}),g=m||0,b=c/(2*Math.sqrt(l*d)),E=o-i,y=Ar(Math.sqrt(l/d)),v=Math.abs(E)<5;r||(r=v?Rt.restSpeed.granular:Rt.restSpeed.default),s||(s=v?Rt.restDelta.granular:Rt.restDelta.default);let _,P,D,k,T,w;if(b<1)D=Og(y,b),k=(g+b*y*E)/D,_=I=>{const N=Math.exp(-b*y*I);return o-N*(k*Math.sin(D*I)+E*Math.cos(D*I))},T=b*y*k+E*D,w=b*y*E-k*D,P=I=>Math.exp(-b*y*I)*(T*Math.sin(D*I)+w*Math.cos(D*I));else if(b===1){_=N=>o-Math.exp(-y*N)*(E+(g+y*E)*N);const I=g+y*E;P=N=>Math.exp(-y*N)*(y*I*N-g)}else{const I=y*Math.sqrt(b*b-1);_=z=>{const B=Math.exp(-b*y*z),q=Math.min(I*z,300);return o-B*((g+b*y*E)*Math.sinh(q)+I*E*Math.cosh(q))/I};const N=(g+b*y*E)/I,j=b*y*N-E*I,A=b*y*E-N*I;P=z=>{const B=Math.exp(-b*y*z),q=Math.min(I*z,300);return B*(j*Math.sinh(q)+A*Math.cosh(q))}}const C={calculatedDuration:p&&h||null,velocity:I=>vr(P(I)),next:I=>{if(!p&&b<1){const j=Math.exp(-b*y*I),A=Math.sin(D*I),z=Math.cos(D*I),B=o-j*(k*A+E*z),q=vr(j*(T*A+w*z));return a.done=Math.abs(q)<=r&&Math.abs(o-B)<=s,a.value=a.done?o:B,a}const N=_(I);if(p)a.done=I>=h;else{const j=vr(P(I));a.done=Math.abs(j)<=r&&Math.abs(o-N)<=s}return a.value=a.done?o:N,a},toString:()=>{const I=Math.min(Z0(C),Rh),N=C2(j=>C.next(I*j).value,I,30);return I+"ms "+N},toTransition:()=>{}};return C}jh.applyToOptions=t=>{const e=_M(t,100,jh);return t.ease=e.ease,t.duration=vr(e.duration),t.type="keyframes",t};const NM=5;function I2(t,e,n){const r=Math.max(e-NM,0);return a2(n-t(r),e-r)}function Fg({keyframes:t,velocity:e=0,power:n=.8,timeConstant:r=325,bounceDamping:s=10,bounceStiffness:i=500,modifyTarget:o,min:a,max:l,restDelta:c=.5,restSpeed:d}){const h=t[0],m={done:!1,value:h},p=w=>a!==void 0&&wl,g=w=>a===void 0?l:l===void 0||Math.abs(a-w)-b*Math.exp(-w/r),_=w=>y+v(w),P=w=>{const C=v(w),I=_(w);m.done=Math.abs(C)<=c,m.value=m.done?y:I};let D,k;const T=w=>{p(m.value)&&(D=w,k=jh({keyframes:[m.value,g(m.value)],velocity:I2(_,w,m.value),damping:s,stiffness:i,restDelta:c,restSpeed:d}))};return T(0),{calculatedDuration:null,next:w=>{let C=!1;return!k&&D===void 0&&(C=!0,P(w),T(w)),D!==void 0&&w>=D?k.next(w-D):(!C&&P(w),m)}}}function AM(t,e,n){const r=[],s=n||Mi.mix||k2,i=t.length-1;for(let o=0;oe[0];if(i===2&&e[0]===e[1])return()=>e[1];const o=t[0]===t[1];t[0]>t[i-1]&&(t=[...t].reverse(),e=[...e].reverse());const a=AM(e,r,s),l=a.length,c=d=>{if(o&&d1)for(;hc(ws(t[0],t[i-1],d)):c}function PM(t,e){const n=t[t.length-1];for(let r=1;r<=e;r++){const s=Uc(0,e,r);t.push(ut(n,1,s))}}function RM(t){const e=[0];return PM(e,t.length-1),e}function jM(t,e){return t.map(n=>n*e)}function DM(t,e){return t.map(()=>e||g2).splice(0,t.length-1)}function uc({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const s=$D(r)?r.map(Tb):Tb(r),i={done:!1,value:e[0]},o=jM(n&&n.length===e.length?n:RM(e),t),a=N2(o,e,{ease:Array.isArray(s)?s:DM(e,s)});return{calculatedDuration:t,next:l=>(i.value=a(l),i.done=l>=t,i)}}const MM=t=>t!==null;function Mf(t,{repeat:e,repeatType:n="loop"},r,s=1){const i=t.filter(MM),a=s<0||e&&n!=="loop"&&e%2===1?0:i.length-1;return!a||r===void 0?i[a]:r}const LM={decay:Fg,inertia:Fg,tween:uc,keyframes:uc,spring:jh};function A2(t){typeof t.type=="string"&&(t.type=LM[t.type])}class ex{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,n){return this.finished.then(e,n)}}const VM=t=>t/100;class Dh extends ex{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{var r,s;const{motionValue:n}=this.options;n&&n.updatedAt!==Rn.now()&&this.tick(Rn.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(s=(r=this.options).onStop)==null||s.call(r))},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){const{options:e}=this;A2(e);const{type:n=uc,repeat:r=0,repeatDelay:s=0,repeatType:i,velocity:o=0}=e;let{keyframes:a}=e;const l=n||uc;l!==uc&&typeof a[0]!="number"&&(this.mixKeyframes=hu(VM,k2(a[0],a[1])),a=[0,100]);const c=l({...e,keyframes:a});i==="mirror"&&(this.mirroredGenerator=l({...e,keyframes:[...a].reverse(),velocity:-o})),c.calculatedDuration===null&&(c.calculatedDuration=Z0(c));const{calculatedDuration:d}=c;this.calculatedDuration=d,this.resolvedDuration=d+s,this.totalDuration=this.resolvedDuration*(r+1)-s,this.generator=c}updateTime(e){const n=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(e,n=!1){const{generator:r,totalDuration:s,mixKeyframes:i,mirroredGenerator:o,resolvedDuration:a,calculatedDuration:l}=this;if(this.startTime===null)return r.next(0);const{delay:c=0,keyframes:d,repeat:h,repeatType:m,repeatDelay:p,type:g,onUpdate:b,finalKeyframe:E}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-s/this.speed,this.startTime)),n?this.currentTime=e:this.updateTime(e);const y=this.currentTime-c*(this.playbackSpeed>=0?1:-1),v=this.playbackSpeed>=0?y<0:y>s;this.currentTime=Math.max(y,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=s);let _=this.currentTime,P=r;if(h){const w=Math.min(this.currentTime,s)/a;let C=Math.floor(w),I=w%1;!I&&w>=1&&(I=1),I===1&&C--,C=Math.min(C,h+1),!!(C%2)&&(m==="reverse"?(I=1-I,p&&(I-=p/a)):m==="mirror"&&(P=o)),_=ws(0,1,I)*a}let D;v?(this.delayState.value=d[0],D=this.delayState):D=P.next(_),i&&!v&&(D.value=i(D.value));let{done:k}=D;!v&&l!==null&&(k=this.playbackSpeed>=0?this.currentTime>=s:this.currentTime<=0);const T=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&k);return T&&g!==Fg&&(D.value=Mf(d,this.options,E,this.speed)),b&&b(D.value),T&&this.finish(),D}then(e,n){return this.finished.then(e,n)}get duration(){return Ar(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+Ar(e)}get time(){return Ar(this.currentTime)}set time(e){e=vr(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=e,this.tick(e))}getGeneratorVelocity(){const e=this.currentTime;if(e<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(e);const n=this.generator.next(e).value;return I2(r=>this.generator.next(r).value,e,n)}get speed(){return this.playbackSpeed}set speed(e){const n=this.playbackSpeed!==e;n&&this.driver&&this.updateTime(Rn.now()),this.playbackSpeed=e,n&&this.driver&&(this.time=Ar(this.currentTime))}play(){var s,i;if(this.isStopped)return;const{driver:e=bM,startTime:n}=this.options;this.driver||(this.driver=e(o=>this.tick(o))),(i=(s=this.options).onPlay)==null||i.call(s);const r=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=r):this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime||(this.startTime=n??r),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(Rn.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var e,n;this.notifyFinished(),this.teardown(),this.state="finished",(n=(e=this.options).onComplete)==null||n.call(e)}cancel(){var e,n;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(n=(e=this.options).onCancel)==null||n.call(e)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){var n;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(n=this.driver)==null||n.stop(),e.observe(this)}}function OM(t){for(let e=1;et*180/Math.PI,zg=t=>{const e=yo(Math.atan2(t[1],t[0]));return Bg(e)},FM={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:zg,rotateZ:zg,skewX:t=>yo(Math.atan(t[1])),skewY:t=>yo(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},Bg=t=>(t=t%360,t<0&&(t+=360),t),Rb=zg,jb=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),Db=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),zM={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:jb,scaleY:Db,scale:t=>(jb(t)+Db(t))/2,rotateX:t=>Bg(yo(Math.atan2(t[6],t[5]))),rotateY:t=>Bg(yo(Math.atan2(-t[2],t[0]))),rotateZ:Rb,rotate:Rb,skewX:t=>yo(Math.atan(t[4])),skewY:t=>yo(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function Ug(t){return t.includes("scale")?1:0}function $g(t,e){if(!t||t==="none")return Ug(e);const n=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,s;if(n)r=zM,s=n;else{const a=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=FM,s=a}if(!s)return Ug(e);const i=r[e],o=s[1].split(",").map(UM);return typeof i=="function"?i(o):o[i]}const BM=(t,e)=>{const{transform:n="none"}=getComputedStyle(t);return $g(n,e)};function UM(t){return parseFloat(t.trim())}const al=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],ll=new Set(al),Mb=t=>t===ol||t===me,$M=new Set(["x","y","z"]),HM=al.filter(t=>!$M.has(t));function GM(t){const e=[];return HM.forEach(n=>{const r=t.getValue(n);r!==void 0&&(e.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),e}const xi={width:({x:t},{paddingLeft:e="0",paddingRight:n="0",boxSizing:r})=>{const s=t.max-t.min;return r==="border-box"?s:s-parseFloat(e)-parseFloat(n)},height:({y:t},{paddingTop:e="0",paddingBottom:n="0",boxSizing:r})=>{const s=t.max-t.min;return r==="border-box"?s:s-parseFloat(e)-parseFloat(n)},top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>$g(e,"x"),y:(t,{transform:e})=>$g(e,"y")};xi.translateX=xi.x;xi.translateY=xi.y;const bo=new Set;let Hg=!1,Gg=!1,qg=!1;function P2(){if(Gg){const t=Array.from(bo).filter(r=>r.needsMeasurement),e=new Set(t.map(r=>r.element)),n=new Map;e.forEach(r=>{const s=GM(r);s.length&&(n.set(r,s),r.render())}),t.forEach(r=>r.measureInitialState()),e.forEach(r=>{r.render();const s=n.get(r);s&&s.forEach(([i,o])=>{var a;(a=r.getValue(i))==null||a.set(o)})}),t.forEach(r=>r.measureEndState()),t.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}Gg=!1,Hg=!1,bo.forEach(t=>t.complete(qg)),bo.clear()}function R2(){bo.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Gg=!0)})}function qM(){qg=!0,R2(),P2(),qg=!1}class tx{constructor(e,n,r,s,i,o=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=n,this.name=r,this.motionValue=s,this.element=i,this.isAsync=o}scheduleResolve(){this.state="scheduled",this.isAsync?(bo.add(this),Hg||(Hg=!0,nt.read(R2),nt.resolveKeyframes(P2))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:n,element:r,motionValue:s}=this;if(e[0]===null){const i=s==null?void 0:s.get(),o=e[e.length-1];if(i!==void 0)e[0]=i;else if(r&&n){const a=r.readValue(n,o);a!=null&&(e[0]=a)}e[0]===void 0&&(e[0]=o),s&&i===void 0&&s.set(e[0])}OM(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),bo.delete(this)}cancel(){this.state==="scheduled"&&(bo.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const WM=t=>t.startsWith("--");function j2(t,e,n){WM(e)?t.style.setProperty(e,n):t.style[e]=n}const KM={};function D2(t,e){const n=o2(t);return()=>KM[e]??n()}const YM=D2(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),M2=D2(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Wl=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,Lb={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Wl([0,.65,.55,1]),circOut:Wl([.55,0,1,.45]),backIn:Wl([.31,.01,.66,-.59]),backOut:Wl([.33,1.53,.69,.99])};function L2(t,e){if(t)return typeof t=="function"?M2()?C2(t,e):"ease-out":y2(t)?Wl(t):Array.isArray(t)?t.map(n=>L2(n,e)||Lb.easeOut):Lb[t]}function QM(t,e,n,{delay:r=0,duration:s=300,repeat:i=0,repeatType:o="loop",ease:a="easeOut",times:l}={},c=void 0){const d={[e]:n};l&&(d.offset=l);const h=L2(a,s);Array.isArray(h)&&(d.easing=h);const m={delay:r,duration:s,easing:Array.isArray(h)?"linear":h,fill:"both",iterations:i+1,direction:o==="reverse"?"alternate":"normal"};return c&&(m.pseudoElement=c),t.animate(d,m)}function V2(t){return typeof t=="function"&&"applyToOptions"in t}function XM({type:t,...e}){return V2(t)&&M2()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class O2 extends ex{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:n,name:r,keyframes:s,pseudoElement:i,allowFlatten:o=!1,finalKeyframe:a,onComplete:l}=e;this.isPseudoElement=!!i,this.allowFlatten=o,this.options=e,G0(typeof e.type!="string");const c=XM(e);this.animation=QM(n,r,s,c,i),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){const d=Mf(s,this.options,a,this.speed);this.updateMotionValue&&this.updateMotionValue(d),j2(n,r,d),this.animation.cancel()}l==null||l(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var e,n;(n=(e=this.animation).finish)==null||n.call(e)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;e==="idle"||e==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var n,r,s;const e=(n=this.options)==null?void 0:n.element;!this.isPseudoElement&&(e!=null&&e.isConnected)&&((s=(r=this.animation).commitStyles)==null||s.call(r))}get duration(){var n,r;const e=((r=(n=this.animation.effect)==null?void 0:n.getComputedTiming)==null?void 0:r.call(n).duration)||0;return Ar(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+Ar(e)}get time(){return Ar(Number(this.animation.currentTime)||0)}set time(e){const n=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=vr(e),n&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,rangeStart:n,rangeEnd:r,observe:s}){var i;return this.allowFlatten&&((i=this.animation.effect)==null||i.updateTiming({easing:"linear"})),this.animation.onfinish=null,e&&YM()?(this.animation.timeline=e,n&&(this.animation.rangeStart=n),r&&(this.animation.rangeEnd=r),Rr):s(this)}}const F2={anticipate:f2,backInOut:h2,circInOut:m2};function JM(t){return t in F2}function ZM(t){typeof t.ease=="string"&&JM(t.ease)&&(t.ease=F2[t.ease])}const Xp=10;class e4 extends O2{constructor(e){ZM(e),A2(e),super(e),e.startTime!==void 0&&e.autoplay!==!1&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:n,onUpdate:r,onComplete:s,element:i,...o}=this.options;if(!n)return;if(e!==void 0){n.set(e);return}const a=new Dh({...o,autoplay:!1}),l=Math.max(Xp,Rn.now()-this.startTime),c=ws(0,Xp,l-Xp),d=a.sample(l).value,{name:h}=this.options;i&&h&&j2(i,h,d),n.setWithVelocity(a.sample(Math.max(0,l-c)).value,d,c),a.stop()}}const Vb=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Kr.test(t)||t==="0")&&!t.startsWith("url("));function t4(t){const e=t[0];if(t.length===1)return!0;for(let n=0;nObject.hasOwnProperty.call(Element.prototype,"animate"));function a4(t){var h;const{motionValue:e,name:n,repeatDelay:r,repeatType:s,damping:i,type:o,keyframes:a}=t;if(!(((h=e==null?void 0:e.owner)==null?void 0:h.current)instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:d}=e.owner.getProps();return o4()&&n&&(z2.has(n)||i4.has(n)&&s4(a))&&(n!=="transform"||!d)&&!c&&!r&&s!=="mirror"&&i!==0&&o!=="inertia"}const l4=40;class c4 extends ex{constructor({autoplay:e=!0,delay:n=0,type:r="keyframes",repeat:s=0,repeatDelay:i=0,repeatType:o="loop",keyframes:a,name:l,motionValue:c,element:d,...h}){var g;super(),this.stop=()=>{var b,E;this._animation&&(this._animation.stop(),(b=this.stopTimeline)==null||b.call(this)),(E=this.keyframeResolver)==null||E.cancel()},this.createdAt=Rn.now();const m={autoplay:e,delay:n,type:r,repeat:s,repeatDelay:i,repeatType:o,name:l,motionValue:c,element:d,...h},p=(d==null?void 0:d.KeyframeResolver)||tx;this.keyframeResolver=new p(a,(b,E,y)=>this.onKeyframesResolved(b,E,m,!y),l,c,d),(g=this.keyframeResolver)==null||g.scheduleResolve()}onKeyframesResolved(e,n,r,s){var y,v;this.keyframeResolver=void 0;const{name:i,type:o,velocity:a,delay:l,isHandoff:c,onUpdate:d}=r;this.resolvedAt=Rn.now();let h=!0;n4(e,i,o,a)||(h=!1,(Mi.instantAnimations||!l)&&(d==null||d(Mf(e,r,n))),e[0]=e[e.length-1],Wg(r),r.repeat=0);const p={startTime:s?this.resolvedAt?this.resolvedAt-this.createdAt>l4?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...r,keyframes:e},g=h&&!c&&a4(p),b=(v=(y=p.motionValue)==null?void 0:y.owner)==null?void 0:v.current;let E;if(g)try{E=new e4({...p,element:b})}catch{E=new Dh(p)}else E=new Dh(p);E.finished.then(()=>{this.notifyFinished()}).catch(Rr),this.pendingTimeline&&(this.stopTimeline=E.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=E}get finished(){return this._animation?this.animation.finished:this._finished}then(e,n){return this.finished.finally(e).then(()=>{})}get animation(){var e;return this._animation||((e=this.keyframeResolver)==null||e.resume(),qM()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var e;this._animation&&this.animation.cancel(),(e=this.keyframeResolver)==null||e.cancel()}}function B2(t,e,n,r=0,s=1){const i=Array.from(t).sort((c,d)=>c.sortNodePosition(d)).indexOf(e),o=t.size,a=(o-1)*r;return typeof n=="function"?n(i,o):s===1?i*r:a-i*r}const u4=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function d4(t){const e=u4.exec(t);if(!e)return[,];const[,n,r,s]=e;return[`--${n??r}`,s]}function U2(t,e,n=1){const[r,s]=d4(t);if(!r)return;const i=window.getComputedStyle(e).getPropertyValue(r);if(i){const o=i.trim();return r2(o)?parseFloat(o):o}return Y0(s)?U2(s,e,n+1):s}const h4={type:"spring",stiffness:500,damping:25,restSpeed:10},f4=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),p4={type:"keyframes",duration:.8},m4={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},g4=(t,{keyframes:e})=>e.length>2?p4:ll.has(t)?t.startsWith("scale")?f4(e[1]):h4:m4;function $2(t,e){if(t!=null&&t.inherit&&e){const{inherit:n,...r}=t;return{...e,...r}}return t}function nx(t,e){const n=(t==null?void 0:t[e])??(t==null?void 0:t.default)??t;return n!==t?$2(n,t):n}const y4=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function x4(t){for(const e in t)if(!y4.has(e))return!0;return!1}const rx=(t,e,n,r={},s,i)=>o=>{const a=nx(r,t)||{},l=a.delay||r.delay||0;let{elapsed:c=0}=r;c=c-vr(l);const d={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-c,onUpdate:m=>{e.set(m),a.onUpdate&&a.onUpdate(m)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:t,motionValue:e,element:i?void 0:s};x4(a)||Object.assign(d,g4(t,d)),d.duration&&(d.duration=vr(d.duration)),d.repeatDelay&&(d.repeatDelay=vr(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let h=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(Wg(d),d.delay===0&&(h=!0)),(Mi.instantAnimations||Mi.skipAnimations||s!=null&&s.shouldSkipAnimations)&&(h=!0,Wg(d),d.delay=0),d.allowFlatten=!a.type&&!a.ease,h&&!i&&e.get()!==void 0){const m=Mf(d.keyframes,a);if(m!==void 0){nt.update(()=>{d.onUpdate(m),d.onComplete()});return}}return a.isSync?new Dh(d):new c4(d)};function Ob(t){const e=[{},{}];return t==null||t.values.forEach((n,r)=>{e[0][r]=n.get(),e[1][r]=n.getVelocity()}),e}function sx(t,e,n,r){if(typeof e=="function"){const[s,i]=Ob(r);e=e(n!==void 0?n:t.custom,s,i)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[s,i]=Ob(r);e=e(n!==void 0?n:t.custom,s,i)}return e}function _o(t,e,n){const r=t.getProps();return sx(r,e,n!==void 0?n:r.custom,t)}const H2=new Set(["width","height","top","left","right","bottom",...al]),Fb=30,v4=t=>!isNaN(parseFloat(t)),dc={current:void 0};class w4{constructor(e,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{var i;const s=Rn.now();if(this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&((i=this.events.change)==null||i.notify(this.current),this.dependents))for(const o of this.dependents)o.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=n.owner}setCurrent(e){this.current=e,this.updatedAt=Rn.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=v4(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,n){this.events[e]||(this.events[e]=new q0);const r=this.events[e].add(n);return e==="change"?()=>{r(),nt.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,n){this.passiveEffect=e,this.stopPassiveEffect=n}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-r}jump(e,n=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var e;(e=this.events.change)==null||e.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return dc.current&&dc.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const e=Rn.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>Fb)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,Fb);return a2(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(e){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=e(n),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(){var e,n;(e=this.dependents)==null||e.clear(),(n=this.events.destroy)==null||n.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Po(t,e){return new w4(t,e)}const Kg=t=>Array.isArray(t);function b4(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,Po(n))}function _4(t){return Kg(t)?t[t.length-1]||0:t}function S4(t,e){const n=_o(t,e);let{transitionEnd:r={},transition:s={},...i}=n||{};i={...i,...r};for(const o in i){const a=_4(i[o]);b4(t,o,a)}}const cn=t=>!!(t&&t.getVelocity);function E4(t){return!!(cn(t)&&t.add)}function Yg(t,e){const n=t.getValue("willChange");if(E4(n))return n.add(e);if(!n&&Mi.WillChange){const r=new Mi.WillChange("auto");t.addValue("willChange",r),r.add(e)}}function ix(t){return t.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}const T4="framerAppearId",G2="data-"+ix(T4);function q2(t){return t.props[G2]}function k4({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,r}function W2(t,e,{delay:n=0,transitionOverride:r,type:s}={}){let{transition:i,transitionEnd:o,...a}=e;const l=t.getDefaultTransition();i=i?$2(i,l):l;const c=i==null?void 0:i.reduceMotion;r&&(i=r);const d=[],h=s&&t.animationState&&t.animationState.getState()[s];for(const m in a){const p=t.getValue(m,t.latestValues[m]??null),g=a[m];if(g===void 0||h&&k4(h,m))continue;const b={delay:n,...nx(i||{},m)},E=p.get();if(E!==void 0&&!p.isAnimating()&&!Array.isArray(g)&&g===E&&!b.velocity){nt.update(()=>p.set(g));continue}let y=!1;if(window.MotionHandoffAnimation){const P=q2(t);if(P){const D=window.MotionHandoffAnimation(P,m,nt);D!==null&&(b.startTime=D,y=!0)}}Yg(t,m);const v=c??t.shouldReduceMotion;p.start(rx(m,p,g,v&&H2.has(m)?{type:!1}:b,t,y));const _=p.animation;_&&d.push(_)}if(o){const m=()=>nt.update(()=>{o&&S4(t,o)});d.length?Promise.all(d).then(m):m()}return d}function Qg(t,e,n={}){var l;const r=_o(t,e,n.type==="exit"?(l=t.presenceContext)==null?void 0:l.custom:void 0);let{transition:s=t.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(s=n.transitionOverride);const i=r?()=>Promise.all(W2(t,r,n)):()=>Promise.resolve(),o=t.variantChildren&&t.variantChildren.size?(c=0)=>{const{delayChildren:d=0,staggerChildren:h,staggerDirection:m}=s;return C4(t,e,c,d,h,m,n)}:()=>Promise.resolve(),{when:a}=s;if(a){const[c,d]=a==="beforeChildren"?[i,o]:[o,i];return c().then(()=>d())}else return Promise.all([i(),o(n.delay)])}function C4(t,e,n=0,r=0,s=0,i=1,o){const a=[];for(const l of t.variantChildren)l.notify("AnimationStart",e),a.push(Qg(l,e,{...o,delay:n+(typeof r=="function"?0:r)+B2(t.variantChildren,l,r,s,i)}).then(()=>l.notify("AnimationComplete",e)));return Promise.all(a)}function I4(t,e,n={}){t.notify("AnimationStart",e);let r;if(Array.isArray(e)){const s=e.map(i=>Qg(t,i,n));r=Promise.all(s)}else if(typeof e=="string")r=Qg(t,e,n);else{const s=typeof e=="function"?_o(t,e,n.custom):e;r=Promise.all(W2(t,s,n))}return r.then(()=>{t.notify("AnimationComplete",e)})}const N4={test:t=>t==="auto",parse:t=>t},K2=t=>e=>e.test(t),Y2=[ol,me,fs,oi,nM,tM,N4],zb=t=>Y2.find(K2(t));function A4(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||i2(t):!0}const P4=new Set(["brightness","contrast","saturate","opacity"]);function R4(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[r]=n.match(Q0)||[];if(!r)return t;const s=n.replace(r,"");let i=P4.has(e)?1:0;return r!==n&&(i*=100),e+"("+i+s+")"}const j4=/\b([a-z-]*)\(.*?\)/gu,Xg={...Kr,getAnimatableNone:t=>{const e=t.match(j4);return e?e.map(R4).join(" "):t}},Jg={...Kr,getAnimatableNone:t=>{const e=Kr.parse(t);return Kr.createTransformer(t)(e.map(r=>typeof r=="number"?0:typeof r=="object"?{...r,alpha:1}:r))}},Bb={...ol,transform:Math.round},D4={rotate:oi,rotateX:oi,rotateY:oi,rotateZ:oi,scale:ud,scaleX:ud,scaleY:ud,scaleZ:ud,skew:oi,skewX:oi,skewY:oi,distance:me,translateX:me,translateY:me,translateZ:me,x:me,y:me,z:me,perspective:me,transformPerspective:me,opacity:$c,originX:Cb,originY:Cb,originZ:me},ox={borderWidth:me,borderTopWidth:me,borderRightWidth:me,borderBottomWidth:me,borderLeftWidth:me,borderRadius:me,borderTopLeftRadius:me,borderTopRightRadius:me,borderBottomRightRadius:me,borderBottomLeftRadius:me,width:me,maxWidth:me,height:me,maxHeight:me,top:me,right:me,bottom:me,left:me,inset:me,insetBlock:me,insetBlockStart:me,insetBlockEnd:me,insetInline:me,insetInlineStart:me,insetInlineEnd:me,padding:me,paddingTop:me,paddingRight:me,paddingBottom:me,paddingLeft:me,paddingBlock:me,paddingBlockStart:me,paddingBlockEnd:me,paddingInline:me,paddingInlineStart:me,paddingInlineEnd:me,margin:me,marginTop:me,marginRight:me,marginBottom:me,marginLeft:me,marginBlock:me,marginBlockStart:me,marginBlockEnd:me,marginInline:me,marginInlineStart:me,marginInlineEnd:me,fontSize:me,backgroundPositionX:me,backgroundPositionY:me,...D4,zIndex:Bb,fillOpacity:$c,strokeOpacity:$c,numOctaves:Bb},M4={...ox,color:Ht,backgroundColor:Ht,outlineColor:Ht,fill:Ht,stroke:Ht,borderColor:Ht,borderTopColor:Ht,borderRightColor:Ht,borderBottomColor:Ht,borderLeftColor:Ht,filter:Xg,WebkitFilter:Xg,mask:Jg,WebkitMask:Jg},Q2=t=>M4[t],L4=new Set([Xg,Jg]);function X2(t,e){let n=Q2(t);return L4.has(n)||(n=Kr),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const V4=new Set(["auto","none","0"]);function O4(t,e,n){let r=0,s;for(;r{e.getValue(l).set(c)}),this.resolveNoneKeyframes()}}function J2(t,e,n){if(t==null)return[];if(t instanceof EventTarget)return[t];if(typeof t=="string"){let r=document;const s=(n==null?void 0:n[t])??r.querySelectorAll(t);return s?Array.from(s):[]}return Array.from(t).filter(r=>r!=null)}const Z2=(t,e)=>e&&typeof t=="number"?e.transform(t):t;function z4(t){return s2(t)&&"offsetHeight"in t&&!("ownerSVGElement"in t)}const{schedule:ax}=x2(queueMicrotask,!1),Fr={x:!1,y:!1};function eC(){return Fr.x||Fr.y}function B4(t){return t==="x"||t==="y"?Fr[t]?null:(Fr[t]=!0,()=>{Fr[t]=!1}):Fr.x||Fr.y?null:(Fr.x=Fr.y=!0,()=>{Fr.x=Fr.y=!1})}function tC(t,e){const n=J2(t),r=new AbortController,s={passive:!0,...e,signal:r.signal};return[n,s,()=>r.abort()]}function U4(t){return!(t.pointerType==="touch"||eC())}function $4(t,e,n={}){const[r,s,i]=tC(t,n);return r.forEach(o=>{let a=!1,l=!1,c;const d=()=>{o.removeEventListener("pointerleave",g)},h=E=>{c&&(c(E),c=void 0),d()},m=E=>{a=!1,window.removeEventListener("pointerup",m),window.removeEventListener("pointercancel",m),l&&(l=!1,h(E))},p=()=>{a=!0,window.addEventListener("pointerup",m,s),window.addEventListener("pointercancel",m,s)},g=E=>{if(E.pointerType!=="touch"){if(a){l=!0;return}h(E)}},b=E=>{if(!U4(E))return;l=!1;const y=e(o,E);typeof y=="function"&&(c=y,o.addEventListener("pointerleave",g,s))};o.addEventListener("pointerenter",b,s),o.addEventListener("pointerdown",p,s)}),i}const nC=(t,e)=>e?t===e?!0:nC(t,e.parentElement):!1,lx=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,H4=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function G4(t){return H4.has(t.tagName)||t.isContentEditable===!0}const q4=new Set(["INPUT","SELECT","TEXTAREA"]);function W4(t){return q4.has(t.tagName)||t.isContentEditable===!0}const zd=new WeakSet;function Ub(t){return e=>{e.key==="Enter"&&t(e)}}function Jp(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const K4=(t,e)=>{const n=t.currentTarget;if(!n)return;const r=Ub(()=>{if(zd.has(n))return;Jp(n,"down");const s=Ub(()=>{Jp(n,"up")}),i=()=>Jp(n,"cancel");n.addEventListener("keyup",s,e),n.addEventListener("blur",i,e)});n.addEventListener("keydown",r,e),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),e)};function $b(t){return lx(t)&&!eC()}const Hb=new WeakSet;function Y4(t,e,n={}){const[r,s,i]=tC(t,n),o=a=>{const l=a.currentTarget;if(!$b(a)||Hb.has(a))return;zd.add(l),n.stopPropagation&&Hb.add(a);const c=e(l,a),d=(p,g)=>{window.removeEventListener("pointerup",h),window.removeEventListener("pointercancel",m),zd.has(l)&&zd.delete(l),$b(p)&&typeof c=="function"&&c(p,{success:g})},h=p=>{d(p,l===window||l===document||n.useGlobalTarget||nC(l,p.target))},m=p=>{d(p,!1)};window.addEventListener("pointerup",h,s),window.addEventListener("pointercancel",m,s)};return r.forEach(a=>{(n.useGlobalTarget?window:a).addEventListener("pointerdown",o,s),z4(a)&&(a.addEventListener("focus",c=>K4(c,s)),!G4(a)&&!a.hasAttribute("tabindex")&&(a.tabIndex=0))}),i}function cx(t){return s2(t)&&"ownerSVGElement"in t}const Bd=new WeakMap;let ai;const rC=(t,e,n)=>(r,s)=>s&&s[0]?s[0][t+"Size"]:cx(r)&&"getBBox"in r?r.getBBox()[e]:r[n],Q4=rC("inline","width","offsetWidth"),X4=rC("block","height","offsetHeight");function J4({target:t,borderBoxSize:e}){var n;(n=Bd.get(t))==null||n.forEach(r=>{r(t,{get width(){return Q4(t,e)},get height(){return X4(t,e)}})})}function Z4(t){t.forEach(J4)}function e5(){typeof ResizeObserver>"u"||(ai=new ResizeObserver(Z4))}function t5(t,e){ai||e5();const n=J2(t);return n.forEach(r=>{let s=Bd.get(r);s||(s=new Set,Bd.set(r,s)),s.add(e),ai==null||ai.observe(r)}),()=>{n.forEach(r=>{const s=Bd.get(r);s==null||s.delete(e),s!=null&&s.size||ai==null||ai.unobserve(r)})}}const Ud=new Set;let _a;function n5(){_a=()=>{const t={get width(){return window.innerWidth},get height(){return window.innerHeight}};Ud.forEach(e=>e(t))},window.addEventListener("resize",_a)}function r5(t){return Ud.add(t),_a||n5(),()=>{Ud.delete(t),!Ud.size&&typeof _a=="function"&&(window.removeEventListener("resize",_a),_a=void 0)}}function Gb(t,e){return typeof t=="function"?r5(t):t5(t,e)}function s5(t){return cx(t)&&t.tagName==="svg"}function i5(...t){const e=!Array.isArray(t[0]),n=e?0:-1,r=t[0+n],s=t[1+n],i=t[2+n],o=t[3+n],a=N2(s,i,o);return e?a(r):a}const o5=[...Y2,Ht,Kr],a5=t=>o5.find(K2(t)),qb=()=>({translate:0,scale:1,origin:0,originPoint:0}),Sa=()=>({x:qb(),y:qb()}),Wb=()=>({min:0,max:0}),Jt=()=>({x:Wb(),y:Wb()}),l5=new WeakMap;function Lf(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function Hc(t){return typeof t=="string"||Array.isArray(t)}const ux=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],dx=["initial",...ux];function Vf(t){return Lf(t.animate)||dx.some(e=>Hc(t[e]))}function sC(t){return!!(Vf(t)||t.variants)}function c5(t,e,n){for(const r in e){const s=e[r],i=n[r];if(cn(s))t.addValue(r,s);else if(cn(i))t.addValue(r,Po(s,{owner:t}));else if(i!==s)if(t.hasValue(r)){const o=t.getValue(r);o.liveStyle===!0?o.jump(s):o.hasAnimated||o.set(s)}else{const o=t.getStaticValue(r);t.addValue(r,Po(o!==void 0?o:s,{owner:t}))}}for(const r in n)e[r]===void 0&&t.removeValue(r);return e}const Zg={current:null},iC={current:!1},u5=typeof window<"u";function d5(){if(iC.current=!0,!!u5)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Zg.current=t.matches;t.addEventListener("change",e),e()}else Zg.current=!1}const Kb=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let Mh={};function oC(t){Mh=t}function h5(){return Mh}class f5{scrapeMotionValuesFromProps(e,n,r){return{}}constructor({parent:e,props:n,presenceContext:r,reducedMotionConfig:s,skipAnimations:i,blockInitialAnimation:o,visualState:a},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=tx,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const p=Rn.now();this.renderScheduledAtthis.bindToMotionValue(i,s)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(iC.current||d5(),this.shouldReduceMotion=Zg.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,(r=this.parent)==null||r.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){var e;this.projection&&this.projection.unmount(),Gs(this.notifyUpdate),Gs(this.render),this.valueSubscriptions.forEach(n=>n()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(e=this.parent)==null||e.removeChild(this);for(const n in this.events)this.events[n].clear();for(const n in this.features){const r=this.features[n];r&&(r.unmount(),r.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,n){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),n.accelerate&&z2.has(e)&&this.current instanceof HTMLElement){const{factory:o,keyframes:a,times:l,ease:c,duration:d}=n.accelerate,h=new O2({element:this.current,name:e,keyframes:a,times:l,ease:c,duration:vr(d)}),m=o(h);this.valueSubscriptions.set(e,()=>{m(),h.cancel()});return}const r=ll.has(e);r&&this.onBindTransform&&this.onBindTransform();const s=n.on("change",o=>{this.latestValues[e]=o,this.props.onUpdate&&nt.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let i;typeof window<"u"&&window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,e,n)),this.valueSubscriptions.set(e,()=>{s(),i&&i(),n.owner&&n.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in Mh){const n=Mh[e];if(!n)continue;const{isEnabled:r,Feature:s}=n;if(!this.features[e]&&s&&r(this.props)&&(this.features[e]=new s(this)),this.features[e]){const i=this.features[e];i.isMounted?i.update():(i.mount(),i.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Jt()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,n){this.latestValues[e]=n}update(e,n){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;rn.variantChildren.delete(e)}addValue(e,n){const r=this.values.get(e);n!==r&&(r&&this.removeValue(e),this.bindToMotionValue(e,n),this.values.set(e,n),this.latestValues[e]=n.get())}removeValue(e){this.values.delete(e);const n=this.valueSubscriptions.get(e);n&&(n(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,n){if(this.props.values&&this.props.values[e])return this.props.values[e];let r=this.values.get(e);return r===void 0&&n!==void 0&&(r=Po(n===null?void 0:n,{owner:this}),this.addValue(e,r)),r}readValue(e,n){let r=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return r!=null&&(typeof r=="string"&&(r2(r)||i2(r))?r=parseFloat(r):!a5(r)&&Kr.test(n)&&(r=X2(e,n)),this.setBaseTarget(e,cn(r)?r.get():r)),cn(r)?r.get():r}setBaseTarget(e,n){this.baseTarget[e]=n}getBaseTarget(e){var i;const{initial:n}=this.props;let r;if(typeof n=="string"||typeof n=="object"){const o=sx(this.props,n,(i=this.presenceContext)==null?void 0:i.custom);o&&(r=o[e])}if(n&&r!==void 0)return r;const s=this.getBaseTargetFromProps(this.props,e);return s!==void 0&&!cn(s)?s:this.initialValues[e]!==void 0&&r===void 0?void 0:this.baseTarget[e]}on(e,n){return this.events[e]||(this.events[e]=new q0),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}scheduleRenderMicrotask(){ax.render(this.render)}}class aC extends f5{constructor(){super(...arguments),this.KeyframeResolver=F4}sortInstanceNodePosition(e,n){return e.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(e,n){const r=e.style;return r?r[n]:void 0}removeValueFromRenderState(e,{vars:n,style:r}){delete n[e],delete r[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;cn(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}class qi{constructor(e){this.isMounted=!1,this.node=e}update(){}}function lC({top:t,left:e,right:n,bottom:r}){return{x:{min:e,max:n},y:{min:t,max:r}}}function p5({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function m5(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),r=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function Zp(t){return t===void 0||t===1}function ey({scale:t,scaleX:e,scaleY:n}){return!Zp(t)||!Zp(e)||!Zp(n)}function co(t){return ey(t)||cC(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function cC(t){return Yb(t.x)||Yb(t.y)}function Yb(t){return t&&t!=="0%"}function Lh(t,e,n){const r=t-n,s=e*r;return n+s}function Qb(t,e,n,r,s){return s!==void 0&&(t=Lh(t,s,r)),Lh(t,n,r)+e}function ty(t,e=0,n=1,r,s){t.min=Qb(t.min,e,n,r,s),t.max=Qb(t.max,e,n,r,s)}function uC(t,{x:e,y:n}){ty(t.x,e.translate,e.scale,e.originPoint),ty(t.y,n.translate,n.scale,n.originPoint)}const Xb=.999999999999,Jb=1.0000000000001;function g5(t,e,n,r=!1){var a;const s=n.length;if(!s)return;e.x=e.y=1;let i,o;for(let l=0;lXb&&(e.x=1),e.yXb&&(e.y=1)}function ls(t,e){t.min+=e,t.max+=e}function Zb(t,e,n,r,s=.5){const i=ut(t.min,t.max,s);ty(t,e,n,i,r)}function e1(t,e){return typeof t=="string"?parseFloat(t)/100*(e.max-e.min):t}function $d(t,e,n){const r=n??t;Zb(t.x,e1(e.x,r.x),e.scaleX,e.scale,e.originX),Zb(t.y,e1(e.y,r.y),e.scaleY,e.scale,e.originY)}function dC(t,e){return lC(m5(t.getBoundingClientRect(),e))}function y5(t,e,n){const r=dC(t,n),{scroll:s}=e;return s&&(ls(r.x,s.offset.x),ls(r.y,s.offset.y)),r}const x5={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},v5=al.length;function w5(t,e,n){let r="",s=!0;for(let i=0;i{if(!e.target)return t;if(typeof t=="string")if(me.test(t))t=parseFloat(t);else return t;const n=t1(t,e.target.x),r=t1(t,e.target.y);return`${n}% ${r}%`}},b5={correct:(t,{treeScale:e,projectionDelta:n})=>{const r=t,s=Kr.parse(t);if(s.length>5)return r;const i=Kr.createTransformer(t),o=typeof s[0]!="number"?1:0,a=n.x.scale*e.x,l=n.y.scale*e.y;s[0+o]/=a,s[1+o]/=l;const c=ut(a,l,.5);return typeof s[2+o]=="number"&&(s[2+o]/=c),typeof s[3+o]=="number"&&(s[3+o]/=c),i(s)}},ny={borderRadius:{...Fl,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Fl,borderTopRightRadius:Fl,borderBottomLeftRadius:Fl,borderBottomRightRadius:Fl,boxShadow:b5};function fC(t,{layout:e,layoutId:n}){return ll.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!ny[t]||t==="opacity")}function fx(t,e,n){var o;const r=t.style,s=e==null?void 0:e.style,i={};if(!r)return i;for(const a in r)(cn(r[a])||s&&cn(s[a])||fC(a,t)||((o=n==null?void 0:n.getValue(a))==null?void 0:o.liveStyle)!==void 0)&&(i[a]=r[a]);return i}function _5(t){return window.getComputedStyle(t)}class S5 extends aC{constructor(){super(...arguments),this.type="html",this.renderInstance=hC}readValueFromInstance(e,n){var r;if(ll.has(n))return(r=this.projection)!=null&&r.isProjecting?Ug(n):BM(e,n);{const s=_5(e),i=(w2(n)?s.getPropertyValue(n):s[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(e,{transformPagePoint:n}){return dC(e,n)}build(e,n,r){hx(e,n,r.transformTemplate)}scrapeMotionValuesFromProps(e,n,r){return fx(e,n,r)}}const E5={offset:"stroke-dashoffset",array:"stroke-dasharray"},T5={offset:"strokeDashoffset",array:"strokeDasharray"};function k5(t,e,n=1,r=0,s=!0){t.pathLength=1;const i=s?E5:T5;t[i.offset]=`${-r}`,t[i.array]=`${e} ${n}`}const C5=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function pC(t,{attrX:e,attrY:n,attrScale:r,pathLength:s,pathSpacing:i=1,pathOffset:o=0,...a},l,c,d){if(hx(t,a,c),l){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:h,style:m}=t;h.transform&&(m.transform=h.transform,delete h.transform),(m.transform||h.transformOrigin)&&(m.transformOrigin=h.transformOrigin??"50% 50%",delete h.transformOrigin),m.transform&&(m.transformBox=(d==null?void 0:d.transformBox)??"fill-box",delete h.transformBox);for(const p of C5)h[p]!==void 0&&(m[p]=h[p],delete h[p]);e!==void 0&&(h.x=e),n!==void 0&&(h.y=n),r!==void 0&&(h.scale=r),s!==void 0&&k5(h,s,i,o,!1)}const mC=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"]),gC=t=>typeof t=="string"&&t.toLowerCase()==="svg";function I5(t,e,n,r){hC(t,e,void 0,r);for(const s in e.attrs)t.setAttribute(mC.has(s)?s:ix(s),e.attrs[s])}function yC(t,e,n){const r=fx(t,e,n);for(const s in t)if(cn(t[s])||cn(e[s])){const i=al.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;r[i]=t[s]}return r}class N5 extends aC{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Jt}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(ll.has(n)){const r=Q2(n);return r&&r.default||0}return n=mC.has(n)?n:ix(n),e.getAttribute(n)}scrapeMotionValuesFromProps(e,n,r){return yC(e,n,r)}build(e,n,r){pC(e,n,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(e,n,r,s){I5(e,n,r,s)}mount(e){this.isSVGTag=gC(e.tagName),super.mount(e)}}const A5=dx.length;function xC(t){if(!t)return;if(!t.isControllingVariants){const n=t.parent?xC(t.parent)||{}:{};return t.props.initial!==void 0&&(n.initial=t.props.initial),n}const e={};for(let n=0;nPromise.all(e.map(({animation:n,options:r})=>I4(t,n,r)))}function D5(t){let e=j5(t),n=n1(),r=!0,s=!1;const i=c=>(d,h)=>{var p;const m=_o(t,h,c==="exit"?(p=t.presenceContext)==null?void 0:p.custom:void 0);if(m){const{transition:g,transitionEnd:b,...E}=m;d={...d,...E,...b}}return d};function o(c){e=c(t)}function a(c){const{props:d}=t,h=xC(t.parent)||{},m=[],p=new Set;let g={},b=1/0;for(let y=0;yb&&D,I=!1;const N=Array.isArray(P)?P:[P];let j=N.reduce(i(v),{});k===!1&&(j={});const{prevResolvedValues:A={}}=_,z={...A,...j},B=O=>{C=!0,p.has(O)&&(I=!0,p.delete(O)),_.needsAnimating[O]=!0;const H=t.getValue(O);H&&(H.liveStyle=!1)};for(const O in z){const H=j[O],R=A[O];if(g.hasOwnProperty(O))continue;let Y=!1;Kg(H)&&Kg(R)?Y=!vC(H,R):Y=H!==R,Y?H!=null?B(O):p.add(O):H!==void 0&&p.has(O)?B(O):_.protectedKeys[O]=!0}_.prevProp=P,_.prevResolvedValues=j,_.isActive&&(g={...g,...j}),(r||s)&&t.blockInitialAnimation&&(C=!1);const q=T&&w;C&&(!q||I)&&m.push(...N.map(O=>{const H={type:v};if(typeof O=="string"&&(r||s)&&!q&&t.manuallyAnimateOnMount&&t.parent){const{parent:R}=t,Y=_o(R,O);if(R.enteringChildren&&Y){const{delayChildren:se}=Y.transition||{};H.delay=B2(R.enteringChildren,t,se)}}return{animation:O,options:H}}))}if(p.size){const y={};if(typeof d.initial!="boolean"){const v=_o(t,Array.isArray(d.initial)?d.initial[0]:d.initial);v&&v.transition&&(y.transition=v.transition)}p.forEach(v=>{const _=t.getBaseTarget(v),P=t.getValue(v);P&&(P.liveStyle=!0),y[v]=_??null}),m.push({animation:y})}let E=!!m.length;return r&&(d.initial===!1||d.initial===d.animate)&&!t.manuallyAnimateOnMount&&(E=!1),r=!1,s=!1,E?e(m):Promise.resolve()}function l(c,d){var m;if(n[c].isActive===d)return Promise.resolve();(m=t.variantChildren)==null||m.forEach(p=>{var g;return(g=p.animationState)==null?void 0:g.setActive(c,d)}),n[c].isActive=d;const h=a(c);for(const p in n)n[p].protectedKeys={};return h}return{animateChanges:a,setActive:l,setAnimateFunction:o,getState:()=>n,reset:()=>{n=n1(),s=!0}}}function M5(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!vC(e,t):!1}function oo(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function n1(){return{animate:oo(!0),whileInView:oo(),whileHover:oo(),whileTap:oo(),whileDrag:oo(),whileFocus:oo(),exit:oo()}}function ry(t,e){t.min=e.min,t.max=e.max}function Or(t,e){ry(t.x,e.x),ry(t.y,e.y)}function r1(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}const wC=1e-4,L5=1-wC,V5=1+wC,bC=.01,O5=0-bC,F5=0+bC;function jn(t){return t.max-t.min}function z5(t,e,n){return Math.abs(t-e)<=n}function s1(t,e,n,r=.5){t.origin=r,t.originPoint=ut(e.min,e.max,t.origin),t.scale=jn(n)/jn(e),t.translate=ut(n.min,n.max,t.origin)-t.originPoint,(t.scale>=L5&&t.scale<=V5||isNaN(t.scale))&&(t.scale=1),(t.translate>=O5&&t.translate<=F5||isNaN(t.translate))&&(t.translate=0)}function hc(t,e,n,r){s1(t.x,e.x,n.x,r?r.originX:void 0),s1(t.y,e.y,n.y,r?r.originY:void 0)}function i1(t,e,n,r=0){const s=r?ut(n.min,n.max,r):n.min;t.min=s+e.min,t.max=t.min+jn(e)}function B5(t,e,n,r){i1(t.x,e.x,n.x,r==null?void 0:r.x),i1(t.y,e.y,n.y,r==null?void 0:r.y)}function o1(t,e,n,r=0){const s=r?ut(n.min,n.max,r):n.min;t.min=e.min-s,t.max=t.min+jn(e)}function Vh(t,e,n,r){o1(t.x,e.x,n.x,r==null?void 0:r.x),o1(t.y,e.y,n.y,r==null?void 0:r.y)}function a1(t,e,n,r,s){return t-=e,t=Lh(t,1/n,r),s!==void 0&&(t=Lh(t,1/s,r)),t}function U5(t,e=0,n=1,r=.5,s,i=t,o=t){if(fs.test(e)&&(e=parseFloat(e),e=ut(o.min,o.max,e/100)-o.min),typeof e!="number")return;let a=ut(i.min,i.max,r);t===i&&(a-=e),t.min=a1(t.min,e,n,a,s),t.max=a1(t.max,e,n,a,s)}function l1(t,e,[n,r,s],i,o){U5(t,e[n],e[r],e[s],e.scale,i,o)}const $5=["x","scaleX","originX"],H5=["y","scaleY","originY"];function c1(t,e,n,r){l1(t.x,e,$5,n?n.x:void 0,r?r.x:void 0),l1(t.y,e,H5,n?n.y:void 0,r?r.y:void 0)}function u1(t){return t.translate===0&&t.scale===1}function _C(t){return u1(t.x)&&u1(t.y)}function d1(t,e){return t.min===e.min&&t.max===e.max}function G5(t,e){return d1(t.x,e.x)&&d1(t.y,e.y)}function h1(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function SC(t,e){return h1(t.x,e.x)&&h1(t.y,e.y)}function f1(t){return jn(t.x)/jn(t.y)}function p1(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}function ss(t){return[t("x"),t("y")]}function q5(t,e,n){let r="";const s=t.x.translate/e.x,i=t.y.translate/e.y,o=(n==null?void 0:n.z)||0;if((s||i||o)&&(r=`translate3d(${s}px, ${i}px, ${o}px) `),(e.x!==1||e.y!==1)&&(r+=`scale(${1/e.x}, ${1/e.y}) `),n){const{transformPerspective:c,rotate:d,rotateX:h,rotateY:m,skewX:p,skewY:g}=n;c&&(r=`perspective(${c}px) ${r}`),d&&(r+=`rotate(${d}deg) `),h&&(r+=`rotateX(${h}deg) `),m&&(r+=`rotateY(${m}deg) `),p&&(r+=`skewX(${p}deg) `),g&&(r+=`skewY(${g}deg) `)}const a=t.x.scale*e.x,l=t.y.scale*e.y;return(a!==1||l!==1)&&(r+=`scale(${a}, ${l})`),r||"none"}const EC=["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"],W5=EC.length,m1=t=>typeof t=="string"?parseFloat(t):t,g1=t=>typeof t=="number"||me.test(t);function K5(t,e,n,r,s,i){s?(t.opacity=ut(0,n.opacity??1,Y5(r)),t.opacityExit=ut(e.opacity??1,0,Q5(r))):i&&(t.opacity=ut(e.opacity??1,n.opacity??1,r));for(let o=0;ore?1:n(Uc(t,e,r))}function X5(t,e,n){const r=cn(t)?t:Po(t);return r.start(rx("",r,e,n)),r.animation}function Gc(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n)}const J5=(t,e)=>t.depth-e.depth;class Z5{constructor(){this.children=[],this.isDirty=!1}add(e){H0(this.children,e),this.isDirty=!0}remove(e){Ah(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(J5),this.isDirty=!1,this.children.forEach(e)}}function eL(t,e){const n=Rn.now(),r=({timestamp:s})=>{const i=s-n;i>=e&&(Gs(r),t(i-e))};return nt.setup(r,!0),()=>Gs(r)}function Hd(t){return cn(t)?t.get():t}class tL{constructor(){this.members=[]}add(e){H0(this.members,e);for(let n=this.members.length-1;n>=0;n--){const r=this.members[n];if(r===e||r===this.lead||r===this.prevLead)continue;const s=r.instance;(!s||s.isConnected===!1)&&!r.snapshot&&(Ah(this.members,r),r.unmount())}e.scheduleRender()}remove(e){if(Ah(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(e){var n;for(let r=this.members.indexOf(e)-1;r>=0;r--){const s=this.members[r];if(s.isPresent!==!1&&((n=s.instance)==null?void 0:n.isConnected)!==!1)return this.promote(s),!0}return!1}promote(e,n){var s;const r=this.lead;if(e!==r&&(this.prevLead=r,this.lead=e,e.show(),r)){r.updateSnapshot(),e.scheduleRender();const{layoutDependency:i}=r.options,{layoutDependency:o}=e.options;(i===void 0||i!==o)&&(e.resumeFrom=r,n&&(r.preserveOpacity=!0),r.snapshot&&(e.snapshot=r.snapshot,e.snapshot.latestValues=r.animationValues||r.latestValues),(s=e.root)!=null&&s.isUpdating&&(e.isLayoutDirty=!0)),e.options.crossfade===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(e=>{var n,r,s,i,o;(r=(n=e.options).onExitComplete)==null||r.call(n),(o=(s=e.resumingFrom)==null?void 0:(i=s.options).onExitComplete)==null||o.call(i)})}scheduleRender(){this.members.forEach(e=>e.instance&&e.scheduleRender(!1))}removeLeadSnapshot(){var e;(e=this.lead)!=null&&e.snapshot&&(this.lead.snapshot=void 0)}}const Gd={hasAnimatedSinceResize:!0,hasEverUpdated:!1},em=["","X","Y","Z"],nL=1e3;let rL=0;function tm(t,e,n,r){const{latestValues:s}=e;s[t]&&(n[t]=s[t],e.setStaticValue(t,0),r&&(r[t]=0))}function kC(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=q2(e);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:s,layoutId:i}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",nt,!(s||i))}const{parent:r}=t;r&&!r.hasCheckedOptimisedAppear&&kC(r)}function CC({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:r,resetTransform:s}){return class{constructor(o={},a=e==null?void 0:e()){this.id=rL++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(oL),this.nodes.forEach(hL),this.nodes.forEach(fL),this.nodes.forEach(aL)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let l=0;lthis.root.updateBlockedByResize=!1;nt.read(()=>{h=window.innerWidth}),t(o,()=>{const p=window.innerWidth;p!==h&&(h=p,this.root.updateBlockedByResize=!0,d&&d(),d=eL(m,250),Gd.hasAnimatedSinceResize&&(Gd.hasAnimatedSinceResize=!1,this.nodes.forEach(w1)))})}a&&this.root.registerSharedNode(a,this),this.options.animate!==!1&&c&&(a||l)&&this.addEventListener("didUpdate",({delta:d,hasLayoutChanged:h,hasRelativeLayoutChanged:m,layout:p})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const g=this.options.transition||c.getDefaultTransition()||xL,{onLayoutAnimationStart:b,onLayoutAnimationComplete:E}=c.getProps(),y=!this.targetLayout||!SC(this.targetLayout,p),v=!h&&m;if(this.options.layoutRoot||this.resumeFrom||v||h&&(y||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const _={...nx(g,"layout"),onPlay:b,onComplete:E};(c.shouldReduceMotion||this.options.layoutRoot)&&(_.delay=0,_.type=!1),this.startAnimation(_),this.setAnimationOrigin(d,v)}else h||w1(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=p})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Gs(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(pL),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&kC(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!jn(this.snapshot.measuredBox.x)&&!jn(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l{const D=P/1e3;b1(h.x,o.x,D),b1(h.y,o.y,D),this.setTargetDelta(h),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Vh(m,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),gL(this.relativeTarget,this.relativeTargetOrigin,m,D),_&&G5(this.relativeTarget,_)&&(this.isProjectionDirty=!1),_||(_=Jt()),Or(_,this.relativeTarget)),b&&(this.animationValues=d,K5(d,c,this.latestValues,D,v,y)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=D},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){var a,l,c;this.notifyListeners("animationStart"),(a=this.currentAnimation)==null||a.stop(),(c=(l=this.resumingFrom)==null?void 0:l.currentAnimation)==null||c.stop(),this.pendingAnimation&&(Gs(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=nt.update(()=>{Gd.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Po(0)),this.motionValue.jump(0,!1),this.currentAnimation=X5(this.motionValue,[0,1e3],{...o,velocity:0,isSync:!0,onUpdate:d=>{this.mixTargetDelta(d),o.onUpdate&&o.onUpdate(d)},onStop:()=>{},onComplete:()=>{o.onComplete&&o.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 o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(nL),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:l,layout:c,latestValues:d}=o;if(!(!a||!l||!c)){if(this!==o&&this.layout&&c&&IC(this.options.animationType,this.layout.layoutBox,c.layoutBox)){l=this.target||Jt();const h=jn(this.layout.layoutBox.x);l.x.min=o.target.x.min,l.x.max=l.x.min+h;const m=jn(this.layout.layoutBox.y);l.y.min=o.target.y.min,l.y.max=l.y.min+m}Or(a,l),$d(a,d),hc(this.projectionDeltaWithTransform,this.layoutCorrected,a,d)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new tL),this.sharedNodes.get(o).add(a);const c=a.options.initialPromotionConfig;a.promote({transition:c?c.transition:void 0,preserveFollowOpacity:c&&c.shouldPreserveFollowOpacity?c.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var a;const{layoutId:o}=this.options;return o?((a=this.getStack())==null?void 0:a.lead)||this:this}getPrevLead(){var a;const{layoutId:o}=this.options;return o?(a=this.getStack())==null?void 0:a.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:l}={}){const c=this.getStack();c&&c.promote(this,l),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:l}=o;if((l.z||l.rotate||l.rotateX||l.rotateY||l.rotateZ||l.skewX||l.skewY)&&(a=!0),!a)return;const c={};l.z&&tm("z",o,c,this.animationValues);for(let d=0;d{var a;return(a=o.currentAnimation)==null?void 0:a.stop()}),this.root.nodes.forEach(x1),this.root.sharedNodes.clear()}}}function sL(t){t.updateLayout()}function iL(t){var n;const e=((n=t.resumeFrom)==null?void 0:n.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&e&&t.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:s}=t.layout,{animationType:i}=t.options,o=e.source!==t.layout.source;if(i==="size")ss(h=>{const m=o?e.measuredBox[h]:e.layoutBox[h],p=jn(m);m.min=r[h].min,m.max=m.min+p});else if(i==="x"||i==="y"){const h=i==="x"?"y":"x";ry(o?e.measuredBox[h]:e.layoutBox[h],r[h])}else IC(i,e.layoutBox,r)&&ss(h=>{const m=o?e.measuredBox[h]:e.layoutBox[h],p=jn(r[h]);m.max=m.min+p,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[h].max=t.relativeTarget[h].min+p)});const a=Sa();hc(a,r,e.layoutBox);const l=Sa();o?hc(l,t.applyTransform(s,!0),e.measuredBox):hc(l,r,e.layoutBox);const c=!_C(a);let d=!1;if(!t.resumeFrom){const h=t.getClosestProjectingParent();if(h&&!h.resumeFrom){const{snapshot:m,layout:p}=h;if(m&&p){const g=t.options.layoutAnchor||void 0,b=Jt();Vh(b,e.layoutBox,m.layoutBox,g);const E=Jt();Vh(E,r,p.layoutBox,g),SC(b,E)||(d=!0),h.options.layoutRoot&&(t.relativeTarget=E,t.relativeTargetOrigin=b,t.relativeParent=h)}}}t.notifyListeners("didUpdate",{layout:r,snapshot:e,delta:l,layoutDelta:a,hasLayoutChanged:c,hasRelativeLayoutChanged:d})}else if(t.isLead()){const{onExitComplete:r}=t.options;r&&r()}t.options.transition=void 0}function oL(t){t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function aL(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function lL(t){t.clearSnapshot()}function x1(t){t.clearMeasurements()}function cL(t){t.isLayoutDirty=!0,t.updateLayout()}function v1(t){t.isLayoutDirty=!1}function uL(t){t.isAnimationBlocked&&t.layout&&!t.isLayoutDirty&&(t.snapshot=t.layout,t.isLayoutDirty=!0)}function dL(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function w1(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function hL(t){t.resolveTargetDelta()}function fL(t){t.calcProjection()}function pL(t){t.resetSkewAndRotation()}function mL(t){t.removeLeadSnapshot()}function b1(t,e,n){t.translate=ut(e.translate,0,n),t.scale=ut(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function _1(t,e,n,r){t.min=ut(e.min,n.min,r),t.max=ut(e.max,n.max,r)}function gL(t,e,n,r){_1(t.x,e.x,n.x,r),_1(t.y,e.y,n.y,r)}function yL(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const xL={duration:.45,ease:[.4,0,.1,1]},S1=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),E1=S1("applewebkit/")&&!S1("chrome/")?Math.round:Rr;function T1(t){t.min=E1(t.min),t.max=E1(t.max)}function vL(t){T1(t.x),T1(t.y)}function IC(t,e,n){return t==="position"||t==="preserve-aspect"&&!z5(f1(e),f1(n),.2)}function wL(t){var e;return t!==t.root&&((e=t.scroll)==null?void 0:e.wasRoot)}const bL=CC({attachResizeListener:(t,e)=>Gc(t,"resize",e),measureScroll:()=>{var t,e;return{x:document.documentElement.scrollLeft||((t=document.body)==null?void 0:t.scrollLeft)||0,y:document.documentElement.scrollTop||((e=document.body)==null?void 0:e.scrollTop)||0}},checkIsScrollRoot:()=>!0}),nm={current:void 0},NC=CC({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!nm.current){const t=new bL({});t.mount(window),t.setOptions({layoutScroll:!0}),nm.current=t}return nm.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),px=V.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});function _L(t=!0){const e=V.useContext($0);if(e===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:s}=e,i=V.useId();V.useEffect(()=>{if(t)return s(i)},[t]);const o=V.useCallback(()=>t&&r&&r(i),[i,r,t]);return!n&&r?[!1,o]:[!0]}const AC=V.createContext({strict:!1}),k1={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"]};let C1=!1;function SL(){if(C1)return;const t={};for(const e in k1)t[e]={isEnabled:n=>k1[e].some(r=>!!n[r])};oC(t),C1=!0}function PC(){return SL(),h5()}function EL(t){const e=PC();for(const n in t)e[n]={...e[n],...t[n]};oC(e)}const TL=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function Oh(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||TL.has(t)}let RC=t=>!Oh(t);function kL(t){typeof t=="function"&&(RC=e=>e.startsWith("on")?!Oh(e):t(e))}try{kL(require("@emotion/is-prop-valid").default)}catch{}function CL(t,e,n){const r={};for(const s in t)s==="values"&&typeof t.values=="object"||cn(t[s])||(RC(s)||n===!0&&Oh(s)||!e&&!Oh(s)||t.draggable&&s.startsWith("onDrag"))&&(r[s]=t[s]);return r}const Of=V.createContext({});function IL(t,e){if(Vf(t)){const{initial:n,animate:r}=t;return{initial:n===!1||Hc(n)?n:void 0,animate:Hc(r)?r:void 0}}return t.inherit!==!1?e:{}}function NL(t){const{initial:e,animate:n}=IL(t,V.useContext(Of));return V.useMemo(()=>({initial:e,animate:n}),[I1(e),I1(n)])}function I1(t){return Array.isArray(t)?t.join(" "):t}const mx=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function jC(t,e,n){for(const r in e)!cn(e[r])&&!fC(r,n)&&(t[r]=e[r])}function AL({transformTemplate:t},e){return V.useMemo(()=>{const n=mx();return hx(n,e,t),Object.assign({},n.vars,n.style)},[e])}function PL(t,e){const n=t.style||{},r={};return jC(r,n,t),Object.assign(r,AL(t,e)),r}function RL(t,e){const n={},r=PL(t,e);return t.drag&&t.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(n.tabIndex=0),n.style=r,n}const DC=()=>({...mx(),attrs:{}});function jL(t,e,n,r){const s=V.useMemo(()=>{const i=DC();return pC(i,e,gC(r),t.transformTemplate,t.style),{...i.attrs,style:{...i.style}}},[e]);if(t.style){const i={};jC(i,t.style,t),s.style={...i,...s.style}}return s}const DL=["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 gx(t){return typeof t!="string"||t.includes("-")?!1:!!(DL.indexOf(t)>-1||/[A-Z]/u.test(t))}function ML(t,e,n,{latestValues:r},s,i=!1,o){const l=(o??gx(t)?jL:RL)(e,r,s,t),c=CL(e,typeof t=="string",i),d=t!==V.Fragment?{...c,...l,ref:n}:{},{children:h}=e,m=V.useMemo(()=>cn(h)?h.get():h,[h]);return V.createElement(t,{...d,children:m})}function LL({scrapeMotionValuesFromProps:t,createRenderState:e},n,r,s){return{latestValues:VL(n,r,s,t),renderState:e()}}function VL(t,e,n,r){const s={},i=r(t,{});for(const m in i)s[m]=Hd(i[m]);let{initial:o,animate:a}=t;const l=Vf(t),c=sC(t);e&&c&&!l&&t.inherit!==!1&&(o===void 0&&(o=e.initial),a===void 0&&(a=e.animate));let d=n?n.initial===!1:!1;d=d||o===!1;const h=d?a:o;if(h&&typeof h!="boolean"&&!Lf(h)){const m=Array.isArray(h)?h:[h];for(let p=0;p(e,n)=>{const r=V.useContext(Of),s=V.useContext($0),i=()=>LL(t,e,r,s);return n?i():du(i)},OL=MC({scrapeMotionValuesFromProps:fx,createRenderState:mx}),FL=MC({scrapeMotionValuesFromProps:yC,createRenderState:DC}),zL=Symbol.for("motionComponentSymbol");function BL(t,e,n){const r=V.useRef(n);V.useInsertionEffect(()=>{r.current=n});const s=V.useRef(null);return V.useCallback(i=>{var a;i&&((a=t.onMount)==null||a.call(t,i));const o=r.current;if(typeof o=="function")if(i){const l=o(i);typeof l=="function"&&(s.current=l)}else s.current?(s.current(),s.current=null):o(i);else o&&(o.current=i);e&&(i?e.mount(i):e.unmount())},[e])}const LC=V.createContext({});function sa(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function UL(t,e,n,r,s,i){var _,P;const{visualElement:o}=V.useContext(Of),a=V.useContext(AC),l=V.useContext($0),c=V.useContext(px),d=c.reducedMotion,h=c.skipAnimations,m=V.useRef(null),p=V.useRef(!1);r=r||a.renderer,!m.current&&r&&(m.current=r(t,{visualState:e,parent:o,props:n,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:d,skipAnimations:h,isSVG:i}),p.current&&m.current&&(m.current.manuallyAnimateOnMount=!0));const g=m.current,b=V.useContext(LC);g&&!g.projection&&s&&(g.type==="html"||g.type==="svg")&&$L(m.current,n,s,b);const E=V.useRef(!1);V.useInsertionEffect(()=>{g&&E.current&&g.update(n,l)});const y=n[G2],v=V.useRef(!!y&&typeof window<"u"&&!((_=window.MotionHandoffIsComplete)!=null&&_.call(window,y))&&((P=window.MotionHasOptimisedAnimation)==null?void 0:P.call(window,y)));return n2(()=>{p.current=!0,g&&(E.current=!0,window.MotionIsMounted=!0,g.updateFeatures(),g.scheduleRenderMicrotask(),v.current&&g.animationState&&g.animationState.animateChanges())}),V.useEffect(()=>{g&&(!v.current&&g.animationState&&g.animationState.animateChanges(),v.current&&(queueMicrotask(()=>{var D;(D=window.MotionHandoffMarkAsComplete)==null||D.call(window,y)}),v.current=!1),g.enteringChildren=void 0)}),g}function $L(t,e,n,r){const{layoutId:s,layout:i,drag:o,dragConstraints:a,layoutScroll:l,layoutRoot:c,layoutAnchor:d,layoutCrossfade:h}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:VC(t.parent)),t.projection.setOptions({layoutId:s,layout:i,alwaysMeasureLayout:!!o||a&&sa(a),visualElement:t,animationType:typeof i=="string"?i:"both",initialPromotionConfig:r,crossfade:h,layoutScroll:l,layoutRoot:c,layoutAnchor:d})}function VC(t){if(t)return t.options.allowProjection!==!1?t.projection:VC(t.parent)}function rm(t,{forwardMotionProps:e=!1,type:n}={},r,s){r&&EL(r);const i=n?n==="svg":gx(t),o=i?FL:OL;function a(c,d){let h;const m={...V.useContext(px),...c,layoutId:HL(c)},{isStatic:p}=m,g=NL(c),b=o(c,p);if(!p&&typeof window<"u"){GL();const E=qL(m);h=E.MeasureLayout,g.visualElement=UL(t,b,m,s,E.ProjectionNode,i)}return u.jsxs(Of.Provider,{value:g,children:[h&&g.visualElement?u.jsx(h,{visualElement:g.visualElement,...m}):null,ML(t,c,BL(b,g.visualElement,d),b,p,e,i)]})}a.displayName=`motion.${typeof t=="string"?t:`create(${t.displayName??t.name??""})`}`;const l=V.forwardRef(a);return l[zL]=t,l}function HL({layoutId:t}){const e=V.useContext(t2).id;return e&&t!==void 0?e+"-"+t:t}function GL(t,e){V.useContext(AC).strict}function qL(t){const e=PC(),{drag:n,layout:r}=e;if(!n&&!r)return{};const s={...n,...r};return{MeasureLayout:n!=null&&n.isEnabled(t)||r!=null&&r.isEnabled(t)?s.MeasureLayout:void 0,ProjectionNode:s.ProjectionNode}}function WL(t,e){if(typeof Proxy>"u")return rm;const n=new Map,r=(i,o)=>rm(i,o,t,e),s=(i,o)=>r(i,o);return new Proxy(s,{get:(i,o)=>o==="create"?r:(n.has(o)||n.set(o,rm(o,void 0,t,e)),n.get(o))})}const KL=(t,e)=>e.isSVG??gx(t)?new N5(e):new S5(e,{allowProjection:t!==V.Fragment});class YL extends qi{constructor(e){super(e),e.animationState||(e.animationState=D5(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();Lf(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:n}=this.node.prevProps||{};e!==n&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)==null||e.call(this)}}let QL=0;class XL extends qi{constructor(){super(...arguments),this.id=QL++,this.isExitComplete=!1}update(){var i;if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===r)return;if(e&&r===!1){if(this.isExitComplete){const{initial:o,custom:a}=this.node.getProps();if(typeof o=="string"){const l=_o(this.node,o,a);if(l){const{transition:c,transitionEnd:d,...h}=l;for(const m in h)(i=this.node.getValue(m))==null||i.jump(h[m])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive("exit",!1);this.isExitComplete=!1;return}const s=this.node.animationState.setActive("exit",!e);n&&!e&&s.then(()=>{this.isExitComplete=!0,n(this.id)})}mount(){const{register:e,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const JL={animation:{Feature:YL},exit:{Feature:XL}};function mu(t){return{point:{x:t.pageX,y:t.pageY}}}const ZL=t=>e=>lx(e)&&t(e,mu(e));function fc(t,e,n,r){return Gc(t,e,ZL(n),r)}const OC=({current:t})=>t?t.ownerDocument.defaultView:null,N1=(t,e)=>Math.abs(t-e);function eV(t,e){const n=N1(t.x,e.x),r=N1(t.y,e.y);return Math.sqrt(n**2+r**2)}const A1=new Set(["auto","scroll"]);class FC{constructor(e,n,{transformPagePoint:r,contextWindow:s=window,dragSnapToOrigin:i=!1,distanceThreshold:o=3,element:a}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=p=>{this.handleScroll(p.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=dd(this.lastRawMoveEventInfo,this.transformPagePoint));const p=sm(this.lastMoveEventInfo,this.history),g=this.startEvent!==null,b=eV(p.offset,{x:0,y:0})>=this.distanceThreshold;if(!g&&!b)return;const{point:E}=p,{timestamp:y}=hn;this.history.push({...E,timestamp:y});const{onStart:v,onMove:_}=this.handlers;g||(v&&v(this.lastMoveEvent,p),this.startEvent=this.lastMoveEvent),_&&_(this.lastMoveEvent,p)},this.handlePointerMove=(p,g)=>{this.lastMoveEvent=p,this.lastRawMoveEventInfo=g,this.lastMoveEventInfo=dd(g,this.transformPagePoint),nt.update(this.updatePoint,!0)},this.handlePointerUp=(p,g)=>{this.end();const{onEnd:b,onSessionEnd:E,resumeAnimation:y}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&y&&y(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const v=sm(p.type==="pointercancel"?this.lastMoveEventInfo:dd(g,this.transformPagePoint),this.history);this.startEvent&&b&&b(p,v),E&&E(p,v)},!lx(e))return;this.dragSnapToOrigin=i,this.handlers=n,this.transformPagePoint=r,this.distanceThreshold=o,this.contextWindow=s||window;const l=mu(e),c=dd(l,this.transformPagePoint),{point:d}=c,{timestamp:h}=hn;this.history=[{...d,timestamp:h}];const{onSessionStart:m}=n;m&&m(e,sm(c,this.history)),this.removeListeners=hu(fc(this.contextWindow,"pointermove",this.handlePointerMove),fc(this.contextWindow,"pointerup",this.handlePointerUp),fc(this.contextWindow,"pointercancel",this.handlePointerUp)),a&&this.startScrollTracking(a)}startScrollTracking(e){let n=e.parentElement;for(;n;){const r=getComputedStyle(n);(A1.has(r.overflowX)||A1.has(r.overflowY))&&this.scrollPositions.set(n,{x:n.scrollLeft,y:n.scrollTop}),n=n.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(e){const n=this.scrollPositions.get(e);if(!n)return;const r=e===window,s=r?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},i={x:s.x-n.x,y:s.y-n.y};i.x===0&&i.y===0||(r?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=i.x,this.lastMoveEventInfo.point.y+=i.y):this.history.length>0&&(this.history[0].x-=i.x,this.history[0].y-=i.y),this.scrollPositions.set(e,s),nt.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),Gs(this.updatePoint)}}function dd(t,e){return e?{point:e(t.point)}:t}function P1(t,e){return{x:t.x-e.x,y:t.y-e.y}}function sm({point:t},e){return{point:t,delta:P1(t,zC(e)),offset:P1(t,tV(e)),velocity:nV(e,.1)}}function tV(t){return t[0]}function zC(t){return t[t.length-1]}function nV(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,r=null;const s=zC(t);for(;n>=0&&(r=t[n],!(s.timestamp-r.timestamp>vr(e)));)n--;if(!r)return{x:0,y:0};r===t[0]&&t.length>2&&s.timestamp-r.timestamp>vr(e)*2&&(r=t[1]);const i=Ar(s.timestamp-r.timestamp);if(i===0)return{x:0,y:0};const o={x:(s.x-r.x)/i,y:(s.y-r.y)/i};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function rV(t,{min:e,max:n},r){return e!==void 0&&tn&&(t=r?ut(n,t,r.max):Math.min(t,n)),t}function R1(t,e,n){return{min:e!==void 0?t.min+e:void 0,max:n!==void 0?t.max+n-(t.max-t.min):void 0}}function sV(t,{top:e,left:n,bottom:r,right:s}){return{x:R1(t.x,n,s),y:R1(t.y,e,r)}}function j1(t,e){let n=e.min-t.min,r=e.max-t.max;return e.max-e.minr?n=Uc(e.min,e.max-r,t.min):r>s&&(n=Uc(t.min,t.max-s,e.min)),ws(0,1,n)}function aV(t,e){const n={};return e.min!==void 0&&(n.min=e.min-t.min),e.max!==void 0&&(n.max=e.max-t.min),n}const sy=.35;function lV(t=sy){return t===!1?t=0:t===!0&&(t=sy),{x:D1(t,"left","right"),y:D1(t,"top","bottom")}}function D1(t,e,n){return{min:M1(t,e),max:M1(t,n)}}function M1(t,e){return typeof t=="number"?t:t[e]||0}const cV=new WeakMap;class uV{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Jt(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:n=!1,distanceThreshold:r}={}){const{presenceContext:s}=this.visualElement;if(s&&s.isPresent===!1)return;const i=h=>{n&&this.snapToCursor(mu(h).point),this.stopAnimation()},o=(h,m)=>{const{drag:p,dragPropagation:g,onDragStart:b}=this.getProps();if(p&&!g&&(this.openDragLock&&this.openDragLock(),this.openDragLock=B4(p),!this.openDragLock))return;this.latestPointerEvent=h,this.latestPanInfo=m,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),ss(y=>{let v=this.getAxisMotionValue(y).get()||0;if(fs.test(v)){const{projection:_}=this.visualElement;if(_&&_.layout){const P=_.layout.layoutBox[y];P&&(v=jn(P)*(parseFloat(v)/100))}}this.originPoint[y]=v}),b&&nt.update(()=>b(h,m),!1,!0),Yg(this.visualElement,"transform");const{animationState:E}=this.visualElement;E&&E.setActive("whileDrag",!0)},a=(h,m)=>{this.latestPointerEvent=h,this.latestPanInfo=m;const{dragPropagation:p,dragDirectionLock:g,onDirectionLock:b,onDrag:E}=this.getProps();if(!p&&!this.openDragLock)return;const{offset:y}=m;if(g&&this.currentDirection===null){this.currentDirection=hV(y),this.currentDirection!==null&&b&&b(this.currentDirection);return}this.updateAxis("x",m.point,y),this.updateAxis("y",m.point,y),this.visualElement.render(),E&&nt.update(()=>E(h,m),!1,!0)},l=(h,m)=>{this.latestPointerEvent=h,this.latestPanInfo=m,this.stop(h,m),this.latestPointerEvent=null,this.latestPanInfo=null},c=()=>{const{dragSnapToOrigin:h}=this.getProps();(h||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:d}=this.getProps();this.panSession=new FC(e,{onSessionStart:i,onStart:o,onMove:a,onSessionEnd:l,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:d,distanceThreshold:r,contextWindow:OC(this.visualElement),element:this.visualElement.current})}stop(e,n){const r=e||this.latestPointerEvent,s=n||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!s||!r)return;const{velocity:o}=s;this.startAnimation(o);const{onDragEnd:a}=this.getProps();a&&nt.postRender(()=>a(r,s))}cancel(){this.isDragging=!1;const{projection:e,animationState:n}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,n,r){const{drag:s}=this.getProps();if(!r||!hd(e,s,this.currentDirection))return;const i=this.getAxisMotionValue(e);let o=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(o=rV(o,this.constraints[e],this.elastic[e])),i.set(o)}resolveConstraints(){var i;const{dragConstraints:e,dragElastic:n}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(i=this.visualElement.projection)==null?void 0:i.layout,s=this.constraints;e&&sa(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&r?this.constraints=sV(r.layoutBox,e):this.constraints=!1,this.elastic=lV(n),s!==this.constraints&&!sa(e)&&r&&this.constraints&&!this.hasMutatedConstraints&&ss(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=aV(r.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!sa(e))return!1;const r=e.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const i=y5(r,s.root,this.visualElement.getTransformPagePoint());let o=iV(s.layout.layoutBox,i);if(n){const a=n(p5(o));this.hasMutatedConstraints=!!a,a&&(o=lC(a))}return o}startAnimation(e){const{drag:n,dragMomentum:r,dragElastic:s,dragTransition:i,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),l=this.constraints||{},c=ss(d=>{if(!hd(d,n,this.currentDirection))return;let h=l&&l[d]||{};(o===!0||o===d)&&(h={min:0,max:0});const m=s?200:1e6,p=s?40:1e7,g={type:"inertia",velocity:r?e[d]:0,bounceStiffness:m,bounceDamping:p,timeConstant:750,restDelta:1,restSpeed:10,...i,...h};return this.startAxisValueAnimation(d,g)});return Promise.all(c).then(a)}startAxisValueAnimation(e,n){const r=this.getAxisMotionValue(e);return Yg(this.visualElement,e),r.start(rx(e,r,0,n,this.visualElement,!1))}stopAnimation(){ss(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){const n=`_drag${e.toUpperCase()}`,r=this.visualElement.getProps(),s=r[n];return s||this.visualElement.getValue(e,(r.initial?r.initial[e]:void 0)||0)}snapToCursor(e){ss(n=>{const{drag:r}=this.getProps();if(!hd(n,r,this.currentDirection))return;const{projection:s}=this.visualElement,i=this.getAxisMotionValue(n);if(s&&s.layout){const{min:o,max:a}=s.layout.layoutBox[n],l=i.get()||0;i.set(e[n]-ut(o,a,.5)+l)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!sa(n)||!r||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};ss(o=>{const a=this.getAxisMotionValue(o);if(a&&this.constraints!==!1){const l=a.get();s[o]=oV({min:l,max:l},this.constraints[o])}});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.constraints=!1,this.resolveConstraints(),ss(o=>{if(!hd(o,e,null))return;const a=this.getAxisMotionValue(o),{min:l,max:c}=this.constraints[o];a.set(ut(l,c,s[o]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;cV.set(this.visualElement,this);const e=this.visualElement.current,n=fc(e,"pointerdown",c=>{const{drag:d,dragListener:h=!0}=this.getProps(),m=c.target,p=m!==e&&W4(m);d&&h&&!p&&this.start(c)});let r;const s=()=>{const{dragConstraints:c}=this.getProps();sa(c)&&c.current&&(this.constraints=this.resolveRefConstraints(),r||(r=dV(e,c.current,()=>this.scalePositionWithinConstraints())))},{projection:i}=this.visualElement,o=i.addEventListener("measure",s);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),nt.read(s);const a=Gc(window,"resize",()=>this.scalePositionWithinConstraints()),l=i.addEventListener("didUpdate",({delta:c,hasLayoutChanged:d})=>{this.isDragging&&d&&(ss(h=>{const m=this.getAxisMotionValue(h);m&&(this.originPoint[h]+=c[h].translate,m.set(m.get()+c[h].translate))}),this.visualElement.render())});return()=>{a(),n(),o(),l&&l(),r&&r()}}getProps(){const e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:s=!1,dragConstraints:i=!1,dragElastic:o=sy,dragMomentum:a=!0}=e;return{...e,drag:n,dragDirectionLock:r,dragPropagation:s,dragConstraints:i,dragElastic:o,dragMomentum:a}}}function L1(t){let e=!0;return()=>{if(e){e=!1;return}t()}}function dV(t,e,n){const r=Gb(t,L1(n)),s=Gb(e,L1(n));return()=>{r(),s()}}function hd(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function hV(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class fV extends qi{constructor(e){super(e),this.removeGroupControls=Rr,this.removeListeners=Rr,this.controls=new uV(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Rr}update(){const{dragControls:e}=this.node.getProps(),{dragControls:n}=this.node.prevProps||{};e!==n&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const im=t=>(e,n)=>{t&&nt.update(()=>t(e,n),!1,!0)};class pV extends qi{constructor(){super(...arguments),this.removePointerDownListener=Rr}onPointerDown(e){this.session=new FC(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:OC(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:r,onPanEnd:s}=this.node.getProps();return{onSessionStart:im(e),onStart:im(n),onMove:im(r),onEnd:(i,o)=>{delete this.session,s&&nt.postRender(()=>s(i,o))}}}mount(){this.removePointerDownListener=fc(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let om=!1;class mV extends V.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r,layoutId:s}=this.props,{projection:i}=e;i&&(n.group&&n.group.add(i),r&&r.register&&s&&r.register(i),om&&i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),Gd.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:r,drag:s,isPresent:i}=this.props,{projection:o}=r;return o&&(o.isPresent=i,e.layoutDependency!==n&&o.setOptions({...o.options,layoutDependency:n}),om=!0,s||e.layoutDependency!==n||n===void 0||e.isPresent!==i?o.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?o.promote():o.relegate()||nt.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{visualElement:e,layoutAnchor:n}=this.props,{projection:r}=e;r&&(r.options.layoutAnchor=n,r.root.didUpdate(),ax.postRender(()=>{!r.currentAnimation&&r.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:s}=e;om=!0,s&&(s.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(s),r&&r.deregister&&r.deregister(s))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function BC(t){const[e,n]=_L(),r=V.useContext(t2);return u.jsx(mV,{...t,layoutGroup:r,switchLayoutGroup:V.useContext(LC),isPresent:e,safeToRemove:n})}const gV={pan:{Feature:pV},drag:{Feature:fV,ProjectionNode:NC,MeasureLayout:BC}};function V1(t,e,n){const{props:r}=t;t.animationState&&r.whileHover&&t.animationState.setActive("whileHover",n==="Start");const s="onHover"+n,i=r[s];i&&nt.postRender(()=>i(e,mu(e)))}class yV extends qi{mount(){const{current:e}=this.node;e&&(this.unmount=$4(e,(n,r)=>(V1(this.node,r,"Start"),s=>V1(this.node,s,"End"))))}unmount(){}}class xV extends qi{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!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=hu(Gc(this.node.current,"focus",()=>this.onFocus()),Gc(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function O1(t,e,n){const{props:r}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&r.whileTap&&t.animationState.setActive("whileTap",n==="Start");const s="onTap"+(n==="End"?"":n),i=r[s];i&&nt.postRender(()=>i(e,mu(e)))}class vV extends qi{mount(){const{current:e}=this.node;if(!e)return;const{globalTapTarget:n,propagate:r}=this.node.props;this.unmount=Y4(e,(s,i)=>(O1(this.node,i,"Start"),(o,{success:a})=>O1(this.node,o,a?"End":"Cancel")),{useGlobalTarget:n,stopPropagation:(r==null?void 0:r.tap)===!1})}unmount(){}}const iy=new WeakMap,am=new WeakMap,wV=t=>{const e=iy.get(t.target);e&&e(t)},bV=t=>{t.forEach(wV)};function _V({root:t,...e}){const n=t||document;am.has(n)||am.set(n,{});const r=am.get(n),s=JSON.stringify(e);return r[s]||(r[s]=new IntersectionObserver(bV,{root:t,...e})),r[s]}function SV(t,e,n){const r=_V(e);return iy.set(t,n),r.observe(t),()=>{iy.delete(t),r.unobserve(t)}}const EV={some:0,all:1};class TV extends qi{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){var l;(l=this.stopObserver)==null||l.call(this);const{viewport:e={}}=this.node.getProps(),{root:n,margin:r,amount:s="some",once:i}=e,o={root:n?n.current:void 0,rootMargin:r,threshold:typeof s=="number"?s:EV[s]},a=c=>{const{isIntersecting:d}=c;if(this.isInView===d||(this.isInView=d,i&&!d&&this.hasEnteredView))return;d&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",d);const{onViewportEnter:h,onViewportLeave:m}=this.node.getProps(),p=d?h:m;p&&p(c)};this.stopObserver=SV(this.node.current,o,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(kV(e,n))&&this.startObserver()}unmount(){var e;(e=this.stopObserver)==null||e.call(this),this.hasEnteredView=!1,this.isInView=!1}}function kV({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const CV={inView:{Feature:TV},tap:{Feature:vV},focus:{Feature:xV},hover:{Feature:yV}},IV={layout:{ProjectionNode:NC,MeasureLayout:BC}},NV={...JL,...CV,...gV,...IV},UC=WL(NV,KL);function $C(t){const e=du(()=>Po(t)),{isStatic:n}=V.useContext(px);if(n){const[,r]=V.useState(t);V.useEffect(()=>e.on("change",r),[])}return e}function HC(t,e){const n=$C(e()),r=()=>n.set(e());return r(),n2(()=>{const s=()=>nt.preRender(r,!1,!0),i=t.map(o=>o.on("change",s));return()=>{i.forEach(o=>o()),Gs(r)}}),n}function AV(t){dc.current=[],t();const e=HC(dc.current,t);return dc.current=void 0,e}function PV(t,e,n,r){if(typeof t=="function")return AV(t);const i=typeof e=="function"?e:i5(e,n,r),o=Array.isArray(t)?F1(t,i):F1([t],([l])=>i(l)),a=Array.isArray(t)?void 0:t.accelerate;return a&&!a.isTransformed&&typeof e!="function"&&Array.isArray(n)&&(r==null?void 0:r.clamp)!==!1&&(o.accelerate={...a,times:e,keyframes:n,isTransformed:!0}),o}function F1(t,e){const n=du(()=>[]);return HC(t,()=>{n.length=0;const r=t.length;for(let s=0;sd.value===e);if(s===-1)return t;const i=r>0?1:-1,o=t[s+i];if(!o)return t;const a=t[s],l=o.layout,c=ut(l.min,l.max,.5);return i===1&&a.layout.max+n>c||i===-1&&a.layout.min+nUC[e]),l=[],c=V.useRef(!1),d=V.useRef(null),h={axis:n,groupRef:d,registerItem:(g,b)=>{const E=l.findIndex(y=>g===y.value);E!==-1?l[E].layout=b[n]:l.push({value:g,layout:b[n]}),l.sort(MV)},updateOrder:(g,b,E)=>{if(c.current)return;const y=RV(l,g,b,E);if(l!==y){c.current=!0;const v=[...s];for(let _=0;_{c.current=!1});const m=g=>{d.current=g,typeof o=="function"?o(g):o&&(o.current=g)},p={overflowAnchor:"none",...i.style};return u.jsx(a,{...i,style:p,ref:m,ignoreStrict:!0,children:u.jsx(GC.Provider,{value:h,children:t})})}const DV=V.forwardRef(jV);function MV(t,e){return t.layout.min-e.layout.min}const fd=50,z1=25,LV=new Set(["auto","scroll"]),pc=new WeakMap,mc=new WeakMap;let Kl=null;function VV(){if(Kl){const t=oy(Kl,"y");t&&(mc.delete(t),pc.delete(t));const e=oy(Kl,"x");e&&e!==t&&(mc.delete(e),pc.delete(e)),Kl=null}}function OV(t,e){const n=getComputedStyle(t),r=e==="x"?n.overflowX:n.overflowY,s=t===document.body||t===document.documentElement;return LV.has(r)||s}function oy(t,e){let n=t==null?void 0:t.parentElement;for(;n;){if(OV(n,e))return n;n=n.parentElement}return null}function FV(t,e,n){const r=e.getBoundingClientRect(),s=n==="x"?Math.max(0,r.left):Math.max(0,r.top),i=n==="x"?Math.min(window.innerWidth,r.right):Math.min(window.innerHeight,r.bottom),o=t-s,a=i-t;if(o0))return;mc.set(s,a);const h=n==="x"?s.scrollWidth-(c?window.innerWidth:s.clientWidth):s.scrollHeight-(c?window.innerHeight:s.clientHeight);pc.set(s,h)}if(o>0){const d=pc.get(s);if((n==="x"?c?window.scrollX:s.scrollLeft:c?window.scrollY:s.scrollTop)>=d)return}n==="x"?c?window.scrollBy({left:o}):s.scrollLeft+=o:c?window.scrollBy({top:o}):s.scrollTop+=o}function B1(t,e=0){return cn(t)?t:$C(e)}function BV({children:t,style:e={},value:n,as:r="li",onDrag:s,onDragEnd:i,layout:o=!0,...a},l){const c=du(()=>UC[r]),d=V.useContext(GC),h={x:B1(e.x),y:B1(e.y)},m=PV([h.x,h.y],([y,v])=>y||v?1:"unset"),{axis:p,registerItem:g,updateOrder:b,groupRef:E}=d;return u.jsx(c,{drag:p,...a,dragSnapToOrigin:!0,style:{...e,x:h.x,y:h.y,zIndex:m},layout:o,onDrag:(y,v)=>{const{velocity:_,point:P}=v,D=h[p].get();b(n,D,_[p]),zV(E.current,P[p],p,_[p]),s&&s(y,v)},onDragEnd:(y,v)=>{VV(),i&&i(y,v)},onLayoutMeasure:y=>{g(n,y)},ref:l,ignoreStrict:!0,children:t})}const UV=V.forwardRef(BV),$V=()=>{};var U1={};/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const qC=function(t){const e=[];let n=0;for(let r=0;r>6|192,e[n++]=s&63|128):(s&64512)===55296&&r+1>18|240,e[n++]=s>>12&63|128,e[n++]=s>>6&63|128,e[n++]=s&63|128):(e[n++]=s>>12|224,e[n++]=s>>6&63|128,e[n++]=s&63|128)}return e},HV=function(t){const e=[];let n=0,r=0;for(;n191&&s<224){const i=t[n++];e[r++]=String.fromCharCode((s&31)<<6|i&63)}else if(s>239&&s<365){const i=t[n++],o=t[n++],a=t[n++],l=((s&7)<<18|(i&63)<<12|(o&63)<<6|a&63)-65536;e[r++]=String.fromCharCode(55296+(l>>10)),e[r++]=String.fromCharCode(56320+(l&1023))}else{const i=t[n++],o=t[n++];e[r++]=String.fromCharCode((s&15)<<12|(i&63)<<6|o&63)}}return e.join("")},WC={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let s=0;s>2,h=(i&3)<<4|a>>4;let m=(a&15)<<2|c>>6,p=c&63;l||(p=64,o||(m=64)),r.push(n[d],n[h],n[m],n[p])}return r.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(qC(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):HV(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();const n=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let s=0;s>4;if(r.push(m),c!==64){const p=a<<4&240|c>>2;if(r.push(p),h!==64){const g=c<<6&192|h;r.push(g)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let t=0;t=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}};class GV extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const qV=function(t){const e=qC(t);return WC.encodeByteArray(e,!0)},Fh=function(t){return qV(t).replace(/\./g,"")},KC=function(t){try{return WC.decodeString(t,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};/** + * @license + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function WV(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}/** + * @license + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const KV=()=>WV().__FIREBASE_DEFAULTS__,YV=()=>{if(typeof process>"u"||typeof U1>"u")return;const t=U1.__FIREBASE_DEFAULTS__;if(t)return JSON.parse(t)},QV=()=>{if(typeof document>"u")return;let t;try{t=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const e=t&&KC(t[1]);return e&&JSON.parse(e)},Ff=()=>{try{return $V()||KV()||YV()||QV()}catch(t){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${t}`);return}},YC=t=>{var e,n;return(n=(e=Ff())==null?void 0:e.emulatorHosts)==null?void 0:n[t]},QC=t=>{const e=YC(t);if(!e)return;const n=e.lastIndexOf(":");if(n<=0||n+1===e.length)throw new Error(`Invalid host ${e} with no separate hostname and port!`);const r=parseInt(e.substring(n+1),10);return e[0]==="["?[e.substring(1,n-1),r]:[e.substring(0,n),r]},XC=()=>{var t;return(t=Ff())==null?void 0:t.config},JC=t=>{var e;return(e=Ff())==null?void 0:e[`_${t}`]};/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class XV{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}wrapCallback(e){return(n,r)=>{n?this.reject(n):this.resolve(r),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(n):e(n,r))}}}/** + * @license + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function ZC(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const n={alg:"none",type:"JWT"},r=e||"demo-project",s=t.iat||0,i=t.sub||t.user_id;if(!i)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const o={iss:`https://securetoken.google.com/${r}`,aud:r,iat:s,exp:s+3600,auth_time:s,sub:i,user_id:i,firebase:{sign_in_provider:"custom",identities:{}},...t};return[Fh(JSON.stringify(n)),Fh(JSON.stringify(o)),""].join(".")}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function In(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function JV(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(In())}function ZV(){var e;const t=(e=Ff())==null?void 0:e.forceEnvironment;if(t==="node")return!0;if(t==="browser")return!1;try{return Object.prototype.toString.call(global.process)==="[object process]"}catch{return!1}}function eO(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function tO(){const t=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof t=="object"&&t.id!==void 0}function nO(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function rO(){const t=In();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0}function sO(){return!ZV()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}function iO(){try{return typeof indexedDB=="object"}catch{return!1}}function oO(){return new Promise((t,e)=>{try{let n=!0;const r="validate-browser-context-for-indexeddb-analytics-module",s=self.indexedDB.open(r);s.onsuccess=()=>{s.result.close(),n||self.indexedDB.deleteDatabase(r),t(!0)},s.onupgradeneeded=()=>{n=!1},s.onerror=()=>{var i;e(((i=s.error)==null?void 0:i.message)||"")}}catch(n){e(n)}})}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const aO="FirebaseError";class Ts extends Error{constructor(e,n,r){super(n),this.code=e,this.customData=r,this.name=aO,Object.setPrototypeOf(this,Ts.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,gu.prototype.create)}}class gu{constructor(e,n,r){this.service=e,this.serviceName=n,this.errors=r}create(e,...n){const r=n[0]||{},s=`${this.service}/${e}`,i=this.errors[e],o=i?lO(i,r):"Error",a=`${this.serviceName}: ${o} (${s}).`;return new Ts(s,a,r)}}function lO(t,e){return t.replace(cO,(n,r)=>{const s=e[r];return s!=null?String(s):`<${r}?>`})}const cO=/\{\$([^}]+)}/g;function uO(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}function Ro(t,e){if(t===e)return!0;const n=Object.keys(t),r=Object.keys(e);for(const s of n){if(!r.includes(s))return!1;const i=t[s],o=e[s];if($1(i)&&$1(o)){if(!Ro(i,o))return!1}else if(i!==o)return!1}for(const s of r)if(!n.includes(s))return!1;return!0}function $1(t){return t!==null&&typeof t=="object"}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function yu(t){const e=[];for(const[n,r]of Object.entries(t))Array.isArray(r)?r.forEach(s=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(s))}):e.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return e.length?"&"+e.join("&"):""}function dO(t,e){const n=new hO(t,e);return n.subscribe.bind(n)}class hO{constructor(e,n){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=n,this.task.then(()=>{e(this)}).catch(r=>{this.error(r)})}next(e){this.forEachObserver(n=>{n.next(e)})}error(e){this.forEachObserver(n=>{n.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,n,r){let s;if(e===void 0&&n===void 0&&r===void 0)throw new Error("Missing Observer.");fO(e,["next","error","complete"])?s=e:s={next:e,error:n,complete:r},s.next===void 0&&(s.next=lm),s.error===void 0&&(s.error=lm),s.complete===void 0&&(s.complete=lm);const i=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?s.error(this.finalError):s.complete()}catch{}}),this.observers.push(s),i}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let n=0;n{if(this.observers!==void 0&&this.observers[e]!==void 0)try{n(this.observers[e])}catch(r){typeof console<"u"&&console.error&&console.error(r)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}}function fO(t,e){if(typeof t!="object"||t===null)return!1;for(const n of e)if(n in t&&typeof t[n]=="function")return!0;return!1}function lm(){}/** + * @license + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function nn(t){return t&&t._delegate?t._delegate:t}/** + * @license + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function cl(t){try{return(t.startsWith("http://")||t.startsWith("https://")?new URL(t).hostname:t).endsWith(".cloudworkstations.dev")}catch{return!1}}async function yx(t){return(await fetch(t,{credentials:"include"})).ok}class Li{constructor(e,n,r){this.name=e,this.instanceFactory=n,this.type=r,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const uo="[DEFAULT]";/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class pO{constructor(e,n){this.name=e,this.container=n,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){const n=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(n)){const r=new XV;if(this.instancesDeferred.set(n,r),this.isInitialized(n)||this.shouldAutoInitialize())try{const s=this.getOrInitializeService({instanceIdentifier:n});s&&r.resolve(s)}catch{}}return this.instancesDeferred.get(n).promise}getImmediate(e){const n=this.normalizeInstanceIdentifier(e==null?void 0:e.identifier),r=(e==null?void 0:e.optional)??!1;if(this.isInitialized(n)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:n})}catch(s){if(r)return null;throw s}else{if(r)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,!!this.shouldAutoInitialize()){if(gO(e))try{this.getOrInitializeService({instanceIdentifier:uo})}catch{}for(const[n,r]of this.instancesDeferred.entries()){const s=this.normalizeInstanceIdentifier(n);try{const i=this.getOrInitializeService({instanceIdentifier:s});r.resolve(i)}catch{}}}}clearInstance(e=uo){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){const e=Array.from(this.instances.values());await Promise.all([...e.filter(n=>"INTERNAL"in n).map(n=>n.INTERNAL.delete()),...e.filter(n=>"_delete"in n).map(n=>n._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=uo){return this.instances.has(e)}getOptions(e=uo){return this.instancesOptions.get(e)||{}}initialize(e={}){const{options:n={}}=e,r=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(r))throw Error(`${this.name}(${r}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const s=this.getOrInitializeService({instanceIdentifier:r,options:n});for(const[i,o]of this.instancesDeferred.entries()){const a=this.normalizeInstanceIdentifier(i);r===a&&o.resolve(s)}return s}onInit(e,n){const r=this.normalizeInstanceIdentifier(n),s=this.onInitCallbacks.get(r)??new Set;s.add(e),this.onInitCallbacks.set(r,s);const i=this.instances.get(r);return i&&e(i,r),()=>{s.delete(e)}}invokeOnInitCallbacks(e,n){const r=this.onInitCallbacks.get(n);if(r)for(const s of r)try{s(e,n)}catch{}}getOrInitializeService({instanceIdentifier:e,options:n={}}){let r=this.instances.get(e);if(!r&&this.component&&(r=this.component.instanceFactory(this.container,{instanceIdentifier:mO(e),options:n}),this.instances.set(e,r),this.instancesOptions.set(e,n),this.invokeOnInitCallbacks(r,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,r)}catch{}return r||null}normalizeInstanceIdentifier(e=uo){return this.component?this.component.multipleInstances?e:uo:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function mO(t){return t===uo?void 0:t}function gO(t){return t.instantiationMode==="EAGER"}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class yO{constructor(e){this.name=e,this.providers=new Map}addComponent(e){const n=this.getProvider(e.name);if(n.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);n.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);const n=new pO(e,this);return this.providers.set(e,n),n}getProviders(){return Array.from(this.providers.values())}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */var Be;(function(t){t[t.DEBUG=0]="DEBUG",t[t.VERBOSE=1]="VERBOSE",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.SILENT=5]="SILENT"})(Be||(Be={}));const xO={debug:Be.DEBUG,verbose:Be.VERBOSE,info:Be.INFO,warn:Be.WARN,error:Be.ERROR,silent:Be.SILENT},vO=Be.INFO,wO={[Be.DEBUG]:"log",[Be.VERBOSE]:"log",[Be.INFO]:"info",[Be.WARN]:"warn",[Be.ERROR]:"error"},bO=(t,e,...n)=>{if(ee.some(n=>t instanceof n);let H1,G1;function SO(){return H1||(H1=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function EO(){return G1||(G1=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const eI=new WeakMap,ay=new WeakMap,tI=new WeakMap,cm=new WeakMap,vx=new WeakMap;function TO(t){const e=new Promise((n,r)=>{const s=()=>{t.removeEventListener("success",i),t.removeEventListener("error",o)},i=()=>{n(Ni(t.result)),s()},o=()=>{r(t.error),s()};t.addEventListener("success",i),t.addEventListener("error",o)});return e.then(n=>{n instanceof IDBCursor&&eI.set(n,t)}).catch(()=>{}),vx.set(e,t),e}function kO(t){if(ay.has(t))return;const e=new Promise((n,r)=>{const s=()=>{t.removeEventListener("complete",i),t.removeEventListener("error",o),t.removeEventListener("abort",o)},i=()=>{n(),s()},o=()=>{r(t.error||new DOMException("AbortError","AbortError")),s()};t.addEventListener("complete",i),t.addEventListener("error",o),t.addEventListener("abort",o)});ay.set(t,e)}let ly={get(t,e,n){if(t instanceof IDBTransaction){if(e==="done")return ay.get(t);if(e==="objectStoreNames")return t.objectStoreNames||tI.get(t);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return Ni(t[e])},set(t,e,n){return t[e]=n,!0},has(t,e){return t instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in t}};function CO(t){ly=t(ly)}function IO(t){return t===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...n){const r=t.call(um(this),e,...n);return tI.set(r,e.sort?e.sort():[e]),Ni(r)}:EO().includes(t)?function(...e){return t.apply(um(this),e),Ni(eI.get(this))}:function(...e){return Ni(t.apply(um(this),e))}}function NO(t){return typeof t=="function"?IO(t):(t instanceof IDBTransaction&&kO(t),_O(t,SO())?new Proxy(t,ly):t)}function Ni(t){if(t instanceof IDBRequest)return TO(t);if(cm.has(t))return cm.get(t);const e=NO(t);return e!==t&&(cm.set(t,e),vx.set(e,t)),e}const um=t=>vx.get(t);function AO(t,e,{blocked:n,upgrade:r,blocking:s,terminated:i}={}){const o=indexedDB.open(t,e),a=Ni(o);return r&&o.addEventListener("upgradeneeded",l=>{r(Ni(o.result),l.oldVersion,l.newVersion,Ni(o.transaction),l)}),n&&o.addEventListener("blocked",l=>n(l.oldVersion,l.newVersion,l)),a.then(l=>{i&&l.addEventListener("close",()=>i()),s&&l.addEventListener("versionchange",c=>s(c.oldVersion,c.newVersion,c))}).catch(()=>{}),a}const PO=["get","getKey","getAll","getAllKeys","count"],RO=["put","add","delete","clear"],dm=new Map;function q1(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(dm.get(e))return dm.get(e);const n=e.replace(/FromIndex$/,""),r=e!==n,s=RO.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(s||PO.includes(n)))return;const i=async function(o,...a){const l=this.transaction(o,s?"readwrite":"readonly");let c=l.store;return r&&(c=c.index(a.shift())),(await Promise.all([c[n](...a),s&&l.done]))[0]};return dm.set(e,i),i}CO(t=>({...t,get:(e,n,r)=>q1(e,n)||t.get(e,n,r),has:(e,n)=>!!q1(e,n)||t.has(e,n)}));/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class jO{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(DO(n)){const r=n.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(n=>n).join(" ")}}function DO(t){const e=t.getComponent();return(e==null?void 0:e.type)==="VERSION"}const cy="@firebase/app",W1="0.14.10";/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const qs=new xx("@firebase/app"),MO="@firebase/app-compat",LO="@firebase/analytics-compat",VO="@firebase/analytics",OO="@firebase/app-check-compat",FO="@firebase/app-check",zO="@firebase/auth",BO="@firebase/auth-compat",UO="@firebase/database",$O="@firebase/data-connect",HO="@firebase/database-compat",GO="@firebase/functions",qO="@firebase/functions-compat",WO="@firebase/installations",KO="@firebase/installations-compat",YO="@firebase/messaging",QO="@firebase/messaging-compat",XO="@firebase/performance",JO="@firebase/performance-compat",ZO="@firebase/remote-config",e3="@firebase/remote-config-compat",t3="@firebase/storage",n3="@firebase/storage-compat",r3="@firebase/firestore",s3="@firebase/ai",i3="@firebase/firestore-compat",o3="firebase",a3="12.11.0";/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const uy="[DEFAULT]",l3={[cy]:"fire-core",[MO]:"fire-core-compat",[VO]:"fire-analytics",[LO]:"fire-analytics-compat",[FO]:"fire-app-check",[OO]:"fire-app-check-compat",[zO]:"fire-auth",[BO]:"fire-auth-compat",[UO]:"fire-rtdb",[$O]:"fire-data-connect",[HO]:"fire-rtdb-compat",[GO]:"fire-fn",[qO]:"fire-fn-compat",[WO]:"fire-iid",[KO]:"fire-iid-compat",[YO]:"fire-fcm",[QO]:"fire-fcm-compat",[XO]:"fire-perf",[JO]:"fire-perf-compat",[ZO]:"fire-rc",[e3]:"fire-rc-compat",[t3]:"fire-gcs",[n3]:"fire-gcs-compat",[r3]:"fire-fst",[i3]:"fire-fst-compat",[s3]:"fire-vertex","fire-js":"fire-js",[o3]:"fire-js-all"};/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const zh=new Map,c3=new Map,dy=new Map;function K1(t,e){try{t.container.addComponent(e)}catch(n){qs.debug(`Component ${e.name} failed to register with FirebaseApp ${t.name}`,n)}}function jo(t){const e=t.name;if(dy.has(e))return qs.debug(`There were multiple attempts to register component ${e}.`),!1;dy.set(e,t);for(const n of zh.values())K1(n,t);for(const n of c3.values())K1(n,t);return!0}function zf(t,e){const n=t.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),t.container.getProvider(e)}function $r(t){return t==null?!1:t.settings!==void 0}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const u3={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},Ai=new gu("app","Firebase",u3);/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class d3{constructor(e,n,r){this._isDeleted=!1,this._options={...e},this._config={...n},this._name=n.name,this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new Li("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw Ai.create("app-deleted",{appName:this._name})}}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Go=a3;function nI(t,e={}){let n=t;typeof e!="object"&&(e={name:e});const r={name:uy,automaticDataCollectionEnabled:!0,...e},s=r.name;if(typeof s!="string"||!s)throw Ai.create("bad-app-name",{appName:String(s)});if(n||(n=XC()),!n)throw Ai.create("no-options");const i=zh.get(s);if(i){if(Ro(n,i.options)&&Ro(r,i.config))return i;throw Ai.create("duplicate-app",{appName:s})}const o=new yO(s);for(const l of dy.values())o.addComponent(l);const a=new d3(n,r,o);return zh.set(s,a),a}function wx(t=uy){const e=zh.get(t);if(!e&&t===uy&&XC())return nI();if(!e)throw Ai.create("no-app",{appName:t});return e}function ps(t,e,n){let r=l3[t]??t;n&&(r+=`-${n}`);const s=r.match(/\s|\//),i=e.match(/\s|\//);if(s||i){const o=[`Unable to register library "${r}" with version "${e}":`];s&&o.push(`library name "${r}" contains illegal characters (whitespace or "/")`),s&&i&&o.push("and"),i&&o.push(`version name "${e}" contains illegal characters (whitespace or "/")`),qs.warn(o.join(" "));return}jo(new Li(`${r}-version`,()=>({library:r,version:e}),"VERSION"))}/** + * @license + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const h3="firebase-heartbeat-database",f3=1,qc="firebase-heartbeat-store";let hm=null;function rI(){return hm||(hm=AO(h3,f3,{upgrade:(t,e)=>{switch(e){case 0:try{t.createObjectStore(qc)}catch(n){console.warn(n)}}}}).catch(t=>{throw Ai.create("idb-open",{originalErrorMessage:t.message})})),hm}async function p3(t){try{const n=(await rI()).transaction(qc),r=await n.objectStore(qc).get(sI(t));return await n.done,r}catch(e){if(e instanceof Ts)qs.warn(e.message);else{const n=Ai.create("idb-get",{originalErrorMessage:e==null?void 0:e.message});qs.warn(n.message)}}}async function Y1(t,e){try{const r=(await rI()).transaction(qc,"readwrite");await r.objectStore(qc).put(e,sI(t)),await r.done}catch(n){if(n instanceof Ts)qs.warn(n.message);else{const r=Ai.create("idb-set",{originalErrorMessage:n==null?void 0:n.message});qs.warn(r.message)}}}function sI(t){return`${t.name}!${t.options.appId}`}/** + * @license + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const m3=1024,g3=30;class y3{constructor(e){this.container=e,this._heartbeatsCache=null;const n=this.container.getProvider("app").getImmediate();this._storage=new v3(n),this._heartbeatsCachePromise=this._storage.read().then(r=>(this._heartbeatsCache=r,r))}async triggerHeartbeat(){var e,n;try{const s=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),i=Q1();if(((e=this._heartbeatsCache)==null?void 0:e.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((n=this._heartbeatsCache)==null?void 0:n.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===i||this._heartbeatsCache.heartbeats.some(o=>o.date===i))return;if(this._heartbeatsCache.heartbeats.push({date:i,agent:s}),this._heartbeatsCache.heartbeats.length>g3){const o=w3(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(o,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(r){qs.warn(r)}}async getHeartbeatsHeader(){var e;try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((e=this._heartbeatsCache)==null?void 0:e.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";const n=Q1(),{heartbeatsToSend:r,unsentEntries:s}=x3(this._heartbeatsCache.heartbeats),i=Fh(JSON.stringify({version:2,heartbeats:r}));return this._heartbeatsCache.lastSentHeartbeatDate=n,s.length>0?(this._heartbeatsCache.heartbeats=s,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),i}catch(n){return qs.warn(n),""}}}function Q1(){return new Date().toISOString().substring(0,10)}function x3(t,e=m3){const n=[];let r=t.slice();for(const s of t){const i=n.find(o=>o.agent===s.agent);if(i){if(i.dates.push(s.date),X1(n)>e){i.dates.pop();break}}else if(n.push({agent:s.agent,dates:[s.date]}),X1(n)>e){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}class v3{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return iO()?oO().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const n=await p3(this.app);return n!=null&&n.heartbeats?n:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){if(await this._canUseIndexedDBPromise){const r=await this.read();return Y1(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){if(await this._canUseIndexedDBPromise){const r=await this.read();return Y1(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:[...r.heartbeats,...e.heartbeats]})}else return}}function X1(t){return Fh(JSON.stringify({version:2,heartbeats:t})).length}function w3(t){if(t.length===0)return-1;let e=0,n=t[0].date;for(let r=1;rnew jO(e),"PRIVATE")),jo(new Li("heartbeat",e=>new y3(e),"PRIVATE")),ps(cy,W1,t),ps(cy,W1,"esm2020"),ps("fire-js","")}b3("");var _3="firebase",S3="12.11.0";/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ps(_3,S3,"app");var J1=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/** @license +Copyright The Closure Library Authors. +SPDX-License-Identifier: Apache-2.0 +*/var Pi,iI;(function(){var t;/** @license + + Copyright The Closure Library Authors. + SPDX-License-Identifier: Apache-2.0 +*/function e(T,w){function C(){}C.prototype=w.prototype,T.F=w.prototype,T.prototype=new C,T.prototype.constructor=T,T.D=function(I,N,j){for(var A=Array(arguments.length-2),z=2;z>>25),A=j+(N^w&(C^N))+I[1]+3905402710&4294967295,j=w+(A<<12&4294967295|A>>>20),A=N+(C^j&(w^C))+I[2]+606105819&4294967295,N=j+(A<<17&4294967295|A>>>15),A=C+(w^N&(j^w))+I[3]+3250441966&4294967295,C=N+(A<<22&4294967295|A>>>10),A=w+(j^C&(N^j))+I[4]+4118548399&4294967295,w=C+(A<<7&4294967295|A>>>25),A=j+(N^w&(C^N))+I[5]+1200080426&4294967295,j=w+(A<<12&4294967295|A>>>20),A=N+(C^j&(w^C))+I[6]+2821735955&4294967295,N=j+(A<<17&4294967295|A>>>15),A=C+(w^N&(j^w))+I[7]+4249261313&4294967295,C=N+(A<<22&4294967295|A>>>10),A=w+(j^C&(N^j))+I[8]+1770035416&4294967295,w=C+(A<<7&4294967295|A>>>25),A=j+(N^w&(C^N))+I[9]+2336552879&4294967295,j=w+(A<<12&4294967295|A>>>20),A=N+(C^j&(w^C))+I[10]+4294925233&4294967295,N=j+(A<<17&4294967295|A>>>15),A=C+(w^N&(j^w))+I[11]+2304563134&4294967295,C=N+(A<<22&4294967295|A>>>10),A=w+(j^C&(N^j))+I[12]+1804603682&4294967295,w=C+(A<<7&4294967295|A>>>25),A=j+(N^w&(C^N))+I[13]+4254626195&4294967295,j=w+(A<<12&4294967295|A>>>20),A=N+(C^j&(w^C))+I[14]+2792965006&4294967295,N=j+(A<<17&4294967295|A>>>15),A=C+(w^N&(j^w))+I[15]+1236535329&4294967295,C=N+(A<<22&4294967295|A>>>10),A=w+(N^j&(C^N))+I[1]+4129170786&4294967295,w=C+(A<<5&4294967295|A>>>27),A=j+(C^N&(w^C))+I[6]+3225465664&4294967295,j=w+(A<<9&4294967295|A>>>23),A=N+(w^C&(j^w))+I[11]+643717713&4294967295,N=j+(A<<14&4294967295|A>>>18),A=C+(j^w&(N^j))+I[0]+3921069994&4294967295,C=N+(A<<20&4294967295|A>>>12),A=w+(N^j&(C^N))+I[5]+3593408605&4294967295,w=C+(A<<5&4294967295|A>>>27),A=j+(C^N&(w^C))+I[10]+38016083&4294967295,j=w+(A<<9&4294967295|A>>>23),A=N+(w^C&(j^w))+I[15]+3634488961&4294967295,N=j+(A<<14&4294967295|A>>>18),A=C+(j^w&(N^j))+I[4]+3889429448&4294967295,C=N+(A<<20&4294967295|A>>>12),A=w+(N^j&(C^N))+I[9]+568446438&4294967295,w=C+(A<<5&4294967295|A>>>27),A=j+(C^N&(w^C))+I[14]+3275163606&4294967295,j=w+(A<<9&4294967295|A>>>23),A=N+(w^C&(j^w))+I[3]+4107603335&4294967295,N=j+(A<<14&4294967295|A>>>18),A=C+(j^w&(N^j))+I[8]+1163531501&4294967295,C=N+(A<<20&4294967295|A>>>12),A=w+(N^j&(C^N))+I[13]+2850285829&4294967295,w=C+(A<<5&4294967295|A>>>27),A=j+(C^N&(w^C))+I[2]+4243563512&4294967295,j=w+(A<<9&4294967295|A>>>23),A=N+(w^C&(j^w))+I[7]+1735328473&4294967295,N=j+(A<<14&4294967295|A>>>18),A=C+(j^w&(N^j))+I[12]+2368359562&4294967295,C=N+(A<<20&4294967295|A>>>12),A=w+(C^N^j)+I[5]+4294588738&4294967295,w=C+(A<<4&4294967295|A>>>28),A=j+(w^C^N)+I[8]+2272392833&4294967295,j=w+(A<<11&4294967295|A>>>21),A=N+(j^w^C)+I[11]+1839030562&4294967295,N=j+(A<<16&4294967295|A>>>16),A=C+(N^j^w)+I[14]+4259657740&4294967295,C=N+(A<<23&4294967295|A>>>9),A=w+(C^N^j)+I[1]+2763975236&4294967295,w=C+(A<<4&4294967295|A>>>28),A=j+(w^C^N)+I[4]+1272893353&4294967295,j=w+(A<<11&4294967295|A>>>21),A=N+(j^w^C)+I[7]+4139469664&4294967295,N=j+(A<<16&4294967295|A>>>16),A=C+(N^j^w)+I[10]+3200236656&4294967295,C=N+(A<<23&4294967295|A>>>9),A=w+(C^N^j)+I[13]+681279174&4294967295,w=C+(A<<4&4294967295|A>>>28),A=j+(w^C^N)+I[0]+3936430074&4294967295,j=w+(A<<11&4294967295|A>>>21),A=N+(j^w^C)+I[3]+3572445317&4294967295,N=j+(A<<16&4294967295|A>>>16),A=C+(N^j^w)+I[6]+76029189&4294967295,C=N+(A<<23&4294967295|A>>>9),A=w+(C^N^j)+I[9]+3654602809&4294967295,w=C+(A<<4&4294967295|A>>>28),A=j+(w^C^N)+I[12]+3873151461&4294967295,j=w+(A<<11&4294967295|A>>>21),A=N+(j^w^C)+I[15]+530742520&4294967295,N=j+(A<<16&4294967295|A>>>16),A=C+(N^j^w)+I[2]+3299628645&4294967295,C=N+(A<<23&4294967295|A>>>9),A=w+(N^(C|~j))+I[0]+4096336452&4294967295,w=C+(A<<6&4294967295|A>>>26),A=j+(C^(w|~N))+I[7]+1126891415&4294967295,j=w+(A<<10&4294967295|A>>>22),A=N+(w^(j|~C))+I[14]+2878612391&4294967295,N=j+(A<<15&4294967295|A>>>17),A=C+(j^(N|~w))+I[5]+4237533241&4294967295,C=N+(A<<21&4294967295|A>>>11),A=w+(N^(C|~j))+I[12]+1700485571&4294967295,w=C+(A<<6&4294967295|A>>>26),A=j+(C^(w|~N))+I[3]+2399980690&4294967295,j=w+(A<<10&4294967295|A>>>22),A=N+(w^(j|~C))+I[10]+4293915773&4294967295,N=j+(A<<15&4294967295|A>>>17),A=C+(j^(N|~w))+I[1]+2240044497&4294967295,C=N+(A<<21&4294967295|A>>>11),A=w+(N^(C|~j))+I[8]+1873313359&4294967295,w=C+(A<<6&4294967295|A>>>26),A=j+(C^(w|~N))+I[15]+4264355552&4294967295,j=w+(A<<10&4294967295|A>>>22),A=N+(w^(j|~C))+I[6]+2734768916&4294967295,N=j+(A<<15&4294967295|A>>>17),A=C+(j^(N|~w))+I[13]+1309151649&4294967295,C=N+(A<<21&4294967295|A>>>11),A=w+(N^(C|~j))+I[4]+4149444226&4294967295,w=C+(A<<6&4294967295|A>>>26),A=j+(C^(w|~N))+I[11]+3174756917&4294967295,j=w+(A<<10&4294967295|A>>>22),A=N+(w^(j|~C))+I[2]+718787259&4294967295,N=j+(A<<15&4294967295|A>>>17),A=C+(j^(N|~w))+I[9]+3951481745&4294967295,T.g[0]=T.g[0]+w&4294967295,T.g[1]=T.g[1]+(N+(A<<21&4294967295|A>>>11))&4294967295,T.g[2]=T.g[2]+N&4294967295,T.g[3]=T.g[3]+j&4294967295}r.prototype.v=function(T,w){w===void 0&&(w=T.length);const C=w-this.blockSize,I=this.C;let N=this.h,j=0;for(;j>>I&255;return T};function i(T,w){var C=a;return Object.prototype.hasOwnProperty.call(C,T)?C[T]:C[T]=w(T)}function o(T,w){this.h=w;const C=[];let I=!0;for(let N=T.length-1;N>=0;N--){const j=T[N]|0;I&&j==w||(C[N]=j,I=!1)}this.g=C}var a={};function l(T){return-128<=T&&T<128?i(T,function(w){return new o([w|0],w<0?-1:0)}):new o([T|0],T<0?-1:0)}function c(T){if(isNaN(T)||!isFinite(T))return h;if(T<0)return E(c(-T));const w=[];let C=1;for(let I=0;T>=C;I++)w[I]=T/C|0,C*=4294967296;return new o(w,0)}function d(T,w){if(T.length==0)throw Error("number format error: empty string");if(w=w||10,w<2||36=0)throw Error('number format error: interior "-" character');const C=c(Math.pow(w,8));let I=h;for(let j=0;j=0?I:4294967296+I)*w,w*=4294967296}return T},t.toString=function(T){if(T=T||10,T<2||360?C.g[0]:C.h)>>>0).toString(T);if(C=N,g(C))return j+I;for(;j.length<6;)j="0"+j;I=j+I}},t.i=function(T){return T<0?0:T>>16)+(this.i(N)>>>16)+(T.i(N)>>>16);I=A>>>16,j&=65535,A&=65535,C[N]=A<<16|j}return new o(C,C[C.length-1]&-2147483648?-1:0)};function y(T,w){return T.add(E(w))}t.j=function(T){if(g(this)||g(T))return h;if(b(this))return b(T)?E(this).j(E(T)):E(E(this).j(T));if(b(T))return E(this.j(E(T)));if(this.l(p)<0&&T.l(p)<0)return c(this.m()*T.m());const w=this.g.length+T.g.length,C=[];for(var I=0;I<2*w;I++)C[I]=0;for(I=0;I>>16,A=this.i(I)&65535,z=T.i(N)>>>16,B=T.i(N)&65535;C[2*I+2*N]+=A*B,v(C,2*I+2*N),C[2*I+2*N+1]+=j*B,v(C,2*I+2*N+1),C[2*I+2*N+1]+=A*z,v(C,2*I+2*N+1),C[2*I+2*N+2]+=j*z,v(C,2*I+2*N+2)}for(T=0;T>>16,T[w]&=65535,w++}function _(T,w){this.g=T,this.h=w}function P(T,w){if(g(w))throw Error("division by zero");if(g(T))return new _(h,h);if(b(T))return w=P(E(T),w),new _(E(w.g),E(w.h));if(b(w))return w=P(T,E(w)),new _(E(w.g),w.h);if(T.g.length>30){if(b(T)||b(w))throw Error("slowDivide_ only works with positive integers.");for(var C=m,I=w;I.l(T)<=0;)C=D(C),I=D(I);var N=k(C,1),j=k(I,1);for(I=k(I,2),C=k(C,2);!g(I);){var A=j.add(I);A.l(T)<=0&&(N=N.add(C),j=A),I=k(I,1),C=k(C,1)}return w=y(T,N.j(w)),new _(N,w)}for(N=h;T.l(w)>=0;){for(C=Math.max(1,Math.floor(T.m()/w.m())),I=Math.ceil(Math.log(C)/Math.LN2),I=I<=48?1:Math.pow(2,I-48),j=c(C),A=j.j(w);b(A)||A.l(T)>0;)C-=I,j=c(C),A=j.j(w);g(j)&&(j=m),N=N.add(j),T=y(T,A)}return new _(N,T)}t.B=function(T){return P(this,T).h},t.and=function(T){const w=Math.max(this.g.length,T.g.length),C=[];for(let I=0;I>>31;return new o(C,T.h)}function k(T,w){const C=w>>5;w%=32;const I=T.g.length-C,N=[];for(let j=0;j0?T.i(j+C)>>>w|T.i(j+C+1)<<32-w:T.i(j+C);return new o(N,T.h)}r.prototype.digest=r.prototype.A,r.prototype.reset=r.prototype.u,r.prototype.update=r.prototype.v,iI=r,o.prototype.add=o.prototype.add,o.prototype.multiply=o.prototype.j,o.prototype.modulo=o.prototype.B,o.prototype.compare=o.prototype.l,o.prototype.toNumber=o.prototype.m,o.prototype.toString=o.prototype.toString,o.prototype.getBits=o.prototype.i,o.fromNumber=c,o.fromString=d,Pi=o}).apply(typeof J1<"u"?J1:typeof self<"u"?self:typeof window<"u"?window:{});var pd=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/** @license +Copyright The Closure Library Authors. +SPDX-License-Identifier: Apache-2.0 +*/var oI,Yl,aI,qd,hy,lI,cI,uI;(function(){var t,e=Object.defineProperty;function n(f){f=[typeof globalThis=="object"&&globalThis,f,typeof window=="object"&&window,typeof self=="object"&&self,typeof pd=="object"&&pd];for(var x=0;xf&&AsyncContext.Snapshot.wrap(f):f=>f;function p(f){const x=f.length;if(x>0){const S=Array(x);for(let L=0;L0?(this.h--,x=this.g,this.g=x.next,x.next=null):x=this.i(),x}}function E(f){o.setTimeout(()=>{throw f},0)}function y(){var f=T;let x=null;return f.g&&(x=f.g,f.g=f.g.next,f.g||(f.h=null),x.next=null),x}class v{constructor(){this.h=this.g=null}add(x,S){const L=_.get();L.set(x,S),this.h?this.h.next=L:this.g=L,this.h=L}}var _=new b(()=>new P,f=>f.reset());class P{constructor(){this.next=this.g=this.h=null}set(x,S){this.h=x,this.g=S,this.next=null}reset(){this.next=this.g=this.h=null}}let D,k=!1,T=new v,w=()=>{const f=Promise.resolve(void 0);D=()=>{f.then(C)}};function C(){for(var f;f=y();){try{f.h.call(f.g)}catch(S){E(S)}var x=_;x.j(f),x.h<100&&(x.h++,f.next=x.g,x.g=f)}k=!1}function I(){this.u=this.u,this.C=this.C}I.prototype.u=!1,I.prototype.dispose=function(){this.u||(this.u=!0,this.N())},I.prototype[Symbol.dispose]=function(){this.dispose()},I.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()};function N(f,x){this.type=f,this.g=this.target=x,this.defaultPrevented=!1}N.prototype.h=function(){this.defaultPrevented=!0};var j=function(){if(!o.addEventListener||!Object.defineProperty)return!1;var f=!1,x=Object.defineProperty({},"passive",{get:function(){f=!0}});try{const S=()=>{};o.addEventListener("test",S,x),o.removeEventListener("test",S,x)}catch{}return f}();function A(f){return/^[\s\xa0]*$/.test(f)}function z(f,x){N.call(this,f?f.type:""),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType="",this.i=null,f&&this.init(f,x)}h(z,N),z.prototype.init=function(f,x){const S=this.type=f.type,L=f.changedTouches&&f.changedTouches.length?f.changedTouches[0]:null;this.target=f.target||f.srcElement,this.g=x,x=f.relatedTarget,x||(S=="mouseover"?x=f.fromElement:S=="mouseout"&&(x=f.toElement)),this.relatedTarget=x,L?(this.clientX=L.clientX!==void 0?L.clientX:L.pageX,this.clientY=L.clientY!==void 0?L.clientY:L.pageY,this.screenX=L.screenX||0,this.screenY=L.screenY||0):(this.clientX=f.clientX!==void 0?f.clientX:f.pageX,this.clientY=f.clientY!==void 0?f.clientY:f.pageY,this.screenX=f.screenX||0,this.screenY=f.screenY||0),this.button=f.button,this.key=f.key||"",this.ctrlKey=f.ctrlKey,this.altKey=f.altKey,this.shiftKey=f.shiftKey,this.metaKey=f.metaKey,this.pointerId=f.pointerId||0,this.pointerType=f.pointerType,this.state=f.state,this.i=f,f.defaultPrevented&&z.Z.h.call(this)},z.prototype.h=function(){z.Z.h.call(this);const f=this.i;f.preventDefault?f.preventDefault():f.returnValue=!1};var B="closure_listenable_"+(Math.random()*1e6|0),q=0;function X(f,x,S,L,U){this.listener=f,this.proxy=null,this.src=x,this.type=S,this.capture=!!L,this.ha=U,this.key=++q,this.da=this.fa=!1}function O(f){f.da=!0,f.listener=null,f.proxy=null,f.src=null,f.ha=null}function H(f,x,S){for(const L in f)x.call(S,f[L],L,f)}function R(f,x){for(const S in f)x.call(void 0,f[S],S,f)}function Y(f){const x={};for(const S in f)x[S]=f[S];return x}const se="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function M(f,x){let S,L;for(let U=1;U-1?(x=f[oe],S||(x.fa=!1)):(x=new X(x,this.src,G,!!L,U),x.fa=S,f.push(x)),x};function ee(f,x){const S=x.type;if(S in f.g){var L=f.g[S],U=Array.prototype.indexOf.call(L,x,void 0),G;(G=U>=0)&&Array.prototype.splice.call(L,U,1),G&&(O(x),f.g[S].length==0&&(delete f.g[S],f.h--))}}function J(f,x,S,L){for(let U=0;U-1&&(O(x[S]),Array.prototype.splice.call(x,S,1),x.length==0&&(delete f.g[G],f.h--)))):f&&(f=Oe(f))&&(x=f.g[x.toString()],f=-1,x&&(f=J(x,S,L,U)),(S=f>-1?x[f]:null)&&zn(S))}function zn(f){if(typeof f!="number"&&f&&!f.da){var x=f.src;if(x&&x[B])ee(x.i,f);else{var S=f.type,L=f.proxy;x.removeEventListener?x.removeEventListener(S,L,f.capture):x.detachEvent?x.detachEvent(le(S),L):x.addListener&&x.removeListener&&x.removeListener(L),(S=Oe(x))?(ee(S,f),S.h==0&&(S.src=null,x[ae]=null)):O(f)}}}function le(f){return f in ce?ce[f]:ce[f]="on"+f}function xe(f,x){if(f.da)f=!0;else{x=new z(x,this);const S=f.listener,L=f.ha||f.src;f.fa&&zn(f),f=S.call(L,x)}return f}function Oe(f){return f=f[ae],f instanceof $?f:null}var qe="__closure_events_fn_"+(Math.random()*1e9>>>0);function ke(f){return typeof f=="function"?f:(f[qe]||(f[qe]=function(x){return f.handleEvent(x)}),f[qe])}function Ce(){I.call(this),this.i=new $(this),this.M=this,this.G=null}h(Ce,I),Ce.prototype[B]=!0,Ce.prototype.removeEventListener=function(f,x,S,L){gt(this,f,x,S,L)};function Ye(f,x){var S,L=f.G;if(L)for(S=[];L;L=L.G)S.push(L);if(f=f.M,L=x.type||x,typeof x=="string")x=new N(x,f);else if(x instanceof N)x.target=x.target||f;else{var U=x;x=new N(L,f),M(x,U)}U=!0;let G,oe;if(S)for(oe=S.length-1;oe>=0;oe--)G=x.g=S[oe],U=or(G,L,!0,x)&&U;if(G=x.g=f,U=or(G,L,!0,x)&&U,U=or(G,L,!1,x)&&U,S)for(oe=0;oe2147483647?-1:o.setTimeout(f,x||0)}function ar(f){f.g=It(()=>{f.g=null,f.i&&(f.i=!1,ar(f))},f.l);const x=f.h;f.h=null,f.m.apply(null,x)}class Ji extends I{constructor(x,S){super(),this.m=x,this.l=S,this.h=null,this.i=!1,this.g=null}j(x){this.h=arguments,this.g?this.i=!0:ar(this)}N(){super.N(),this.g&&(o.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function Sr(f){I.call(this),this.h=f,this.g={}}h(Sr,I);var W=[];function te(f){H(f.g,function(x,S){this.g.hasOwnProperty(S)&&zn(x)},f),f.g={}}Sr.prototype.N=function(){Sr.Z.N.call(this),te(this)},Sr.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var ve=o.JSON.stringify,Pe=o.JSON.parse,Me=class{stringify(f){return o.JSON.stringify(f,void 0)}parse(f){return o.JSON.parse(f,void 0)}};function yt(){}function je(){}var Kt={OPEN:"a",hb:"b",ERROR:"c",tb:"d"};function et(){N.call(this,"d")}h(et,N);function Bn(){N.call(this,"c")}h(Bn,N);var ot={},Ft=null;function zt(){return Ft=Ft||new Ce}ot.Ia="serverreachability";function rn(f){N.call(this,ot.Ia,f)}h(rn,N);function Cs(f){const x=zt();Ye(x,new rn(x))}ot.STAT_EVENT="statevent";function Zi(f,x){N.call(this,ot.STAT_EVENT,f),this.stat=x}h(Zi,N);function rt(f){const x=zt();Ye(x,new Zi(x,f))}ot.Ja="timingevent";function eo(f,x){N.call(this,ot.Ja,f),this.size=x}h(eo,N);function _e(f,x){if(typeof f!="function")throw Error("Fn must not be null and must be a function");return o.setTimeout(function(){f()},x)}function ht(){this.g=!0}ht.prototype.ua=function(){this.g=!1};function st(f,x,S,L,U,G){f.info(function(){if(f.g)if(G){var oe="",Le=G.split("&");for(let it=0;it1){const on=Xt[0];Xt=Xt[1];const es=on.split("_");oe=es.length>=2&&es[1]=="type"?oe+(on+"="+Xt+"&"):oe+(on+"=redacted&")}}}else oe=null;else oe=G;return"XMLHTTP REQ ("+L+") [attempt "+U+"]: "+x+` +`+S+` +`+oe})}function Bt(f,x,S,L,U,G,oe){f.info(function(){return"XMLHTTP RESP ("+L+") [ attempt "+U+"]: "+x+` +`+S+` +`+G+" "+oe})}function Yt(f,x,S,L){f.info(function(){return"XMLHTTP TEXT ("+x+"): "+Nt(f,S)+(L?" "+L:"")})}function bt(f,x){f.info(function(){return"TIMEOUT: "+x})}ht.prototype.info=function(){};function Nt(f,x){if(!f.g)return x;if(!x)return null;try{const G=JSON.parse(x);if(G){for(f=0;f0&&f.length;)S.push(f.shift()),x--;return f.length&&S.push(f.join(":")),S}function Jr(f,x,S,L){this.j=f,this.i=x,this.l=S,this.S=L||1,this.V=new Sr(this),this.H=45e3,this.J=null,this.o=!1,this.u=this.B=this.A=this.M=this.F=this.T=this.D=null,this.G=[],this.g=null,this.C=0,this.m=this.v=null,this.X=-1,this.K=!1,this.P=0,this.O=null,this.W=this.L=this.U=this.R=!1,this.h=new Js}function Js(){this.i=null,this.g="",this.h=!1}var Du={},_t={};function xt(f,x,S){f.M=1,f.A=An(Fe(x)),f.u=S,f.R=!0,Mu(f,null)}function Mu(f,x){f.F=Date.now(),Qo(f),f.B=Fe(f.A);var S=f.B,L=f.S;Array.isArray(L)||(L=[String(L)]),Ov(S.i,"t",L),f.C=0,S=f.j.L,f.h=new Js,f.g=nw(f.j,S?x:null,!f.u),f.P>0&&(f.O=new Ji(c(f.Y,f,f.g),f.P)),x=f.V,S=f.g,L=f.ba;var U="readystatechange";Array.isArray(U)||(U&&(W[0]=U.toString()),U=W);for(let G=0;G0&&!this.W){this.W=!0;var oe=this.j;oe.g==this&&oe.aa&&!oe.P&&(oe.j.info("Great, no buffering proxy detected. Bytes received: "+S.length),gp(oe),oe.P=!0,rt(11))}}else Yt(this.i,this.l,S,null),Xo(this,S);Le==4&&Zr(this),this.o&&!this.K&&(Le==4?Jv(this.j,this):(this.o=!1,Qo(this)))}else MP(this.g),x==400&&S.indexOf("Unknown SID")>0?(this.m=3,rt(12)):(this.m=0,rt(13)),Zr(this),to(this)}}}catch{}finally{}};function dp(f){if(!Is(f))return f.g.la();const x=Gv(f.g);if(x==="")return"";let S="";const L=x.length,U=ei(f.g)==4;if(!f.h.i){if(typeof TextDecoder>"u")return Zr(f),to(f),"";f.h.i=new o.TextDecoder}for(let G=0;Gx.length?_t:(x=x.slice(L,L+S),f.C=L+S,x)))}Jr.prototype.cancel=function(){this.K=!0,Zr(this)};function Qo(f){f.T=Date.now()+f.H,wl(f,f.H)}function wl(f,x){if(f.D!=null)throw Error("WatchDog timer not null");f.D=_e(c(f.aa,f),x)}function bl(f){f.D&&(o.clearTimeout(f.D),f.D=null)}Jr.prototype.aa=function(){this.D=null;const f=Date.now();f-this.T>=0?(bt(this.i,this.B),this.M!=2&&(Cs(),rt(17)),Zr(this),this.m=2,to(this)):wl(this,this.T-f)};function to(f){f.j.I==0||f.K||Jv(f.j,f)}function Zr(f){bl(f);var x=f.O;x&&typeof x.dispose=="function"&&x.dispose(),f.O=null,te(f.V),f.g&&(x=f.g,f.g=null,x.abort(),x.dispose())}function Xo(f,x){try{var S=f.j;if(S.I!=0&&(S.g==f||Sl(S.h,f))){if(!f.L&&Sl(S.h,f)&&S.I==3){try{var L=S.Ba.g.parse(x)}catch{L=null}if(Array.isArray(L)&&L.length==3){var U=L;if(U[0]==0){e:if(!S.v){if(S.g)if(S.g.F+3e30&&(L=1.5*ti,S.O=L,S.j.info("backChannelRequestTimeoutMs_="+L)),L=S;const ni=f.g;if(ni){const Gu=ni.g?ni.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(Gu){var G=L.h;G.g||Gu.indexOf("spdy")==-1&&Gu.indexOf("quic")==-1&&Gu.indexOf("h2")==-1||(G.j=G.l,G.g=new Set,G.h&&(El(G,G.h),G.h=null))}if(L.G){const yp=ni.g?ni.g.getResponseHeader("X-HTTP-Session-Id"):null;yp&&(L.wa=yp,ge(L.J,L.G,yp))}}S.I=3,S.l&&S.l.ra(),S.aa&&(S.T=Date.now()-f.F,S.j.info("Handshake RTT: "+S.T+"ms")),L=S;var oe=f;if(L.na=tw(L,L.L?L.ba:null,L.W),oe.L){Ou(L.h,oe);var Le=oe,Xt=L.O;Xt&&(Le.H=Xt),Le.D&&(bl(Le),Qo(Le)),L.g=oe}else Qv(L);S.i.length>0&&Uu(S)}else it[0]!="stop"&&it[0]!="close"||so(S,7);else S.I==3&&(it[0]=="stop"||it[0]=="close"?it[0]=="stop"?so(S,7):pp(S):it[0]!="noop"&&S.l&&S.l.qa(it),S.A=0)}}Cs(4)}catch{}}var Hn=class{constructor(f,x){this.g=f,this.map=x}};function Lu(f){this.l=f||10,o.PerformanceNavigationTiming?(f=o.performance.getEntriesByType("navigation"),f=f.length>0&&(f[0].nextHopProtocol=="hq"||f[0].nextHopProtocol=="h2")):f=!!(o.chrome&&o.chrome.loadTimes&&o.chrome.loadTimes()&&o.chrome.loadTimes().wasFetchedViaSpdy),this.j=f?this.l:1,this.g=null,this.j>1&&(this.g=new Set),this.h=null,this.i=[]}function _l(f){return f.h?!0:f.g?f.g.size>=f.j:!1}function Vu(f){return f.h?1:f.g?f.g.size:0}function Sl(f,x){return f.h?f.h==x:f.g?f.g.has(x):!1}function El(f,x){f.g?f.g.add(x):f.h=x}function Ou(f,x){f.h&&f.h==x?f.h=null:f.g&&f.g.has(x)&&f.g.delete(x)}Lu.prototype.cancel=function(){if(this.i=F(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&this.g.size!==0){for(const f of this.g.values())f.cancel();this.g.clear()}};function F(f){if(f.h!=null)return f.i.concat(f.h.G);if(f.g!=null&&f.g.size!==0){let x=f.i;for(const S of f.g.values())x=x.concat(S.G);return x}return p(f.i)}var ne=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function de(f,x){if(f){f=f.split("&");for(let S=0;S=0?(U=f[S].substring(0,L),G=f[S].substring(L+1)):U=f[S],x(U,G?decodeURIComponent(G.replace(/\+/g," ")):"")}}}function we(f){this.g=this.o=this.j="",this.u=null,this.m=this.h="",this.l=!1;let x;f instanceof we?(this.l=f.l,tt(this,f.j),this.o=f.o,this.g=f.g,Ie(this,f.u),this.h=f.h,He(this,Fv(f.i)),this.m=f.m):f&&(x=String(f).match(ne))?(this.l=!1,tt(this,x[1]||"",!0),this.o=Gn(x[2]||""),this.g=Gn(x[3]||"",!0),Ie(this,x[4]),this.h=Gn(x[5]||"",!0),He(this,x[6]||"",!0),this.m=Gn(x[7]||"")):(this.l=!1,this.i=new kl(null,this.l))}we.prototype.toString=function(){const f=[];var x=this.j;x&&f.push(qn(x,Jo,!0),":");var S=this.g;return(S||x=="file")&&(f.push("//"),(x=this.o)&&f.push(qn(x,Jo,!0),"@"),f.push(sn(S).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),S=this.u,S!=null&&f.push(":",String(S))),(S=this.h)&&(this.g&&S.charAt(0)!="/"&&f.push("/"),f.push(qn(S,S.charAt(0)=="/"?no:Tl,!0))),(S=this.i.toString())&&f.push("?",S),(S=this.m)&&f.push("#",qn(S,IP)),f.join("")},we.prototype.resolve=function(f){const x=Fe(this);let S=!!f.j;S?tt(x,f.j):S=!!f.o,S?x.o=f.o:S=!!f.g,S?x.g=f.g:S=f.u!=null;var L=f.h;if(S)Ie(x,f.u);else if(S=!!f.h){if(L.charAt(0)!="/")if(this.g&&!this.h)L="/"+L;else{var U=x.h.lastIndexOf("/");U!=-1&&(L=x.h.slice(0,U+1)+L)}if(U=L,U==".."||U==".")L="";else if(U.indexOf("./")!=-1||U.indexOf("/.")!=-1){L=U.lastIndexOf("/",0)==0,U=U.split("/");const G=[];for(let oe=0;oe1||G.length==1&&G[0]!="")&&G.pop(),L&&oe==U.length&&G.push("")):(G.push(Le),L=!0)}L=G.join("/")}else L=U}return S?x.h=L:S=f.i.toString()!=="",S?He(x,Fv(f.i)):S=!!f.m,S&&(x.m=f.m),x};function Fe(f){return new we(f)}function tt(f,x,S){f.j=S?Gn(x,!0):x,f.j&&(f.j=f.j.replace(/:$/,""))}function Ie(f,x){if(x){if(x=Number(x),isNaN(x)||x<0)throw Error("Bad port number "+x);f.u=x}else f.u=null}function He(f,x,S){x instanceof kl?(f.i=x,NP(f.i,f.l)):(S||(x=qn(x,CP)),f.i=new kl(x,f.l))}function ge(f,x,S){f.i.set(x,S)}function An(f){return ge(f,"zx",Math.floor(Math.random()*2147483648).toString(36)+Math.abs(Math.floor(Math.random()*2147483648)^Date.now()).toString(36)),f}function Gn(f,x){return f?x?decodeURI(f.replace(/%25/g,"%2525")):decodeURIComponent(f):""}function qn(f,x,S){return typeof f=="string"?(f=encodeURI(f).replace(x,Ns),S&&(f=f.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),f):null}function Ns(f){return f=f.charCodeAt(0),"%"+(f>>4&15).toString(16)+(f&15).toString(16)}var Jo=/[#\/\?@]/g,Tl=/[#\?:]/g,no=/[#\?]/g,CP=/[#\?@]/g,IP=/#/g;function kl(f,x){this.h=this.g=null,this.i=f||null,this.j=!!x}function ro(f){f.g||(f.g=new Map,f.h=0,f.i&&de(f.i,function(x,S){f.add(decodeURIComponent(x.replace(/\+/g," ")),S)}))}t=kl.prototype,t.add=function(f,x){ro(this),this.i=null,f=Zo(this,f);let S=this.g.get(f);return S||this.g.set(f,S=[]),S.push(x),this.h+=1,this};function Mv(f,x){ro(f),x=Zo(f,x),f.g.has(x)&&(f.i=null,f.h-=f.g.get(x).length,f.g.delete(x))}function Lv(f,x){return ro(f),x=Zo(f,x),f.g.has(x)}t.forEach=function(f,x){ro(this),this.g.forEach(function(S,L){S.forEach(function(U){f.call(x,U,L,this)},this)},this)};function Vv(f,x){ro(f);let S=[];if(typeof x=="string")Lv(f,x)&&(S=S.concat(f.g.get(Zo(f,x))));else for(f=Array.from(f.g.values()),x=0;x0?String(f[0]):x):x};function Ov(f,x,S){Mv(f,x),S.length>0&&(f.i=null,f.g.set(Zo(f,x),p(S)),f.h+=S.length)}t.toString=function(){if(this.i)return this.i;if(!this.g)return"";const f=[],x=Array.from(this.g.keys());for(let L=0;L{L.abort(),Zs(S,"TestPingServer: timeout",!1,x)},1e4);fetch(f,{signal:L.signal}).then(G=>{clearTimeout(U),G.ok?Zs(S,"TestPingServer: ok",!0,x):Zs(S,"TestPingServer: server error",!1,x)}).catch(()=>{clearTimeout(U),Zs(S,"TestPingServer: error",!1,x)})}function Zs(f,x,S,L,U){try{U&&(U.onload=null,U.onerror=null,U.onabort=null,U.ontimeout=null),L(S)}catch{}}function RP(){this.g=new Me}function hp(f){this.i=f.Sb||null,this.h=f.ab||!1}h(hp,yt),hp.prototype.g=function(){return new Fu(this.i,this.h)};function Fu(f,x){Ce.call(this),this.H=f,this.o=x,this.m=void 0,this.status=this.readyState=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.A=new Headers,this.h=null,this.F="GET",this.D="",this.g=!1,this.B=this.j=this.l=null,this.v=new AbortController}h(Fu,Ce),t=Fu.prototype,t.open=function(f,x){if(this.readyState!=0)throw this.abort(),Error("Error reopening a connection");this.F=f,this.D=x,this.readyState=1,Il(this)},t.send=function(f){if(this.readyState!=1)throw this.abort(),Error("need to call open() first. ");if(this.v.signal.aborted)throw this.abort(),Error("Request was aborted.");this.g=!0;const x={headers:this.A,method:this.F,credentials:this.m,cache:void 0,signal:this.v.signal};f&&(x.body=f),(this.H||o).fetch(new Request(this.D,x)).then(this.Pa.bind(this),this.ga.bind(this))},t.abort=function(){this.response=this.responseText="",this.A=new Headers,this.status=0,this.v.abort(),this.j&&this.j.cancel("Request was aborted.").catch(()=>{}),this.readyState>=1&&this.g&&this.readyState!=4&&(this.g=!1,Cl(this)),this.readyState=0},t.Pa=function(f){if(this.g&&(this.l=f,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=f.headers,this.readyState=2,Il(this)),this.g&&(this.readyState=3,Il(this),this.g)))if(this.responseType==="arraybuffer")f.arrayBuffer().then(this.Na.bind(this),this.ga.bind(this));else if(typeof o.ReadableStream<"u"&&"body"in f){if(this.j=f.body.getReader(),this.o){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.B=new TextDecoder;zv(this)}else f.text().then(this.Oa.bind(this),this.ga.bind(this))};function zv(f){f.j.read().then(f.Ma.bind(f)).catch(f.ga.bind(f))}t.Ma=function(f){if(this.g){if(this.o&&f.value)this.response.push(f.value);else if(!this.o){var x=f.value?f.value:new Uint8Array(0);(x=this.B.decode(x,{stream:!f.done}))&&(this.response=this.responseText+=x)}f.done?Cl(this):Il(this),this.readyState==3&&zv(this)}},t.Oa=function(f){this.g&&(this.response=this.responseText=f,Cl(this))},t.Na=function(f){this.g&&(this.response=f,Cl(this))},t.ga=function(){this.g&&Cl(this)};function Cl(f){f.readyState=4,f.l=null,f.j=null,f.B=null,Il(f)}t.setRequestHeader=function(f,x){this.A.append(f,x)},t.getResponseHeader=function(f){return this.h&&this.h.get(f.toLowerCase())||""},t.getAllResponseHeaders=function(){if(!this.h)return"";const f=[],x=this.h.entries();for(var S=x.next();!S.done;)S=S.value,f.push(S[0]+": "+S[1]),S=x.next();return f.join(`\r +`)};function Il(f){f.onreadystatechange&&f.onreadystatechange.call(f)}Object.defineProperty(Fu.prototype,"withCredentials",{get:function(){return this.m==="include"},set:function(f){this.m=f?"include":"same-origin"}});function Bv(f){let x="";return H(f,function(S,L){x+=L,x+=":",x+=S,x+=`\r +`}),x}function fp(f,x,S){e:{for(L in S){var L=!1;break e}L=!0}L||(S=Bv(S),typeof f=="string"?S!=null&&sn(S):ge(f,x,S))}function Pt(f){Ce.call(this),this.headers=new Map,this.L=f||null,this.h=!1,this.g=null,this.D="",this.o=0,this.l="",this.j=this.B=this.v=this.A=!1,this.m=null,this.F="",this.H=!1}h(Pt,Ce);var jP=/^https?$/i,DP=["POST","PUT"];t=Pt.prototype,t.Fa=function(f){this.H=f},t.ea=function(f,x,S,L){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+f);x=x?x.toUpperCase():"GET",this.D=f,this.l="",this.o=0,this.A=!1,this.h=!0,this.g=this.L?this.L.g():Qt.g(),this.g.onreadystatechange=m(c(this.Ca,this));try{this.B=!0,this.g.open(x,String(f),!0),this.B=!1}catch(G){Uv(this,G);return}if(f=S||"",S=new Map(this.headers),L)if(Object.getPrototypeOf(L)===Object.prototype)for(var U in L)S.set(U,L[U]);else if(typeof L.keys=="function"&&typeof L.get=="function")for(const G of L.keys())S.set(G,L.get(G));else throw Error("Unknown input type for opt_headers: "+String(L));L=Array.from(S.keys()).find(G=>G.toLowerCase()=="content-type"),U=o.FormData&&f instanceof o.FormData,!(Array.prototype.indexOf.call(DP,x,void 0)>=0)||L||U||S.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(const[G,oe]of S)this.g.setRequestHeader(G,oe);this.F&&(this.g.responseType=this.F),"withCredentials"in this.g&&this.g.withCredentials!==this.H&&(this.g.withCredentials=this.H);try{this.m&&(clearTimeout(this.m),this.m=null),this.v=!0,this.g.send(f),this.v=!1}catch(G){Uv(this,G)}};function Uv(f,x){f.h=!1,f.g&&(f.j=!0,f.g.abort(),f.j=!1),f.l=x,f.o=5,$v(f),zu(f)}function $v(f){f.A||(f.A=!0,Ye(f,"complete"),Ye(f,"error"))}t.abort=function(f){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.o=f||7,Ye(this,"complete"),Ye(this,"abort"),zu(this))},t.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),zu(this,!0)),Pt.Z.N.call(this)},t.Ca=function(){this.u||(this.B||this.v||this.j?Hv(this):this.Xa())},t.Xa=function(){Hv(this)};function Hv(f){if(f.h&&typeof i<"u"){if(f.v&&ei(f)==4)setTimeout(f.Ca.bind(f),0);else if(Ye(f,"readystatechange"),ei(f)==4){f.h=!1;try{const G=f.ca();e:switch(G){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var x=!0;break e;default:x=!1}var S;if(!(S=x)){var L;if(L=G===0){let oe=String(f.D).match(ne)[1]||null;!oe&&o.self&&o.self.location&&(oe=o.self.location.protocol.slice(0,-1)),L=!jP.test(oe?oe.toLowerCase():"")}S=L}if(S)Ye(f,"complete"),Ye(f,"success");else{f.o=6;try{var U=ei(f)>2?f.g.statusText:""}catch{U=""}f.l=U+" ["+f.ca()+"]",$v(f)}}finally{zu(f)}}}}function zu(f,x){if(f.g){f.m&&(clearTimeout(f.m),f.m=null);const S=f.g;f.g=null,x||Ye(f,"ready");try{S.onreadystatechange=null}catch{}}}t.isActive=function(){return!!this.g};function ei(f){return f.g?f.g.readyState:0}t.ca=function(){try{return ei(this)>2?this.g.status:-1}catch{return-1}},t.la=function(){try{return this.g?this.g.responseText:""}catch{return""}},t.La=function(f){if(this.g){var x=this.g.responseText;return f&&x.indexOf(f)==0&&(x=x.substring(f.length)),Pe(x)}};function Gv(f){try{if(!f.g)return null;if("response"in f.g)return f.g.response;switch(f.F){case"":case"text":return f.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in f.g)return f.g.mozResponseArrayBuffer}return null}catch{return null}}function MP(f){const x={};f=(f.g&&ei(f)>=2&&f.g.getAllResponseHeaders()||"").split(`\r +`);for(let L=0;L0&&(this.ia=f.longPollingTimeout),this.ta=void 0,this.T=0,this.P=!1,this.ja=this.B=null}t=qv.prototype,t.ka=8,t.I=1,t.connect=function(f,x,S,L){rt(0),this.W=f,this.H=x||{},S&&L!==void 0&&(this.H.OSID=S,this.H.OAID=L),this.F=this.X,this.J=tw(this,null,this.W),Uu(this)};function pp(f){if(Wv(f),f.I==3){var x=f.V++,S=Fe(f.J);if(ge(S,"SID",f.M),ge(S,"RID",x),ge(S,"TYPE","terminate"),Al(f,S),x=new Jr(f,f.j,x),x.M=2,x.A=An(Fe(S)),S=!1,o.navigator&&o.navigator.sendBeacon)try{S=o.navigator.sendBeacon(x.A.toString(),"")}catch{}!S&&o.Image&&(new Image().src=x.A,S=!0),S||(x.g=nw(x.j,null),x.g.ea(x.A)),x.F=Date.now(),Qo(x)}ew(f)}function Bu(f){f.g&&(gp(f),f.g.cancel(),f.g=null)}function Wv(f){Bu(f),f.v&&(o.clearTimeout(f.v),f.v=null),$u(f),f.h.cancel(),f.m&&(typeof f.m=="number"&&o.clearTimeout(f.m),f.m=null)}function Uu(f){if(!_l(f.h)&&!f.m){f.m=!0;var x=f.Ea;D||w(),k||(D(),k=!0),T.add(x,f),f.D=0}}function LP(f,x){return Vu(f.h)>=f.h.j-(f.m?1:0)?!1:f.m?(f.i=x.G.concat(f.i),!0):f.I==1||f.I==2||f.D>=(f.Sa?0:f.Ta)?!1:(f.m=_e(c(f.Ea,f,x),Zv(f,f.D)),f.D++,!0)}t.Ea=function(f){if(this.m)if(this.m=null,this.I==1){if(!f){this.V=Math.floor(Math.random()*1e5),f=this.V++;const U=new Jr(this,this.j,f);let G=this.o;if(this.U&&(G?(G=Y(G),M(G,this.U)):G=this.U),this.u!==null||this.R||(U.J=G,G=null),this.S)e:{for(var x=0,S=0;S4096){x=S;break e}if(x===4096||S===this.i.length-1){x=S+1;break e}}x=1e3}else x=1e3;x=Yv(this,U,x),S=Fe(this.J),ge(S,"RID",f),ge(S,"CVER",22),this.G&&ge(S,"X-HTTP-Session-Id",this.G),Al(this,S),G&&(this.R?x="headers="+sn(Bv(G))+"&"+x:this.u&&fp(S,this.u,G)),El(this.h,U),this.Ra&&ge(S,"TYPE","init"),this.S?(ge(S,"$req",x),ge(S,"SID","null"),U.U=!0,xt(U,S,null)):xt(U,S,x),this.I=2}}else this.I==3&&(f?Kv(this,f):this.i.length==0||_l(this.h)||Kv(this))};function Kv(f,x){var S;x?S=x.l:S=f.V++;const L=Fe(f.J);ge(L,"SID",f.M),ge(L,"RID",S),ge(L,"AID",f.K),Al(f,L),f.u&&f.o&&fp(L,f.u,f.o),S=new Jr(f,f.j,S,f.D+1),f.u===null&&(S.J=f.o),x&&(f.i=x.G.concat(f.i)),x=Yv(f,S,1e3),S.H=Math.round(f.va*.5)+Math.round(f.va*.5*Math.random()),El(f.h,S),xt(S,L,x)}function Al(f,x){f.H&&H(f.H,function(S,L){ge(x,L,S)}),f.l&&H({},function(S,L){ge(x,L,S)})}function Yv(f,x,S){S=Math.min(f.i.length,S);const L=f.l?c(f.l.Ka,f.l,f):null;e:{var U=f.i;let Le=-1;for(;;){const Xt=["count="+S];Le==-1?S>0?(Le=U[0].g,Xt.push("ofs="+Le)):Le=0:Xt.push("ofs="+Le);let it=!0;for(let on=0;on=3?!1:(f.Y++,f.v=_e(c(f.Da,f),Zv(f,f.A)),f.A++,!0)}t.Da=function(){if(this.v=null,Xv(this),this.aa&&!(this.P||this.g==null||this.T<=0)){var f=4*this.T;this.j.info("BP detection timer enabled: "+f),this.B=_e(c(this.Wa,this),f)}},t.Wa=function(){this.B&&(this.B=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.F=!1,this.P=!0,rt(10),Bu(this),Xv(this))};function gp(f){f.B!=null&&(o.clearTimeout(f.B),f.B=null)}function Xv(f){f.g=new Jr(f,f.j,"rpc",f.Y),f.u===null&&(f.g.J=f.o),f.g.P=0;var x=Fe(f.na);ge(x,"RID","rpc"),ge(x,"SID",f.M),ge(x,"AID",f.K),ge(x,"CI",f.F?"0":"1"),!f.F&&f.ia&&ge(x,"TO",f.ia),ge(x,"TYPE","xmlhttp"),Al(f,x),f.u&&f.o&&fp(x,f.u,f.o),f.O&&(f.g.H=f.O);var S=f.g;f=f.ba,S.M=1,S.A=An(Fe(x)),S.u=null,S.R=!0,Mu(S,f)}t.Va=function(){this.C!=null&&(this.C=null,Bu(this),mp(this),rt(19))};function $u(f){f.C!=null&&(o.clearTimeout(f.C),f.C=null)}function Jv(f,x){var S=null;if(f.g==x){$u(f),gp(f),f.g=null;var L=2}else if(Sl(f.h,x))S=x.G,Ou(f.h,x),L=1;else return;if(f.I!=0){if(x.o)if(L==1){S=x.u?x.u.length:0,x=Date.now()-x.F;var U=f.D;L=zt(),Ye(L,new eo(L,S)),Uu(f)}else Qv(f);else if(U=x.m,U==3||U==0&&x.X>0||!(L==1&&LP(f,x)||L==2&&mp(f)))switch(S&&S.length>0&&(x=f.h,x.i=x.i.concat(S)),U){case 1:so(f,5);break;case 4:so(f,10);break;case 3:so(f,6);break;default:so(f,2)}}}function Zv(f,x){let S=f.Qa+Math.floor(Math.random()*f.Za);return f.isActive()||(S*=2),S*x}function so(f,x){if(f.j.info("Error code "+x),x==2){var S=c(f.bb,f),L=f.Ua;const U=!L;L=new we(L||"//www.google.com/images/cleardot.gif"),o.location&&o.location.protocol=="http"||tt(L,"https"),An(L),U?AP(L.toString(),S):PP(L.toString(),S)}else rt(2);f.I=0,f.l&&f.l.pa(x),ew(f),Wv(f)}t.bb=function(f){f?(this.j.info("Successfully pinged google.com"),rt(2)):(this.j.info("Failed to ping google.com"),rt(1))};function ew(f){if(f.I=0,f.ja=[],f.l){const x=F(f.h);(x.length!=0||f.i.length!=0)&&(g(f.ja,x),g(f.ja,f.i),f.h.i.length=0,p(f.i),f.i.length=0),f.l.oa()}}function tw(f,x,S){var L=S instanceof we?Fe(S):new we(S);if(L.g!="")x&&(L.g=x+"."+L.g),Ie(L,L.u);else{var U=o.location;L=U.protocol,x=x?x+"."+U.hostname:U.hostname,U=+U.port;const G=new we(null);L&&tt(G,L),x&&(G.g=x),U&&Ie(G,U),S&&(G.h=S),L=G}return S=f.G,x=f.wa,S&&x&&ge(L,S,x),ge(L,"VER",f.ka),Al(f,L),L}function nw(f,x,S){if(x&&!f.L)throw Error("Can't create secondary domain capable XhrIo object.");return x=f.Aa&&!f.ma?new Pt(new hp({ab:S})):new Pt(f.ma),x.Fa(f.L),x}t.isActive=function(){return!!this.l&&this.l.isActive(this)};function rw(){}t=rw.prototype,t.ra=function(){},t.qa=function(){},t.pa=function(){},t.oa=function(){},t.isActive=function(){return!0},t.Ka=function(){};function Hu(){}Hu.prototype.g=function(f,x){return new cr(f,x)};function cr(f,x){Ce.call(this),this.g=new qv(x),this.l=f,this.h=x&&x.messageUrlParams||null,f=x&&x.messageHeaders||null,x&&x.clientProtocolHeaderRequired&&(f?f["X-Client-Protocol"]="webchannel":f={"X-Client-Protocol":"webchannel"}),this.g.o=f,f=x&&x.initMessageHeaders||null,x&&x.messageContentType&&(f?f["X-WebChannel-Content-Type"]=x.messageContentType:f={"X-WebChannel-Content-Type":x.messageContentType}),x&&x.sa&&(f?f["X-WebChannel-Client-Profile"]=x.sa:f={"X-WebChannel-Client-Profile":x.sa}),this.g.U=f,(f=x&&x.Qb)&&!A(f)&&(this.g.u=f),this.A=x&&x.supportsCrossDomainXhr||!1,this.v=x&&x.sendRawJson||!1,(x=x&&x.httpSessionIdParam)&&!A(x)&&(this.g.G=x,f=this.h,f!==null&&x in f&&(f=this.h,x in f&&delete f[x])),this.j=new ea(this)}h(cr,Ce),cr.prototype.m=function(){this.g.l=this.j,this.A&&(this.g.L=!0),this.g.connect(this.l,this.h||void 0)},cr.prototype.close=function(){pp(this.g)},cr.prototype.o=function(f){var x=this.g;if(typeof f=="string"){var S={};S.__data__=f,f=S}else this.v&&(S={},S.__data__=ve(f),f=S);x.i.push(new Hn(x.Ya++,f)),x.I==3&&Uu(x)},cr.prototype.N=function(){this.g.l=null,delete this.j,pp(this.g),delete this.g,cr.Z.N.call(this)};function sw(f){et.call(this),f.__headers__&&(this.headers=f.__headers__,this.statusCode=f.__status__,delete f.__headers__,delete f.__status__);var x=f.__sm__;if(x){e:{for(const S in x){f=S;break e}f=void 0}(this.i=f)&&(f=this.i,x=x!==null&&f in x?x[f]:void 0),this.data=x}else this.data=f}h(sw,et);function iw(){Bn.call(this),this.status=1}h(iw,Bn);function ea(f){this.g=f}h(ea,rw),ea.prototype.ra=function(){Ye(this.g,"a")},ea.prototype.qa=function(f){Ye(this.g,new sw(f))},ea.prototype.pa=function(f){Ye(this.g,new iw)},ea.prototype.oa=function(){Ye(this.g,"b")},Hu.prototype.createWebChannel=Hu.prototype.g,cr.prototype.send=cr.prototype.o,cr.prototype.open=cr.prototype.m,cr.prototype.close=cr.prototype.close,uI=function(){return new Hu},cI=function(){return zt()},lI=ot,hy={jb:0,mb:1,nb:2,Hb:3,Mb:4,Jb:5,Kb:6,Ib:7,Gb:8,Lb:9,PROXY:10,NOPROXY:11,Eb:12,Ab:13,Bb:14,zb:15,Cb:16,Db:17,fb:18,eb:19,gb:20},Un.NO_ERROR=0,Un.TIMEOUT=8,Un.HTTP_ERROR=6,qd=Un,At.COMPLETE="complete",aI=At,je.EventType=Kt,Kt.OPEN="a",Kt.CLOSE="b",Kt.ERROR="c",Kt.MESSAGE="d",Ce.prototype.listen=Ce.prototype.J,Yl=je,Pt.prototype.listenOnce=Pt.prototype.K,Pt.prototype.getLastError=Pt.prototype.Ha,Pt.prototype.getLastErrorCode=Pt.prototype.ya,Pt.prototype.getStatus=Pt.prototype.ca,Pt.prototype.getResponseJson=Pt.prototype.La,Pt.prototype.getResponseText=Pt.prototype.la,Pt.prototype.send=Pt.prototype.ea,Pt.prototype.setWithCredentials=Pt.prototype.Fa,oI=Pt}).apply(typeof pd<"u"?pd:typeof self<"u"?self:typeof window<"u"?window:{});/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Sn{constructor(e){this.uid=e}isAuthenticated(){return this.uid!=null}toKey(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}isEqual(e){return e.uid===this.uid}}Sn.UNAUTHENTICATED=new Sn(null),Sn.GOOGLE_CREDENTIALS=new Sn("google-credentials-uid"),Sn.FIRST_PARTY=new Sn("first-party-uid"),Sn.MOCK_USER=new Sn("mock-user");/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */let ul="12.11.0";function E3(t){ul=t}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *//** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Do=new xx("@firebase/firestore");function ia(){return Do.logLevel}function fe(t,...e){if(Do.logLevel<=Be.DEBUG){const n=e.map(bx);Do.debug(`Firestore (${ul}): ${t}`,...n)}}function Ws(t,...e){if(Do.logLevel<=Be.ERROR){const n=e.map(bx);Do.error(`Firestore (${ul}): ${t}`,...n)}}function Mo(t,...e){if(Do.logLevel<=Be.WARN){const n=e.map(bx);Do.warn(`Firestore (${ul}): ${t}`,...n)}}function bx(t){if(typeof t=="string")return t;try{return function(n){return JSON.stringify(n)}(t)}catch{return t}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Se(t,e,n){let r="Unexpected state";typeof e=="string"?r=e:n=e,dI(t,r,n)}function dI(t,e,n){let r=`FIRESTORE (${ul}) INTERNAL ASSERTION FAILED: ${e} (ID: ${t.toString(16)})`;if(n!==void 0)try{r+=" CONTEXT: "+JSON.stringify(n)}catch{r+=" CONTEXT: "+n}throw Ws(r),new Error(r)}function Xe(t,e,n,r){let s="Unexpected state";typeof n=="string"?s=n:r=n,t||dI(e,s,r)}function Re(t,e){return t}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const K={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENTED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"};class ue extends Ts{constructor(e,n){super(e,n),this.code=e,this.message=n,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class zs{constructor(){this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class hI{constructor(e,n){this.user=n,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}}class T3{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,n){e.enqueueRetryable(()=>n(Sn.UNAUTHENTICATED))}shutdown(){}}class k3{constructor(e){this.token=e,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(e,n){this.changeListener=n,e.enqueueRetryable(()=>n(this.token.user))}shutdown(){this.changeListener=null}}class C3{constructor(e){this.t=e,this.currentUser=Sn.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,n){Xe(this.o===void 0,42304);let r=this.i;const s=l=>this.i!==r?(r=this.i,n(l)):Promise.resolve();let i=new zs;this.o=()=>{this.i++,this.currentUser=this.u(),i.resolve(),i=new zs,e.enqueueRetryable(()=>s(this.currentUser))};const o=()=>{const l=i;e.enqueueRetryable(async()=>{await l.promise,await s(this.currentUser)})},a=l=>{fe("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=l,this.o&&(this.auth.addAuthTokenListener(this.o),o())};this.t.onInit(l=>a(l)),setTimeout(()=>{if(!this.auth){const l=this.t.getImmediate({optional:!0});l?a(l):(fe("FirebaseAuthCredentialsProvider","Auth not yet detected"),i.resolve(),i=new zs)}},0),o()}getToken(){const e=this.i,n=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(n).then(r=>this.i!==e?(fe("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):r?(Xe(typeof r.accessToken=="string",31837,{l:r}),new hI(r.accessToken,this.currentUser)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.o&&this.auth.removeAuthTokenListener(this.o),this.o=void 0}u(){const e=this.auth&&this.auth.getUid();return Xe(e===null||typeof e=="string",2055,{h:e}),new Sn(e)}}class I3{constructor(e,n,r){this.P=e,this.T=n,this.I=r,this.type="FirstParty",this.user=Sn.FIRST_PARTY,this.R=new Map}A(){return this.I?this.I():null}get headers(){this.R.set("X-Goog-AuthUser",this.P);const e=this.A();return e&&this.R.set("Authorization",e),this.T&&this.R.set("X-Goog-Iam-Authorization-Token",this.T),this.R}}class N3{constructor(e,n,r){this.P=e,this.T=n,this.I=r}getToken(){return Promise.resolve(new I3(this.P,this.T,this.I))}start(e,n){e.enqueueRetryable(()=>n(Sn.FIRST_PARTY))}shutdown(){}invalidateToken(){}}class Z1{constructor(e){this.value=e,this.type="AppCheck",this.headers=new Map,e&&e.length>0&&this.headers.set("x-firebase-appcheck",this.value)}}class A3{constructor(e,n){this.V=n,this.forceRefresh=!1,this.appCheck=null,this.m=null,this.p=null,$r(e)&&e.settings.appCheckToken&&(this.p=e.settings.appCheckToken)}start(e,n){Xe(this.o===void 0,3512);const r=i=>{i.error!=null&&fe("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${i.error.message}`);const o=i.token!==this.m;return this.m=i.token,fe("FirebaseAppCheckTokenProvider",`Received ${o?"new":"existing"} token.`),o?n(i.token):Promise.resolve()};this.o=i=>{e.enqueueRetryable(()=>r(i))};const s=i=>{fe("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=i,this.o&&this.appCheck.addTokenListener(this.o)};this.V.onInit(i=>s(i)),setTimeout(()=>{if(!this.appCheck){const i=this.V.getImmediate({optional:!0});i?s(i):fe("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}},0)}getToken(){if(this.p)return Promise.resolve(new Z1(this.p));const e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then(n=>n?(Xe(typeof n.token=="string",44558,{tokenResult:n}),this.m=n.token,new Z1(n.token)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.o&&this.appCheck.removeTokenListener(this.o),this.o=void 0}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function P3(t){const e=typeof self<"u"&&(self.crypto||self.msCrypto),n=new Uint8Array(t);if(e&&typeof e.getRandomValues=="function")e.getRandomValues(n);else for(let r=0;re?1:0}function fy(t,e){const n=Math.min(t.length,e.length);for(let r=0;r=R3&&e<=j3}function Ya(t,e,n){return t.length===e.length&&t.every((r,s)=>n(r,e[s]))}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const e_="__name__";class os{constructor(e,n,r){n===void 0?n=0:n>e.length&&Se(637,{offset:n,range:e.length}),r===void 0?r=e.length-n:r>e.length-n&&Se(1746,{length:r,range:e.length-n}),this.segments=e,this.offset=n,this.len=r}get length(){return this.len}isEqual(e){return os.comparator(this,e)===0}child(e){const n=this.segments.slice(this.offset,this.limit());return e instanceof os?e.forEach(r=>{n.push(r)}):n.push(e),this.construct(n)}limit(){return this.offset+this.length}popFirst(e){return e=e===void 0?1:e,this.construct(this.segments,this.offset+e,this.length-e)}popLast(){return this.construct(this.segments,this.offset,this.length-1)}firstSegment(){return this.segments[this.offset]}lastSegment(){return this.get(this.length-1)}get(e){return this.segments[this.offset+e]}isEmpty(){return this.length===0}isPrefixOf(e){if(e.length=0)throw new ue(K.INVALID_ARGUMENT,`Invalid segment (${r}). Paths must not contain // in them.`);n.push(...r.split("/").filter(s=>s.length>0))}return new lt(n)}static emptyPath(){return new lt([])}}const D3=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class mn extends os{construct(e,n,r){return new mn(e,n,r)}static isValidIdentifier(e){return D3.test(e)}canonicalString(){return this.toArray().map(e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),mn.isValidIdentifier(e)||(e="`"+e+"`"),e)).join(".")}toString(){return this.canonicalString()}isKeyField(){return this.length===1&&this.get(0)===e_}static keyField(){return new mn([e_])}static fromServerFormat(e){const n=[];let r="",s=0;const i=()=>{if(r.length===0)throw new ue(K.INVALID_ARGUMENT,`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);n.push(r),r=""};let o=!1;for(;s=2&&this.path.get(this.path.length-2)===e}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(e){return e!==null&<.comparator(this.path,e.path)===0}toString(){return this.path.toString()}static comparator(e,n){return lt.comparator(e.path,n.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new be(new lt(e.slice()))}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function fI(t,e,n){if(!n)throw new ue(K.INVALID_ARGUMENT,`Function ${t}() cannot be called with an empty ${e}.`)}function M3(t,e,n,r){if(e===!0&&r===!0)throw new ue(K.INVALID_ARGUMENT,`${t} and ${n} cannot be used together.`)}function t_(t){if(!be.isDocumentKey(t))throw new ue(K.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`)}function n_(t){if(be.isDocumentKey(t))throw new ue(K.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`)}function pI(t){return typeof t=="object"&&t!==null&&(Object.getPrototypeOf(t)===Object.prototype||Object.getPrototypeOf(t)===null)}function Bf(t){if(t===void 0)return"undefined";if(t===null)return"null";if(typeof t=="string")return t.length>20&&(t=`${t.substring(0,20)}...`),JSON.stringify(t);if(typeof t=="number"||typeof t=="boolean")return""+t;if(typeof t=="object"){if(t instanceof Array)return"an array";{const e=function(r){return r.constructor?r.constructor.name:null}(t);return e?`a custom ${e} object`:"an object"}}return typeof t=="function"?"a function":Se(12329,{type:typeof t})}function Mn(t,e){if("_delegate"in t&&(t=t._delegate),!(t instanceof e)){if(e.name===t.constructor.name)throw new ue(K.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const n=Bf(t);throw new ue(K.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${n}`)}}return t}/** + * @license + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Wt(t,e){const n={typeString:t};return e&&(n.value=e),n}function xu(t,e){if(!pI(t))throw new ue(K.INVALID_ARGUMENT,"JSON must be an object");let n;for(const r in e)if(e[r]){const s=e[r].typeString,i="value"in e[r]?{value:e[r].value}:void 0;if(!(r in t)){n=`JSON missing required field: '${r}'`;break}const o=t[r];if(s&&typeof o!==s){n=`JSON field '${r}' must be a ${s}.`;break}if(i!==void 0&&o!==i.value){n=`Expected '${r}' field to equal '${i.value}'`;break}}if(n)throw new ue(K.INVALID_ARGUMENT,n);return!0}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const r_=-62135596800,s_=1e6;class Ve{static now(){return Ve.fromMillis(Date.now())}static fromDate(e){return Ve.fromMillis(e.getTime())}static fromMillis(e){const n=Math.floor(e/1e3),r=Math.floor((e-1e3*n)*s_);return new Ve(n,r)}constructor(e,n){if(this.seconds=e,this.nanoseconds=n,n<0)throw new ue(K.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+n);if(n>=1e9)throw new ue(K.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+n);if(e=253402300800)throw new ue(K.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/s_}_compareTo(e){return this.seconds===e.seconds?Ue(this.nanoseconds,e.nanoseconds):Ue(this.seconds,e.seconds)}isEqual(e){return e.seconds===this.seconds&&e.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{type:Ve._jsonSchemaVersion,seconds:this.seconds,nanoseconds:this.nanoseconds}}static fromJSON(e){if(xu(e,Ve._jsonSchema))return new Ve(e.seconds,e.nanoseconds)}valueOf(){const e=this.seconds-r_;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}Ve._jsonSchemaVersion="firestore/timestamp/1.0",Ve._jsonSchema={type:Wt("string",Ve._jsonSchemaVersion),seconds:Wt("number"),nanoseconds:Wt("number")};/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Ne{static fromTimestamp(e){return new Ne(e)}static min(){return new Ne(new Ve(0,0))}static max(){return new Ne(new Ve(253402300799,999999999))}constructor(e){this.timestamp=e}compareTo(e){return this.timestamp._compareTo(e.timestamp)}isEqual(e){return this.timestamp.isEqual(e.timestamp)}toMicroseconds(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}toString(){return"SnapshotVersion("+this.timestamp.toString()+")"}toTimestamp(){return this.timestamp}}/** + * @license + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Wc=-1;function L3(t,e){const n=t.toTimestamp().seconds,r=t.toTimestamp().nanoseconds+1,s=Ne.fromTimestamp(r===1e9?new Ve(n+1,0):new Ve(n,r));return new Vi(s,be.empty(),e)}function V3(t){return new Vi(t.readTime,t.key,Wc)}class Vi{constructor(e,n,r){this.readTime=e,this.documentKey=n,this.largestBatchId=r}static min(){return new Vi(Ne.min(),be.empty(),Wc)}static max(){return new Vi(Ne.max(),be.empty(),Wc)}}function O3(t,e){let n=t.readTime.compareTo(e.readTime);return n!==0?n:(n=be.comparator(t.documentKey,e.documentKey),n!==0?n:Ue(t.largestBatchId,e.largestBatchId))}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const F3="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.";class z3{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach(e=>e())}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function dl(t){if(t.code!==K.FAILED_PRECONDITION||t.message!==F3)throw t;fe("LocalStore","Unexpectedly lost primary lease")}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Q{constructor(e){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,e(n=>{this.isDone=!0,this.result=n,this.nextCallback&&this.nextCallback(n)},n=>{this.isDone=!0,this.error=n,this.catchCallback&&this.catchCallback(n)})}catch(e){return this.next(void 0,e)}next(e,n){return this.callbackAttached&&Se(59440),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(n,this.error):this.wrapSuccess(e,this.result):new Q((r,s)=>{this.nextCallback=i=>{this.wrapSuccess(e,i).next(r,s)},this.catchCallback=i=>{this.wrapFailure(n,i).next(r,s)}})}toPromise(){return new Promise((e,n)=>{this.next(e,n)})}wrapUserFunction(e){try{const n=e();return n instanceof Q?n:Q.resolve(n)}catch(n){return Q.reject(n)}}wrapSuccess(e,n){return e?this.wrapUserFunction(()=>e(n)):Q.resolve(n)}wrapFailure(e,n){return e?this.wrapUserFunction(()=>e(n)):Q.reject(n)}static resolve(e){return new Q((n,r)=>{n(e)})}static reject(e){return new Q((n,r)=>{r(e)})}static waitFor(e){return new Q((n,r)=>{let s=0,i=0,o=!1;e.forEach(a=>{++s,a.next(()=>{++i,o&&i===s&&n()},l=>r(l))}),o=!0,i===s&&n()})}static or(e){let n=Q.resolve(!1);for(const r of e)n=n.next(s=>s?Q.resolve(s):r());return n}static forEach(e,n){const r=[];return e.forEach((s,i)=>{r.push(n.call(this,s,i))}),this.waitFor(r)}static mapArray(e,n){return new Q((r,s)=>{const i=e.length,o=new Array(i);let a=0;for(let l=0;l{o[c]=d,++a,a===i&&r(o)},d=>s(d))}})}static doWhile(e,n){return new Q((r,s)=>{const i=()=>{e()===!0?n().next(()=>{i()},s):r()};i()})}}function B3(t){const e=t.match(/Android ([\d.]+)/i),n=e?e[1].split(".").slice(0,2).join("."):"-1";return Number(n)}function hl(t){return t.name==="IndexedDbTransactionError"}/** + * @license + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Uf{constructor(e,n){this.previousValue=e,n&&(n.sequenceNumberHandler=r=>this.ae(r),this.ue=r=>n.writeSequenceNumber(r))}ae(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){const e=++this.previousValue;return this.ue&&this.ue(e),e}}Uf.ce=-1;/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Sx=-1;function $f(t){return t==null}function Bh(t){return t===0&&1/t==-1/0}function U3(t){return typeof t=="number"&&Number.isInteger(t)&&!Bh(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const mI="";function $3(t){let e="";for(let n=0;n0&&(e=i_(e)),e=H3(t.get(n),e);return i_(e)}function H3(t,e){let n=e;const r=t.length;for(let s=0;s0&&(n=n.right)}return null}indexOf(e){let n=0,r=this.root;for(;!r.isEmpty();){const s=this.comparator(e,r.key);if(s===0)return n+r.left.size;s<0?r=r.left:(n+=r.left.size+1,r=r.right)}return-1}isEmpty(){return this.root.isEmpty()}get size(){return this.root.size}minKey(){return this.root.minKey()}maxKey(){return this.root.maxKey()}inorderTraversal(e){return this.root.inorderTraversal(e)}forEach(e){this.inorderTraversal((n,r)=>(e(n,r),!1))}toString(){const e=[];return this.inorderTraversal((n,r)=>(e.push(`${n}:${r}`),!1)),`{${e.join(", ")}}`}reverseTraversal(e){return this.root.reverseTraversal(e)}getIterator(){return new md(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new md(this.root,e,this.comparator,!1)}getReverseIterator(){return new md(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new md(this.root,e,this.comparator,!0)}}class md{constructor(e,n,r,s){this.isReverse=s,this.nodeStack=[];let i=1;for(;!e.isEmpty();)if(i=n?r(e.key,n):1,n&&s&&(i*=-1),i<0)e=this.isReverse?e.left:e.right;else{if(i===0){this.nodeStack.push(e);break}this.nodeStack.push(e),e=this.isReverse?e.right:e.left}}getNext(){let e=this.nodeStack.pop();const n={key:e.key,value:e.value};if(this.isReverse)for(e=e.left;!e.isEmpty();)this.nodeStack.push(e),e=e.right;else for(e=e.right;!e.isEmpty();)this.nodeStack.push(e),e=e.left;return n}hasNext(){return this.nodeStack.length>0}peek(){if(this.nodeStack.length===0)return null;const e=this.nodeStack[this.nodeStack.length-1];return{key:e.key,value:e.value}}}class fn{constructor(e,n,r,s,i){this.key=e,this.value=n,this.color=r??fn.RED,this.left=s??fn.EMPTY,this.right=i??fn.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,n,r,s,i){return new fn(e??this.key,n??this.value,r??this.color,s??this.left,i??this.right)}isEmpty(){return!1}inorderTraversal(e){return this.left.inorderTraversal(e)||e(this.key,this.value)||this.right.inorderTraversal(e)}reverseTraversal(e){return this.right.reverseTraversal(e)||e(this.key,this.value)||this.left.reverseTraversal(e)}min(){return this.left.isEmpty()?this:this.left.min()}minKey(){return this.min().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(e,n,r){let s=this;const i=r(e,s.key);return s=i<0?s.copy(null,null,null,s.left.insert(e,n,r),null):i===0?s.copy(null,n,null,null,null):s.copy(null,null,null,null,s.right.insert(e,n,r)),s.fixUp()}removeMin(){if(this.left.isEmpty())return fn.EMPTY;let e=this;return e.left.isRed()||e.left.left.isRed()||(e=e.moveRedLeft()),e=e.copy(null,null,null,e.left.removeMin(),null),e.fixUp()}remove(e,n){let r,s=this;if(n(e,s.key)<0)s.left.isEmpty()||s.left.isRed()||s.left.left.isRed()||(s=s.moveRedLeft()),s=s.copy(null,null,null,s.left.remove(e,n),null);else{if(s.left.isRed()&&(s=s.rotateRight()),s.right.isEmpty()||s.right.isRed()||s.right.left.isRed()||(s=s.moveRedRight()),n(e,s.key)===0){if(s.right.isEmpty())return fn.EMPTY;r=s.right.min(),s=s.copy(r.key,r.value,null,null,s.right.removeMin())}s=s.copy(null,null,null,null,s.right.remove(e,n))}return s.fixUp()}isRed(){return this.color}fixUp(){let e=this;return e.right.isRed()&&!e.left.isRed()&&(e=e.rotateLeft()),e.left.isRed()&&e.left.left.isRed()&&(e=e.rotateRight()),e.left.isRed()&&e.right.isRed()&&(e=e.colorFlip()),e}moveRedLeft(){let e=this.colorFlip();return e.right.left.isRed()&&(e=e.copy(null,null,null,null,e.right.rotateRight()),e=e.rotateLeft(),e=e.colorFlip()),e}moveRedRight(){let e=this.colorFlip();return e.left.left.isRed()&&(e=e.rotateRight(),e=e.colorFlip()),e}rotateLeft(){const e=this.copy(null,null,fn.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){const e=this.copy(null,null,fn.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)}colorFlip(){const e=this.left.copy(null,null,!this.left.color,null,null),n=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,n)}checkMaxDepth(){const e=this.check();return Math.pow(2,e)<=this.size+1}check(){if(this.isRed()&&this.left.isRed())throw Se(43730,{key:this.key,value:this.value});if(this.right.isRed())throw Se(14113,{key:this.key,value:this.value});const e=this.left.check();if(e!==this.right.check())throw Se(27949);return e+(this.isRed()?0:1)}}fn.EMPTY=null,fn.RED=!0,fn.BLACK=!1;fn.EMPTY=new class{constructor(){this.size=0}get key(){throw Se(57766)}get value(){throw Se(16141)}get color(){throw Se(16727)}get left(){throw Se(29726)}get right(){throw Se(36894)}copy(e,n,r,s,i){return this}insert(e,n,r){return new fn(e,n)}remove(e,n){return this}isEmpty(){return!0}inorderTraversal(e){return!1}reverseTraversal(e){return!1}minKey(){return null}maxKey(){return null}isRed(){return!1}checkMaxDepth(){return!0}check(){return 0}};/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class tn{constructor(e){this.comparator=e,this.data=new kt(this.comparator)}has(e){return this.data.get(e)!==null}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(e){return this.data.indexOf(e)}forEach(e){this.data.inorderTraversal((n,r)=>(e(n),!1))}forEachInRange(e,n){const r=this.data.getIteratorFrom(e[0]);for(;r.hasNext();){const s=r.getNext();if(this.comparator(s.key,e[1])>=0)return;n(s.key)}}forEachWhile(e,n){let r;for(r=n!==void 0?this.data.getIteratorFrom(n):this.data.getIterator();r.hasNext();)if(!e(r.getNext().key))return}firstAfterOrEqual(e){const n=this.data.getIteratorFrom(e);return n.hasNext()?n.getNext().key:null}getIterator(){return new a_(this.data.getIterator())}getIteratorFrom(e){return new a_(this.data.getIteratorFrom(e))}add(e){return this.copy(this.data.remove(e).insert(e,!0))}delete(e){return this.has(e)?this.copy(this.data.remove(e)):this}isEmpty(){return this.data.isEmpty()}unionWith(e){let n=this;return n.size{n=n.add(r)}),n}isEqual(e){if(!(e instanceof tn)||this.size!==e.size)return!1;const n=this.data.getIterator(),r=e.data.getIterator();for(;n.hasNext();){const s=n.getNext().key,i=r.getNext().key;if(this.comparator(s,i)!==0)return!1}return!0}toArray(){const e=[];return this.forEach(n=>{e.push(n)}),e}toString(){const e=[];return this.forEach(n=>e.push(n)),"SortedSet("+e.toString()+")"}copy(e){const n=new tn(this.comparator);return n.data=e,n}}class a_{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class gr{constructor(e){this.fields=e,e.sort(mn.comparator)}static empty(){return new gr([])}unionWith(e){let n=new tn(mn.comparator);for(const r of this.fields)n=n.add(r);for(const r of e)n=n.add(r);return new gr(n.toArray())}covers(e){for(const n of this.fields)if(n.isPrefixOf(e))return!0;return!1}isEqual(e){return Ya(this.fields,e.fields,(n,r)=>n.isEqual(r))}}/** + * @license + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class yI extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class xn{constructor(e){this.binaryString=e}static fromBase64String(e){const n=function(s){try{return atob(s)}catch(i){throw typeof DOMException<"u"&&i instanceof DOMException?new yI("Invalid base64 string: "+i):i}}(e);return new xn(n)}static fromUint8Array(e){const n=function(s){let i="";for(let o=0;oebs(n,e))!==void 0}function Qa(t,e){if(t===e)return 0;const n=zi(t),r=zi(e);if(n!==r)return Ue(n,r);switch(n){case 0:case 9007199254740991:return 0;case 1:return Ue(t.booleanValue,e.booleanValue);case 2:return function(i,o){const a=Lt(i.integerValue||i.doubleValue),l=Lt(o.integerValue||o.doubleValue);return al?1:a===l?0:isNaN(a)?isNaN(l)?0:-1:1}(t,e);case 3:return l_(t.timestampValue,e.timestampValue);case 4:return l_(Kc(t),Kc(e));case 5:return fy(t.stringValue,e.stringValue);case 6:return function(i,o){const a=Fi(i),l=Fi(o);return a.compareTo(l)}(t.bytesValue,e.bytesValue);case 7:return function(i,o){const a=i.split("/"),l=o.split("/");for(let c=0;cs+Wd(i),0)}(t.arrayValue);case 10:case 11:return function(r){let s=0;return Wi(r.fields,(i,o)=>{s+=i.length+Wd(o)}),s}(t.mapValue);default:throw Se(13486,{value:t})}}function u_(t,e){return{referenceValue:`projects/${t.projectId}/databases/${t.database}/documents/${e.path.canonicalString()}`}}function my(t){return!!t&&"integerValue"in t}function Tx(t){return!!t&&"arrayValue"in t}function d_(t){return!!t&&"nullValue"in t}function h_(t){return!!t&&"doubleValue"in t&&isNaN(Number(t.doubleValue))}function Kd(t){return!!t&&"mapValue"in t}function Y3(t){var n,r;return((r=(((n=t==null?void 0:t.mapValue)==null?void 0:n.fields)||{})[_I])==null?void 0:r.stringValue)===SI}function gc(t){if(t.geoPointValue)return{geoPointValue:{...t.geoPointValue}};if(t.timestampValue&&typeof t.timestampValue=="object")return{timestampValue:{...t.timestampValue}};if(t.mapValue){const e={mapValue:{fields:{}}};return Wi(t.mapValue.fields,(n,r)=>e.mapValue.fields[n]=gc(r)),e}if(t.arrayValue){const e={arrayValue:{values:[]}};for(let n=0;n<(t.arrayValue.values||[]).length;++n)e.arrayValue.values[n]=gc(t.arrayValue.values[n]);return e}return{...t}}function Q3(t){return(((t.mapValue||{}).fields||{}).__type__||{}).stringValue===K3}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Xn{constructor(e){this.value=e}static empty(){return new Xn({mapValue:{}})}field(e){if(e.isEmpty())return this.value;{let n=this.value;for(let r=0;r{if(!n.isImmediateParentOf(a)){const l=this.getFieldsMap(n);this.applyChanges(l,r,s),r={},s=[],n=a.popLast()}o?r[a.lastSegment()]=gc(o):s.push(a.lastSegment())});const i=this.getFieldsMap(n);this.applyChanges(i,r,s)}delete(e){const n=this.field(e.popLast());Kd(n)&&n.mapValue.fields&&delete n.mapValue.fields[e.lastSegment()]}isEqual(e){return bs(this.value,e.value)}getFieldsMap(e){let n=this.value;n.mapValue.fields||(n.mapValue={fields:{}});for(let r=0;re[s]=i);for(const s of r)delete e[s]}clone(){return new Xn(gc(this.value))}}function EI(t){const e=[];return Wi(t.fields,(n,r)=>{const s=new mn([n]);if(Kd(r)){const i=EI(r.mapValue).fields;if(i.length===0)e.push(s);else for(const o of i)e.push(s.child(o))}else e.push(s)}),new gr(e)}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Tn{constructor(e,n,r,s,i,o,a){this.key=e,this.documentType=n,this.version=r,this.readTime=s,this.createTime=i,this.data=o,this.documentState=a}static newInvalidDocument(e){return new Tn(e,0,Ne.min(),Ne.min(),Ne.min(),Xn.empty(),0)}static newFoundDocument(e,n,r,s){return new Tn(e,1,n,Ne.min(),r,s,0)}static newNoDocument(e,n){return new Tn(e,2,n,Ne.min(),Ne.min(),Xn.empty(),0)}static newUnknownDocument(e,n){return new Tn(e,3,n,Ne.min(),Ne.min(),Xn.empty(),2)}convertToFoundDocument(e,n){return!this.createTime.isEqual(Ne.min())||this.documentType!==2&&this.documentType!==0||(this.createTime=e),this.version=e,this.documentType=1,this.data=n,this.documentState=0,this}convertToNoDocument(e){return this.version=e,this.documentType=2,this.data=Xn.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=Xn.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=Ne.min(),this}setReadTime(e){return this.readTime=e,this}get hasLocalMutations(){return this.documentState===1}get hasCommittedMutations(){return this.documentState===2}get hasPendingWrites(){return this.hasLocalMutations||this.hasCommittedMutations}isValidDocument(){return this.documentType!==0}isFoundDocument(){return this.documentType===1}isNoDocument(){return this.documentType===2}isUnknownDocument(){return this.documentType===3}isEqual(e){return e instanceof Tn&&this.key.isEqual(e.key)&&this.version.isEqual(e.version)&&this.documentType===e.documentType&&this.documentState===e.documentState&&this.data.isEqual(e.data)}mutableCopy(){return new Tn(this.key,this.documentType,this.version,this.readTime,this.createTime,this.data.clone(),this.documentState)}toString(){return`Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {createTime: ${this.createTime}}), {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`}}/** + * @license + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Hh{constructor(e,n){this.position=e,this.inclusive=n}}function f_(t,e,n){let r=0;for(let s=0;s":return e>0;case">=":return e>=0;default:return Se(47266,{operator:this.op})}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}}class Xr extends TI{constructor(e,n){super(),this.filters=e,this.op=n,this.Pe=null}static create(e,n){return new Xr(e,n)}matches(e){return kI(this)?this.filters.find(n=>!n.matches(e))===void 0:this.filters.find(n=>n.matches(e))!==void 0}getFlattenedFilters(){return this.Pe!==null||(this.Pe=this.filters.reduce((e,n)=>e.concat(n.getFlattenedFilters()),[])),this.Pe}getFilters(){return Object.assign([],this.filters)}}function kI(t){return t.op==="and"}function CI(t){return J3(t)&&kI(t)}function J3(t){for(const e of t.filters)if(e instanceof Xr)return!1;return!0}function gy(t){if(t instanceof qt)return t.field.canonicalString()+t.op.toString()+Xa(t.value);if(CI(t))return t.filters.map(e=>gy(e)).join(",");{const e=t.filters.map(n=>gy(n)).join(",");return`${t.op}(${e})`}}function II(t,e){return t instanceof qt?function(r,s){return s instanceof qt&&r.op===s.op&&r.field.isEqual(s.field)&&bs(r.value,s.value)}(t,e):t instanceof Xr?function(r,s){return s instanceof Xr&&r.op===s.op&&r.filters.length===s.filters.length?r.filters.reduce((i,o,a)=>i&&II(o,s.filters[a]),!0):!1}(t,e):void Se(19439)}function NI(t){return t instanceof qt?function(n){return`${n.field.canonicalString()} ${n.op} ${Xa(n.value)}`}(t):t instanceof Xr?function(n){return n.op.toString()+" {"+n.getFilters().map(NI).join(" ,")+"}"}(t):"Filter"}class Z3 extends qt{constructor(e,n,r){super(e,n,r),this.key=be.fromName(r.referenceValue)}matches(e){const n=be.comparator(e.key,this.key);return this.matchesComparison(n)}}class e6 extends qt{constructor(e,n){super(e,"in",n),this.keys=AI("in",n)}matches(e){return this.keys.some(n=>n.isEqual(e.key))}}class t6 extends qt{constructor(e,n){super(e,"not-in",n),this.keys=AI("not-in",n)}matches(e){return!this.keys.some(n=>n.isEqual(e.key))}}function AI(t,e){var n;return(((n=e.arrayValue)==null?void 0:n.values)||[]).map(r=>be.fromName(r.referenceValue))}class n6 extends qt{constructor(e,n){super(e,"array-contains",n)}matches(e){const n=e.data.field(this.field);return Tx(n)&&Qc(n.arrayValue,this.value)}}class r6 extends qt{constructor(e,n){super(e,"in",n)}matches(e){const n=e.data.field(this.field);return n!==null&&Qc(this.value.arrayValue,n)}}class s6 extends qt{constructor(e,n){super(e,"not-in",n)}matches(e){if(Qc(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const n=e.data.field(this.field);return n!==null&&n.nullValue===void 0&&!Qc(this.value.arrayValue,n)}}class i6 extends qt{constructor(e,n){super(e,"array-contains-any",n)}matches(e){const n=e.data.field(this.field);return!(!Tx(n)||!n.arrayValue.values)&&n.arrayValue.values.some(r=>Qc(this.value.arrayValue,r))}}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class o6{constructor(e,n=null,r=[],s=[],i=null,o=null,a=null){this.path=e,this.collectionGroup=n,this.orderBy=r,this.filters=s,this.limit=i,this.startAt=o,this.endAt=a,this.Te=null}}function m_(t,e=null,n=[],r=[],s=null,i=null,o=null){return new o6(t,e,n,r,s,i,o)}function kx(t){const e=Re(t);if(e.Te===null){let n=e.path.canonicalString();e.collectionGroup!==null&&(n+="|cg:"+e.collectionGroup),n+="|f:",n+=e.filters.map(r=>gy(r)).join(","),n+="|ob:",n+=e.orderBy.map(r=>function(i){return i.field.canonicalString()+i.dir}(r)).join(","),$f(e.limit)||(n+="|l:",n+=e.limit),e.startAt&&(n+="|lb:",n+=e.startAt.inclusive?"b:":"a:",n+=e.startAt.position.map(r=>Xa(r)).join(",")),e.endAt&&(n+="|ub:",n+=e.endAt.inclusive?"a:":"b:",n+=e.endAt.position.map(r=>Xa(r)).join(",")),e.Te=n}return e.Te}function Cx(t,e){if(t.limit!==e.limit||t.orderBy.length!==e.orderBy.length)return!1;for(let n=0;n0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc";(function(o){let a=new tn(mn.comparator);return o.filters.forEach(l=>{l.getFlattenedFilters().forEach(c=>{c.isInequality()&&(a=a.add(c.field))})}),a})(e).forEach(i=>{n.has(i.canonicalString())||i.isKeyField()||e.Ee.push(new Xc(i,r))}),n.has(mn.keyField().canonicalString())||e.Ee.push(new Xc(mn.keyField(),r))}return e.Ee}function ms(t){const e=Re(t);return e.Ie||(e.Ie=c6(e,yc(t))),e.Ie}function c6(t,e){if(t.limitType==="F")return m_(t.path,t.collectionGroup,e,t.filters,t.limit,t.startAt,t.endAt);{e=e.map(s=>{const i=s.dir==="desc"?"asc":"desc";return new Xc(s.field,i)});const n=t.endAt?new Hh(t.endAt.position,t.endAt.inclusive):null,r=t.startAt?new Hh(t.startAt.position,t.startAt.inclusive):null;return m_(t.path,t.collectionGroup,e,t.filters,t.limit,n,r)}}function xy(t,e){const n=t.filters.concat([e]);return new fl(t.path,t.collectionGroup,t.explicitOrderBy.slice(),n,t.limit,t.limitType,t.startAt,t.endAt)}function u6(t,e){const n=t.explicitOrderBy.concat([e]);return new fl(t.path,t.collectionGroup,n,t.filters.slice(),t.limit,t.limitType,t.startAt,t.endAt)}function vy(t,e,n){return new fl(t.path,t.collectionGroup,t.explicitOrderBy.slice(),t.filters.slice(),e,n,t.startAt,t.endAt)}function qf(t,e){return Cx(ms(t),ms(e))&&t.limitType===e.limitType}function RI(t){return`${kx(ms(t))}|lt:${t.limitType}`}function oa(t){return`Query(target=${function(n){let r=n.path.canonicalString();return n.collectionGroup!==null&&(r+=" collectionGroup="+n.collectionGroup),n.filters.length>0&&(r+=`, filters: [${n.filters.map(s=>NI(s)).join(", ")}]`),$f(n.limit)||(r+=", limit: "+n.limit),n.orderBy.length>0&&(r+=`, orderBy: [${n.orderBy.map(s=>function(o){return`${o.field.canonicalString()} (${o.dir})`}(s)).join(", ")}]`),n.startAt&&(r+=", startAt: ",r+=n.startAt.inclusive?"b:":"a:",r+=n.startAt.position.map(s=>Xa(s)).join(",")),n.endAt&&(r+=", endAt: ",r+=n.endAt.inclusive?"a:":"b:",r+=n.endAt.position.map(s=>Xa(s)).join(",")),`Target(${r})`}(ms(t))}; limitType=${t.limitType})`}function Wf(t,e){return e.isFoundDocument()&&function(r,s){const i=s.key.path;return r.collectionGroup!==null?s.key.hasCollectionId(r.collectionGroup)&&r.path.isPrefixOf(i):be.isDocumentKey(r.path)?r.path.isEqual(i):r.path.isImmediateParentOf(i)}(t,e)&&function(r,s){for(const i of yc(r))if(!i.field.isKeyField()&&s.data.field(i.field)===null)return!1;return!0}(t,e)&&function(r,s){for(const i of r.filters)if(!i.matches(s))return!1;return!0}(t,e)&&function(r,s){return!(r.startAt&&!function(o,a,l){const c=f_(o,a,l);return o.inclusive?c<=0:c<0}(r.startAt,yc(r),s)||r.endAt&&!function(o,a,l){const c=f_(o,a,l);return o.inclusive?c>=0:c>0}(r.endAt,yc(r),s))}(t,e)}function d6(t){return t.collectionGroup||(t.path.length%2==1?t.path.lastSegment():t.path.get(t.path.length-2))}function jI(t){return(e,n)=>{let r=!1;for(const s of yc(t)){const i=h6(s,e,n);if(i!==0)return i;r=r||s.field.isKeyField()}return 0}}function h6(t,e,n){const r=t.field.isKeyField()?be.comparator(e.key,n.key):function(i,o,a){const l=o.data.field(i),c=a.data.field(i);return l!==null&&c!==null?Qa(l,c):Se(42886)}(t.field,e,n);switch(t.dir){case"asc":return r;case"desc":return-1*r;default:return Se(19790,{direction:t.dir})}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class qo{constructor(e,n){this.mapKeyFn=e,this.equalsFn=n,this.inner={},this.innerSize=0}get(e){const n=this.mapKeyFn(e),r=this.inner[n];if(r!==void 0){for(const[s,i]of r)if(this.equalsFn(s,e))return i}}has(e){return this.get(e)!==void 0}set(e,n){const r=this.mapKeyFn(e),s=this.inner[r];if(s===void 0)return this.inner[r]=[[e,n]],void this.innerSize++;for(let i=0;i{for(const[s,i]of r)e(s,i)})}isEmpty(){return gI(this.inner)}size(){return this.innerSize}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const f6=new kt(be.comparator);function Ks(){return f6}const DI=new kt(be.comparator);function Ql(...t){let e=DI;for(const n of t)e=e.insert(n.key,n);return e}function MI(t){let e=DI;return t.forEach((n,r)=>e=e.insert(n,r.overlayedDocument)),e}function xo(){return xc()}function LI(){return xc()}function xc(){return new qo(t=>t.toString(),(t,e)=>t.isEqual(e))}const p6=new kt(be.comparator),m6=new tn(be.comparator);function $e(...t){let e=m6;for(const n of t)e=e.add(n);return e}const g6=new tn(Ue);function y6(){return g6}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Ix(t,e){if(t.useProto3Json){if(isNaN(e))return{doubleValue:"NaN"};if(e===1/0)return{doubleValue:"Infinity"};if(e===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:Bh(e)?"-0":e}}function VI(t){return{integerValue:""+t}}function OI(t,e){return U3(e)?VI(e):Ix(t,e)}/** + * @license + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Kf{constructor(){this._=void 0}}function x6(t,e,n){return t instanceof Gh?function(s,i){const o={fields:{[vI]:{stringValue:xI},[bI]:{timestampValue:{seconds:s.seconds,nanos:s.nanoseconds}}}};return i&&Ex(i)&&(i=Hf(i)),i&&(o.fields[wI]=i),{mapValue:o}}(n,e):t instanceof Jc?zI(t,e):t instanceof Zc?BI(t,e):function(s,i){const o=FI(s,i),a=y_(o)+y_(s.Ae);return my(o)&&my(s.Ae)?VI(a):Ix(s.serializer,a)}(t,e)}function v6(t,e,n){return t instanceof Jc?zI(t,e):t instanceof Zc?BI(t,e):n}function FI(t,e){return t instanceof eu?function(r){return my(r)||function(i){return!!i&&"doubleValue"in i}(r)}(e)?e:{integerValue:0}:null}class Gh extends Kf{}class Jc extends Kf{constructor(e){super(),this.elements=e}}function zI(t,e){const n=UI(e);for(const r of t.elements)n.some(s=>bs(s,r))||n.push(r);return{arrayValue:{values:n}}}class Zc extends Kf{constructor(e){super(),this.elements=e}}function BI(t,e){let n=UI(e);for(const r of t.elements)n=n.filter(s=>!bs(s,r));return{arrayValue:{values:n}}}class eu extends Kf{constructor(e,n){super(),this.serializer=e,this.Ae=n}}function y_(t){return Lt(t.integerValue||t.doubleValue)}function UI(t){return Tx(t)&&t.arrayValue.values?t.arrayValue.values.slice():[]}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class w6{constructor(e,n){this.field=e,this.transform=n}}function b6(t,e){return t.field.isEqual(e.field)&&function(r,s){return r instanceof Jc&&s instanceof Jc||r instanceof Zc&&s instanceof Zc?Ya(r.elements,s.elements,bs):r instanceof eu&&s instanceof eu?bs(r.Ae,s.Ae):r instanceof Gh&&s instanceof Gh}(t.transform,e.transform)}class _6{constructor(e,n){this.version=e,this.transformResults=n}}class Ln{constructor(e,n){this.updateTime=e,this.exists=n}static none(){return new Ln}static exists(e){return new Ln(void 0,e)}static updateTime(e){return new Ln(e)}get isNone(){return this.updateTime===void 0&&this.exists===void 0}isEqual(e){return this.exists===e.exists&&(this.updateTime?!!e.updateTime&&this.updateTime.isEqual(e.updateTime):!e.updateTime)}}function Yd(t,e){return t.updateTime!==void 0?e.isFoundDocument()&&e.version.isEqual(t.updateTime):t.exists===void 0||t.exists===e.isFoundDocument()}class Yf{}function $I(t,e){if(!t.hasLocalMutations||e&&e.fields.length===0)return null;if(e===null)return t.isNoDocument()?new Qf(t.key,Ln.none()):new vu(t.key,t.data,Ln.none());{const n=t.data,r=Xn.empty();let s=new tn(mn.comparator);for(let i of e.fields)if(!s.has(i)){let o=n.field(i);o===null&&i.length>1&&(i=i.popLast(),o=n.field(i)),o===null?r.delete(i):r.set(i,o),s=s.add(i)}return new Ki(t.key,r,new gr(s.toArray()),Ln.none())}}function S6(t,e,n){t instanceof vu?function(s,i,o){const a=s.value.clone(),l=v_(s.fieldTransforms,i,o.transformResults);a.setAll(l),i.convertToFoundDocument(o.version,a).setHasCommittedMutations()}(t,e,n):t instanceof Ki?function(s,i,o){if(!Yd(s.precondition,i))return void i.convertToUnknownDocument(o.version);const a=v_(s.fieldTransforms,i,o.transformResults),l=i.data;l.setAll(HI(s)),l.setAll(a),i.convertToFoundDocument(o.version,l).setHasCommittedMutations()}(t,e,n):function(s,i,o){i.convertToNoDocument(o.version).setHasCommittedMutations()}(0,e,n)}function vc(t,e,n,r){return t instanceof vu?function(i,o,a,l){if(!Yd(i.precondition,o))return a;const c=i.value.clone(),d=w_(i.fieldTransforms,l,o);return c.setAll(d),o.convertToFoundDocument(o.version,c).setHasLocalMutations(),null}(t,e,n,r):t instanceof Ki?function(i,o,a,l){if(!Yd(i.precondition,o))return a;const c=w_(i.fieldTransforms,l,o),d=o.data;return d.setAll(HI(i)),d.setAll(c),o.convertToFoundDocument(o.version,d).setHasLocalMutations(),a===null?null:a.unionWith(i.fieldMask.fields).unionWith(i.fieldTransforms.map(h=>h.field))}(t,e,n,r):function(i,o,a){return Yd(i.precondition,o)?(o.convertToNoDocument(o.version).setHasLocalMutations(),null):a}(t,e,n)}function E6(t,e){let n=null;for(const r of t.fieldTransforms){const s=e.data.field(r.field),i=FI(r.transform,s||null);i!=null&&(n===null&&(n=Xn.empty()),n.set(r.field,i))}return n||null}function x_(t,e){return t.type===e.type&&!!t.key.isEqual(e.key)&&!!t.precondition.isEqual(e.precondition)&&!!function(r,s){return r===void 0&&s===void 0||!(!r||!s)&&Ya(r,s,(i,o)=>b6(i,o))}(t.fieldTransforms,e.fieldTransforms)&&(t.type===0?t.value.isEqual(e.value):t.type!==1||t.data.isEqual(e.data)&&t.fieldMask.isEqual(e.fieldMask))}class vu extends Yf{constructor(e,n,r,s=[]){super(),this.key=e,this.value=n,this.precondition=r,this.fieldTransforms=s,this.type=0}getFieldMask(){return null}}class Ki extends Yf{constructor(e,n,r,s,i=[]){super(),this.key=e,this.data=n,this.fieldMask=r,this.precondition=s,this.fieldTransforms=i,this.type=1}getFieldMask(){return this.fieldMask}}function HI(t){const e=new Map;return t.fieldMask.fields.forEach(n=>{if(!n.isEmpty()){const r=t.data.field(n);e.set(n,r)}}),e}function v_(t,e,n){const r=new Map;Xe(t.length===n.length,32656,{Ve:n.length,de:t.length});for(let s=0;s{const i=e.get(s.key),o=i.overlayedDocument;let a=this.applyToLocalView(o,i.mutatedFields);a=n.has(s.key)?null:a;const l=$I(o,a);l!==null&&r.set(s.key,l),o.isValidDocument()||o.convertToNoDocument(Ne.min())}),r}keys(){return this.mutations.reduce((e,n)=>e.add(n.key),$e())}isEqual(e){return this.batchId===e.batchId&&Ya(this.mutations,e.mutations,(n,r)=>x_(n,r))&&Ya(this.baseMutations,e.baseMutations,(n,r)=>x_(n,r))}}class Nx{constructor(e,n,r,s){this.batch=e,this.commitVersion=n,this.mutationResults=r,this.docVersions=s}static from(e,n,r){Xe(e.mutations.length===r.length,58842,{me:e.mutations.length,fe:r.length});let s=function(){return p6}();const i=e.mutations;for(let o=0;o=8)throw new Xl(`Invalid padding: ${n}`);if(r<0)throw new Xl(`Invalid hash count: ${r}`);if(e.length>0&&this.hashCount===0)throw new Xl(`Invalid hash count: ${r}`);if(e.length===0&&n!==0)throw new Xl(`Invalid padding when bitmap length is 0: ${n}`);this.ge=8*e.length-n,this.pe=Pi.fromNumber(this.ge)}ye(e,n,r){let s=e.add(n.multiply(Pi.fromNumber(r)));return s.compare(P6)===1&&(s=new Pi([s.getBits(0),s.getBits(1)],0)),s.modulo(this.pe).toNumber()}we(e){return!!(this.bitmap[Math.floor(e/8)]&1<o.insert(a)),o}insert(e){if(this.ge===0)return;const n=b_(e),[r,s]=__(n);for(let i=0;i0&&(this.Oe=!0,this.Me=e)}ke(){let e=$e(),n=$e(),r=$e();return this.Fe.forEach((s,i)=>{switch(i){case 0:e=e.add(s);break;case 2:n=n.add(s);break;case 1:r=r.add(s);break;default:Se(38017,{changeType:i})}}),new wu(this.Me,this.xe,e,n,r)}qe(){this.Oe=!1,this.Fe=E_()}Ke(e,n){this.Oe=!0,this.Fe=this.Fe.insert(e,n)}Ue(e){this.Oe=!0,this.Fe=this.Fe.remove(e)}$e(){this.ve+=1}We(){this.ve-=1,Xe(this.ve>=0,3241,{ve:this.ve})}Qe(){this.Oe=!0,this.xe=!0}}class R6{constructor(e){this.Ge=e,this.ze=new Map,this.je=Ks(),this.Je=yd(),this.He=yd(),this.Ze=new kt(Ue)}Xe(e){for(const n of e.be)e.De&&e.De.isFoundDocument()?this.Ye(n,e.De):this.et(n,e.key,e.De);for(const n of e.removedTargetIds)this.et(n,e.key,e.De)}tt(e){this.forEachTarget(e,n=>{const r=this.nt(n);switch(e.state){case 0:this.rt(n)&&r.Le(e.resumeToken);break;case 1:r.We(),r.Ne||r.qe(),r.Le(e.resumeToken);break;case 2:r.We(),r.Ne||this.removeTarget(n);break;case 3:this.rt(n)&&(r.Qe(),r.Le(e.resumeToken));break;case 4:this.rt(n)&&(this.it(n),r.Le(e.resumeToken));break;default:Se(56790,{state:e.state})}})}forEachTarget(e,n){e.targetIds.length>0?e.targetIds.forEach(n):this.ze.forEach((r,s)=>{this.rt(s)&&n(s)})}st(e){const n=e.targetId,r=e.Ce.count,s=this.ot(n);if(s){const i=s.target;if(yy(i))if(r===0){const o=new be(i.path);this.et(n,o,Tn.newNoDocument(o,Ne.min()))}else Xe(r===1,20013,{expectedCount:r});else{const o=this._t(n);if(o!==r){const a=this.ut(e),l=a?this.ct(a,e,o):1;if(l!==0){this.it(n);const c=l===2?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.Ze=this.Ze.insert(n,c)}}}}}ut(e){const n=e.Ce.unchangedNames;if(!n||!n.bits)return null;const{bits:{bitmap:r="",padding:s=0},hashCount:i=0}=n;let o,a;try{o=Fi(r).toUint8Array()}catch(l){if(l instanceof yI)return Mo("Decoding the base64 bloom filter in existence filter failed ("+l.message+"); ignoring the bloom filter and falling back to full re-query."),null;throw l}try{a=new Ax(o,s,i)}catch(l){return Mo(l instanceof Xl?"BloomFilter error: ":"Applying bloom filter failed: ",l),null}return a.ge===0?null:a}ct(e,n,r){return n.Ce.count===r-this.Pt(e,n.targetId)?0:2}Pt(e,n){const r=this.Ge.getRemoteKeysForTarget(n);let s=0;return r.forEach(i=>{const o=this.Ge.ht(),a=`projects/${o.projectId}/databases/${o.database}/documents/${i.path.canonicalString()}`;e.mightContain(a)||(this.et(n,i,null),s++)}),s}Tt(e){const n=new Map;this.ze.forEach((i,o)=>{const a=this.ot(o);if(a){if(i.current&&yy(a.target)){const l=new be(a.target.path);this.Et(l).has(o)||this.It(o,l)||this.et(o,l,Tn.newNoDocument(l,e))}i.Be&&(n.set(o,i.ke()),i.qe())}});let r=$e();this.He.forEach((i,o)=>{let a=!0;o.forEachWhile(l=>{const c=this.ot(l);return!c||c.purpose==="TargetPurposeLimboResolution"||(a=!1,!1)}),a&&(r=r.add(i))}),this.je.forEach((i,o)=>o.setReadTime(e));const s=new Xf(e,n,this.Ze,this.je,r);return this.je=Ks(),this.Je=yd(),this.He=yd(),this.Ze=new kt(Ue),s}Ye(e,n){if(!this.rt(e))return;const r=this.It(e,n.key)?2:0;this.nt(e).Ke(n.key,r),this.je=this.je.insert(n.key,n),this.Je=this.Je.insert(n.key,this.Et(n.key).add(e)),this.He=this.He.insert(n.key,this.Rt(n.key).add(e))}et(e,n,r){if(!this.rt(e))return;const s=this.nt(e);this.It(e,n)?s.Ke(n,1):s.Ue(n),this.He=this.He.insert(n,this.Rt(n).delete(e)),this.He=this.He.insert(n,this.Rt(n).add(e)),r&&(this.je=this.je.insert(n,r))}removeTarget(e){this.ze.delete(e)}_t(e){const n=this.nt(e).ke();return this.Ge.getRemoteKeysForTarget(e).size+n.addedDocuments.size-n.removedDocuments.size}$e(e){this.nt(e).$e()}nt(e){let n=this.ze.get(e);return n||(n=new S_,this.ze.set(e,n)),n}Rt(e){let n=this.He.get(e);return n||(n=new tn(Ue),this.He=this.He.insert(e,n)),n}Et(e){let n=this.Je.get(e);return n||(n=new tn(Ue),this.Je=this.Je.insert(e,n)),n}rt(e){const n=this.ot(e)!==null;return n||fe("WatchChangeAggregator","Detected inactive target",e),n}ot(e){const n=this.ze.get(e);return n&&n.Ne?null:this.Ge.At(e)}it(e){this.ze.set(e,new S_),this.Ge.getRemoteKeysForTarget(e).forEach(n=>{this.et(e,n,null)})}It(e,n){return this.Ge.getRemoteKeysForTarget(e).has(n)}}function yd(){return new kt(be.comparator)}function E_(){return new kt(be.comparator)}const j6={asc:"ASCENDING",desc:"DESCENDING"},D6={"<":"LESS_THAN","<=":"LESS_THAN_OR_EQUAL",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","!=":"NOT_EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","not-in":"NOT_IN","array-contains-any":"ARRAY_CONTAINS_ANY"},M6={and:"AND",or:"OR"};class L6{constructor(e,n){this.databaseId=e,this.useProto3Json=n}}function wy(t,e){return t.useProto3Json||$f(e)?e:{value:e}}function qh(t,e){return t.useProto3Json?`${new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+e.nanoseconds).slice(-9)}Z`:{seconds:""+e.seconds,nanos:e.nanoseconds}}function KI(t,e){return t.useProto3Json?e.toBase64():e.toUint8Array()}function V6(t,e){return qh(t,e.toTimestamp())}function gs(t){return Xe(!!t,49232),Ne.fromTimestamp(function(n){const r=Oi(n);return new Ve(r.seconds,r.nanos)}(t))}function Px(t,e){return by(t,e).canonicalString()}function by(t,e){const n=function(s){return new lt(["projects",s.projectId,"databases",s.database])}(t).child("documents");return e===void 0?n:n.child(e)}function YI(t){const e=lt.fromString(t);return Xe(eN(e),10190,{key:e.toString()}),e}function _y(t,e){return Px(t.databaseId,e.path)}function pm(t,e){const n=YI(e);if(n.get(1)!==t.databaseId.projectId)throw new ue(K.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+n.get(1)+" vs "+t.databaseId.projectId);if(n.get(3)!==t.databaseId.database)throw new ue(K.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+t.databaseId.database);return new be(XI(n))}function QI(t,e){return Px(t.databaseId,e)}function O6(t){const e=YI(t);return e.length===4?lt.emptyPath():XI(e)}function Sy(t){return new lt(["projects",t.databaseId.projectId,"databases",t.databaseId.database]).canonicalString()}function XI(t){return Xe(t.length>4&&t.get(4)==="documents",29091,{key:t.toString()}),t.popFirst(5)}function T_(t,e,n){return{name:_y(t,e),fields:n.value.mapValue.fields}}function F6(t,e){let n;if("targetChange"in e){e.targetChange;const r=function(c){return c==="NO_CHANGE"?0:c==="ADD"?1:c==="REMOVE"?2:c==="CURRENT"?3:c==="RESET"?4:Se(39313,{state:c})}(e.targetChange.targetChangeType||"NO_CHANGE"),s=e.targetChange.targetIds||[],i=function(c,d){return c.useProto3Json?(Xe(d===void 0||typeof d=="string",58123),xn.fromBase64String(d||"")):(Xe(d===void 0||d instanceof Buffer||d instanceof Uint8Array,16193),xn.fromUint8Array(d||new Uint8Array))}(t,e.targetChange.resumeToken),o=e.targetChange.cause,a=o&&function(c){const d=c.code===void 0?K.UNKNOWN:GI(c.code);return new ue(d,c.message||"")}(o);n=new WI(r,s,i,a||null)}else if("documentChange"in e){e.documentChange;const r=e.documentChange;r.document,r.document.name,r.document.updateTime;const s=pm(t,r.document.name),i=gs(r.document.updateTime),o=r.document.createTime?gs(r.document.createTime):Ne.min(),a=new Xn({mapValue:{fields:r.document.fields}}),l=Tn.newFoundDocument(s,i,o,a),c=r.targetIds||[],d=r.removedTargetIds||[];n=new Qd(c,d,l.key,l)}else if("documentDelete"in e){e.documentDelete;const r=e.documentDelete;r.document;const s=pm(t,r.document),i=r.readTime?gs(r.readTime):Ne.min(),o=Tn.newNoDocument(s,i),a=r.removedTargetIds||[];n=new Qd([],a,o.key,o)}else if("documentRemove"in e){e.documentRemove;const r=e.documentRemove;r.document;const s=pm(t,r.document),i=r.removedTargetIds||[];n=new Qd([],i,s,null)}else{if(!("filter"in e))return Se(11601,{Vt:e});{e.filter;const r=e.filter;r.targetId;const{count:s=0,unchangedNames:i}=r,o=new I6(s,i),a=r.targetId;n=new qI(a,o)}}return n}function z6(t,e){let n;if(e instanceof vu)n={update:T_(t,e.key,e.value)};else if(e instanceof Qf)n={delete:_y(t,e.key)};else if(e instanceof Ki)n={update:T_(t,e.key,e.data),updateMask:Y6(e.fieldMask)};else{if(!(e instanceof T6))return Se(16599,{dt:e.type});n={verify:_y(t,e.key)}}return e.fieldTransforms.length>0&&(n.updateTransforms=e.fieldTransforms.map(r=>function(i,o){const a=o.transform;if(a instanceof Gh)return{fieldPath:o.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(a instanceof Jc)return{fieldPath:o.field.canonicalString(),appendMissingElements:{values:a.elements}};if(a instanceof Zc)return{fieldPath:o.field.canonicalString(),removeAllFromArray:{values:a.elements}};if(a instanceof eu)return{fieldPath:o.field.canonicalString(),increment:a.Ae};throw Se(20930,{transform:o.transform})}(0,r))),e.precondition.isNone||(n.currentDocument=function(s,i){return i.updateTime!==void 0?{updateTime:V6(s,i.updateTime)}:i.exists!==void 0?{exists:i.exists}:Se(27497)}(t,e.precondition)),n}function B6(t,e){return t&&t.length>0?(Xe(e!==void 0,14353),t.map(n=>function(s,i){let o=s.updateTime?gs(s.updateTime):gs(i);return o.isEqual(Ne.min())&&(o=gs(i)),new _6(o,s.transformResults||[])}(n,e))):[]}function U6(t,e){return{documents:[QI(t,e.path)]}}function $6(t,e){const n={structuredQuery:{}},r=e.path;let s;e.collectionGroup!==null?(s=r,n.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(s=r.popLast(),n.structuredQuery.from=[{collectionId:r.lastSegment()}]),n.parent=QI(t,s);const i=function(c){if(c.length!==0)return ZI(Xr.create(c,"and"))}(e.filters);i&&(n.structuredQuery.where=i);const o=function(c){if(c.length!==0)return c.map(d=>function(m){return{field:aa(m.field),direction:q6(m.dir)}}(d))}(e.orderBy);o&&(n.structuredQuery.orderBy=o);const a=wy(t,e.limit);return a!==null&&(n.structuredQuery.limit=a),e.startAt&&(n.structuredQuery.startAt=function(c){return{before:c.inclusive,values:c.position}}(e.startAt)),e.endAt&&(n.structuredQuery.endAt=function(c){return{before:!c.inclusive,values:c.position}}(e.endAt)),{ft:n,parent:s}}function H6(t){let e=O6(t.parent);const n=t.structuredQuery,r=n.from?n.from.length:0;let s=null;if(r>0){Xe(r===1,65062);const d=n.from[0];d.allDescendants?s=d.collectionId:e=e.child(d.collectionId)}let i=[];n.where&&(i=function(h){const m=JI(h);return m instanceof Xr&&CI(m)?m.getFilters():[m]}(n.where));let o=[];n.orderBy&&(o=function(h){return h.map(m=>function(g){return new Xc(la(g.field),function(E){switch(E){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(g.direction))}(m))}(n.orderBy));let a=null;n.limit&&(a=function(h){let m;return m=typeof h=="object"?h.value:h,$f(m)?null:m}(n.limit));let l=null;n.startAt&&(l=function(h){const m=!!h.before,p=h.values||[];return new Hh(p,m)}(n.startAt));let c=null;return n.endAt&&(c=function(h){const m=!h.before,p=h.values||[];return new Hh(p,m)}(n.endAt)),a6(e,s,o,i,a,"F",l,c)}function G6(t,e){const n=function(s){switch(s){case"TargetPurposeListen":return null;case"TargetPurposeExistenceFilterMismatch":return"existence-filter-mismatch";case"TargetPurposeExistenceFilterMismatchBloom":return"existence-filter-mismatch-bloom";case"TargetPurposeLimboResolution":return"limbo-document";default:return Se(28987,{purpose:s})}}(e.purpose);return n==null?null:{"goog-listen-tags":n}}function JI(t){return t.unaryFilter!==void 0?function(n){switch(n.unaryFilter.op){case"IS_NAN":const r=la(n.unaryFilter.field);return qt.create(r,"==",{doubleValue:NaN});case"IS_NULL":const s=la(n.unaryFilter.field);return qt.create(s,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const i=la(n.unaryFilter.field);return qt.create(i,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const o=la(n.unaryFilter.field);return qt.create(o,"!=",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":return Se(61313);default:return Se(60726)}}(t):t.fieldFilter!==void 0?function(n){return qt.create(la(n.fieldFilter.field),function(s){switch(s){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";case"OPERATOR_UNSPECIFIED":return Se(58110);default:return Se(50506)}}(n.fieldFilter.op),n.fieldFilter.value)}(t):t.compositeFilter!==void 0?function(n){return Xr.create(n.compositeFilter.filters.map(r=>JI(r)),function(s){switch(s){case"AND":return"and";case"OR":return"or";default:return Se(1026)}}(n.compositeFilter.op))}(t):Se(30097,{filter:t})}function q6(t){return j6[t]}function W6(t){return D6[t]}function K6(t){return M6[t]}function aa(t){return{fieldPath:t.canonicalString()}}function la(t){return mn.fromServerFormat(t.fieldPath)}function ZI(t){return t instanceof qt?function(n){if(n.op==="=="){if(h_(n.value))return{unaryFilter:{field:aa(n.field),op:"IS_NAN"}};if(d_(n.value))return{unaryFilter:{field:aa(n.field),op:"IS_NULL"}}}else if(n.op==="!="){if(h_(n.value))return{unaryFilter:{field:aa(n.field),op:"IS_NOT_NAN"}};if(d_(n.value))return{unaryFilter:{field:aa(n.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:aa(n.field),op:W6(n.op),value:n.value}}}(t):t instanceof Xr?function(n){const r=n.getFilters().map(s=>ZI(s));return r.length===1?r[0]:{compositeFilter:{op:K6(n.op),filters:r}}}(t):Se(54877,{filter:t})}function Y6(t){const e=[];return t.fields.forEach(n=>e.push(n.canonicalString())),{fieldPaths:e}}function eN(t){return t.length>=4&&t.get(0)==="projects"&&t.get(2)==="databases"}function tN(t){return!!t&&typeof t._toProto=="function"&&t._protoValueType==="ProtoValue"}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class vi{constructor(e,n,r,s,i=Ne.min(),o=Ne.min(),a=xn.EMPTY_BYTE_STRING,l=null){this.target=e,this.targetId=n,this.purpose=r,this.sequenceNumber=s,this.snapshotVersion=i,this.lastLimboFreeSnapshotVersion=o,this.resumeToken=a,this.expectedCount=l}withSequenceNumber(e){return new vi(this.target,this.targetId,this.purpose,e,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(e,n){return new vi(this.target,this.targetId,this.purpose,this.sequenceNumber,n,this.lastLimboFreeSnapshotVersion,e,null)}withExpectedCount(e){return new vi(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,e)}withLastLimboFreeSnapshotVersion(e){return new vi(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,e,this.resumeToken,this.expectedCount)}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Q6{constructor(e){this.yt=e}}function X6(t){const e=H6({parent:t.parent,structuredQuery:t.structuredQuery});return t.limitType==="LAST"?vy(e,e.limit,"L"):e}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class J6{constructor(){this.bn=new Z6}addToCollectionParentIndex(e,n){return this.bn.add(n),Q.resolve()}getCollectionParents(e,n){return Q.resolve(this.bn.getEntries(n))}addFieldIndex(e,n){return Q.resolve()}deleteFieldIndex(e,n){return Q.resolve()}deleteAllFieldIndexes(e){return Q.resolve()}createTargetIndexes(e,n){return Q.resolve()}getDocumentsMatchingTarget(e,n){return Q.resolve(null)}getIndexType(e,n){return Q.resolve(0)}getFieldIndexes(e,n){return Q.resolve([])}getNextCollectionGroupToUpdate(e){return Q.resolve(null)}getMinOffset(e,n){return Q.resolve(Vi.min())}getMinOffsetFromCollectionGroup(e,n){return Q.resolve(Vi.min())}updateCollectionGroup(e,n,r){return Q.resolve()}updateIndexEntries(e,n){return Q.resolve()}}class Z6{constructor(){this.index={}}add(e){const n=e.lastSegment(),r=e.popLast(),s=this.index[n]||new tn(lt.comparator),i=!s.has(r);return this.index[n]=s.add(r),i}has(e){const n=e.lastSegment(),r=e.popLast(),s=this.index[n];return s&&s.has(r)}getEntries(e){return(this.index[e]||new tn(lt.comparator)).toArray()}}/** + * @license + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const k_={didRun:!1,sequenceNumbersCollected:0,targetsRemoved:0,documentsRemoved:0},nN=41943040;class Yn{static withCacheSize(e){return new Yn(e,Yn.DEFAULT_COLLECTION_PERCENTILE,Yn.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}constructor(e,n,r){this.cacheSizeCollectionThreshold=e,this.percentileToCollect=n,this.maximumSequenceNumbersToCollect=r}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */Yn.DEFAULT_COLLECTION_PERCENTILE=10,Yn.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,Yn.DEFAULT=new Yn(nN,Yn.DEFAULT_COLLECTION_PERCENTILE,Yn.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),Yn.DISABLED=new Yn(-1,0,0);/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Ja{constructor(e){this.sr=e}next(){return this.sr+=2,this.sr}static _r(){return new Ja(0)}static ar(){return new Ja(-1)}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const C_="LruGarbageCollector",eF=1048576;function I_([t,e],[n,r]){const s=Ue(t,n);return s===0?Ue(e,r):s}class tF{constructor(e){this.Pr=e,this.buffer=new tn(I_),this.Tr=0}Er(){return++this.Tr}Ir(e){const n=[e,this.Er()];if(this.buffer.size{this.Rr=null;try{await this.localStore.collectGarbage(this.garbageCollector)}catch(n){hl(n)?fe(C_,"Ignoring IndexedDB error during garbage collection: ",n):await dl(n)}await this.Ar(3e5)})}}class rF{constructor(e,n){this.Vr=e,this.params=n}calculateTargetCount(e,n){return this.Vr.dr(e).next(r=>Math.floor(n/100*r))}nthSequenceNumber(e,n){if(n===0)return Q.resolve(Uf.ce);const r=new tF(n);return this.Vr.forEachTarget(e,s=>r.Ir(s.sequenceNumber)).next(()=>this.Vr.mr(e,s=>r.Ir(s))).next(()=>r.maxValue)}removeTargets(e,n,r){return this.Vr.removeTargets(e,n,r)}removeOrphanedDocuments(e,n){return this.Vr.removeOrphanedDocuments(e,n)}collect(e,n){return this.params.cacheSizeCollectionThreshold===-1?(fe("LruGarbageCollector","Garbage collection skipped; disabled"),Q.resolve(k_)):this.getCacheSize(e).next(r=>r(h>this.params.maximumSequenceNumbersToCollect?(fe("LruGarbageCollector",`Capping sequence numbers to collect down to the maximum of ${this.params.maximumSequenceNumbersToCollect} from ${h}`),s=this.params.maximumSequenceNumbersToCollect):s=h,o=Date.now(),this.nthSequenceNumber(e,s))).next(h=>(r=h,a=Date.now(),this.removeTargets(e,r,n))).next(h=>(i=h,l=Date.now(),this.removeOrphanedDocuments(e,r))).next(h=>(c=Date.now(),ia()<=Be.DEBUG&&fe("LruGarbageCollector",`LRU Garbage Collection + Counted targets in ${o-d}ms + Determined least recently used ${s} in `+(a-o)+`ms + Removed ${i} targets in `+(l-a)+`ms + Removed ${h} documents in `+(c-l)+`ms +Total Duration: ${c-d}ms`),Q.resolve({didRun:!0,sequenceNumbersCollected:s,targetsRemoved:i,documentsRemoved:h})))}}function sF(t,e){return new rF(t,e)}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class iF{constructor(){this.changes=new qo(e=>e.toString(),(e,n)=>e.isEqual(n)),this.changesApplied=!1}addEntry(e){this.assertNotApplied(),this.changes.set(e.key,e)}removeEntry(e,n){this.assertNotApplied(),this.changes.set(e,Tn.newInvalidDocument(e).setReadTime(n))}getEntry(e,n){this.assertNotApplied();const r=this.changes.get(n);return r!==void 0?Q.resolve(r):this.getFromCache(e,n)}getEntries(e,n){return this.getAllFromCache(e,n)}apply(e){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(e)}assertNotApplied(){}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *//** + * @license + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class oF{constructor(e,n){this.overlayedDocument=e,this.mutatedFields=n}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class aF{constructor(e,n,r,s){this.remoteDocumentCache=e,this.mutationQueue=n,this.documentOverlayCache=r,this.indexManager=s}getDocument(e,n){let r=null;return this.documentOverlayCache.getOverlay(e,n).next(s=>(r=s,this.remoteDocumentCache.getEntry(e,n))).next(s=>(r!==null&&vc(r.mutation,s,gr.empty(),Ve.now()),s))}getDocuments(e,n){return this.remoteDocumentCache.getEntries(e,n).next(r=>this.getLocalViewOfDocuments(e,r,$e()).next(()=>r))}getLocalViewOfDocuments(e,n,r=$e()){const s=xo();return this.populateOverlays(e,s,n).next(()=>this.computeViews(e,n,s,r).next(i=>{let o=Ql();return i.forEach((a,l)=>{o=o.insert(a,l.overlayedDocument)}),o}))}getOverlayedDocuments(e,n){const r=xo();return this.populateOverlays(e,r,n).next(()=>this.computeViews(e,n,r,$e()))}populateOverlays(e,n,r){const s=[];return r.forEach(i=>{n.has(i)||s.push(i)}),this.documentOverlayCache.getOverlays(e,s).next(i=>{i.forEach((o,a)=>{n.set(o,a)})})}computeViews(e,n,r,s){let i=Ks();const o=xc(),a=function(){return xc()}();return n.forEach((l,c)=>{const d=r.get(c.key);s.has(c.key)&&(d===void 0||d.mutation instanceof Ki)?i=i.insert(c.key,c):d!==void 0?(o.set(c.key,d.mutation.getFieldMask()),vc(d.mutation,c,d.mutation.getFieldMask(),Ve.now())):o.set(c.key,gr.empty())}),this.recalculateAndSaveOverlays(e,i).next(l=>(l.forEach((c,d)=>o.set(c,d)),n.forEach((c,d)=>a.set(c,new oF(d,o.get(c)??null))),a))}recalculateAndSaveOverlays(e,n){const r=xc();let s=new kt((o,a)=>o-a),i=$e();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,n).next(o=>{for(const a of o)a.keys().forEach(l=>{const c=n.get(l);if(c===null)return;let d=r.get(l)||gr.empty();d=a.applyToLocalView(c,d),r.set(l,d);const h=(s.get(a.batchId)||$e()).add(l);s=s.insert(a.batchId,h)})}).next(()=>{const o=[],a=s.getReverseIterator();for(;a.hasNext();){const l=a.getNext(),c=l.key,d=l.value,h=LI();d.forEach(m=>{if(!i.has(m)){const p=$I(n.get(m),r.get(m));p!==null&&h.set(m,p),i=i.add(m)}}),o.push(this.documentOverlayCache.saveOverlays(e,c,h))}return Q.waitFor(o)}).next(()=>r)}recalculateAndSaveOverlaysForDocumentKeys(e,n){return this.remoteDocumentCache.getEntries(e,n).next(r=>this.recalculateAndSaveOverlays(e,r))}getDocumentsMatchingQuery(e,n,r,s){return l6(n)?this.getDocumentsMatchingDocumentQuery(e,n.path):PI(n)?this.getDocumentsMatchingCollectionGroupQuery(e,n,r,s):this.getDocumentsMatchingCollectionQuery(e,n,r,s)}getNextDocuments(e,n,r,s){return this.remoteDocumentCache.getAllFromCollectionGroup(e,n,r,s).next(i=>{const o=s-i.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,n,r.largestBatchId,s-i.size):Q.resolve(xo());let a=Wc,l=i;return o.next(c=>Q.forEach(c,(d,h)=>(a{l=l.insert(d,m)}))).next(()=>this.populateOverlays(e,c,i)).next(()=>this.computeViews(e,l,c,$e())).next(d=>({batchId:a,changes:MI(d)})))})}getDocumentsMatchingDocumentQuery(e,n){return this.getDocument(e,new be(n)).next(r=>{let s=Ql();return r.isFoundDocument()&&(s=s.insert(r.key,r)),s})}getDocumentsMatchingCollectionGroupQuery(e,n,r,s){const i=n.collectionGroup;let o=Ql();return this.indexManager.getCollectionParents(e,i).next(a=>Q.forEach(a,l=>{const c=function(h,m){return new fl(m,null,h.explicitOrderBy.slice(),h.filters.slice(),h.limit,h.limitType,h.startAt,h.endAt)}(n,l.child(i));return this.getDocumentsMatchingCollectionQuery(e,c,r,s).next(d=>{d.forEach((h,m)=>{o=o.insert(h,m)})})}).next(()=>o))}getDocumentsMatchingCollectionQuery(e,n,r,s){let i;return this.documentOverlayCache.getOverlaysForCollection(e,n.path,r.largestBatchId).next(o=>(i=o,this.remoteDocumentCache.getDocumentsMatchingQuery(e,n,r,i,s))).next(o=>{i.forEach((l,c)=>{const d=c.getKey();o.get(d)===null&&(o=o.insert(d,Tn.newInvalidDocument(d)))});let a=Ql();return o.forEach((l,c)=>{const d=i.get(l);d!==void 0&&vc(d.mutation,c,gr.empty(),Ve.now()),Wf(n,c)&&(a=a.insert(l,c))}),a})}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class lF{constructor(e){this.serializer=e,this.Nr=new Map,this.Br=new Map}getBundleMetadata(e,n){return Q.resolve(this.Nr.get(n))}saveBundleMetadata(e,n){return this.Nr.set(n.id,function(s){return{id:s.id,version:s.version,createTime:gs(s.createTime)}}(n)),Q.resolve()}getNamedQuery(e,n){return Q.resolve(this.Br.get(n))}saveNamedQuery(e,n){return this.Br.set(n.name,function(s){return{name:s.name,query:X6(s.bundledQuery),readTime:gs(s.readTime)}}(n)),Q.resolve()}}/** + * @license + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class cF{constructor(){this.overlays=new kt(be.comparator),this.Lr=new Map}getOverlay(e,n){return Q.resolve(this.overlays.get(n))}getOverlays(e,n){const r=xo();return Q.forEach(n,s=>this.getOverlay(e,s).next(i=>{i!==null&&r.set(s,i)})).next(()=>r)}saveOverlays(e,n,r){return r.forEach((s,i)=>{this.St(e,n,i)}),Q.resolve()}removeOverlaysForBatchId(e,n,r){const s=this.Lr.get(r);return s!==void 0&&(s.forEach(i=>this.overlays=this.overlays.remove(i)),this.Lr.delete(r)),Q.resolve()}getOverlaysForCollection(e,n,r){const s=xo(),i=n.length+1,o=new be(n.child("")),a=this.overlays.getIteratorFrom(o);for(;a.hasNext();){const l=a.getNext().value,c=l.getKey();if(!n.isPrefixOf(c.path))break;c.path.length===i&&l.largestBatchId>r&&s.set(l.getKey(),l)}return Q.resolve(s)}getOverlaysForCollectionGroup(e,n,r,s){let i=new kt((c,d)=>c-d);const o=this.overlays.getIterator();for(;o.hasNext();){const c=o.getNext().value;if(c.getKey().getCollectionGroup()===n&&c.largestBatchId>r){let d=i.get(c.largestBatchId);d===null&&(d=xo(),i=i.insert(c.largestBatchId,d)),d.set(c.getKey(),c)}}const a=xo(),l=i.getIterator();for(;l.hasNext()&&(l.getNext().value.forEach((c,d)=>a.set(c,d)),!(a.size()>=s)););return Q.resolve(a)}St(e,n,r){const s=this.overlays.get(r.key);if(s!==null){const o=this.Lr.get(s.largestBatchId).delete(r.key);this.Lr.set(s.largestBatchId,o)}this.overlays=this.overlays.insert(r.key,new C6(n,r));let i=this.Lr.get(n);i===void 0&&(i=$e(),this.Lr.set(n,i)),this.Lr.set(n,i.add(r.key))}}/** + * @license + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class uF{constructor(){this.sessionToken=xn.EMPTY_BYTE_STRING}getSessionToken(e){return Q.resolve(this.sessionToken)}setSessionToken(e,n){return this.sessionToken=n,Q.resolve()}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Rx{constructor(){this.kr=new tn(an.qr),this.Kr=new tn(an.Ur)}isEmpty(){return this.kr.isEmpty()}addReference(e,n){const r=new an(e,n);this.kr=this.kr.add(r),this.Kr=this.Kr.add(r)}$r(e,n){e.forEach(r=>this.addReference(r,n))}removeReference(e,n){this.Wr(new an(e,n))}Qr(e,n){e.forEach(r=>this.removeReference(r,n))}Gr(e){const n=new be(new lt([])),r=new an(n,e),s=new an(n,e+1),i=[];return this.Kr.forEachInRange([r,s],o=>{this.Wr(o),i.push(o.key)}),i}zr(){this.kr.forEach(e=>this.Wr(e))}Wr(e){this.kr=this.kr.delete(e),this.Kr=this.Kr.delete(e)}jr(e){const n=new be(new lt([])),r=new an(n,e),s=new an(n,e+1);let i=$e();return this.Kr.forEachInRange([r,s],o=>{i=i.add(o.key)}),i}containsKey(e){const n=new an(e,0),r=this.kr.firstAfterOrEqual(n);return r!==null&&e.isEqual(r.key)}}class an{constructor(e,n){this.key=e,this.Jr=n}static qr(e,n){return be.comparator(e.key,n.key)||Ue(e.Jr,n.Jr)}static Ur(e,n){return Ue(e.Jr,n.Jr)||be.comparator(e.key,n.key)}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class dF{constructor(e,n){this.indexManager=e,this.referenceDelegate=n,this.mutationQueue=[],this.Yn=1,this.Hr=new tn(an.qr)}checkEmpty(e){return Q.resolve(this.mutationQueue.length===0)}addMutationBatch(e,n,r,s){const i=this.Yn;this.Yn++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const o=new k6(i,n,r,s);this.mutationQueue.push(o);for(const a of s)this.Hr=this.Hr.add(new an(a.key,i)),this.indexManager.addToCollectionParentIndex(e,a.key.path.popLast());return Q.resolve(o)}lookupMutationBatch(e,n){return Q.resolve(this.Zr(n))}getNextMutationBatchAfterBatchId(e,n){const r=n+1,s=this.Xr(r),i=s<0?0:s;return Q.resolve(this.mutationQueue.length>i?this.mutationQueue[i]:null)}getHighestUnacknowledgedBatchId(){return Q.resolve(this.mutationQueue.length===0?Sx:this.Yn-1)}getAllMutationBatches(e){return Q.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,n){const r=new an(n,0),s=new an(n,Number.POSITIVE_INFINITY),i=[];return this.Hr.forEachInRange([r,s],o=>{const a=this.Zr(o.Jr);i.push(a)}),Q.resolve(i)}getAllMutationBatchesAffectingDocumentKeys(e,n){let r=new tn(Ue);return n.forEach(s=>{const i=new an(s,0),o=new an(s,Number.POSITIVE_INFINITY);this.Hr.forEachInRange([i,o],a=>{r=r.add(a.Jr)})}),Q.resolve(this.Yr(r))}getAllMutationBatchesAffectingQuery(e,n){const r=n.path,s=r.length+1;let i=r;be.isDocumentKey(i)||(i=i.child(""));const o=new an(new be(i),0);let a=new tn(Ue);return this.Hr.forEachWhile(l=>{const c=l.key.path;return!!r.isPrefixOf(c)&&(c.length===s&&(a=a.add(l.Jr)),!0)},o),Q.resolve(this.Yr(a))}Yr(e){const n=[];return e.forEach(r=>{const s=this.Zr(r);s!==null&&n.push(s)}),n}removeMutationBatch(e,n){Xe(this.ei(n.batchId,"removed")===0,55003),this.mutationQueue.shift();let r=this.Hr;return Q.forEach(n.mutations,s=>{const i=new an(s.key,n.batchId);return r=r.delete(i),this.referenceDelegate.markPotentiallyOrphaned(e,s.key)}).next(()=>{this.Hr=r})}nr(e){}containsKey(e,n){const r=new an(n,0),s=this.Hr.firstAfterOrEqual(r);return Q.resolve(n.isEqual(s&&s.key))}performConsistencyCheck(e){return this.mutationQueue.length,Q.resolve()}ei(e,n){return this.Xr(e)}Xr(e){return this.mutationQueue.length===0?0:e-this.mutationQueue[0].batchId}Zr(e){const n=this.Xr(e);return n<0||n>=this.mutationQueue.length?null:this.mutationQueue[n]}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class hF{constructor(e){this.ti=e,this.docs=function(){return new kt(be.comparator)}(),this.size=0}setIndexManager(e){this.indexManager=e}addEntry(e,n){const r=n.key,s=this.docs.get(r),i=s?s.size:0,o=this.ti(n);return this.docs=this.docs.insert(r,{document:n.mutableCopy(),size:o}),this.size+=o-i,this.indexManager.addToCollectionParentIndex(e,r.path.popLast())}removeEntry(e){const n=this.docs.get(e);n&&(this.docs=this.docs.remove(e),this.size-=n.size)}getEntry(e,n){const r=this.docs.get(n);return Q.resolve(r?r.document.mutableCopy():Tn.newInvalidDocument(n))}getEntries(e,n){let r=Ks();return n.forEach(s=>{const i=this.docs.get(s);r=r.insert(s,i?i.document.mutableCopy():Tn.newInvalidDocument(s))}),Q.resolve(r)}getDocumentsMatchingQuery(e,n,r,s){let i=Ks();const o=n.path,a=new be(o.child("__id-9223372036854775808__")),l=this.docs.getIteratorFrom(a);for(;l.hasNext();){const{key:c,value:{document:d}}=l.getNext();if(!o.isPrefixOf(c.path))break;c.path.length>o.length+1||O3(V3(d),r)<=0||(s.has(d.key)||Wf(n,d))&&(i=i.insert(d.key,d.mutableCopy()))}return Q.resolve(i)}getAllFromCollectionGroup(e,n,r,s){Se(9500)}ni(e,n){return Q.forEach(this.docs,r=>n(r))}newChangeBuffer(e){return new fF(this)}getSize(e){return Q.resolve(this.size)}}class fF extends iF{constructor(e){super(),this.Mr=e}applyChanges(e){const n=[];return this.changes.forEach((r,s)=>{s.isValidDocument()?n.push(this.Mr.addEntry(e,s)):this.Mr.removeEntry(r)}),Q.waitFor(n)}getFromCache(e,n){return this.Mr.getEntry(e,n)}getAllFromCache(e,n){return this.Mr.getEntries(e,n)}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class pF{constructor(e){this.persistence=e,this.ri=new qo(n=>kx(n),Cx),this.lastRemoteSnapshotVersion=Ne.min(),this.highestTargetId=0,this.ii=0,this.si=new Rx,this.targetCount=0,this.oi=Ja._r()}forEachTarget(e,n){return this.ri.forEach((r,s)=>n(s)),Q.resolve()}getLastRemoteSnapshotVersion(e){return Q.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return Q.resolve(this.ii)}allocateTargetId(e){return this.highestTargetId=this.oi.next(),Q.resolve(this.highestTargetId)}setTargetsMetadata(e,n,r){return r&&(this.lastRemoteSnapshotVersion=r),n>this.ii&&(this.ii=n),Q.resolve()}lr(e){this.ri.set(e.target,e);const n=e.targetId;n>this.highestTargetId&&(this.oi=new Ja(n),this.highestTargetId=n),e.sequenceNumber>this.ii&&(this.ii=e.sequenceNumber)}addTargetData(e,n){return this.lr(n),this.targetCount+=1,Q.resolve()}updateTargetData(e,n){return this.lr(n),Q.resolve()}removeTargetData(e,n){return this.ri.delete(n.target),this.si.Gr(n.targetId),this.targetCount-=1,Q.resolve()}removeTargets(e,n,r){let s=0;const i=[];return this.ri.forEach((o,a)=>{a.sequenceNumber<=n&&r.get(a.targetId)===null&&(this.ri.delete(o),i.push(this.removeMatchingKeysForTargetId(e,a.targetId)),s++)}),Q.waitFor(i).next(()=>s)}getTargetCount(e){return Q.resolve(this.targetCount)}getTargetData(e,n){const r=this.ri.get(n)||null;return Q.resolve(r)}addMatchingKeys(e,n,r){return this.si.$r(n,r),Q.resolve()}removeMatchingKeys(e,n,r){this.si.Qr(n,r);const s=this.persistence.referenceDelegate,i=[];return s&&n.forEach(o=>{i.push(s.markPotentiallyOrphaned(e,o))}),Q.waitFor(i)}removeMatchingKeysForTargetId(e,n){return this.si.Gr(n),Q.resolve()}getMatchingKeysForTargetId(e,n){const r=this.si.jr(n);return Q.resolve(r)}containsKey(e,n){return Q.resolve(this.si.containsKey(n))}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class rN{constructor(e,n){this._i={},this.overlays={},this.ai=new Uf(0),this.ui=!1,this.ui=!0,this.ci=new uF,this.referenceDelegate=e(this),this.li=new pF(this),this.indexManager=new J6,this.remoteDocumentCache=function(s){return new hF(s)}(r=>this.referenceDelegate.hi(r)),this.serializer=new Q6(n),this.Pi=new lF(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.ui=!1,Promise.resolve()}get started(){return this.ui}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let n=this.overlays[e.toKey()];return n||(n=new cF,this.overlays[e.toKey()]=n),n}getMutationQueue(e,n){let r=this._i[e.toKey()];return r||(r=new dF(n,this.referenceDelegate),this._i[e.toKey()]=r),r}getGlobalsCache(){return this.ci}getTargetCache(){return this.li}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.Pi}runTransaction(e,n,r){fe("MemoryPersistence","Starting transaction:",e);const s=new mF(this.ai.next());return this.referenceDelegate.Ti(),r(s).next(i=>this.referenceDelegate.Ei(s).next(()=>i)).toPromise().then(i=>(s.raiseOnCommittedEvent(),i))}Ii(e,n){return Q.or(Object.values(this._i).map(r=>()=>r.containsKey(e,n)))}}class mF extends z3{constructor(e){super(),this.currentSequenceNumber=e}}class jx{constructor(e){this.persistence=e,this.Ri=new Rx,this.Ai=null}static Vi(e){return new jx(e)}get di(){if(this.Ai)return this.Ai;throw Se(60996)}addReference(e,n,r){return this.Ri.addReference(r,n),this.di.delete(r.toString()),Q.resolve()}removeReference(e,n,r){return this.Ri.removeReference(r,n),this.di.add(r.toString()),Q.resolve()}markPotentiallyOrphaned(e,n){return this.di.add(n.toString()),Q.resolve()}removeTarget(e,n){this.Ri.Gr(n.targetId).forEach(s=>this.di.add(s.toString()));const r=this.persistence.getTargetCache();return r.getMatchingKeysForTargetId(e,n.targetId).next(s=>{s.forEach(i=>this.di.add(i.toString()))}).next(()=>r.removeTargetData(e,n))}Ti(){this.Ai=new Set}Ei(e){const n=this.persistence.getRemoteDocumentCache().newChangeBuffer();return Q.forEach(this.di,r=>{const s=be.fromPath(r);return this.mi(e,s).next(i=>{i||n.removeEntry(s,Ne.min())})}).next(()=>(this.Ai=null,n.apply(e)))}updateLimboDocument(e,n){return this.mi(e,n).next(r=>{r?this.di.delete(n.toString()):this.di.add(n.toString())})}hi(e){return 0}mi(e,n){return Q.or([()=>Q.resolve(this.Ri.containsKey(n)),()=>this.persistence.getTargetCache().containsKey(e,n),()=>this.persistence.Ii(e,n)])}}class Wh{constructor(e,n){this.persistence=e,this.fi=new qo(r=>$3(r.path),(r,s)=>r.isEqual(s)),this.garbageCollector=sF(this,n)}static Vi(e,n){return new Wh(e,n)}Ti(){}Ei(e){return Q.resolve()}forEachTarget(e,n){return this.persistence.getTargetCache().forEachTarget(e,n)}dr(e){const n=this.pr(e);return this.persistence.getTargetCache().getTargetCount(e).next(r=>n.next(s=>r+s))}pr(e){let n=0;return this.mr(e,r=>{n++}).next(()=>n)}mr(e,n){return Q.forEach(this.fi,(r,s)=>this.wr(e,r,s).next(i=>i?Q.resolve():n(s)))}removeTargets(e,n,r){return this.persistence.getTargetCache().removeTargets(e,n,r)}removeOrphanedDocuments(e,n){let r=0;const s=this.persistence.getRemoteDocumentCache(),i=s.newChangeBuffer();return s.ni(e,o=>this.wr(e,o,n).next(a=>{a||(r++,i.removeEntry(o,Ne.min()))})).next(()=>i.apply(e)).next(()=>r)}markPotentiallyOrphaned(e,n){return this.fi.set(n,e.currentSequenceNumber),Q.resolve()}removeTarget(e,n){const r=n.withSequenceNumber(e.currentSequenceNumber);return this.persistence.getTargetCache().updateTargetData(e,r)}addReference(e,n,r){return this.fi.set(r,e.currentSequenceNumber),Q.resolve()}removeReference(e,n,r){return this.fi.set(r,e.currentSequenceNumber),Q.resolve()}updateLimboDocument(e,n){return this.fi.set(n,e.currentSequenceNumber),Q.resolve()}hi(e){let n=e.key.toString().length;return e.isFoundDocument()&&(n+=Wd(e.data.value)),n}wr(e,n,r){return Q.or([()=>this.persistence.Ii(e,n),()=>this.persistence.getTargetCache().containsKey(e,n),()=>{const s=this.fi.get(n);return Q.resolve(s!==void 0&&s>r)}])}getCacheSize(e){return this.persistence.getRemoteDocumentCache().getSize(e)}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Dx{constructor(e,n,r,s){this.targetId=e,this.fromCache=n,this.Ts=r,this.Es=s}static Is(e,n){let r=$e(),s=$e();for(const i of n.docChanges)switch(i.type){case 0:r=r.add(i.doc.key);break;case 1:s=s.add(i.doc.key)}return new Dx(e,n.fromCache,r,s)}}/** + * @license + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class gF{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class yF{constructor(){this.Rs=!1,this.As=!1,this.Vs=100,this.ds=function(){return sO()?8:B3(In())>0?6:4}()}initialize(e,n){this.fs=e,this.indexManager=n,this.Rs=!0}getDocumentsMatchingQuery(e,n,r,s){const i={result:null};return this.gs(e,n).next(o=>{i.result=o}).next(()=>{if(!i.result)return this.ps(e,n,s,r).next(o=>{i.result=o})}).next(()=>{if(i.result)return;const o=new gF;return this.ys(e,n,o).next(a=>{if(i.result=a,this.As)return this.ws(e,n,o,a.size)})}).next(()=>i.result)}ws(e,n,r,s){return r.documentReadCountthis.ds*s?(ia()<=Be.DEBUG&&fe("QueryEngine","The SDK decides to create cache indexes for query:",oa(n),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(e,ms(n))):Q.resolve())}gs(e,n){if(g_(n))return Q.resolve(null);let r=ms(n);return this.indexManager.getIndexType(e,r).next(s=>s===0?null:(n.limit!==null&&s===1&&(n=vy(n,null,"F"),r=ms(n)),this.indexManager.getDocumentsMatchingTarget(e,r).next(i=>{const o=$e(...i);return this.fs.getDocuments(e,o).next(a=>this.indexManager.getMinOffset(e,r).next(l=>{const c=this.Ss(n,a);return this.bs(n,c,o,l.readTime)?this.gs(e,vy(n,null,"F")):this.Ds(e,c,n,l)}))})))}ps(e,n,r,s){return g_(n)||s.isEqual(Ne.min())?Q.resolve(null):this.fs.getDocuments(e,r).next(i=>{const o=this.Ss(n,i);return this.bs(n,o,r,s)?Q.resolve(null):(ia()<=Be.DEBUG&&fe("QueryEngine","Re-using previous result from %s to execute query: %s",s.toString(),oa(n)),this.Ds(e,o,n,L3(s,Wc)).next(a=>a))})}Ss(e,n){let r=new tn(jI(e));return n.forEach((s,i)=>{Wf(e,i)&&(r=r.add(i))}),r}bs(e,n,r,s){if(e.limit===null)return!1;if(r.size!==n.size)return!0;const i=e.limitType==="F"?n.last():n.first();return!!i&&(i.hasPendingWrites||i.version.compareTo(s)>0)}ys(e,n,r){return ia()<=Be.DEBUG&&fe("QueryEngine","Using full collection scan to execute query:",oa(n)),this.fs.getDocumentsMatchingQuery(e,n,Vi.min(),r)}Ds(e,n,r,s){return this.fs.getDocumentsMatchingQuery(e,r,s).next(i=>(n.forEach(o=>{i=i.insert(o.key,o)}),i))}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Mx="LocalStore",xF=3e8;class vF{constructor(e,n,r,s){this.persistence=e,this.Cs=n,this.serializer=s,this.vs=new kt(Ue),this.Fs=new qo(i=>kx(i),Cx),this.Ms=new Map,this.xs=e.getRemoteDocumentCache(),this.li=e.getTargetCache(),this.Pi=e.getBundleCache(),this.Os(r)}Os(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new aF(this.xs,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.xs.setIndexManager(this.indexManager),this.Cs.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction("Collect garbage","readwrite-primary",n=>e.collect(n,this.vs))}}function wF(t,e,n,r){return new vF(t,e,n,r)}async function sN(t,e){const n=Re(t);return await n.persistence.runTransaction("Handle user change","readonly",r=>{let s;return n.mutationQueue.getAllMutationBatches(r).next(i=>(s=i,n.Os(e),n.mutationQueue.getAllMutationBatches(r))).next(i=>{const o=[],a=[];let l=$e();for(const c of s){o.push(c.batchId);for(const d of c.mutations)l=l.add(d.key)}for(const c of i){a.push(c.batchId);for(const d of c.mutations)l=l.add(d.key)}return n.localDocuments.getDocuments(r,l).next(c=>({Ns:c,removedBatchIds:o,addedBatchIds:a}))})})}function bF(t,e){const n=Re(t);return n.persistence.runTransaction("Acknowledge batch","readwrite-primary",r=>{const s=e.batch.keys(),i=n.xs.newChangeBuffer({trackRemovals:!0});return function(a,l,c,d){const h=c.batch,m=h.keys();let p=Q.resolve();return m.forEach(g=>{p=p.next(()=>d.getEntry(l,g)).next(b=>{const E=c.docVersions.get(g);Xe(E!==null,48541),b.version.compareTo(E)<0&&(h.applyToRemoteDocument(b,c),b.isValidDocument()&&(b.setReadTime(c.commitVersion),d.addEntry(b)))})}),p.next(()=>a.mutationQueue.removeMutationBatch(l,h))}(n,r,e,i).next(()=>i.apply(r)).next(()=>n.mutationQueue.performConsistencyCheck(r)).next(()=>n.documentOverlayCache.removeOverlaysForBatchId(r,s,e.batch.batchId)).next(()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(r,function(a){let l=$e();for(let c=0;c0&&(l=l.add(a.batch.mutations[c].key));return l}(e))).next(()=>n.localDocuments.getDocuments(r,s))})}function iN(t){const e=Re(t);return e.persistence.runTransaction("Get last remote snapshot version","readonly",n=>e.li.getLastRemoteSnapshotVersion(n))}function _F(t,e){const n=Re(t),r=e.snapshotVersion;let s=n.vs;return n.persistence.runTransaction("Apply remote event","readwrite-primary",i=>{const o=n.xs.newChangeBuffer({trackRemovals:!0});s=n.vs;const a=[];e.targetChanges.forEach((d,h)=>{const m=s.get(h);if(!m)return;a.push(n.li.removeMatchingKeys(i,d.removedDocuments,h).next(()=>n.li.addMatchingKeys(i,d.addedDocuments,h)));let p=m.withSequenceNumber(i.currentSequenceNumber);e.targetMismatches.get(h)!==null?p=p.withResumeToken(xn.EMPTY_BYTE_STRING,Ne.min()).withLastLimboFreeSnapshotVersion(Ne.min()):d.resumeToken.approximateByteSize()>0&&(p=p.withResumeToken(d.resumeToken,r)),s=s.insert(h,p),function(b,E,y){return b.resumeToken.approximateByteSize()===0||E.snapshotVersion.toMicroseconds()-b.snapshotVersion.toMicroseconds()>=xF?!0:y.addedDocuments.size+y.modifiedDocuments.size+y.removedDocuments.size>0}(m,p,d)&&a.push(n.li.updateTargetData(i,p))});let l=Ks(),c=$e();if(e.documentUpdates.forEach(d=>{e.resolvedLimboDocuments.has(d)&&a.push(n.persistence.referenceDelegate.updateLimboDocument(i,d))}),a.push(SF(i,o,e.documentUpdates).next(d=>{l=d.Bs,c=d.Ls})),!r.isEqual(Ne.min())){const d=n.li.getLastRemoteSnapshotVersion(i).next(h=>n.li.setTargetsMetadata(i,i.currentSequenceNumber,r));a.push(d)}return Q.waitFor(a).next(()=>o.apply(i)).next(()=>n.localDocuments.getLocalViewOfDocuments(i,l,c)).next(()=>l)}).then(i=>(n.vs=s,i))}function SF(t,e,n){let r=$e(),s=$e();return n.forEach(i=>r=r.add(i)),e.getEntries(t,r).next(i=>{let o=Ks();return n.forEach((a,l)=>{const c=i.get(a);l.isFoundDocument()!==c.isFoundDocument()&&(s=s.add(a)),l.isNoDocument()&&l.version.isEqual(Ne.min())?(e.removeEntry(a,l.readTime),o=o.insert(a,l)):!c.isValidDocument()||l.version.compareTo(c.version)>0||l.version.compareTo(c.version)===0&&c.hasPendingWrites?(e.addEntry(l),o=o.insert(a,l)):fe(Mx,"Ignoring outdated watch update for ",a,". Current version:",c.version," Watch version:",l.version)}),{Bs:o,Ls:s}})}function EF(t,e){const n=Re(t);return n.persistence.runTransaction("Get next mutation batch","readonly",r=>(e===void 0&&(e=Sx),n.mutationQueue.getNextMutationBatchAfterBatchId(r,e)))}function TF(t,e){const n=Re(t);return n.persistence.runTransaction("Allocate target","readwrite",r=>{let s;return n.li.getTargetData(r,e).next(i=>i?(s=i,Q.resolve(s)):n.li.allocateTargetId(r).next(o=>(s=new vi(e,o,"TargetPurposeListen",r.currentSequenceNumber),n.li.addTargetData(r,s).next(()=>s))))}).then(r=>{const s=n.vs.get(r.targetId);return(s===null||r.snapshotVersion.compareTo(s.snapshotVersion)>0)&&(n.vs=n.vs.insert(r.targetId,r),n.Fs.set(e,r.targetId)),r})}async function Ey(t,e,n){const r=Re(t),s=r.vs.get(e),i=n?"readwrite":"readwrite-primary";try{n||await r.persistence.runTransaction("Release target",i,o=>r.persistence.referenceDelegate.removeTarget(o,s))}catch(o){if(!hl(o))throw o;fe(Mx,`Failed to update sequence numbers for target ${e}: ${o}`)}r.vs=r.vs.remove(e),r.Fs.delete(s.target)}function N_(t,e,n){const r=Re(t);let s=Ne.min(),i=$e();return r.persistence.runTransaction("Execute query","readwrite",o=>function(l,c,d){const h=Re(l),m=h.Fs.get(d);return m!==void 0?Q.resolve(h.vs.get(m)):h.li.getTargetData(c,d)}(r,o,ms(e)).next(a=>{if(a)return s=a.lastLimboFreeSnapshotVersion,r.li.getMatchingKeysForTargetId(o,a.targetId).next(l=>{i=l})}).next(()=>r.Cs.getDocumentsMatchingQuery(o,e,n?s:Ne.min(),n?i:$e())).next(a=>(kF(r,d6(e),a),{documents:a,ks:i})))}function kF(t,e,n){let r=t.Ms.get(e)||Ne.min();n.forEach((s,i)=>{i.readTime.compareTo(r)>0&&(r=i.readTime)}),t.Ms.set(e,r)}class A_{constructor(){this.activeTargetIds=y6()}Qs(e){this.activeTargetIds=this.activeTargetIds.add(e)}Gs(e){this.activeTargetIds=this.activeTargetIds.delete(e)}Ws(){const e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)}}class CF{constructor(){this.vo=new A_,this.Fo={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,n,r){}addLocalQueryTarget(e,n=!0){return n&&this.vo.Qs(e),this.Fo[e]||"not-current"}updateQueryState(e,n,r){this.Fo[e]=n}removeLocalQueryTarget(e){this.vo.Gs(e)}isLocalQueryTarget(e){return this.vo.activeTargetIds.has(e)}clearQueryState(e){delete this.Fo[e]}getAllActiveQueryTargets(){return this.vo.activeTargetIds}isActiveQueryTarget(e){return this.vo.activeTargetIds.has(e)}start(){return this.vo=new A_,Promise.resolve()}handleUserChange(e,n,r){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class IF{Mo(e){}shutdown(){}}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const P_="ConnectivityMonitor";class R_{constructor(){this.xo=()=>this.Oo(),this.No=()=>this.Bo(),this.Lo=[],this.ko()}Mo(e){this.Lo.push(e)}shutdown(){window.removeEventListener("online",this.xo),window.removeEventListener("offline",this.No)}ko(){window.addEventListener("online",this.xo),window.addEventListener("offline",this.No)}Oo(){fe(P_,"Network connectivity changed: AVAILABLE");for(const e of this.Lo)e(0)}Bo(){fe(P_,"Network connectivity changed: UNAVAILABLE");for(const e of this.Lo)e(1)}static v(){return typeof window<"u"&&window.addEventListener!==void 0&&window.removeEventListener!==void 0}}/** + * @license + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */let xd=null;function Ty(){return xd===null?xd=function(){return 268435456+Math.round(2147483648*Math.random())}():xd++,"0x"+xd.toString(16)}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const mm="RestConnection",NF={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery",ExecutePipeline:"executePipeline"};class AF{get qo(){return!1}constructor(e){this.databaseInfo=e,this.databaseId=e.databaseId;const n=e.ssl?"https":"http",r=encodeURIComponent(this.databaseId.projectId),s=encodeURIComponent(this.databaseId.database);this.Ko=n+"://"+e.host,this.Uo=`projects/${r}/databases/${s}`,this.$o=this.databaseId.database===Uh?`project_id=${r}`:`project_id=${r}&database_id=${s}`}Wo(e,n,r,s,i){const o=Ty(),a=this.Qo(e,n.toUriEncodedString());fe(mm,`Sending RPC '${e}' ${o}:`,a,r);const l={"google-cloud-resource-prefix":this.Uo,"x-goog-request-params":this.$o};this.Go(l,s,i);const{host:c}=new URL(a),d=cl(c);return this.zo(e,a,l,r,d).then(h=>(fe(mm,`Received RPC '${e}' ${o}: `,h),h),h=>{throw Mo(mm,`RPC '${e}' ${o} failed with error: `,h,"url: ",a,"request:",r),h})}jo(e,n,r,s,i,o){return this.Wo(e,n,r,s,i)}Go(e,n,r){e["X-Goog-Api-Client"]=function(){return"gl-js/ fire/"+ul}(),e["Content-Type"]="text/plain",this.databaseInfo.appId&&(e["X-Firebase-GMPID"]=this.databaseInfo.appId),n&&n.headers.forEach((s,i)=>e[i]=s),r&&r.headers.forEach((s,i)=>e[i]=s)}Qo(e,n){const r=NF[e];let s=`${this.Ko}/v1/${n}:${r}`;return this.databaseInfo.apiKey&&(s=`${s}?key=${encodeURIComponent(this.databaseInfo.apiKey)}`),s}terminate(){}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class PF{constructor(e){this.Jo=e.Jo,this.Ho=e.Ho}Zo(e){this.Xo=e}Yo(e){this.e_=e}t_(e){this.n_=e}onMessage(e){this.r_=e}close(){this.Ho()}send(e){this.Jo(e)}i_(){this.Xo()}s_(){this.e_()}o_(e){this.n_(e)}__(e){this.r_(e)}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const _n="WebChannelConnection",zl=(t,e,n)=>{t.listen(e,r=>{try{n(r)}catch(s){setTimeout(()=>{throw s},0)}})};class ja extends AF{constructor(e){super(e),this.a_=[],this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}static u_(){if(!ja.c_){const e=cI();zl(e,lI.STAT_EVENT,n=>{n.stat===hy.PROXY?fe(_n,"STAT_EVENT: detected buffering proxy"):n.stat===hy.NOPROXY&&fe(_n,"STAT_EVENT: detected no buffering proxy")}),ja.c_=!0}}zo(e,n,r,s,i){const o=Ty();return new Promise((a,l)=>{const c=new oI;c.setWithCredentials(!0),c.listenOnce(aI.COMPLETE,()=>{try{switch(c.getLastErrorCode()){case qd.NO_ERROR:const h=c.getResponseJson();fe(_n,`XHR for RPC '${e}' ${o} received:`,JSON.stringify(h)),a(h);break;case qd.TIMEOUT:fe(_n,`RPC '${e}' ${o} timed out`),l(new ue(K.DEADLINE_EXCEEDED,"Request time out"));break;case qd.HTTP_ERROR:const m=c.getStatus();if(fe(_n,`RPC '${e}' ${o} failed with status:`,m,"response text:",c.getResponseText()),m>0){let p=c.getResponseJson();Array.isArray(p)&&(p=p[0]);const g=p==null?void 0:p.error;if(g&&g.status&&g.message){const b=function(y){const v=y.toLowerCase().replace(/_/g,"-");return Object.values(K).indexOf(v)>=0?v:K.UNKNOWN}(g.status);l(new ue(b,g.message))}else l(new ue(K.UNKNOWN,"Server responded with status "+c.getStatus()))}else l(new ue(K.UNAVAILABLE,"Connection failed."));break;default:Se(9055,{l_:e,streamId:o,h_:c.getLastErrorCode(),P_:c.getLastError()})}}finally{fe(_n,`RPC '${e}' ${o} completed.`)}});const d=JSON.stringify(s);fe(_n,`RPC '${e}' ${o} sending request:`,s),c.send(n,"POST",d,r,15)})}T_(e,n,r){const s=Ty(),i=[this.Ko,"/","google.firestore.v1.Firestore","/",e,"/channel"],o=this.createWebChannelTransport(),a={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:`projects/${this.databaseId.projectId}/databases/${this.databaseId.database}`},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling},l=this.longPollingOptions.timeoutSeconds;l!==void 0&&(a.longPollingTimeout=Math.round(1e3*l)),this.useFetchStreams&&(a.useFetchStreams=!0),this.Go(a.initMessageHeaders,n,r),a.encodeInitMessageHeaders=!0;const c=i.join("");fe(_n,`Creating RPC '${e}' stream ${s}: ${c}`,a);const d=o.createWebChannel(c,a);this.E_(d);let h=!1,m=!1;const p=new PF({Jo:g=>{m?fe(_n,`Not sending because RPC '${e}' stream ${s} is closed:`,g):(h||(fe(_n,`Opening RPC '${e}' stream ${s} transport.`),d.open(),h=!0),fe(_n,`RPC '${e}' stream ${s} sending:`,g),d.send(g))},Ho:()=>d.close()});return zl(d,Yl.EventType.OPEN,()=>{m||(fe(_n,`RPC '${e}' stream ${s} transport opened.`),p.i_())}),zl(d,Yl.EventType.CLOSE,()=>{m||(m=!0,fe(_n,`RPC '${e}' stream ${s} transport closed`),p.o_(),this.I_(d))}),zl(d,Yl.EventType.ERROR,g=>{m||(m=!0,Mo(_n,`RPC '${e}' stream ${s} transport errored. Name:`,g.name,"Message:",g.message),p.o_(new ue(K.UNAVAILABLE,"The operation could not be completed")))}),zl(d,Yl.EventType.MESSAGE,g=>{var b;if(!m){const E=g.data[0];Xe(!!E,16349);const y=E,v=(y==null?void 0:y.error)||((b=y[0])==null?void 0:b.error);if(v){fe(_n,`RPC '${e}' stream ${s} received error:`,v);const _=v.status;let P=function(T){const w=Ut[T];if(w!==void 0)return GI(w)}(_),D=v.message;_==="NOT_FOUND"&&D.includes("database")&&D.includes("does not exist")&&D.includes(this.databaseId.database)&&Mo(`Database '${this.databaseId.database}' not found. Please check your project configuration.`),P===void 0&&(P=K.INTERNAL,D="Unknown error status: "+_+" with message "+v.message),m=!0,p.o_(new ue(P,D)),d.close()}else fe(_n,`RPC '${e}' stream ${s} received:`,E),p.__(E)}}),ja.u_(),setTimeout(()=>{p.s_()},0),p}terminate(){this.a_.forEach(e=>e.close()),this.a_=[]}E_(e){this.a_.push(e)}I_(e){this.a_=this.a_.filter(n=>n===e)}Go(e,n,r){super.Go(e,n,r),this.databaseInfo.apiKey&&(e["x-goog-api-key"]=this.databaseInfo.apiKey)}createWebChannelTransport(){return uI()}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function RF(t){return new ja(t)}function gm(){return typeof document<"u"?document:null}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Jf(t){return new L6(t,!0)}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ja.c_=!1;class oN{constructor(e,n,r=1e3,s=1.5,i=6e4){this.Ci=e,this.timerId=n,this.R_=r,this.A_=s,this.V_=i,this.d_=0,this.m_=null,this.f_=Date.now(),this.reset()}reset(){this.d_=0}g_(){this.d_=this.V_}p_(e){this.cancel();const n=Math.floor(this.d_+this.y_()),r=Math.max(0,Date.now()-this.f_),s=Math.max(0,n-r);s>0&&fe("ExponentialBackoff",`Backing off for ${s} ms (base delay: ${this.d_} ms, delay with jitter: ${n} ms, last attempt: ${r} ms ago)`),this.m_=this.Ci.enqueueAfterDelay(this.timerId,s,()=>(this.f_=Date.now(),e())),this.d_*=this.A_,this.d_this.V_&&(this.d_=this.V_)}w_(){this.m_!==null&&(this.m_.skipDelay(),this.m_=null)}cancel(){this.m_!==null&&(this.m_.cancel(),this.m_=null)}y_(){return(Math.random()-.5)*this.d_}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const j_="PersistentStream";class aN{constructor(e,n,r,s,i,o,a,l){this.Ci=e,this.S_=r,this.b_=s,this.connection=i,this.authCredentialsProvider=o,this.appCheckCredentialsProvider=a,this.listener=l,this.state=0,this.D_=0,this.C_=null,this.v_=null,this.stream=null,this.F_=0,this.M_=new oN(e,n)}x_(){return this.state===1||this.state===5||this.O_()}O_(){return this.state===2||this.state===3}start(){this.F_=0,this.state!==4?this.auth():this.N_()}async stop(){this.x_()&&await this.close(0)}B_(){this.state=0,this.M_.reset()}L_(){this.O_()&&this.C_===null&&(this.C_=this.Ci.enqueueAfterDelay(this.S_,6e4,()=>this.k_()))}q_(e){this.K_(),this.stream.send(e)}async k_(){if(this.O_())return this.close(0)}K_(){this.C_&&(this.C_.cancel(),this.C_=null)}U_(){this.v_&&(this.v_.cancel(),this.v_=null)}async close(e,n){this.K_(),this.U_(),this.M_.cancel(),this.D_++,e!==4?this.M_.reset():n&&n.code===K.RESOURCE_EXHAUSTED?(Ws(n.toString()),Ws("Using maximum backoff delay to prevent overloading the backend."),this.M_.g_()):n&&n.code===K.UNAUTHENTICATED&&this.state!==3&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),this.stream!==null&&(this.W_(),this.stream.close(),this.stream=null),this.state=e,await this.listener.t_(n)}W_(){}auth(){this.state=1;const e=this.Q_(this.D_),n=this.D_;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then(([r,s])=>{this.D_===n&&this.G_(r,s)},r=>{e(()=>{const s=new ue(K.UNKNOWN,"Fetching auth token failed: "+r.message);return this.z_(s)})})}G_(e,n){const r=this.Q_(this.D_);this.stream=this.j_(e,n),this.stream.Zo(()=>{r(()=>this.listener.Zo())}),this.stream.Yo(()=>{r(()=>(this.state=2,this.v_=this.Ci.enqueueAfterDelay(this.b_,1e4,()=>(this.O_()&&(this.state=3),Promise.resolve())),this.listener.Yo()))}),this.stream.t_(s=>{r(()=>this.z_(s))}),this.stream.onMessage(s=>{r(()=>++this.F_==1?this.J_(s):this.onNext(s))})}N_(){this.state=5,this.M_.p_(async()=>{this.state=0,this.start()})}z_(e){return fe(j_,`close with error: ${e}`),this.stream=null,this.close(4,e)}Q_(e){return n=>{this.Ci.enqueueAndForget(()=>this.D_===e?n():(fe(j_,"stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve()))}}}class jF extends aN{constructor(e,n,r,s,i,o){super(e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",n,r,s,o),this.serializer=i}j_(e,n){return this.connection.T_("Listen",e,n)}J_(e){return this.onNext(e)}onNext(e){this.M_.reset();const n=F6(this.serializer,e),r=function(i){if(!("targetChange"in i))return Ne.min();const o=i.targetChange;return o.targetIds&&o.targetIds.length?Ne.min():o.readTime?gs(o.readTime):Ne.min()}(e);return this.listener.H_(n,r)}Z_(e){const n={};n.database=Sy(this.serializer),n.addTarget=function(i,o){let a;const l=o.target;if(a=yy(l)?{documents:U6(i,l)}:{query:$6(i,l).ft},a.targetId=o.targetId,o.resumeToken.approximateByteSize()>0){a.resumeToken=KI(i,o.resumeToken);const c=wy(i,o.expectedCount);c!==null&&(a.expectedCount=c)}else if(o.snapshotVersion.compareTo(Ne.min())>0){a.readTime=qh(i,o.snapshotVersion.toTimestamp());const c=wy(i,o.expectedCount);c!==null&&(a.expectedCount=c)}return a}(this.serializer,e);const r=G6(this.serializer,e);r&&(n.labels=r),this.q_(n)}X_(e){const n={};n.database=Sy(this.serializer),n.removeTarget=e,this.q_(n)}}class DF extends aN{constructor(e,n,r,s,i,o){super(e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",n,r,s,o),this.serializer=i}get Y_(){return this.F_>0}start(){this.lastStreamToken=void 0,super.start()}W_(){this.Y_&&this.ea([])}j_(e,n){return this.connection.T_("Write",e,n)}J_(e){return Xe(!!e.streamToken,31322),this.lastStreamToken=e.streamToken,Xe(!e.writeResults||e.writeResults.length===0,55816),this.listener.ta()}onNext(e){Xe(!!e.streamToken,12678),this.lastStreamToken=e.streamToken,this.M_.reset();const n=B6(e.writeResults,e.commitTime),r=gs(e.commitTime);return this.listener.na(r,n)}ra(){const e={};e.database=Sy(this.serializer),this.q_(e)}ea(e){const n={streamToken:this.lastStreamToken,writes:e.map(r=>z6(this.serializer,r))};this.q_(n)}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class MF{}class LF extends MF{constructor(e,n,r,s){super(),this.authCredentials=e,this.appCheckCredentials=n,this.connection=r,this.serializer=s,this.ia=!1}sa(){if(this.ia)throw new ue(K.FAILED_PRECONDITION,"The client has already been terminated.")}Wo(e,n,r,s){return this.sa(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([i,o])=>this.connection.Wo(e,by(n,r),s,i,o)).catch(i=>{throw i.name==="FirebaseError"?(i.code===K.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),i):new ue(K.UNKNOWN,i.toString())})}jo(e,n,r,s,i){return this.sa(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([o,a])=>this.connection.jo(e,by(n,r),s,o,a,i)).catch(o=>{throw o.name==="FirebaseError"?(o.code===K.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),o):new ue(K.UNKNOWN,o.toString())})}terminate(){this.ia=!0,this.connection.terminate()}}function VF(t,e,n,r){return new LF(t,e,n,r)}class OF{constructor(e,n){this.asyncQueue=e,this.onlineStateHandler=n,this.state="Unknown",this.oa=0,this._a=null,this.aa=!0}ua(){this.oa===0&&(this.ca("Unknown"),this._a=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,()=>(this._a=null,this.la("Backend didn't respond within 10 seconds."),this.ca("Offline"),Promise.resolve())))}ha(e){this.state==="Online"?this.ca("Unknown"):(this.oa++,this.oa>=1&&(this.Pa(),this.la(`Connection failed 1 times. Most recent error: ${e.toString()}`),this.ca("Offline")))}set(e){this.Pa(),this.oa=0,e==="Online"&&(this.aa=!1),this.ca(e)}ca(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}la(e){const n=`Could not reach Cloud Firestore backend. ${e} +This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.`;this.aa?(Ws(n),this.aa=!1):fe("OnlineStateTracker",n)}Pa(){this._a!==null&&(this._a.cancel(),this._a=null)}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Lo="RemoteStore";class FF{constructor(e,n,r,s,i){this.localStore=e,this.datastore=n,this.asyncQueue=r,this.remoteSyncer={},this.Ta=[],this.Ea=new Map,this.Ia=new Set,this.Ra=[],this.Aa=i,this.Aa.Mo(o=>{r.enqueueAndForget(async()=>{Wo(this)&&(fe(Lo,"Restarting streams for network reachability change."),await async function(l){const c=Re(l);c.Ia.add(4),await bu(c),c.Va.set("Unknown"),c.Ia.delete(4),await Zf(c)}(this))})}),this.Va=new OF(r,s)}}async function Zf(t){if(Wo(t))for(const e of t.Ra)await e(!0)}async function bu(t){for(const e of t.Ra)await e(!1)}function lN(t,e){const n=Re(t);n.Ea.has(e.targetId)||(n.Ea.set(e.targetId,e),Fx(n)?Ox(n):pl(n).O_()&&Vx(n,e))}function Lx(t,e){const n=Re(t),r=pl(n);n.Ea.delete(e),r.O_()&&cN(n,e),n.Ea.size===0&&(r.O_()?r.L_():Wo(n)&&n.Va.set("Unknown"))}function Vx(t,e){if(t.da.$e(e.targetId),e.resumeToken.approximateByteSize()>0||e.snapshotVersion.compareTo(Ne.min())>0){const n=t.remoteSyncer.getRemoteKeysForTarget(e.targetId).size;e=e.withExpectedCount(n)}pl(t).Z_(e)}function cN(t,e){t.da.$e(e),pl(t).X_(e)}function Ox(t){t.da=new R6({getRemoteKeysForTarget:e=>t.remoteSyncer.getRemoteKeysForTarget(e),At:e=>t.Ea.get(e)||null,ht:()=>t.datastore.serializer.databaseId}),pl(t).start(),t.Va.ua()}function Fx(t){return Wo(t)&&!pl(t).x_()&&t.Ea.size>0}function Wo(t){return Re(t).Ia.size===0}function uN(t){t.da=void 0}async function zF(t){t.Va.set("Online")}async function BF(t){t.Ea.forEach((e,n)=>{Vx(t,e)})}async function UF(t,e){uN(t),Fx(t)?(t.Va.ha(e),Ox(t)):t.Va.set("Unknown")}async function $F(t,e,n){if(t.Va.set("Online"),e instanceof WI&&e.state===2&&e.cause)try{await async function(s,i){const o=i.cause;for(const a of i.targetIds)s.Ea.has(a)&&(await s.remoteSyncer.rejectListen(a,o),s.Ea.delete(a),s.da.removeTarget(a))}(t,e)}catch(r){fe(Lo,"Failed to remove targets %s: %s ",e.targetIds.join(","),r),await Kh(t,r)}else if(e instanceof Qd?t.da.Xe(e):e instanceof qI?t.da.st(e):t.da.tt(e),!n.isEqual(Ne.min()))try{const r=await iN(t.localStore);n.compareTo(r)>=0&&await function(i,o){const a=i.da.Tt(o);return a.targetChanges.forEach((l,c)=>{if(l.resumeToken.approximateByteSize()>0){const d=i.Ea.get(c);d&&i.Ea.set(c,d.withResumeToken(l.resumeToken,o))}}),a.targetMismatches.forEach((l,c)=>{const d=i.Ea.get(l);if(!d)return;i.Ea.set(l,d.withResumeToken(xn.EMPTY_BYTE_STRING,d.snapshotVersion)),cN(i,l);const h=new vi(d.target,l,c,d.sequenceNumber);Vx(i,h)}),i.remoteSyncer.applyRemoteEvent(a)}(t,n)}catch(r){fe(Lo,"Failed to raise snapshot:",r),await Kh(t,r)}}async function Kh(t,e,n){if(!hl(e))throw e;t.Ia.add(1),await bu(t),t.Va.set("Offline"),n||(n=()=>iN(t.localStore)),t.asyncQueue.enqueueRetryable(async()=>{fe(Lo,"Retrying IndexedDB access"),await n(),t.Ia.delete(1),await Zf(t)})}function dN(t,e){return e().catch(n=>Kh(t,n,e))}async function ep(t){const e=Re(t),n=Bi(e);let r=e.Ta.length>0?e.Ta[e.Ta.length-1].batchId:Sx;for(;HF(e);)try{const s=await EF(e.localStore,r);if(s===null){e.Ta.length===0&&n.L_();break}r=s.batchId,GF(e,s)}catch(s){await Kh(e,s)}hN(e)&&fN(e)}function HF(t){return Wo(t)&&t.Ta.length<10}function GF(t,e){t.Ta.push(e);const n=Bi(t);n.O_()&&n.Y_&&n.ea(e.mutations)}function hN(t){return Wo(t)&&!Bi(t).x_()&&t.Ta.length>0}function fN(t){Bi(t).start()}async function qF(t){Bi(t).ra()}async function WF(t){const e=Bi(t);for(const n of t.Ta)e.ea(n.mutations)}async function KF(t,e,n){const r=t.Ta.shift(),s=Nx.from(r,e,n);await dN(t,()=>t.remoteSyncer.applySuccessfulWrite(s)),await ep(t)}async function YF(t,e){e&&Bi(t).Y_&&await async function(r,s){if(function(o){return N6(o)&&o!==K.ABORTED}(s.code)){const i=r.Ta.shift();Bi(r).B_(),await dN(r,()=>r.remoteSyncer.rejectFailedWrite(i.batchId,s)),await ep(r)}}(t,e),hN(t)&&fN(t)}async function D_(t,e){const n=Re(t);n.asyncQueue.verifyOperationInProgress(),fe(Lo,"RemoteStore received new credentials");const r=Wo(n);n.Ia.add(3),await bu(n),r&&n.Va.set("Unknown"),await n.remoteSyncer.handleCredentialChange(e),n.Ia.delete(3),await Zf(n)}async function QF(t,e){const n=Re(t);e?(n.Ia.delete(2),await Zf(n)):e||(n.Ia.add(2),await bu(n),n.Va.set("Unknown"))}function pl(t){return t.ma||(t.ma=function(n,r,s){const i=Re(n);return i.sa(),new jF(r,i.connection,i.authCredentials,i.appCheckCredentials,i.serializer,s)}(t.datastore,t.asyncQueue,{Zo:zF.bind(null,t),Yo:BF.bind(null,t),t_:UF.bind(null,t),H_:$F.bind(null,t)}),t.Ra.push(async e=>{e?(t.ma.B_(),Fx(t)?Ox(t):t.Va.set("Unknown")):(await t.ma.stop(),uN(t))})),t.ma}function Bi(t){return t.fa||(t.fa=function(n,r,s){const i=Re(n);return i.sa(),new DF(r,i.connection,i.authCredentials,i.appCheckCredentials,i.serializer,s)}(t.datastore,t.asyncQueue,{Zo:()=>Promise.resolve(),Yo:qF.bind(null,t),t_:YF.bind(null,t),ta:WF.bind(null,t),na:KF.bind(null,t)}),t.Ra.push(async e=>{e?(t.fa.B_(),await ep(t)):(await t.fa.stop(),t.Ta.length>0&&(fe(Lo,`Stopping write stream with ${t.Ta.length} pending writes`),t.Ta=[]))})),t.fa}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class zx{constructor(e,n,r,s,i){this.asyncQueue=e,this.timerId=n,this.targetTimeMs=r,this.op=s,this.removalCallback=i,this.deferred=new zs,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch(o=>{})}get promise(){return this.deferred.promise}static createAndSchedule(e,n,r,s,i){const o=Date.now()+r,a=new zx(e,n,o,s,i);return a.start(r),a}start(e){this.timerHandle=setTimeout(()=>this.handleDelayElapsed(),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){this.timerHandle!==null&&(this.clearTimeout(),this.deferred.reject(new ue(K.CANCELLED,"Operation cancelled"+(e?": "+e:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget(()=>this.timerHandle!==null?(this.clearTimeout(),this.op().then(e=>this.deferred.resolve(e))):Promise.resolve())}clearTimeout(){this.timerHandle!==null&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}}function Bx(t,e){if(Ws("AsyncQueue",`${e}: ${t}`),hl(t))return new ue(K.UNAVAILABLE,`${e}: ${t}`);throw t}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Da{static emptySet(e){return new Da(e.comparator)}constructor(e){this.comparator=e?(n,r)=>e(n,r)||be.comparator(n.key,r.key):(n,r)=>be.comparator(n.key,r.key),this.keyedMap=Ql(),this.sortedSet=new kt(this.comparator)}has(e){return this.keyedMap.get(e)!=null}get(e){return this.keyedMap.get(e)}first(){return this.sortedSet.minKey()}last(){return this.sortedSet.maxKey()}isEmpty(){return this.sortedSet.isEmpty()}indexOf(e){const n=this.keyedMap.get(e);return n?this.sortedSet.indexOf(n):-1}get size(){return this.sortedSet.size}forEach(e){this.sortedSet.inorderTraversal((n,r)=>(e(n),!1))}add(e){const n=this.delete(e.key);return n.copy(n.keyedMap.insert(e.key,e),n.sortedSet.insert(e,null))}delete(e){const n=this.get(e);return n?this.copy(this.keyedMap.remove(e),this.sortedSet.remove(n)):this}isEqual(e){if(!(e instanceof Da)||this.size!==e.size)return!1;const n=this.sortedSet.getIterator(),r=e.sortedSet.getIterator();for(;n.hasNext();){const s=n.getNext().key,i=r.getNext().key;if(!s.isEqual(i))return!1}return!0}toString(){const e=[];return this.forEach(n=>{e.push(n.toString())}),e.length===0?"DocumentSet ()":`DocumentSet ( + `+e.join(` +`)+` +)`}copy(e,n){const r=new Da;return r.comparator=this.comparator,r.keyedMap=e,r.sortedSet=n,r}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class M_{constructor(){this.ga=new kt(be.comparator)}track(e){const n=e.doc.key,r=this.ga.get(n);r?e.type!==0&&r.type===3?this.ga=this.ga.insert(n,e):e.type===3&&r.type!==1?this.ga=this.ga.insert(n,{type:r.type,doc:e.doc}):e.type===2&&r.type===2?this.ga=this.ga.insert(n,{type:2,doc:e.doc}):e.type===2&&r.type===0?this.ga=this.ga.insert(n,{type:0,doc:e.doc}):e.type===1&&r.type===0?this.ga=this.ga.remove(n):e.type===1&&r.type===2?this.ga=this.ga.insert(n,{type:1,doc:r.doc}):e.type===0&&r.type===1?this.ga=this.ga.insert(n,{type:2,doc:e.doc}):Se(63341,{Vt:e,pa:r}):this.ga=this.ga.insert(n,e)}ya(){const e=[];return this.ga.inorderTraversal((n,r)=>{e.push(r)}),e}}class Za{constructor(e,n,r,s,i,o,a,l,c){this.query=e,this.docs=n,this.oldDocs=r,this.docChanges=s,this.mutatedKeys=i,this.fromCache=o,this.syncStateChanged=a,this.excludesMetadataChanges=l,this.hasCachedResults=c}static fromInitialDocuments(e,n,r,s,i){const o=[];return n.forEach(a=>{o.push({type:0,doc:a})}),new Za(e,n,Da.emptySet(n),o,r,s,!0,!1,i)}get hasPendingWrites(){return!this.mutatedKeys.isEmpty()}isEqual(e){if(!(this.fromCache===e.fromCache&&this.hasCachedResults===e.hasCachedResults&&this.syncStateChanged===e.syncStateChanged&&this.mutatedKeys.isEqual(e.mutatedKeys)&&qf(this.query,e.query)&&this.docs.isEqual(e.docs)&&this.oldDocs.isEqual(e.oldDocs)))return!1;const n=this.docChanges,r=e.docChanges;if(n.length!==r.length)return!1;for(let s=0;se.Da())}}class JF{constructor(){this.queries=L_(),this.onlineState="Unknown",this.Ca=new Set}terminate(){(function(n,r){const s=Re(n),i=s.queries;s.queries=L_(),i.forEach((o,a)=>{for(const l of a.Sa)l.onError(r)})})(this,new ue(K.ABORTED,"Firestore shutting down"))}}function L_(){return new qo(t=>RI(t),qf)}async function Ux(t,e){const n=Re(t);let r=3;const s=e.query;let i=n.queries.get(s);i?!i.ba()&&e.Da()&&(r=2):(i=new XF,r=e.Da()?0:1);try{switch(r){case 0:i.wa=await n.onListen(s,!0);break;case 1:i.wa=await n.onListen(s,!1);break;case 2:await n.onFirstRemoteStoreListen(s)}}catch(o){const a=Bx(o,`Initialization of query '${oa(e.query)}' failed`);return void e.onError(a)}n.queries.set(s,i),i.Sa.push(e),e.va(n.onlineState),i.wa&&e.Fa(i.wa)&&Hx(n)}async function $x(t,e){const n=Re(t),r=e.query;let s=3;const i=n.queries.get(r);if(i){const o=i.Sa.indexOf(e);o>=0&&(i.Sa.splice(o,1),i.Sa.length===0?s=e.Da()?0:1:!i.ba()&&e.Da()&&(s=2))}switch(s){case 0:return n.queries.delete(r),n.onUnlisten(r,!0);case 1:return n.queries.delete(r),n.onUnlisten(r,!1);case 2:return n.onLastRemoteStoreUnlisten(r);default:return}}function ZF(t,e){const n=Re(t);let r=!1;for(const s of e){const i=s.query,o=n.queries.get(i);if(o){for(const a of o.Sa)a.Fa(s)&&(r=!0);o.wa=s}}r&&Hx(n)}function ez(t,e,n){const r=Re(t),s=r.queries.get(e);if(s)for(const i of s.Sa)i.onError(n);r.queries.delete(e)}function Hx(t){t.Ca.forEach(e=>{e.next()})}var ky,V_;(V_=ky||(ky={})).Ma="default",V_.Cache="cache";class Gx{constructor(e,n,r){this.query=e,this.xa=n,this.Oa=!1,this.Na=null,this.onlineState="Unknown",this.options=r||{}}Fa(e){if(!this.options.includeMetadataChanges){const r=[];for(const s of e.docChanges)s.type!==3&&r.push(s);e=new Za(e.query,e.docs,e.oldDocs,r,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let n=!1;return this.Oa?this.Ba(e)&&(this.xa.next(e),n=!0):this.La(e,this.onlineState)&&(this.ka(e),n=!0),this.Na=e,n}onError(e){this.xa.error(e)}va(e){this.onlineState=e;let n=!1;return this.Na&&!this.Oa&&this.La(this.Na,e)&&(this.ka(this.Na),n=!0),n}La(e,n){if(!e.fromCache||!this.Da())return!0;const r=n!=="Offline";return(!this.options.qa||!r)&&(!e.docs.isEmpty()||e.hasCachedResults||n==="Offline")}Ba(e){if(e.docChanges.length>0)return!0;const n=this.Na&&this.Na.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!n)&&this.options.includeMetadataChanges===!0}ka(e){e=Za.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.Oa=!0,this.xa.next(e)}Da(){return this.options.source!==ky.Cache}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class pN{constructor(e){this.key=e}}class mN{constructor(e){this.key=e}}class tz{constructor(e,n){this.query=e,this.Za=n,this.Xa=null,this.hasCachedResults=!1,this.current=!1,this.Ya=$e(),this.mutatedKeys=$e(),this.eu=jI(e),this.tu=new Da(this.eu)}get nu(){return this.Za}ru(e,n){const r=n?n.iu:new M_,s=n?n.tu:this.tu;let i=n?n.mutatedKeys:this.mutatedKeys,o=s,a=!1;const l=this.query.limitType==="F"&&s.size===this.query.limit?s.last():null,c=this.query.limitType==="L"&&s.size===this.query.limit?s.first():null;if(e.inorderTraversal((d,h)=>{const m=s.get(d),p=Wf(this.query,h)?h:null,g=!!m&&this.mutatedKeys.has(m.key),b=!!p&&(p.hasLocalMutations||this.mutatedKeys.has(p.key)&&p.hasCommittedMutations);let E=!1;m&&p?m.data.isEqual(p.data)?g!==b&&(r.track({type:3,doc:p}),E=!0):this.su(m,p)||(r.track({type:2,doc:p}),E=!0,(l&&this.eu(p,l)>0||c&&this.eu(p,c)<0)&&(a=!0)):!m&&p?(r.track({type:0,doc:p}),E=!0):m&&!p&&(r.track({type:1,doc:m}),E=!0,(l||c)&&(a=!0)),E&&(p?(o=o.add(p),i=b?i.add(d):i.delete(d)):(o=o.delete(d),i=i.delete(d)))}),this.query.limit!==null)for(;o.size>this.query.limit;){const d=this.query.limitType==="F"?o.last():o.first();o=o.delete(d.key),i=i.delete(d.key),r.track({type:1,doc:d})}return{tu:o,iu:r,bs:a,mutatedKeys:i}}su(e,n){return e.hasLocalMutations&&n.hasCommittedMutations&&!n.hasLocalMutations}applyChanges(e,n,r,s){const i=this.tu;this.tu=e.tu,this.mutatedKeys=e.mutatedKeys;const o=e.iu.ya();o.sort((d,h)=>function(p,g){const b=E=>{switch(E){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return Se(20277,{Vt:E})}};return b(p)-b(g)}(d.type,h.type)||this.eu(d.doc,h.doc)),this.ou(r),s=s??!1;const a=n&&!s?this._u():[],l=this.Ya.size===0&&this.current&&!s?1:0,c=l!==this.Xa;return this.Xa=l,o.length!==0||c?{snapshot:new Za(this.query,e.tu,i,o,e.mutatedKeys,l===0,c,!1,!!r&&r.resumeToken.approximateByteSize()>0),au:a}:{au:a}}va(e){return this.current&&e==="Offline"?(this.current=!1,this.applyChanges({tu:this.tu,iu:new M_,mutatedKeys:this.mutatedKeys,bs:!1},!1)):{au:[]}}uu(e){return!this.Za.has(e)&&!!this.tu.has(e)&&!this.tu.get(e).hasLocalMutations}ou(e){e&&(e.addedDocuments.forEach(n=>this.Za=this.Za.add(n)),e.modifiedDocuments.forEach(n=>{}),e.removedDocuments.forEach(n=>this.Za=this.Za.delete(n)),this.current=e.current)}_u(){if(!this.current)return[];const e=this.Ya;this.Ya=$e(),this.tu.forEach(r=>{this.uu(r.key)&&(this.Ya=this.Ya.add(r.key))});const n=[];return e.forEach(r=>{this.Ya.has(r)||n.push(new mN(r))}),this.Ya.forEach(r=>{e.has(r)||n.push(new pN(r))}),n}cu(e){this.Za=e.ks,this.Ya=$e();const n=this.ru(e.documents);return this.applyChanges(n,!0)}lu(){return Za.fromInitialDocuments(this.query,this.tu,this.mutatedKeys,this.Xa===0,this.hasCachedResults)}}const qx="SyncEngine";class nz{constructor(e,n,r){this.query=e,this.targetId=n,this.view=r}}class rz{constructor(e){this.key=e,this.hu=!1}}class sz{constructor(e,n,r,s,i,o){this.localStore=e,this.remoteStore=n,this.eventManager=r,this.sharedClientState=s,this.currentUser=i,this.maxConcurrentLimboResolutions=o,this.Pu={},this.Tu=new qo(a=>RI(a),qf),this.Eu=new Map,this.Iu=new Set,this.Ru=new kt(be.comparator),this.Au=new Map,this.Vu=new Rx,this.du={},this.mu=new Map,this.fu=Ja.ar(),this.onlineState="Unknown",this.gu=void 0}get isPrimaryClient(){return this.gu===!0}}async function iz(t,e,n=!0){const r=bN(t);let s;const i=r.Tu.get(e);return i?(r.sharedClientState.addLocalQueryTarget(i.targetId),s=i.view.lu()):s=await gN(r,e,n,!0),s}async function oz(t,e){const n=bN(t);await gN(n,e,!0,!1)}async function gN(t,e,n,r){const s=await TF(t.localStore,ms(e)),i=s.targetId,o=t.sharedClientState.addLocalQueryTarget(i,n);let a;return r&&(a=await az(t,e,i,o==="current",s.resumeToken)),t.isPrimaryClient&&n&&lN(t.remoteStore,s),a}async function az(t,e,n,r,s){t.pu=(h,m,p)=>async function(b,E,y,v){let _=E.view.ru(y);_.bs&&(_=await N_(b.localStore,E.query,!1).then(({documents:T})=>E.view.ru(T,_)));const P=v&&v.targetChanges.get(E.targetId),D=v&&v.targetMismatches.get(E.targetId)!=null,k=E.view.applyChanges(_,b.isPrimaryClient,P,D);return F_(b,E.targetId,k.au),k.snapshot}(t,h,m,p);const i=await N_(t.localStore,e,!0),o=new tz(e,i.ks),a=o.ru(i.documents),l=wu.createSynthesizedTargetChangeForCurrentChange(n,r&&t.onlineState!=="Offline",s),c=o.applyChanges(a,t.isPrimaryClient,l);F_(t,n,c.au);const d=new nz(e,n,o);return t.Tu.set(e,d),t.Eu.has(n)?t.Eu.get(n).push(e):t.Eu.set(n,[e]),c.snapshot}async function lz(t,e,n){const r=Re(t),s=r.Tu.get(e),i=r.Eu.get(s.targetId);if(i.length>1)return r.Eu.set(s.targetId,i.filter(o=>!qf(o,e))),void r.Tu.delete(e);r.isPrimaryClient?(r.sharedClientState.removeLocalQueryTarget(s.targetId),r.sharedClientState.isActiveQueryTarget(s.targetId)||await Ey(r.localStore,s.targetId,!1).then(()=>{r.sharedClientState.clearQueryState(s.targetId),n&&Lx(r.remoteStore,s.targetId),Cy(r,s.targetId)}).catch(dl)):(Cy(r,s.targetId),await Ey(r.localStore,s.targetId,!0))}async function cz(t,e){const n=Re(t),r=n.Tu.get(e),s=n.Eu.get(r.targetId);n.isPrimaryClient&&s.length===1&&(n.sharedClientState.removeLocalQueryTarget(r.targetId),Lx(n.remoteStore,r.targetId))}async function uz(t,e,n){const r=yz(t);try{const s=await function(o,a){const l=Re(o),c=Ve.now(),d=a.reduce((p,g)=>p.add(g.key),$e());let h,m;return l.persistence.runTransaction("Locally write mutations","readwrite",p=>{let g=Ks(),b=$e();return l.xs.getEntries(p,d).next(E=>{g=E,g.forEach((y,v)=>{v.isValidDocument()||(b=b.add(y))})}).next(()=>l.localDocuments.getOverlayedDocuments(p,g)).next(E=>{h=E;const y=[];for(const v of a){const _=E6(v,h.get(v.key).overlayedDocument);_!=null&&y.push(new Ki(v.key,_,EI(_.value.mapValue),Ln.exists(!0)))}return l.mutationQueue.addMutationBatch(p,c,y,a)}).next(E=>{m=E;const y=E.applyToLocalDocumentSet(h,b);return l.documentOverlayCache.saveOverlays(p,E.batchId,y)})}).then(()=>({batchId:m.batchId,changes:MI(h)}))}(r.localStore,e);r.sharedClientState.addPendingMutation(s.batchId),function(o,a,l){let c=o.du[o.currentUser.toKey()];c||(c=new kt(Ue)),c=c.insert(a,l),o.du[o.currentUser.toKey()]=c}(r,s.batchId,n),await _u(r,s.changes),await ep(r.remoteStore)}catch(s){const i=Bx(s,"Failed to persist write");n.reject(i)}}async function yN(t,e){const n=Re(t);try{const r=await _F(n.localStore,e);e.targetChanges.forEach((s,i)=>{const o=n.Au.get(i);o&&(Xe(s.addedDocuments.size+s.modifiedDocuments.size+s.removedDocuments.size<=1,22616),s.addedDocuments.size>0?o.hu=!0:s.modifiedDocuments.size>0?Xe(o.hu,14607):s.removedDocuments.size>0&&(Xe(o.hu,42227),o.hu=!1))}),await _u(n,r,e)}catch(r){await dl(r)}}function O_(t,e,n){const r=Re(t);if(r.isPrimaryClient&&n===0||!r.isPrimaryClient&&n===1){const s=[];r.Tu.forEach((i,o)=>{const a=o.view.va(e);a.snapshot&&s.push(a.snapshot)}),function(o,a){const l=Re(o);l.onlineState=a;let c=!1;l.queries.forEach((d,h)=>{for(const m of h.Sa)m.va(a)&&(c=!0)}),c&&Hx(l)}(r.eventManager,e),s.length&&r.Pu.H_(s),r.onlineState=e,r.isPrimaryClient&&r.sharedClientState.setOnlineState(e)}}async function dz(t,e,n){const r=Re(t);r.sharedClientState.updateQueryState(e,"rejected",n);const s=r.Au.get(e),i=s&&s.key;if(i){let o=new kt(be.comparator);o=o.insert(i,Tn.newNoDocument(i,Ne.min()));const a=$e().add(i),l=new Xf(Ne.min(),new Map,new kt(Ue),o,a);await yN(r,l),r.Ru=r.Ru.remove(i),r.Au.delete(e),Wx(r)}else await Ey(r.localStore,e,!1).then(()=>Cy(r,e,n)).catch(dl)}async function hz(t,e){const n=Re(t),r=e.batch.batchId;try{const s=await bF(n.localStore,e);vN(n,r,null),xN(n,r),n.sharedClientState.updateMutationState(r,"acknowledged"),await _u(n,s)}catch(s){await dl(s)}}async function fz(t,e,n){const r=Re(t);try{const s=await function(o,a){const l=Re(o);return l.persistence.runTransaction("Reject batch","readwrite-primary",c=>{let d;return l.mutationQueue.lookupMutationBatch(c,a).next(h=>(Xe(h!==null,37113),d=h.keys(),l.mutationQueue.removeMutationBatch(c,h))).next(()=>l.mutationQueue.performConsistencyCheck(c)).next(()=>l.documentOverlayCache.removeOverlaysForBatchId(c,d,a)).next(()=>l.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(c,d)).next(()=>l.localDocuments.getDocuments(c,d))})}(r.localStore,e);vN(r,e,n),xN(r,e),r.sharedClientState.updateMutationState(e,"rejected",n),await _u(r,s)}catch(s){await dl(s)}}function xN(t,e){(t.mu.get(e)||[]).forEach(n=>{n.resolve()}),t.mu.delete(e)}function vN(t,e,n){const r=Re(t);let s=r.du[r.currentUser.toKey()];if(s){const i=s.get(e);i&&(n?i.reject(n):i.resolve(),s=s.remove(e)),r.du[r.currentUser.toKey()]=s}}function Cy(t,e,n=null){t.sharedClientState.removeLocalQueryTarget(e);for(const r of t.Eu.get(e))t.Tu.delete(r),n&&t.Pu.yu(r,n);t.Eu.delete(e),t.isPrimaryClient&&t.Vu.Gr(e).forEach(r=>{t.Vu.containsKey(r)||wN(t,r)})}function wN(t,e){t.Iu.delete(e.path.canonicalString());const n=t.Ru.get(e);n!==null&&(Lx(t.remoteStore,n),t.Ru=t.Ru.remove(e),t.Au.delete(n),Wx(t))}function F_(t,e,n){for(const r of n)r instanceof pN?(t.Vu.addReference(r.key,e),pz(t,r)):r instanceof mN?(fe(qx,"Document no longer in limbo: "+r.key),t.Vu.removeReference(r.key,e),t.Vu.containsKey(r.key)||wN(t,r.key)):Se(19791,{wu:r})}function pz(t,e){const n=e.key,r=n.path.canonicalString();t.Ru.get(n)||t.Iu.has(r)||(fe(qx,"New document in limbo: "+n),t.Iu.add(r),Wx(t))}function Wx(t){for(;t.Iu.size>0&&t.Ru.size{o.push(r.pu(l,e,n).then(c=>{var d;if((c||n)&&r.isPrimaryClient){const h=c?!c.fromCache:(d=n==null?void 0:n.targetChanges.get(l.targetId))==null?void 0:d.current;r.sharedClientState.updateQueryState(l.targetId,h?"current":"not-current")}if(c){s.push(c);const h=Dx.Is(l.targetId,c);i.push(h)}}))}),await Promise.all(o),r.Pu.H_(s),await async function(l,c){const d=Re(l);try{await d.persistence.runTransaction("notifyLocalViewChanges","readwrite",h=>Q.forEach(c,m=>Q.forEach(m.Ts,p=>d.persistence.referenceDelegate.addReference(h,m.targetId,p)).next(()=>Q.forEach(m.Es,p=>d.persistence.referenceDelegate.removeReference(h,m.targetId,p)))))}catch(h){if(!hl(h))throw h;fe(Mx,"Failed to update sequence numbers: "+h)}for(const h of c){const m=h.targetId;if(!h.fromCache){const p=d.vs.get(m),g=p.snapshotVersion,b=p.withLastLimboFreeSnapshotVersion(g);d.vs=d.vs.insert(m,b)}}}(r.localStore,i))}async function mz(t,e){const n=Re(t);if(!n.currentUser.isEqual(e)){fe(qx,"User change. New user:",e.toKey());const r=await sN(n.localStore,e);n.currentUser=e,function(i,o){i.mu.forEach(a=>{a.forEach(l=>{l.reject(new ue(K.CANCELLED,o))})}),i.mu.clear()}(n,"'waitForPendingWrites' promise is rejected due to a user change."),n.sharedClientState.handleUserChange(e,r.removedBatchIds,r.addedBatchIds),await _u(n,r.Ns)}}function gz(t,e){const n=Re(t),r=n.Au.get(e);if(r&&r.hu)return $e().add(r.key);{let s=$e();const i=n.Eu.get(e);if(!i)return s;for(const o of i){const a=n.Tu.get(o);s=s.unionWith(a.view.nu)}return s}}function bN(t){const e=Re(t);return e.remoteStore.remoteSyncer.applyRemoteEvent=yN.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=gz.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=dz.bind(null,e),e.Pu.H_=ZF.bind(null,e.eventManager),e.Pu.yu=ez.bind(null,e.eventManager),e}function yz(t){const e=Re(t);return e.remoteStore.remoteSyncer.applySuccessfulWrite=hz.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=fz.bind(null,e),e}class Yh{constructor(){this.kind="memory",this.synchronizeTabs=!1}async initialize(e){this.serializer=Jf(e.databaseInfo.databaseId),this.sharedClientState=this.Du(e),this.persistence=this.Cu(e),await this.persistence.start(),this.localStore=this.vu(e),this.gcScheduler=this.Fu(e,this.localStore),this.indexBackfillerScheduler=this.Mu(e,this.localStore)}Fu(e,n){return null}Mu(e,n){return null}vu(e){return wF(this.persistence,new yF,e.initialUser,this.serializer)}Cu(e){return new rN(jx.Vi,this.serializer)}Du(e){return new CF}async terminate(){var e,n;(e=this.gcScheduler)==null||e.stop(),(n=this.indexBackfillerScheduler)==null||n.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}}Yh.provider={build:()=>new Yh};class xz extends Yh{constructor(e){super(),this.cacheSizeBytes=e}Fu(e,n){Xe(this.persistence.referenceDelegate instanceof Wh,46915);const r=this.persistence.referenceDelegate.garbageCollector;return new nF(r,e.asyncQueue,n)}Cu(e){const n=this.cacheSizeBytes!==void 0?Yn.withCacheSize(this.cacheSizeBytes):Yn.DEFAULT;return new rN(r=>Wh.Vi(r,n),this.serializer)}}class Iy{async initialize(e,n){this.localStore||(this.localStore=e.localStore,this.sharedClientState=e.sharedClientState,this.datastore=this.createDatastore(n),this.remoteStore=this.createRemoteStore(n),this.eventManager=this.createEventManager(n),this.syncEngine=this.createSyncEngine(n,!e.synchronizeTabs),this.sharedClientState.onlineStateHandler=r=>O_(this.syncEngine,r,1),this.remoteStore.remoteSyncer.handleCredentialChange=mz.bind(null,this.syncEngine),await QF(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return function(){return new JF}()}createDatastore(e){const n=Jf(e.databaseInfo.databaseId),r=RF(e.databaseInfo);return VF(e.authCredentials,e.appCheckCredentials,r,n)}createRemoteStore(e){return function(r,s,i,o,a){return new FF(r,s,i,o,a)}(this.localStore,this.datastore,e.asyncQueue,n=>O_(this.syncEngine,n,0),function(){return R_.v()?new R_:new IF}())}createSyncEngine(e,n){return function(s,i,o,a,l,c,d){const h=new sz(s,i,o,a,l,c);return d&&(h.gu=!0),h}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,n)}async terminate(){var e,n;await async function(s){const i=Re(s);fe(Lo,"RemoteStore shutting down."),i.Ia.add(5),await bu(i),i.Aa.shutdown(),i.Va.set("Unknown")}(this.remoteStore),(e=this.datastore)==null||e.terminate(),(n=this.eventManager)==null||n.terminate()}}Iy.provider={build:()=>new Iy};/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *//** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Kx{constructor(e){this.observer=e,this.muted=!1}next(e){this.muted||this.observer.next&&this.Ou(this.observer.next,e)}error(e){this.muted||(this.observer.error?this.Ou(this.observer.error,e):Ws("Uncaught Error in snapshot listener:",e.toString()))}Nu(){this.muted=!0}Ou(e,n){setTimeout(()=>{this.muted||e(n)},0)}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Ui="FirestoreClient";class vz{constructor(e,n,r,s,i){this.authCredentials=e,this.appCheckCredentials=n,this.asyncQueue=r,this._databaseInfo=s,this.user=Sn.UNAUTHENTICATED,this.clientId=_x.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=i,this.authCredentials.start(r,async o=>{fe(Ui,"Received user=",o.uid),await this.authCredentialListener(o),this.user=o}),this.appCheckCredentials.start(r,o=>(fe(Ui,"Received new app check token=",o),this.appCheckCredentialListener(o,this.user)))}get configuration(){return{asyncQueue:this.asyncQueue,databaseInfo:this._databaseInfo,clientId:this.clientId,authCredentials:this.authCredentials,appCheckCredentials:this.appCheckCredentials,initialUser:this.user,maxConcurrentLimboResolutions:100}}setCredentialChangeListener(e){this.authCredentialListener=e}setAppCheckTokenChangeListener(e){this.appCheckCredentialListener=e}terminate(){this.asyncQueue.enterRestrictedMode();const e=new zs;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted(async()=>{try{this._onlineComponents&&await this._onlineComponents.terminate(),this._offlineComponents&&await this._offlineComponents.terminate(),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),e.resolve()}catch(n){const r=Bx(n,"Failed to shutdown persistence");e.reject(r)}}),e.promise}}async function ym(t,e){t.asyncQueue.verifyOperationInProgress(),fe(Ui,"Initializing OfflineComponentProvider");const n=t.configuration;await e.initialize(n);let r=n.initialUser;t.setCredentialChangeListener(async s=>{r.isEqual(s)||(await sN(e.localStore,s),r=s)}),e.persistence.setDatabaseDeletedListener(()=>t.terminate()),t._offlineComponents=e}async function z_(t,e){t.asyncQueue.verifyOperationInProgress();const n=await wz(t);fe(Ui,"Initializing OnlineComponentProvider"),await e.initialize(n,t.configuration),t.setCredentialChangeListener(r=>D_(e.remoteStore,r)),t.setAppCheckTokenChangeListener((r,s)=>D_(e.remoteStore,s)),t._onlineComponents=e}async function wz(t){if(!t._offlineComponents)if(t._uninitializedComponentsProvider){fe(Ui,"Using user provided OfflineComponentProvider");try{await ym(t,t._uninitializedComponentsProvider._offline)}catch(e){const n=e;if(!function(s){return s.name==="FirebaseError"?s.code===K.FAILED_PRECONDITION||s.code===K.UNIMPLEMENTED:!(typeof DOMException<"u"&&s instanceof DOMException)||s.code===22||s.code===20||s.code===11}(n))throw n;Mo("Error using user provided cache. Falling back to memory cache: "+n),await ym(t,new Yh)}}else fe(Ui,"Using default OfflineComponentProvider"),await ym(t,new xz(void 0));return t._offlineComponents}async function _N(t){return t._onlineComponents||(t._uninitializedComponentsProvider?(fe(Ui,"Using user provided OnlineComponentProvider"),await z_(t,t._uninitializedComponentsProvider._online)):(fe(Ui,"Using default OnlineComponentProvider"),await z_(t,new Iy))),t._onlineComponents}function bz(t){return _N(t).then(e=>e.syncEngine)}async function Qh(t){const e=await _N(t),n=e.eventManager;return n.onListen=iz.bind(null,e.syncEngine),n.onUnlisten=lz.bind(null,e.syncEngine),n.onFirstRemoteStoreListen=oz.bind(null,e.syncEngine),n.onLastRemoteStoreUnlisten=cz.bind(null,e.syncEngine),n}function _z(t,e,n,r){const s=new Kx(r),i=new Gx(e,s,n);return t.asyncQueue.enqueueAndForget(async()=>Ux(await Qh(t),i)),()=>{s.Nu(),t.asyncQueue.enqueueAndForget(async()=>$x(await Qh(t),i))}}function Sz(t,e,n={}){const r=new zs;return t.asyncQueue.enqueueAndForget(async()=>function(i,o,a,l,c){const d=new Kx({next:m=>{d.Nu(),o.enqueueAndForget(()=>$x(i,h));const p=m.docs.has(a);!p&&m.fromCache?c.reject(new ue(K.UNAVAILABLE,"Failed to get document because the client is offline.")):p&&m.fromCache&&l&&l.source==="server"?c.reject(new ue(K.UNAVAILABLE,'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')):c.resolve(m)},error:m=>c.reject(m)}),h=new Gx(Gf(a.path),d,{includeMetadataChanges:!0,qa:!0});return Ux(i,h)}(await Qh(t),t.asyncQueue,e,n,r)),r.promise}function Ez(t,e,n={}){const r=new zs;return t.asyncQueue.enqueueAndForget(async()=>function(i,o,a,l,c){const d=new Kx({next:m=>{d.Nu(),o.enqueueAndForget(()=>$x(i,h)),m.fromCache&&l.source==="server"?c.reject(new ue(K.UNAVAILABLE,'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')):c.resolve(m)},error:m=>c.reject(m)}),h=new Gx(a,d,{includeMetadataChanges:!0,qa:!0});return Ux(i,h)}(await Qh(t),t.asyncQueue,e,n,r)),r.promise}function Tz(t,e){const n=new zs;return t.asyncQueue.enqueueAndForget(async()=>uz(await bz(t),e,n)),n.promise}/** + * @license + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function SN(t){const e={};return t.timeoutSeconds!==void 0&&(e.timeoutSeconds=t.timeoutSeconds),e}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const kz="ComponentProvider",B_=new Map;function Cz(t,e,n,r,s){return new q3(t,e,n,s.host,s.ssl,s.experimentalForceLongPolling,s.experimentalAutoDetectLongPolling,SN(s.experimentalLongPollingOptions),s.useFetchStreams,s.isUsingEmulator,r)}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const EN="firestore.googleapis.com",U_=!0;class $_{constructor(e){if(e.host===void 0){if(e.ssl!==void 0)throw new ue(K.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host=EN,this.ssl=U_}else this.host=e.host,this.ssl=e.ssl??U_;if(this.isUsingEmulator=e.emulatorOptions!==void 0,this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,this.localCache=e.localCache,e.cacheSizeBytes===void 0)this.cacheSizeBytes=nN;else{if(e.cacheSizeBytes!==-1&&e.cacheSizeBytes30)throw new ue(K.INVALID_ARGUMENT,`invalid long polling timeout: ${r.timeoutSeconds} (maximum allowed value is 30)`)}}(this.experimentalLongPollingOptions),this.useFetchStreams=!!e.useFetchStreams}isEqual(e){return this.host===e.host&&this.ssl===e.ssl&&this.credentials===e.credentials&&this.cacheSizeBytes===e.cacheSizeBytes&&this.experimentalForceLongPolling===e.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===e.experimentalAutoDetectLongPolling&&function(r,s){return r.timeoutSeconds===s.timeoutSeconds}(this.experimentalLongPollingOptions,e.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}}class tp{constructor(e,n,r,s){this._authCredentials=e,this._appCheckCredentials=n,this._databaseId=r,this._app=s,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new $_({}),this._settingsFrozen=!1,this._emulatorOptions={},this._terminateTask="notTerminated"}get app(){if(!this._app)throw new ue(K.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}get _initialized(){return this._settingsFrozen}get _terminated(){return this._terminateTask!=="notTerminated"}_setSettings(e){if(this._settingsFrozen)throw new ue(K.FAILED_PRECONDITION,"Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");this._settings=new $_(e),this._emulatorOptions=e.emulatorOptions||{},e.credentials!==void 0&&(this._authCredentials=function(r){if(!r)return new T3;switch(r.type){case"firstParty":return new N3(r.sessionIndex||"0",r.iamToken||null,r.authTokenFactory||null);case"provider":return r.client;default:throw new ue(K.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}}(e.credentials))}_getSettings(){return this._settings}_getEmulatorOptions(){return this._emulatorOptions}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return this._terminateTask==="notTerminated"&&(this._terminateTask=this._terminate()),this._terminateTask}async _restart(){this._terminateTask==="notTerminated"?await this._terminate():this._terminateTask="notTerminated"}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(n){const r=B_.get(n);r&&(fe(kz,"Removing Datastore"),B_.delete(n),r.terminate())}(this),Promise.resolve()}}function Iz(t,e,n,r={}){var c;t=Mn(t,tp);const s=cl(e),i=t._getSettings(),o={...i,emulatorOptions:t._getEmulatorOptions()},a=`${e}:${n}`;s&&yx(`https://${a}`),i.host!==EN&&i.host!==a&&Mo("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used.");const l={...i,host:a,ssl:s,emulatorOptions:r};if(!Ro(l,o)&&(t._setSettings(l),r.mockUserToken)){let d,h;if(typeof r.mockUserToken=="string")d=r.mockUserToken,h=Sn.MOCK_USER;else{d=ZC(r.mockUserToken,(c=t._app)==null?void 0:c.options.projectId);const m=r.mockUserToken.sub||r.mockUserToken.user_id;if(!m)throw new ue(K.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");h=new Sn(m)}t._authCredentials=new k3(new hI(d,h))}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Yi{constructor(e,n,r){this.converter=n,this._query=r,this.type="query",this.firestore=e}withConverter(e){return new Yi(this.firestore,e,this._query)}}class Dt{constructor(e,n,r){this.converter=n,this._key=r,this.type="document",this.firestore=e}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new Ri(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new Dt(this.firestore,e,this._key)}toJSON(){return{type:Dt._jsonSchemaVersion,referencePath:this._key.toString()}}static fromJSON(e,n,r){if(xu(n,Dt._jsonSchema))return new Dt(e,r||null,new be(lt.fromString(n.referencePath)))}}Dt._jsonSchemaVersion="firestore/documentReference/1.0",Dt._jsonSchema={type:Wt("string",Dt._jsonSchemaVersion),referencePath:Wt("string")};class Ri extends Yi{constructor(e,n,r){super(e,n,Gf(r)),this._path=r,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const e=this._path.popLast();return e.isEmpty()?null:new Dt(this.firestore,null,new be(e))}withConverter(e){return new Ri(this.firestore,e,this._path)}}function Ot(t,e,...n){if(t=nn(t),fI("collection","path",e),t instanceof tp){const r=lt.fromString(e,...n);return n_(r),new Ri(t,null,r)}{if(!(t instanceof Dt||t instanceof Ri))throw new ue(K.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(lt.fromString(e,...n));return n_(r),new Ri(t.firestore,null,r)}}function wt(t,e,...n){if(t=nn(t),arguments.length===1&&(e=_x.newId()),fI("doc","path",e),t instanceof tp){const r=lt.fromString(e,...n);return t_(r),new Dt(t,null,new be(r))}{if(!(t instanceof Dt||t instanceof Ri))throw new ue(K.INVALID_ARGUMENT,"Expected first argument to doc() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(lt.fromString(e,...n));return t_(r),new Dt(t.firestore,t instanceof Ri?t.converter:null,new be(r))}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const H_="AsyncQueue";class G_{constructor(e=Promise.resolve()){this.Yu=[],this.ec=!1,this.tc=[],this.nc=null,this.rc=!1,this.sc=!1,this.oc=[],this.M_=new oN(this,"async_queue_retry"),this._c=()=>{const r=gm();r&&fe(H_,"Visibility state changed to "+r.visibilityState),this.M_.w_()},this.ac=e;const n=gm();n&&typeof n.addEventListener=="function"&&n.addEventListener("visibilitychange",this._c)}get isShuttingDown(){return this.ec}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.uc(),this.cc(e)}enterRestrictedMode(e){if(!this.ec){this.ec=!0,this.sc=e||!1;const n=gm();n&&typeof n.removeEventListener=="function"&&n.removeEventListener("visibilitychange",this._c)}}enqueue(e){if(this.uc(),this.ec)return new Promise(()=>{});const n=new zs;return this.cc(()=>this.ec&&this.sc?Promise.resolve():(e().then(n.resolve,n.reject),n.promise)).then(()=>n.promise)}enqueueRetryable(e){this.enqueueAndForget(()=>(this.Yu.push(e),this.lc()))}async lc(){if(this.Yu.length!==0){try{await this.Yu[0](),this.Yu.shift(),this.M_.reset()}catch(e){if(!hl(e))throw e;fe(H_,"Operation failed with retryable error: "+e)}this.Yu.length>0&&this.M_.p_(()=>this.lc())}}cc(e){const n=this.ac.then(()=>(this.rc=!0,e().catch(r=>{throw this.nc=r,this.rc=!1,Ws("INTERNAL UNHANDLED ERROR: ",q_(r)),r}).then(r=>(this.rc=!1,r))));return this.ac=n,n}enqueueAfterDelay(e,n,r){this.uc(),this.oc.indexOf(e)>-1&&(n=0);const s=zx.createAndSchedule(this,e,n,r,i=>this.hc(i));return this.tc.push(s),s}uc(){this.nc&&Se(47125,{Pc:q_(this.nc)})}verifyOperationInProgress(){}async Tc(){let e;do e=this.ac,await e;while(e!==this.ac)}Ec(e){for(const n of this.tc)if(n.timerId===e)return!0;return!1}Ic(e){return this.Tc().then(()=>{this.tc.sort((n,r)=>n.targetTimeMs-r.targetTimeMs);for(const n of this.tc)if(n.skipDelay(),e!=="all"&&n.timerId===e)break;return this.Tc()})}Rc(e){this.oc.push(e)}hc(e){const n=this.tc.indexOf(e);this.tc.splice(n,1)}}function q_(t){let e=t.message||"";return t.stack&&(e=t.stack.includes(t.message)?t.stack:t.message+` +`+t.stack),e}class _s extends tp{constructor(e,n,r,s){super(e,n,r,s),this.type="firestore",this._queue=new G_,this._persistenceKey=(s==null?void 0:s.name)||"[DEFAULT]"}async _terminate(){if(this._firestoreClient){const e=this._firestoreClient.terminate();this._queue=new G_(e),this._firestoreClient=void 0,await e}}}function Nz(t,e){const n=typeof t=="object"?t:wx(),r=typeof t=="string"?t:Uh,s=zf(n,"firestore").getImmediate({identifier:r});if(!s._initialized){const i=QC("firestore");i&&Iz(s,...i)}return s}function Su(t){if(t._terminated)throw new ue(K.FAILED_PRECONDITION,"The client has already been terminated.");return t._firestoreClient||Az(t),t._firestoreClient}function Az(t){var r,s,i,o;const e=t._freezeSettings(),n=Cz(t._databaseId,((r=t._app)==null?void 0:r.options.appId)||"",t._persistenceKey,(s=t._app)==null?void 0:s.options.apiKey,e);t._componentsProvider||(i=e.localCache)!=null&&i._offlineComponentProvider&&((o=e.localCache)!=null&&o._onlineComponentProvider)&&(t._componentsProvider={_offline:e.localCache._offlineComponentProvider,_online:e.localCache._onlineComponentProvider}),t._firestoreClient=new vz(t._authCredentials,t._appCheckCredentials,t._queue,n,t._componentsProvider&&function(l){const c=l==null?void 0:l._online.build();return{_offline:l==null?void 0:l._offline.build(c),_online:c}}(t._componentsProvider))}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Cr{constructor(e){this._byteString=e}static fromBase64String(e){try{return new Cr(xn.fromBase64String(e))}catch(n){throw new ue(K.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+n)}}static fromUint8Array(e){return new Cr(xn.fromUint8Array(e))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return"Bytes(base64: "+this.toBase64()+")"}isEqual(e){return this._byteString.isEqual(e._byteString)}toJSON(){return{type:Cr._jsonSchemaVersion,bytes:this.toBase64()}}static fromJSON(e){if(xu(e,Cr._jsonSchema))return Cr.fromBase64String(e.bytes)}}Cr._jsonSchemaVersion="firestore/bytes/1.0",Cr._jsonSchema={type:Wt("string",Cr._jsonSchemaVersion),bytes:Wt("string")};/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class np{constructor(...e){for(let n=0;n90)throw new ue(K.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(n)||n<-180||n>180)throw new ue(K.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+n);this._lat=e,this._long=n}get latitude(){return this._lat}get longitude(){return this._long}isEqual(e){return this._lat===e._lat&&this._long===e._long}_compareTo(e){return Ue(this._lat,e._lat)||Ue(this._long,e._long)}toJSON(){return{latitude:this._lat,longitude:this._long,type:ys._jsonSchemaVersion}}static fromJSON(e){if(xu(e,ys._jsonSchema))return new ys(e.latitude,e.longitude)}}ys._jsonSchemaVersion="firestore/geoPoint/1.0",ys._jsonSchema={type:Wt("string",ys._jsonSchemaVersion),latitude:Wt("number"),longitude:Wt("number")};/** + * @license + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Yr{constructor(e){this._values=(e||[]).map(n=>n)}toArray(){return this._values.map(e=>e)}isEqual(e){return function(r,s){if(r.length!==s.length)return!1;for(let i=0;itypeof n=="number"))return new Yr(e.vectorValues);throw new ue(K.INVALID_ARGUMENT,"Expected 'vectorValues' field to be a number array")}}}Yr._jsonSchemaVersion="firestore/vectorValue/1.0",Yr._jsonSchema={type:Wt("string",Yr._jsonSchemaVersion),vectorValues:Wt("object")};/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Pz=/^__.*__$/;class Rz{constructor(e,n,r){this.data=e,this.fieldMask=n,this.fieldTransforms=r}toMutation(e,n){return this.fieldMask!==null?new Ki(e,this.data,this.fieldMask,n,this.fieldTransforms):new vu(e,this.data,n,this.fieldTransforms)}}class TN{constructor(e,n,r){this.data=e,this.fieldMask=n,this.fieldTransforms=r}toMutation(e,n){return new Ki(e,this.data,this.fieldMask,n,this.fieldTransforms)}}function kN(t){switch(t){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw Se(40011,{dataSource:t})}}class Yx{constructor(e,n,r,s,i,o){this.settings=e,this.databaseId=n,this.serializer=r,this.ignoreUndefinedProperties=s,i===void 0&&this.Ac(),this.fieldTransforms=i||[],this.fieldMask=o||[]}get path(){return this.settings.path}get dataSource(){return this.settings.dataSource}i(e){return new Yx({...this.settings,...e},this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}dc(e){var s;const n=(s=this.path)==null?void 0:s.child(e),r=this.i({path:n,arrayElement:!1});return r.mc(e),r}fc(e){var s;const n=(s=this.path)==null?void 0:s.child(e),r=this.i({path:n,arrayElement:!1});return r.Ac(),r}gc(e){return this.i({path:void 0,arrayElement:!0})}yc(e){return Xh(e,this.settings.methodName,this.settings.hasConverter||!1,this.path,this.settings.targetDoc)}contains(e){return this.fieldMask.find(n=>e.isPrefixOf(n))!==void 0||this.fieldTransforms.find(n=>e.isPrefixOf(n.field))!==void 0}Ac(){if(this.path)for(let e=0;el.covers(h.field))}else l=null,c=o.fieldTransforms;return new Rz(new Xn(a),l,c)}class Tu extends rp{_toFieldTransform(e){if(e.dataSource!==2)throw e.dataSource===1?e.yc(`${this._methodName}() can only appear at the top level of your update data`):e.yc(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);return e.fieldMask.push(e.path),null}isEqual(e){return e instanceof Tu}}class Xx extends rp{constructor(e,n){super(e),this.bc=n}_toFieldTransform(e){const n=new eu(e.serializer,OI(e.serializer,this.bc));return new w6(e.path,n)}isEqual(e){return e instanceof Xx&&this.bc===e.bc}}function CN(t,e,n,r){const s=t.A(1,e,n);Jx("Data must be an object, but it was:",s,r);const i=[],o=Xn.empty();Wi(r,(l,c)=>{const d=PN(e,l,n);c=nn(c);const h=s.fc(d);if(c instanceof Tu)i.push(d);else{const m=ku(c,h);m!=null&&(i.push(d),o.set(d,m))}});const a=new gr(i);return new TN(o,a,s.fieldTransforms)}function IN(t,e,n,r,s,i){const o=t.A(1,e,n),a=[Vo(e,r,n)],l=[s];if(i.length%2!=0)throw new ue(K.INVALID_ARGUMENT,`Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);for(let m=0;m=0;--m)if(!RN(c,a[m])){const p=a[m];let g=l[m];g=nn(g);const b=o.fc(p);if(g instanceof Tu)c.push(p);else{const E=ku(g,b);E!=null&&(c.push(p),d.set(p,E))}}const h=new gr(c);return new TN(d,h,o.fieldTransforms)}function Dz(t,e,n,r=!1){return ku(n,t.A(r?4:3,e))}function ku(t,e){if(AN(t=nn(t)))return Jx("Unsupported field value:",e,t),NN(t,e);if(t instanceof rp)return function(r,s){if(!kN(s.dataSource))throw s.yc(`${r._methodName}() can only be used with update() and set()`);if(!s.path)throw s.yc(`${r._methodName}() is not currently supported inside arrays`);const i=r._toFieldTransform(s);i&&s.fieldTransforms.push(i)}(t,e),null;if(t===void 0&&e.ignoreUndefinedProperties)return null;if(e.path&&e.fieldMask.push(e.path),t instanceof Array){if(e.settings.arrayElement&&e.dataSource!==4)throw e.yc("Nested arrays are not supported");return function(r,s){const i=[];let o=0;for(const a of r){let l=ku(a,s.gc(o));l==null&&(l={nullValue:"NULL_VALUE"}),i.push(l),o++}return{arrayValue:{values:i}}}(t,e)}return function(r,s){if((r=nn(r))===null)return{nullValue:"NULL_VALUE"};if(typeof r=="number")return OI(s.serializer,r);if(typeof r=="boolean")return{booleanValue:r};if(typeof r=="string")return{stringValue:r};if(r instanceof Date){const i=Ve.fromDate(r);return{timestampValue:qh(s.serializer,i)}}if(r instanceof Ve){const i=new Ve(r.seconds,1e3*Math.floor(r.nanoseconds/1e3));return{timestampValue:qh(s.serializer,i)}}if(r instanceof ys)return{geoPointValue:{latitude:r.latitude,longitude:r.longitude}};if(r instanceof Cr)return{bytesValue:KI(s.serializer,r._byteString)};if(r instanceof Dt){const i=s.databaseId,o=r.firestore._databaseId;if(!o.isEqual(i))throw s.yc(`Document reference is for database ${o.projectId}/${o.database} but should be for database ${i.projectId}/${i.database}`);return{referenceValue:Px(r.firestore._databaseId||s.databaseId,r._key.path)}}if(r instanceof Yr)return function(o,a){const l=o instanceof Yr?o.toArray():o;return{mapValue:{fields:{[_I]:{stringValue:SI},[$h]:{arrayValue:{values:l.map(d=>{if(typeof d!="number")throw a.yc("VectorValues must only contain numeric values.");return Ix(a.serializer,d)})}}}}}}(r,s);if(tN(r))return r._toProto(s.serializer);throw s.yc(`Unsupported field value: ${Bf(r)}`)}(t,e)}function NN(t,e){const n={};return gI(t)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):Wi(t,(r,s)=>{const i=ku(s,e.dc(r));i!=null&&(n[r]=i)}),{mapValue:{fields:n}}}function AN(t){return!(typeof t!="object"||t===null||t instanceof Array||t instanceof Date||t instanceof Ve||t instanceof ys||t instanceof Cr||t instanceof Dt||t instanceof rp||t instanceof Yr||tN(t))}function Jx(t,e,n){if(!AN(n)||!pI(n)){const r=Bf(n);throw r==="an object"?e.yc(t+" a custom object"):e.yc(t+" "+r)}}function Vo(t,e,n){if((e=nn(e))instanceof np)return e._internalPath;if(typeof e=="string")return PN(t,e);throw Xh("Field path arguments must be of type string or ",t,!1,void 0,n)}const Mz=new RegExp("[~\\*/\\[\\]]");function PN(t,e,n){if(e.search(Mz)>=0)throw Xh(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,t,!1,void 0,n);try{return new np(...e.split("."))._internalPath}catch{throw Xh(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,t,!1,void 0,n)}}function Xh(t,e,n,r,s){const i=r&&!r.isEmpty(),o=s!==void 0;let a=`Function ${e}() called with invalid data`;n&&(a+=" (via `toFirestore()`)"),a+=". ";let l="";return(i||o)&&(l+=" (found",i&&(l+=` in field ${r}`),o&&(l+=` in document ${s}`),l+=")"),new ue(K.INVALID_ARGUMENT,a+t+l)}function RN(t,e){return t.some(n=>n.isEqual(e))}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Lz{convertValue(e,n="none"){switch(zi(e)){case 0:return null;case 1:return e.booleanValue;case 2:return Lt(e.integerValue||e.doubleValue);case 3:return this.convertTimestamp(e.timestampValue);case 4:return this.convertServerTimestamp(e,n);case 5:return e.stringValue;case 6:return this.convertBytes(Fi(e.bytesValue));case 7:return this.convertReference(e.referenceValue);case 8:return this.convertGeoPoint(e.geoPointValue);case 9:return this.convertArray(e.arrayValue,n);case 11:return this.convertObject(e.mapValue,n);case 10:return this.convertVectorValue(e.mapValue);default:throw Se(62114,{value:e})}}convertObject(e,n){return this.convertObjectMap(e.fields,n)}convertObjectMap(e,n="none"){const r={};return Wi(e,(s,i)=>{r[s]=this.convertValue(i,n)}),r}convertVectorValue(e){var r,s,i;const n=(i=(s=(r=e.fields)==null?void 0:r[$h].arrayValue)==null?void 0:s.values)==null?void 0:i.map(o=>Lt(o.doubleValue));return new Yr(n)}convertGeoPoint(e){return new ys(Lt(e.latitude),Lt(e.longitude))}convertArray(e,n){return(e.values||[]).map(r=>this.convertValue(r,n))}convertServerTimestamp(e,n){switch(n){case"previous":const r=Hf(e);return r==null?null:this.convertValue(r,n);case"estimate":return this.convertTimestamp(Kc(e));default:return null}}convertTimestamp(e){const n=Oi(e);return new Ve(n.seconds,n.nanos)}convertDocumentKey(e,n){const r=lt.fromString(e);Xe(eN(r),9688,{name:e});const s=new Yc(r.get(1),r.get(3)),i=new be(r.popFirst(5));return s.isEqual(n)||Ws(`Document ${i} contains a document reference within a different database (${s.projectId}/${s.database}) which is not supported. It will be treated as a reference in the current database (${n.projectId}/${n.database}) instead.`),i}}/** + * @license + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Zx extends Lz{constructor(e){super(),this.firestore=e}convertBytes(e){return new Cr(e)}convertReference(e){const n=this.convertDocumentKey(e,this.firestore._databaseId);return new Dt(this.firestore,null,n)}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Jl(){return new Tu("deleteField")}function Vz(t){return new Xx("increment",t)}const W_="@firebase/firestore",K_="4.13.0";/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Y_(t){return function(n,r){if(typeof n!="object"||n===null)return!1;const s=n;for(const i of r)if(i in s&&typeof s[i]=="function")return!0;return!1}(t,["next","error","complete"])}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class jN{constructor(e,n,r,s,i){this._firestore=e,this._userDataWriter=n,this._key=r,this._document=s,this._converter=i}get id(){return this._key.path.lastSegment()}get ref(){return new Dt(this._firestore,this._converter,this._key)}exists(){return this._document!==null}data(){if(this._document){if(this._converter){const e=new Oz(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(e)}return this._userDataWriter.convertValue(this._document.data.value)}}_fieldsProto(){var e;return((e=this._document)==null?void 0:e.data.clone().value.mapValue.fields)??void 0}get(e){if(this._document){const n=this._document.data.field(Vo("DocumentSnapshot.get",e));if(n!==null)return this._userDataWriter.convertValue(n)}}}class Oz extends jN{data(){return super.data()}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function DN(t){if(t.limitType==="L"&&t.explicitOrderBy.length===0)throw new ue(K.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class ev{}class MN extends ev{}function sr(t,e,...n){let r=[];e instanceof ev&&r.push(e),r=r.concat(n),function(i){const o=i.filter(l=>l instanceof tv).length,a=i.filter(l=>l instanceof sp).length;if(o>1||o>0&&a>0)throw new ue(K.INVALID_ARGUMENT,"InvalidQuery. When using composite filters, you cannot use more than one filter at the top level. Consider nesting the multiple filters within an `and(...)` statement. For example: change `query(query, where(...), or(...))` to `query(query, and(where(...), or(...)))`.")}(r);for(const s of r)t=s._apply(t);return t}class sp extends MN{constructor(e,n,r){super(),this._field=e,this._op=n,this._value=r,this.type="where"}static _create(e,n,r){return new sp(e,n,r)}_apply(e){const n=this._parse(e);return LN(e._query,n),new Yi(e.firestore,e.converter,xy(e._query,n))}_parse(e){const n=Eu(e.firestore);return function(i,o,a,l,c,d,h){let m;if(c.isKeyField()){if(d==="array-contains"||d==="array-contains-any")throw new ue(K.INVALID_ARGUMENT,`Invalid Query. You can't perform '${d}' queries on documentId().`);if(d==="in"||d==="not-in"){X_(h,d);const g=[];for(const b of h)g.push(Q_(l,i,b));m={arrayValue:{values:g}}}else m=Q_(l,i,h)}else d!=="in"&&d!=="not-in"&&d!=="array-contains-any"||X_(h,d),m=Dz(a,o,h,d==="in"||d==="not-in");return qt.create(c,d,m)}(e._query,"where",n,e.firestore._databaseId,this._field,this._op,this._value)}}function Mr(t,e,n){const r=e,s=Vo("where",t);return sp._create(s,r,n)}class tv extends ev{constructor(e,n){super(),this.type=e,this._queryConstraints=n}static _create(e,n){return new tv(e,n)}_parse(e){const n=this._queryConstraints.map(r=>r._parse(e)).filter(r=>r.getFilters().length>0);return n.length===1?n[0]:Xr.create(n,this._getOperator())}_apply(e){const n=this._parse(e);return n.getFilters().length===0?e:(function(s,i){let o=s;const a=i.getFlattenedFilters();for(const l of a)LN(o,l),o=xy(o,l)}(e._query,n),new Yi(e.firestore,e.converter,xy(e._query,n)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return this.type==="and"?"and":"or"}}class nv extends MN{constructor(e,n){super(),this._field=e,this._direction=n,this.type="orderBy"}static _create(e,n){return new nv(e,n)}_apply(e){const n=function(s,i,o){if(s.startAt!==null)throw new ue(K.INVALID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(s.endAt!==null)throw new ue(K.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");return new Xc(i,o)}(e._query,this._field,this._direction);return new Yi(e.firestore,e.converter,u6(e._query,n))}}function Fz(t,e="asc"){const n=e,r=Vo("orderBy",t);return nv._create(r,n)}function Q_(t,e,n){if(typeof(n=nn(n))=="string"){if(n==="")throw new ue(K.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!PI(e)&&n.indexOf("/")!==-1)throw new ue(K.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);const r=e.path.child(lt.fromString(n));if(!be.isDocumentKey(r))throw new ue(K.INVALID_ARGUMENT,`Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${r}' is not because it has an odd number of segments (${r.length}).`);return u_(t,new be(r))}if(n instanceof Dt)return u_(t,n._key);throw new ue(K.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${Bf(n)}.`)}function X_(t,e){if(!Array.isArray(t)||t.length===0)throw new ue(K.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`)}function LN(t,e){const n=function(s,i){for(const o of s)for(const a of o.getFlattenedFilters())if(i.indexOf(a.op)>=0)return a.op;return null}(t.filters,function(s){switch(s){case"!=":return["!=","not-in"];case"array-contains-any":case"in":return["not-in"];case"not-in":return["array-contains-any","in","not-in","!="];default:return[]}}(e.op));if(n!==null)throw n===e.op?new ue(K.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}' filter.`):new ue(K.INVALID_ARGUMENT,`Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`)}function rv(t,e,n){let r;return r=t?n&&(n.merge||n.mergeFields)?t.toFirestore(e,n):t.toFirestore(e):e,r}class Zl{constructor(e,n){this.hasPendingWrites=e,this.fromCache=n}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}class So extends jN{constructor(e,n,r,s,i,o){super(e,n,r,s,o),this._firestore=e,this._firestoreImpl=e,this.metadata=i}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){const n=new Xd(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(n,e)}return this._userDataWriter.convertValue(this._document.data.value,e.serverTimestamps)}}get(e,n={}){if(this._document){const r=this._document.data.field(Vo("DocumentSnapshot.get",e));if(r!==null)return this._userDataWriter.convertValue(r,n.serverTimestamps)}}toJSON(){if(this.metadata.hasPendingWrites)throw new ue(K.FAILED_PRECONDITION,"DocumentSnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const e=this._document,n={};return n.type=So._jsonSchemaVersion,n.bundle="",n.bundleSource="DocumentSnapshot",n.bundleName=this._key.toString(),!e||!e.isValidDocument()||!e.isFoundDocument()?n:(this._userDataWriter.convertObjectMap(e.data.value.mapValue.fields,"previous"),n.bundle=(this._firestore,this.ref.path,"NOT SUPPORTED"),n)}}So._jsonSchemaVersion="firestore/documentSnapshot/1.0",So._jsonSchema={type:Wt("string",So._jsonSchemaVersion),bundleSource:Wt("string","DocumentSnapshot"),bundleName:Wt("string"),bundle:Wt("string")};class Xd extends So{data(e={}){return super.data(e)}}class Eo{constructor(e,n,r,s){this._firestore=e,this._userDataWriter=n,this._snapshot=s,this.metadata=new Zl(s.hasPendingWrites,s.fromCache),this.query=r}get docs(){const e=[];return this.forEach(n=>e.push(n)),e}get size(){return this._snapshot.docs.size}get empty(){return this.size===0}forEach(e,n){this._snapshot.docs.forEach(r=>{e.call(n,new Xd(this._firestore,this._userDataWriter,r.key,r,new Zl(this._snapshot.mutatedKeys.has(r.key),this._snapshot.fromCache),this.query.converter))})}docChanges(e={}){const n=!!e.includeMetadataChanges;if(n&&this._snapshot.excludesMetadataChanges)throw new ue(K.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===n||(this._cachedChanges=function(s,i){if(s._snapshot.oldDocs.isEmpty()){let o=0;return s._snapshot.docChanges.map(a=>{const l=new Xd(s._firestore,s._userDataWriter,a.doc.key,a.doc,new Zl(s._snapshot.mutatedKeys.has(a.doc.key),s._snapshot.fromCache),s.query.converter);return a.doc,{type:"added",doc:l,oldIndex:-1,newIndex:o++}})}{let o=s._snapshot.oldDocs;return s._snapshot.docChanges.filter(a=>i||a.type!==3).map(a=>{const l=new Xd(s._firestore,s._userDataWriter,a.doc.key,a.doc,new Zl(s._snapshot.mutatedKeys.has(a.doc.key),s._snapshot.fromCache),s.query.converter);let c=-1,d=-1;return a.type!==0&&(c=o.indexOf(a.doc.key),o=o.delete(a.doc.key)),a.type!==1&&(o=o.add(a.doc),d=o.indexOf(a.doc.key)),{type:zz(a.type),doc:l,oldIndex:c,newIndex:d}})}}(this,n),this._cachedChangesIncludeMetadataChanges=n),this._cachedChanges}toJSON(){if(this.metadata.hasPendingWrites)throw new ue(K.FAILED_PRECONDITION,"QuerySnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const e={};e.type=Eo._jsonSchemaVersion,e.bundleSource="QuerySnapshot",e.bundleName=_x.newId(),this._firestore._databaseId.database,this._firestore._databaseId.projectId;const n=[],r=[],s=[];return this.docs.forEach(i=>{i._document!==null&&(n.push(i._document),r.push(this._userDataWriter.convertObjectMap(i._document.data.value.mapValue.fields,"previous")),s.push(i.ref.path))}),e.bundle=(this._firestore,this.query._query,e.bundleName,"NOT SUPPORTED"),e}}function zz(t){switch(t){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return Se(61501,{type:t})}}/** + * @license + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */Eo._jsonSchemaVersion="firestore/querySnapshot/1.0",Eo._jsonSchema={type:Wt("string",Eo._jsonSchemaVersion),bundleSource:Wt("string","QuerySnapshot"),bundleName:Wt("string"),bundle:Wt("string")};/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Bz{constructor(e,n){this._firestore=e,this._commitHandler=n,this._mutations=[],this._committed=!1,this._dataReader=Eu(e)}set(e,n,r){this._verifyNotCommitted();const s=xm(e,this._firestore),i=rv(s.converter,n,r),o=Qx(this._dataReader,"WriteBatch.set",s._key,i,s.converter!==null,r);return this._mutations.push(o.toMutation(s._key,Ln.none())),this}update(e,n,r,...s){this._verifyNotCommitted();const i=xm(e,this._firestore);let o;return o=typeof(n=nn(n))=="string"||n instanceof np?IN(this._dataReader,"WriteBatch.update",i._key,n,r,s):CN(this._dataReader,"WriteBatch.update",i._key,n),this._mutations.push(o.toMutation(i._key,Ln.exists(!0))),this}delete(e){this._verifyNotCommitted();const n=xm(e,this._firestore);return this._mutations=this._mutations.concat(new Qf(n._key,Ln.none())),this}commit(){return this._verifyNotCommitted(),this._committed=!0,this._mutations.length>0?this._commitHandler(this._mutations):Promise.resolve()}_verifyNotCommitted(){if(this._committed)throw new ue(K.FAILED_PRECONDITION,"A write batch can no longer be used after commit() has been called.")}}function xm(t,e){if((t=nn(t)).firestore!==e)throw new ue(K.INVALID_ARGUMENT,"Provided document reference is from a different Firestore instance.");return t}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Oo(t){t=Mn(t,Dt);const e=Mn(t.firestore,_s),n=Su(e);return Sz(n,t._key).then(r=>ON(e,t,r))}function kn(t){t=Mn(t,Yi);const e=Mn(t.firestore,_s),n=Su(e),r=new Zx(e);return DN(t._query),Ez(n,t._query).then(s=>new Eo(e,r,t,s))}function VN(t,e,n){t=Mn(t,Dt);const r=Mn(t.firestore,_s),s=rv(t.converter,e,n),i=Eu(r);return Iu(r,[Qx(i,"setDoc",t._key,s,t.converter!==null,n).toMutation(t._key,Ln.none())])}function Lr(t,e,n,...r){t=Mn(t,Dt);const s=Mn(t.firestore,_s),i=Eu(s);let o;return o=typeof(e=nn(e))=="string"||e instanceof np?IN(i,"updateDoc",t._key,e,n,r):CN(i,"updateDoc",t._key,e),Iu(s,[o.toMutation(t._key,Ln.exists(!0))])}function tu(t){return Iu(Mn(t.firestore,_s),[new Qf(t._key,Ln.none())])}function Cu(t,e){const n=Mn(t.firestore,_s),r=wt(t),s=rv(t.converter,e),i=Eu(t.firestore);return Iu(n,[Qx(i,"addDoc",r._key,s,t.converter!==null,{}).toMutation(r._key,Ln.exists(!1))]).then(()=>r)}function sv(t,...e){var c,d,h;t=nn(t);let n={includeMetadataChanges:!1,source:"default"},r=0;typeof e[r]!="object"||Y_(e[r])||(n=e[r++]);const s={includeMetadataChanges:n.includeMetadataChanges,source:n.source};if(Y_(e[r])){const m=e[r];e[r]=(c=m.next)==null?void 0:c.bind(m),e[r+1]=(d=m.error)==null?void 0:d.bind(m),e[r+2]=(h=m.complete)==null?void 0:h.bind(m)}let i,o,a;if(t instanceof Dt)o=Mn(t.firestore,_s),a=Gf(t._key.path),i={next:m=>{e[r]&&e[r](ON(o,t,m))},error:e[r+1],complete:e[r+2]};else{const m=Mn(t,Yi);o=Mn(m.firestore,_s),a=m._query;const p=new Zx(o);i={next:g=>{e[r]&&e[r](new Eo(o,p,m,g))},error:e[r+1],complete:e[r+2]},DN(t._query)}const l=Su(o);return _z(l,a,s,i)}function Iu(t,e){const n=Su(t);return Tz(n,e)}function ON(t,e,n){const r=n.docs.get(e._key),s=new Zx(t);return new So(t,s,e._key,r,new Zl(n.hasPendingWrites,n.fromCache),e.converter)}function Uz(t){return t=Mn(t,_s),Su(t),new Bz(t,e=>Iu(t,e))}(function(e,n=!0){E3(Go),jo(new Li("firestore",(r,{instanceIdentifier:s,options:i})=>{const o=r.getProvider("app").getImmediate(),a=new _s(new C3(r.getProvider("auth-internal")),new A3(o,r.getProvider("app-check-internal")),W3(o,s),o);return i={useFetchStreams:n,...i},a._setSettings(i),a},"PUBLIC").setMultipleInstances(!0)),ps(W_,K_,e),ps(W_,K_,"esm2020")})();/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const FN="firebasestorage.googleapis.com",$z="storageBucket",Hz=2*60*1e3,Gz=10*60*1e3;/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class ks extends Ts{constructor(e,n,r=0){super(vm(e),`Firebase Storage: ${n} (${vm(e)})`),this.status_=r,this.customData={serverResponse:null},this._baseMessage=this.message,Object.setPrototypeOf(this,ks.prototype)}get status(){return this.status_}set status(e){this.status_=e}_codeEquals(e){return vm(e)===this.code}get serverResponse(){return this.customData.serverResponse}set serverResponse(e){this.customData.serverResponse=e,this.customData.serverResponse?this.message=`${this._baseMessage} +${this.customData.serverResponse}`:this.message=this._baseMessage}}var Ss;(function(t){t.UNKNOWN="unknown",t.OBJECT_NOT_FOUND="object-not-found",t.BUCKET_NOT_FOUND="bucket-not-found",t.PROJECT_NOT_FOUND="project-not-found",t.QUOTA_EXCEEDED="quota-exceeded",t.UNAUTHENTICATED="unauthenticated",t.UNAUTHORIZED="unauthorized",t.UNAUTHORIZED_APP="unauthorized-app",t.RETRY_LIMIT_EXCEEDED="retry-limit-exceeded",t.INVALID_CHECKSUM="invalid-checksum",t.CANCELED="canceled",t.INVALID_EVENT_NAME="invalid-event-name",t.INVALID_URL="invalid-url",t.INVALID_DEFAULT_BUCKET="invalid-default-bucket",t.NO_DEFAULT_BUCKET="no-default-bucket",t.CANNOT_SLICE_BLOB="cannot-slice-blob",t.SERVER_FILE_WRONG_SIZE="server-file-wrong-size",t.NO_DOWNLOAD_URL="no-download-url",t.INVALID_ARGUMENT="invalid-argument",t.INVALID_ARGUMENT_COUNT="invalid-argument-count",t.APP_DELETED="app-deleted",t.INVALID_ROOT_OPERATION="invalid-root-operation",t.INVALID_FORMAT="invalid-format",t.INTERNAL_ERROR="internal-error",t.UNSUPPORTED_ENVIRONMENT="unsupported-environment"})(Ss||(Ss={}));function vm(t){return"storage/"+t}function qz(){const t="An unknown error occurred, please check the error payload for server response.";return new ks(Ss.UNKNOWN,t)}function Wz(){return new ks(Ss.RETRY_LIMIT_EXCEEDED,"Max retry time for operation exceeded, please try again.")}function Kz(){return new ks(Ss.CANCELED,"User canceled the upload/download.")}function Yz(t){return new ks(Ss.INVALID_URL,"Invalid URL '"+t+"'.")}function Qz(t){return new ks(Ss.INVALID_DEFAULT_BUCKET,"Invalid default bucket '"+t+"'.")}function J_(t){return new ks(Ss.INVALID_ARGUMENT,t)}function zN(){return new ks(Ss.APP_DELETED,"The Firebase app was deleted.")}function Xz(t){return new ks(Ss.INVALID_ROOT_OPERATION,"The operation '"+t+"' cannot be performed on a root reference, create a non-root reference using child, such as .child('file.png').")}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Hr{constructor(e,n){this.bucket=e,this.path_=n}get path(){return this.path_}get isRoot(){return this.path.length===0}fullServerUrl(){const e=encodeURIComponent;return"/b/"+e(this.bucket)+"/o/"+e(this.path)}bucketOnlyServerUrl(){return"/b/"+encodeURIComponent(this.bucket)+"/o"}static makeFromBucketSpec(e,n){let r;try{r=Hr.makeFromUrl(e,n)}catch{return new Hr(e,"")}if(r.path==="")return r;throw Qz(e)}static makeFromUrl(e,n){let r=null;const s="([A-Za-z0-9.\\-_]+)";function i(P){P.path.charAt(P.path.length-1)==="/"&&(P.path_=P.path_.slice(0,-1))}const o="(/(.*))?$",a=new RegExp("^gs://"+s+o,"i"),l={bucket:1,path:3};function c(P){P.path_=decodeURIComponent(P.path)}const d="v[A-Za-z0-9_]+",h=n.replace(/[.]/g,"\\."),m="(/([^?#]*).*)?$",p=new RegExp(`^https?://${h}/${d}/b/${s}/o${m}`,"i"),g={bucket:1,path:3},b=n===FN?"(?:storage.googleapis.com|storage.cloud.google.com)":n,E="([^?#]*)",y=new RegExp(`^https?://${b}/${s}/${E}`,"i"),_=[{regex:a,indices:l,postModify:i},{regex:p,indices:g,postModify:c},{regex:y,indices:{bucket:1,path:2},postModify:c}];for(let P=0;P<_.length;P++){const D=_[P],k=D.regex.exec(e);if(k){const T=k[D.indices.bucket];let w=k[D.indices.path];w||(w=""),r=new Hr(T,w),D.postModify(r);break}}if(r==null)throw Yz(e);return r}}class Jz{constructor(e){this.promise_=Promise.reject(e)}getPromise(){return this.promise_}cancel(e=!1){}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Zz(t,e,n){let r=1,s=null,i=null,o=!1,a=0;function l(){return a===2}let c=!1;function d(...E){c||(c=!0,e.apply(null,E))}function h(E){s=setTimeout(()=>{s=null,t(p,l())},E)}function m(){i&&clearTimeout(i)}function p(E,...y){if(c){m();return}if(E){m(),d.call(null,E,...y);return}if(l()||o){m(),d.call(null,E,...y);return}r<64&&(r*=2);let _;a===1?(a=2,_=0):_=(r+Math.random())*1e3,h(_)}let g=!1;function b(E){g||(g=!0,m(),!c&&(s!==null?(E||(a=2),clearTimeout(s),h(0)):E||(a=1)))}return h(0),i=setTimeout(()=>{o=!0,b(!0)},n),b}function e8(t){t(!1)}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function t8(t){return t!==void 0}function Z_(t,e,n,r){if(rn)throw J_(`Invalid value for '${t}'. Expected ${n} or less.`)}function n8(t){const e=encodeURIComponent;let n="?";for(const r in t)if(t.hasOwnProperty(r)){const s=e(r)+"="+e(t[r]);n=n+s+"&"}return n=n.slice(0,-1),n}var Jh;(function(t){t[t.NO_ERROR=0]="NO_ERROR",t[t.NETWORK_ERROR=1]="NETWORK_ERROR",t[t.ABORT=2]="ABORT"})(Jh||(Jh={}));/** + * @license + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function r8(t,e){const n=t>=500&&t<600,s=[408,429].indexOf(t)!==-1,i=e.indexOf(t)!==-1;return n||s||i}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class s8{constructor(e,n,r,s,i,o,a,l,c,d,h,m=!0,p=!1){this.url_=e,this.method_=n,this.headers_=r,this.body_=s,this.successCodes_=i,this.additionalRetryCodes_=o,this.callback_=a,this.errorCallback_=l,this.timeout_=c,this.progressCallback_=d,this.connectionFactory_=h,this.retry=m,this.isUsingEmulator=p,this.pendingConnection_=null,this.backoffId_=null,this.canceled_=!1,this.appDelete_=!1,this.promise_=new Promise((g,b)=>{this.resolve_=g,this.reject_=b,this.start_()})}start_(){const e=(r,s)=>{if(s){r(!1,new vd(!1,null,!0));return}const i=this.connectionFactory_();this.pendingConnection_=i;const o=a=>{const l=a.loaded,c=a.lengthComputable?a.total:-1;this.progressCallback_!==null&&this.progressCallback_(l,c)};this.progressCallback_!==null&&i.addUploadProgressListener(o),i.send(this.url_,this.method_,this.isUsingEmulator,this.body_,this.headers_).then(()=>{this.progressCallback_!==null&&i.removeUploadProgressListener(o),this.pendingConnection_=null;const a=i.getErrorCode()===Jh.NO_ERROR,l=i.getStatus();if(!a||r8(l,this.additionalRetryCodes_)&&this.retry){const d=i.getErrorCode()===Jh.ABORT;r(!1,new vd(!1,null,d));return}const c=this.successCodes_.indexOf(l)!==-1;r(!0,new vd(c,i))})},n=(r,s)=>{const i=this.resolve_,o=this.reject_,a=s.connection;if(s.wasSuccessCode)try{const l=this.callback_(a,a.getResponse());t8(l)?i(l):i()}catch(l){o(l)}else if(a!==null){const l=qz();l.serverResponse=a.getErrorText(),this.errorCallback_?o(this.errorCallback_(a,l)):o(l)}else if(s.canceled){const l=this.appDelete_?zN():Kz();o(l)}else{const l=Wz();o(l)}};this.canceled_?n(!1,new vd(!1,null,!0)):this.backoffId_=Zz(e,n,this.timeout_)}getPromise(){return this.promise_}cancel(e){this.canceled_=!0,this.appDelete_=e||!1,this.backoffId_!==null&&e8(this.backoffId_),this.pendingConnection_!==null&&this.pendingConnection_.abort()}}class vd{constructor(e,n,r){this.wasSuccessCode=e,this.connection=n,this.canceled=!!r}}function i8(t,e){e!==null&&e.length>0&&(t.Authorization="Firebase "+e)}function o8(t,e){t["X-Firebase-Storage-Version"]="webjs/"+(e??"AppManager")}function a8(t,e){e&&(t["X-Firebase-GMPID"]=e)}function l8(t,e){e!==null&&(t["X-Firebase-AppCheck"]=e)}function c8(t,e,n,r,s,i,o=!0,a=!1){const l=n8(t.urlParams),c=t.url+l,d=Object.assign({},t.headers);return a8(d,e),i8(d,n),o8(d,i),l8(d,r),new s8(c,t.method,d,t.body,t.successCodes,t.additionalRetryCodes,t.handler,t.errorHandler,t.timeout,t.progressCallback,s,o,a)}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function u8(t){if(t.length===0)return null;const e=t.lastIndexOf("/");return e===-1?"":t.slice(0,e)}function d8(t){const e=t.lastIndexOf("/",t.length-2);return e===-1?t:t.slice(e+1)}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Zh{constructor(e,n){this._service=e,n instanceof Hr?this._location=n:this._location=Hr.makeFromUrl(n,e.host)}toString(){return"gs://"+this._location.bucket+"/"+this._location.path}_newRef(e,n){return new Zh(e,n)}get root(){const e=new Hr(this._location.bucket,"");return this._newRef(this._service,e)}get bucket(){return this._location.bucket}get fullPath(){return this._location.path}get name(){return d8(this._location.path)}get storage(){return this._service}get parent(){const e=u8(this._location.path);if(e===null)return null;const n=new Hr(this._location.bucket,e);return new Zh(this._service,n)}_throwIfRoot(e){if(this._location.path==="")throw Xz(e)}}function eS(t,e){const n=e==null?void 0:e[$z];return n==null?null:Hr.makeFromBucketSpec(n,t)}function h8(t,e,n,r={}){t.host=`${e}:${n}`;const s=cl(e);s&&yx(`https://${t.host}/b`),t._isUsingEmulator=!0,t._protocol=s?"https":"http";const{mockUserToken:i}=r;i&&(t._overrideAuthToken=typeof i=="string"?i:ZC(i,t.app.options.projectId))}class f8{constructor(e,n,r,s,i,o=!1){this.app=e,this._authProvider=n,this._appCheckProvider=r,this._url=s,this._firebaseVersion=i,this._isUsingEmulator=o,this._bucket=null,this._host=FN,this._protocol="https",this._appId=null,this._deleted=!1,this._maxOperationRetryTime=Hz,this._maxUploadRetryTime=Gz,this._requests=new Set,s!=null?this._bucket=Hr.makeFromBucketSpec(s,this._host):this._bucket=eS(this._host,this.app.options)}get host(){return this._host}set host(e){this._host=e,this._url!=null?this._bucket=Hr.makeFromBucketSpec(this._url,e):this._bucket=eS(e,this.app.options)}get maxUploadRetryTime(){return this._maxUploadRetryTime}set maxUploadRetryTime(e){Z_("time",0,Number.POSITIVE_INFINITY,e),this._maxUploadRetryTime=e}get maxOperationRetryTime(){return this._maxOperationRetryTime}set maxOperationRetryTime(e){Z_("time",0,Number.POSITIVE_INFINITY,e),this._maxOperationRetryTime=e}async _getAuthToken(){if(this._overrideAuthToken)return this._overrideAuthToken;const e=this._authProvider.getImmediate({optional:!0});if(e){const n=await e.getToken();if(n!==null)return n.accessToken}return null}async _getAppCheckToken(){if($r(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const e=this._appCheckProvider.getImmediate({optional:!0});return e?(await e.getToken()).token:null}_delete(){return this._deleted||(this._deleted=!0,this._requests.forEach(e=>e.cancel()),this._requests.clear()),Promise.resolve()}_makeStorageReference(e){return new Zh(this,e)}_makeRequest(e,n,r,s,i=!0){if(this._deleted)return new Jz(zN());{const o=c8(e,this._appId,r,s,n,this._firebaseVersion,i,this._isUsingEmulator);return this._requests.add(o),o.getPromise().then(()=>this._requests.delete(o),()=>this._requests.delete(o)),o}}async makeRequestWithTokens(e,n){const[r,s]=await Promise.all([this._getAuthToken(),this._getAppCheckToken()]);return this._makeRequest(e,n,r,s).getPromise()}}const tS="@firebase/storage",nS="0.14.2";/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const BN="storage";function p8(t=wx(),e){t=nn(t);const r=zf(t,BN).getImmediate({identifier:e}),s=QC("storage");return s&&m8(r,...s),r}function m8(t,e,n,r={}){h8(t,e,n,r)}function g8(t,{instanceIdentifier:e}){const n=t.getProvider("app").getImmediate(),r=t.getProvider("auth-internal"),s=t.getProvider("app-check-internal");return new f8(n,r,s,e,Go)}function y8(){jo(new Li(BN,g8,"PUBLIC").setMultipleInstances(!0)),ps(tS,nS,""),ps(tS,nS,"esm2020")}y8();function UN(){return{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}}const x8=UN,$N=new gu("auth","Firebase",UN());/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const ef=new xx("@firebase/auth");function v8(t,...e){ef.logLevel<=Be.WARN&&ef.warn(`Auth (${Go}): ${t}`,...e)}function Jd(t,...e){ef.logLevel<=Be.ERROR&&ef.error(`Auth (${Go}): ${t}`,...e)}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Ys(t,...e){throw iv(t,...e)}function xs(t,...e){return iv(t,...e)}function HN(t,e,n){const r={...x8(),[e]:n};return new gu("auth","Firebase",r).create(e,{appName:t.name})}function To(t){return HN(t,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function iv(t,...e){if(typeof t!="string"){const n=e[0],r=[...e.slice(1)];return r[0]&&(r[0].appName=t.name),t._errorFactory.create(n,...r)}return $N.create(t,...e)}function Te(t,e,...n){if(!t)throw iv(e,...n)}function Ls(t){const e="INTERNAL ASSERTION FAILED: "+t;throw Jd(e),new Error(e)}function Qs(t,e){t||Ls(e)}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Ny(){var t;return typeof self<"u"&&((t=self.location)==null?void 0:t.href)||""}function w8(){return rS()==="http:"||rS()==="https:"}function rS(){var t;return typeof self<"u"&&((t=self.location)==null?void 0:t.protocol)||null}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function b8(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(w8()||tO()||"connection"in navigator)?navigator.onLine:!0}function _8(){if(typeof navigator>"u")return null;const t=navigator;return t.languages&&t.languages[0]||t.language||null}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Nu{constructor(e,n){this.shortDelay=e,this.longDelay=n,Qs(n>e,"Short delay should be less than long delay!"),this.isMobile=JV()||nO()}get(){return b8()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function ov(t,e){Qs(t.emulator,"Emulator should always be set here");const{url:n}=t.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class GN{static initialize(e,n,r){this.fetchImpl=e,n&&(this.headersImpl=n),r&&(this.responseImpl=r)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;Ls("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;Ls("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;Ls("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const S8={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const E8=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],T8=new Nu(3e4,6e4);function av(t,e){return t.tenantId&&!e.tenantId?{...e,tenantId:t.tenantId}:e}async function ml(t,e,n,r,s={}){return qN(t,s,async()=>{let i={},o={};r&&(e==="GET"?o=r:i={body:JSON.stringify(r)});const a=yu({key:t.config.apiKey,...o}).slice(1),l=await t._getAdditionalHeaders();l["Content-Type"]="application/json",t.languageCode&&(l["X-Firebase-Locale"]=t.languageCode);const c={method:e,headers:l,...i};return eO()||(c.referrerPolicy="no-referrer"),t.emulatorConfig&&cl(t.emulatorConfig.host)&&(c.credentials="include"),GN.fetch()(await WN(t,t.config.apiHost,n,a),c)})}async function qN(t,e,n){t._canInitEmulator=!1;const r={...S8,...e};try{const s=new C8(t),i=await Promise.race([n(),s.promise]);s.clearNetworkTimeout();const o=await i.json();if("needConfirmation"in o)throw wd(t,"account-exists-with-different-credential",o);if(i.ok&&!("errorMessage"in o))return o;{const a=i.ok?o.errorMessage:o.error.message,[l,c]=a.split(" : ");if(l==="FEDERATED_USER_ID_ALREADY_LINKED")throw wd(t,"credential-already-in-use",o);if(l==="EMAIL_EXISTS")throw wd(t,"email-already-in-use",o);if(l==="USER_DISABLED")throw wd(t,"user-disabled",o);const d=r[l]||l.toLowerCase().replace(/[_\s]+/g,"-");if(c)throw HN(t,d,c);Ys(t,d)}}catch(s){if(s instanceof Ts)throw s;Ys(t,"network-request-failed",{message:String(s)})}}async function k8(t,e,n,r,s={}){const i=await ml(t,e,n,r,s);return"mfaPendingCredential"in i&&Ys(t,"multi-factor-auth-required",{_serverResponse:i}),i}async function WN(t,e,n,r){const s=`${e}${n}?${r}`,i=t,o=i.config.emulator?ov(t.config,s):`${t.config.apiScheme}://${s}`;return E8.includes(n)&&(await i._persistenceManagerAvailable,i._getPersistenceType()==="COOKIE")?i._getPersistence()._getFinalTarget(o).toString():o}class C8{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((n,r)=>{this.timer=setTimeout(()=>r(xs(this.auth,"network-request-failed")),T8.get())})}}function wd(t,e,n){const r={appName:t.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const s=xs(t,e,r);return s.customData._tokenResponse=n,s}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function I8(t,e){return ml(t,"POST","/v1/accounts:delete",e)}async function tf(t,e){return ml(t,"POST","/v1/accounts:lookup",e)}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function wc(t){if(t)try{const e=new Date(Number(t));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function N8(t,e=!1){const n=nn(t),r=await n.getIdToken(e),s=lv(r);Te(s&&s.exp&&s.auth_time&&s.iat,n.auth,"internal-error");const i=typeof s.firebase=="object"?s.firebase:void 0,o=i==null?void 0:i.sign_in_provider;return{claims:s,token:r,authTime:wc(wm(s.auth_time)),issuedAtTime:wc(wm(s.iat)),expirationTime:wc(wm(s.exp)),signInProvider:o||null,signInSecondFactor:(i==null?void 0:i.sign_in_second_factor)||null}}function wm(t){return Number(t)*1e3}function lv(t){const[e,n,r]=t.split(".");if(e===void 0||n===void 0||r===void 0)return Jd("JWT malformed, contained fewer than 3 sections"),null;try{const s=KC(n);return s?JSON.parse(s):(Jd("Failed to decode base64 JWT payload"),null)}catch(s){return Jd("Caught error parsing JWT payload as JSON",s==null?void 0:s.toString()),null}}function sS(t){const e=lv(t);return Te(e,"internal-error"),Te(typeof e.exp<"u","internal-error"),Te(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function nu(t,e,n=!1){if(n)return e;try{return await e}catch(r){throw r instanceof Ts&&A8(r)&&t.auth.currentUser===t&&await t.auth.signOut(),r}}function A8({code:t}){return t==="auth/user-disabled"||t==="auth/user-token-expired"}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class P8{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(e){if(e){const n=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),n}else{this.errorBackoff=3e4;const r=(this.user.stsTokenManager.expirationTime??0)-Date.now()-3e5;return Math.max(0,r)}}schedule(e=!1){if(!this.isRunning)return;const n=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},n)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){(e==null?void 0:e.code)==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Ay{constructor(e,n){this.createdAt=e,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=wc(this.lastLoginAt),this.creationTime=wc(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function nf(t){var h;const e=t.auth,n=await t.getIdToken(),r=await nu(t,tf(e,{idToken:n}));Te(r==null?void 0:r.users.length,e,"internal-error");const s=r.users[0];t._notifyReloadListener(s);const i=(h=s.providerUserInfo)!=null&&h.length?KN(s.providerUserInfo):[],o=j8(t.providerData,i),a=t.isAnonymous,l=!(t.email&&s.passwordHash)&&!(o!=null&&o.length),c=a?l:!1,d={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:o,metadata:new Ay(s.createdAt,s.lastLoginAt),isAnonymous:c};Object.assign(t,d)}async function R8(t){const e=nn(t);await nf(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function j8(t,e){return[...t.filter(r=>!e.some(s=>s.providerId===r.providerId)),...e]}function KN(t){return t.map(({providerId:e,...n})=>({providerId:e,uid:n.rawId||"",displayName:n.displayName||null,email:n.email||null,phoneNumber:n.phoneNumber||null,photoURL:n.photoUrl||null}))}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function D8(t,e){const n=await qN(t,{},async()=>{const r=yu({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:s,apiKey:i}=t.config,o=await WN(t,s,"/v1/token",`key=${i}`),a=await t._getAdditionalHeaders();a["Content-Type"]="application/x-www-form-urlencoded";const l={method:"POST",headers:a,body:r};return t.emulatorConfig&&cl(t.emulatorConfig.host)&&(l.credentials="include"),GN.fetch()(o,l)});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function M8(t,e){return ml(t,"POST","/v2/accounts:revokeToken",av(t,e))}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Ma{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){Te(e.idToken,"internal-error"),Te(typeof e.idToken<"u","internal-error"),Te(typeof e.refreshToken<"u","internal-error");const n="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):sS(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,n)}updateFromIdToken(e){Te(e.length!==0,"internal-error");const n=sS(e);this.updateTokensAndExpiration(e,null,n)}async getToken(e,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(Te(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(e,n){const{accessToken:r,refreshToken:s,expiresIn:i}=await D8(e,n);this.updateTokensAndExpiration(r,s,Number(i))}updateTokensAndExpiration(e,n,r){this.refreshToken=n||null,this.accessToken=e||null,this.expirationTime=Date.now()+r*1e3}static fromJSON(e,n){const{refreshToken:r,accessToken:s,expirationTime:i}=n,o=new Ma;return r&&(Te(typeof r=="string","internal-error",{appName:e}),o.refreshToken=r),s&&(Te(typeof s=="string","internal-error",{appName:e}),o.accessToken=s),i&&(Te(typeof i=="number","internal-error",{appName:e}),o.expirationTime=i),o}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new Ma,this.toJSON())}_performRefresh(){return Ls("not implemented")}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function si(t,e){Te(typeof t=="string"||typeof t>"u","internal-error",{appName:e})}class Gr{constructor({uid:e,auth:n,stsTokenManager:r,...s}){this.providerId="firebase",this.proactiveRefresh=new P8(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=n,this.stsTokenManager=r,this.accessToken=r.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new Ay(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(e){const n=await nu(this,this.stsTokenManager.getToken(this.auth,e));return Te(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(e){return N8(this,e)}reload(){return R8(this)}_assign(e){this!==e&&(Te(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(n=>({...n})),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){const n=new Gr({...this,auth:e,stsTokenManager:this.stsTokenManager._clone()});return n.metadata._copy(this.metadata),n}_onReload(e){Te(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,n=!1){let r=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),r=!0),n&&await nf(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){if($r(this.auth.app))return Promise.reject(To(this.auth));const e=await this.getIdToken();return await nu(this,I8(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return{uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>({...e})),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId,...this.metadata.toJSON(),apiKey:this.auth.config.apiKey,appName:this.auth.name}}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,n){const r=n.displayName??void 0,s=n.email??void 0,i=n.phoneNumber??void 0,o=n.photoURL??void 0,a=n.tenantId??void 0,l=n._redirectEventId??void 0,c=n.createdAt??void 0,d=n.lastLoginAt??void 0,{uid:h,emailVerified:m,isAnonymous:p,providerData:g,stsTokenManager:b}=n;Te(h&&b,e,"internal-error");const E=Ma.fromJSON(this.name,b);Te(typeof h=="string",e,"internal-error"),si(r,e.name),si(s,e.name),Te(typeof m=="boolean",e,"internal-error"),Te(typeof p=="boolean",e,"internal-error"),si(i,e.name),si(o,e.name),si(a,e.name),si(l,e.name),si(c,e.name),si(d,e.name);const y=new Gr({uid:h,auth:e,email:s,emailVerified:m,displayName:r,isAnonymous:p,photoURL:o,phoneNumber:i,tenantId:a,stsTokenManager:E,createdAt:c,lastLoginAt:d});return g&&Array.isArray(g)&&(y.providerData=g.map(v=>({...v}))),l&&(y._redirectEventId=l),y}static async _fromIdTokenResponse(e,n,r=!1){const s=new Ma;s.updateFromServerResponse(n);const i=new Gr({uid:n.localId,auth:e,stsTokenManager:s,isAnonymous:r});return await nf(i),i}static async _fromGetAccountInfoResponse(e,n,r){const s=n.users[0];Te(s.localId!==void 0,"internal-error");const i=s.providerUserInfo!==void 0?KN(s.providerUserInfo):[],o=!(s.email&&s.passwordHash)&&!(i!=null&&i.length),a=new Ma;a.updateFromIdToken(r);const l=new Gr({uid:s.localId,auth:e,stsTokenManager:a,isAnonymous:o}),c={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:i,metadata:new Ay(s.createdAt,s.lastLoginAt),isAnonymous:!(s.email&&s.passwordHash)&&!(i!=null&&i.length)};return Object.assign(l,c),l}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const iS=new Map;function Vs(t){Qs(t instanceof Function,"Expected a class definition");let e=iS.get(t);return e?(Qs(e instanceof t,"Instance stored in cache mismatched with class"),e):(e=new t,iS.set(t,e),e)}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class YN{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,n){this.storage[e]=n}async _get(e){const n=this.storage[e];return n===void 0?null:n}async _remove(e){delete this.storage[e]}_addListener(e,n){}_removeListener(e,n){}}YN.type="NONE";const oS=YN;/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Zd(t,e,n){return`firebase:${t}:${e}:${n}`}class La{constructor(e,n,r){this.persistence=e,this.auth=n,this.userKey=r;const{config:s,name:i}=this.auth;this.fullUserKey=Zd(this.userKey,s.apiKey,i),this.fullPersistenceKey=Zd("persistence",s.apiKey,i),this.boundEventHandler=n._onStorageEvent.bind(n),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){const e=await this.persistence._get(this.fullUserKey);if(!e)return null;if(typeof e=="string"){const n=await tf(this.auth,{idToken:e}).catch(()=>{});return n?Gr._fromGetAccountInfoResponse(this.auth,n,e):null}return Gr._fromJSON(this.auth,e)}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;const n=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,n)return this.setCurrentUser(n)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,n,r="authUser"){if(!n.length)return new La(Vs(oS),e,r);const s=(await Promise.all(n.map(async c=>{if(await c._isAvailable())return c}))).filter(c=>c);let i=s[0]||Vs(oS);const o=Zd(r,e.config.apiKey,e.name);let a=null;for(const c of n)try{const d=await c._get(o);if(d){let h;if(typeof d=="string"){const m=await tf(e,{idToken:d}).catch(()=>{});if(!m)break;h=await Gr._fromGetAccountInfoResponse(e,m,d)}else h=Gr._fromJSON(e,d);c!==i&&(a=h),i=c;break}}catch{}const l=s.filter(c=>c._shouldAllowMigration);return!i._shouldAllowMigration||!l.length?new La(i,e,r):(i=l[0],a&&await i._set(o,a.toJSON()),await Promise.all(n.map(async c=>{if(c!==i)try{await c._remove(o)}catch{}})),new La(i,e,r))}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function aS(t){const e=t.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(ZN(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(QN(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(tA(e))return"Blackberry";if(nA(e))return"Webos";if(XN(e))return"Safari";if((e.includes("chrome/")||JN(e))&&!e.includes("edge/"))return"Chrome";if(eA(e))return"Android";{const n=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,r=t.match(n);if((r==null?void 0:r.length)===2)return r[1]}return"Other"}function QN(t=In()){return/firefox\//i.test(t)}function XN(t=In()){const e=t.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function JN(t=In()){return/crios\//i.test(t)}function ZN(t=In()){return/iemobile/i.test(t)}function eA(t=In()){return/android/i.test(t)}function tA(t=In()){return/blackberry/i.test(t)}function nA(t=In()){return/webos/i.test(t)}function cv(t=In()){return/iphone|ipad|ipod/i.test(t)||/macintosh/i.test(t)&&/mobile/i.test(t)}function L8(t=In()){var e;return cv(t)&&!!((e=window.navigator)!=null&&e.standalone)}function V8(){return rO()&&document.documentMode===10}function rA(t=In()){return cv(t)||eA(t)||nA(t)||tA(t)||/windows phone/i.test(t)||ZN(t)}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function sA(t,e=[]){let n;switch(t){case"Browser":n=aS(In());break;case"Worker":n=`${aS(In())}-${t}`;break;default:n=t}const r=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${Go}/${r}`}/** + * @license + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class O8{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,n){const r=i=>new Promise((o,a)=>{try{const l=e(i);o(l)}catch(l){a(l)}});r.onAbort=n,this.queue.push(r);const s=this.queue.length-1;return()=>{this.queue[s]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;const n=[];try{for(const r of this.queue)await r(e),r.onAbort&&n.push(r.onAbort)}catch(r){n.reverse();for(const s of n)try{s()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:r==null?void 0:r.message})}}}/** + * @license + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function F8(t,e={}){return ml(t,"GET","/v2/passwordPolicy",av(t,e))}/** + * @license + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const z8=6;class B8{constructor(e){var r;const n=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=n.minPasswordLength??z8,n.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=n.maxPasswordLength),n.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=n.containsLowercaseCharacter),n.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=n.containsUppercaseCharacter),n.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=n.containsNumericCharacter),n.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=n.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=((r=e.allowedNonAlphanumericCharacters)==null?void 0:r.join(""))??"",this.forceUpgradeOnSignin=e.forceUpgradeOnSignin??!1,this.schemaVersion=e.schemaVersion}validatePassword(e){const n={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,n),this.validatePasswordCharacterOptions(e,n),n.isValid&&(n.isValid=n.meetsMinPasswordLength??!0),n.isValid&&(n.isValid=n.meetsMaxPasswordLength??!0),n.isValid&&(n.isValid=n.containsLowercaseLetter??!0),n.isValid&&(n.isValid=n.containsUppercaseLetter??!0),n.isValid&&(n.isValid=n.containsNumericCharacter??!0),n.isValid&&(n.isValid=n.containsNonAlphanumericCharacter??!0),n}validatePasswordLengthOptions(e,n){const r=this.customStrengthOptions.minPasswordLength,s=this.customStrengthOptions.maxPasswordLength;r&&(n.meetsMinPasswordLength=e.length>=r),s&&(n.meetsMaxPasswordLength=e.length<=s)}validatePasswordCharacterOptions(e,n){this.updatePasswordCharacterOptionsStatuses(n,!1,!1,!1,!1);let r;for(let s=0;s="a"&&r<="z",r>="A"&&r<="Z",r>="0"&&r<="9",this.allowedNonAlphanumericCharacters.includes(r))}updatePasswordCharacterOptionsStatuses(e,n,r,s,i){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=n)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=r)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=s)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=i))}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class U8{constructor(e,n,r,s){this.app=e,this.heartbeatServiceProvider=n,this.appCheckServiceProvider=r,this.config=s,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new lS(this),this.idTokenSubscription=new lS(this),this.beforeStateQueue=new O8(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=$N,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this._resolvePersistenceManagerAvailable=void 0,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=s.sdkClientVersion,this._persistenceManagerAvailable=new Promise(i=>this._resolvePersistenceManagerAvailable=i)}_initializeWithPersistence(e,n){return n&&(this._popupRedirectResolver=Vs(n)),this._initializationPromise=this.queue(async()=>{var r,s,i;if(!this._deleted&&(this.persistenceManager=await La.create(this,e),(r=this._resolvePersistenceManagerAvailable)==null||r.call(this),!this._deleted)){if((s=this._popupRedirectResolver)!=null&&s._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(n),this.lastNotifiedUid=((i=this.currentUser)==null?void 0:i.uid)||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const e=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!e)){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUserFromIdToken(e){try{const n=await tf(this,{idToken:e}),r=await Gr._fromGetAccountInfoResponse(this,n,e);await this.directlySetCurrentUser(r)}catch(n){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",n),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){var i;if($r(this.app)){const o=this.app.settings.authIdToken;return o?new Promise(a=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(o).then(a,a))}):this.directlySetCurrentUser(null)}const n=await this.assertedPersistence.getCurrentUser();let r=n,s=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const o=(i=this.redirectUser)==null?void 0:i._redirectEventId,a=r==null?void 0:r._redirectEventId,l=await this.tryRedirectSignIn(e);(!o||o===a)&&(l!=null&&l.user)&&(r=l.user,s=!0)}if(!r)return this.directlySetCurrentUser(null);if(!r._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(r)}catch(o){r=n,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(o))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return Te(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===r._redirectEventId?this.directlySetCurrentUser(r):this.reloadAndSetCurrentUserOrClear(r)}async tryRedirectSignIn(e){let n=null;try{n=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return n}async reloadAndSetCurrentUserOrClear(e){try{await nf(e)}catch(n){if((n==null?void 0:n.code)!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=_8()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if($r(this.app))return Promise.reject(To(this));const n=e?nn(e):null;return n&&Te(n.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(n&&n._clone(this))}async _updateCurrentUser(e,n=!1){if(!this._deleted)return e&&Te(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),n||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return $r(this.app)?Promise.reject(To(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return $r(this.app)?Promise.reject(To(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(Vs(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();const n=this._getPasswordPolicyInternal();return n.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):n.validatePassword(e)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){const e=await F8(this),n=new B8(e);this.tenantId===null?this._projectPasswordPolicy=n:this._tenantPasswordPolicies[this.tenantId]=n}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(e){this._errorFactory=new gu("auth","Firebase",e())}onAuthStateChanged(e,n,r){return this.registerStateListener(this.authStateSubscription,e,n,r)}beforeAuthStateChanged(e,n){return this.beforeStateQueue.pushCallback(e,n)}onIdTokenChanged(e,n,r){return this.registerStateListener(this.idTokenSubscription,e,n,r)}authStateReady(){return new Promise((e,n)=>{if(this.currentUser)e();else{const r=this.onAuthStateChanged(()=>{r(),e()},n)}})}async revokeAccessToken(e){if(this.currentUser){const n=await this.currentUser.getIdToken(),r={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:n};this.tenantId!=null&&(r.tenantId=this.tenantId),await M8(this,r)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:(e=this._currentUser)==null?void 0:e.toJSON()}}async _setRedirectUser(e,n){const r=await this.getOrInitRedirectPersistenceManager(n);return e===null?r.removeCurrentUser():r.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){const n=e&&Vs(e)||this._popupRedirectResolver;Te(n,this,"argument-error"),this.redirectPersistenceManager=await La.create(this,[Vs(n._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var n,r;return this._isInitialized&&await this.queue(async()=>{}),((n=this._currentUser)==null?void 0:n._redirectEventId)===e?this._currentUser:((r=this.redirectUser)==null?void 0:r._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var n;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const e=((n=this.currentUser)==null?void 0:n.uid)??null;this.lastNotifiedUid!==e&&(this.lastNotifiedUid=e,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,n,r,s){if(this._deleted)return()=>{};const i=typeof n=="function"?n:n.next.bind(n);let o=!1;const a=this._isInitialized?Promise.resolve():this._initializationPromise;if(Te(a,this,"internal-error"),a.then(()=>{o||i(this.currentUser)}),typeof n=="function"){const l=e.addObserver(n,r,s);return()=>{o=!0,l()}}else{const l=e.addObserver(n);return()=>{o=!0,l()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return Te(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=sA(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var s;const e={"X-Client-Version":this.clientVersion};this.app.options.appId&&(e["X-Firebase-gmpid"]=this.app.options.appId);const n=await((s=this.heartbeatServiceProvider.getImmediate({optional:!0}))==null?void 0:s.getHeartbeatsHeader());n&&(e["X-Firebase-Client"]=n);const r=await this._getAppCheckToken();return r&&(e["X-Firebase-AppCheck"]=r),e}async _getAppCheckToken(){var n;if($r(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const e=await((n=this.appCheckServiceProvider.getImmediate({optional:!0}))==null?void 0:n.getToken());return e!=null&&e.error&&v8(`Error while retrieving App Check token: ${e.error}`),e==null?void 0:e.token}}function uv(t){return nn(t)}class lS{constructor(e){this.auth=e,this.observer=null,this.addObserver=dO(n=>this.observer=n)}get next(){return Te(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */let dv={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function $8(t){dv=t}function H8(t){return dv.loadJS(t)}function G8(){return dv.gapiScript}function q8(t){return`__${t}${Math.floor(Math.random()*1e6)}`}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function W8(t,e){const n=zf(t,"auth");if(n.isInitialized()){const s=n.getImmediate(),i=n.getOptions();if(Ro(i,e??{}))return s;Ys(s,"already-initialized")}return n.initialize({options:e})}function K8(t,e){const n=(e==null?void 0:e.persistence)||[],r=(Array.isArray(n)?n:[n]).map(Vs);e!=null&&e.errorMap&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(r,e==null?void 0:e.popupRedirectResolver)}function Y8(t,e,n){const r=uv(t);Te(/^https?:\/\//.test(e),r,"invalid-emulator-scheme");const s=!1,i=iA(e),{host:o,port:a}=Q8(e),l=a===null?"":`:${a}`,c={url:`${i}//${o}${l}/`},d=Object.freeze({host:o,port:a,protocol:i.replace(":",""),options:Object.freeze({disableWarnings:s})});if(!r._canInitEmulator){Te(r.config.emulator&&r.emulatorConfig,r,"emulator-config-failed"),Te(Ro(c,r.config.emulator)&&Ro(d,r.emulatorConfig),r,"emulator-config-failed");return}r.config.emulator=c,r.emulatorConfig=d,r.settings.appVerificationDisabledForTesting=!0,cl(o)?yx(`${i}//${o}${l}`):X8()}function iA(t){const e=t.indexOf(":");return e<0?"":t.substr(0,e+1)}function Q8(t){const e=iA(t),n=/(\/\/)?([^?#/]+)/.exec(t.substr(e.length));if(!n)return{host:"",port:null};const r=n[2].split("@").pop()||"",s=/^(\[[^\]]+\])(:|$)/.exec(r);if(s){const i=s[1];return{host:i,port:cS(r.substr(i.length+1))}}else{const[i,o]=r.split(":");return{host:i,port:cS(o)}}}function cS(t){if(!t)return null;const e=Number(t);return isNaN(e)?null:e}function X8(){function t(){const e=document.createElement("p"),n=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",n.position="fixed",n.width="100%",n.backgroundColor="#ffffff",n.border=".1em solid #000000",n.color="#b50000",n.bottom="0px",n.left="0px",n.margin="0px",n.zIndex="10000",n.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",t):t())}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class oA{constructor(e,n){this.providerId=e,this.signInMethod=n}toJSON(){return Ls("not implemented")}_getIdTokenResponse(e){return Ls("not implemented")}_linkToIdToken(e,n){return Ls("not implemented")}_getReauthenticationResolver(e){return Ls("not implemented")}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function Va(t,e){return k8(t,"POST","/v1/accounts:signInWithIdp",av(t,e))}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const J8="http://localhost";class Fo extends oA{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const n=new Fo(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(n.idToken=e.idToken),e.accessToken&&(n.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(n.nonce=e.nonce),e.pendingToken&&(n.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(n.accessToken=e.oauthToken,n.secret=e.oauthTokenSecret):Ys("argument-error"),n}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){const n=typeof e=="string"?JSON.parse(e):e,{providerId:r,signInMethod:s,...i}=n;if(!r||!s)return null;const o=new Fo(r,s);return o.idToken=i.idToken||void 0,o.accessToken=i.accessToken||void 0,o.secret=i.secret,o.nonce=i.nonce,o.pendingToken=i.pendingToken||null,o}_getIdTokenResponse(e){const n=this.buildRequest();return Va(e,n)}_linkToIdToken(e,n){const r=this.buildRequest();return r.idToken=n,Va(e,r)}_getReauthenticationResolver(e){const n=this.buildRequest();return n.autoCreate=!1,Va(e,n)}buildRequest(){const e={requestUri:J8,returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{const n={};this.idToken&&(n.id_token=this.idToken),this.accessToken&&(n.access_token=this.accessToken),this.secret&&(n.oauth_token_secret=this.secret),n.providerId=this.providerId,this.nonce&&!this.pendingToken&&(n.nonce=this.nonce),e.postBody=yu(n)}return e}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class aA{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Au extends aA{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class fi extends Au{constructor(){super("facebook.com")}static credential(e){return Fo._fromParams({providerId:fi.PROVIDER_ID,signInMethod:fi.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return fi.credentialFromTaggedObject(e)}static credentialFromError(e){return fi.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return fi.credential(e.oauthAccessToken)}catch{return null}}}fi.FACEBOOK_SIGN_IN_METHOD="facebook.com";fi.PROVIDER_ID="facebook.com";/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class js extends Au{constructor(){super("google.com"),this.addScope("profile")}static credential(e,n){return Fo._fromParams({providerId:js.PROVIDER_ID,signInMethod:js.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:n})}static credentialFromResult(e){return js.credentialFromTaggedObject(e)}static credentialFromError(e){return js.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:n,oauthAccessToken:r}=e;if(!n&&!r)return null;try{return js.credential(n,r)}catch{return null}}}js.GOOGLE_SIGN_IN_METHOD="google.com";js.PROVIDER_ID="google.com";/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class pi extends Au{constructor(){super("github.com")}static credential(e){return Fo._fromParams({providerId:pi.PROVIDER_ID,signInMethod:pi.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return pi.credentialFromTaggedObject(e)}static credentialFromError(e){return pi.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return pi.credential(e.oauthAccessToken)}catch{return null}}}pi.GITHUB_SIGN_IN_METHOD="github.com";pi.PROVIDER_ID="github.com";/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class mi extends Au{constructor(){super("twitter.com")}static credential(e,n){return Fo._fromParams({providerId:mi.PROVIDER_ID,signInMethod:mi.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:n})}static credentialFromResult(e){return mi.credentialFromTaggedObject(e)}static credentialFromError(e){return mi.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthAccessToken:n,oauthTokenSecret:r}=e;if(!n||!r)return null;try{return mi.credential(n,r)}catch{return null}}}mi.TWITTER_SIGN_IN_METHOD="twitter.com";mi.PROVIDER_ID="twitter.com";/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class el{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,n,r,s=!1){const i=await Gr._fromIdTokenResponse(e,r,s),o=uS(r);return new el({user:i,providerId:o,_tokenResponse:r,operationType:n})}static async _forOperation(e,n,r){await e._updateTokensIfNecessary(r,!0);const s=uS(r);return new el({user:e,providerId:s,_tokenResponse:r,operationType:n})}}function uS(t){return t.providerId?t.providerId:"phoneNumber"in t?"phone":null}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class rf extends Ts{constructor(e,n,r,s){super(n.code,n.message),this.operationType=r,this.user=s,Object.setPrototypeOf(this,rf.prototype),this.customData={appName:e.name,tenantId:e.tenantId??void 0,_serverResponse:n.customData._serverResponse,operationType:r}}static _fromErrorAndOperation(e,n,r,s){return new rf(e,n,r,s)}}function lA(t,e,n,r){return(e==="reauthenticate"?n._getReauthenticationResolver(t):n._getIdTokenResponse(t)).catch(i=>{throw i.code==="auth/multi-factor-auth-required"?rf._fromErrorAndOperation(t,i,e,r):i})}async function Z8(t,e,n=!1){const r=await nu(t,e._linkToIdToken(t.auth,await t.getIdToken()),n);return el._forOperation(t,"link",r)}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function e9(t,e,n=!1){const{auth:r}=t;if($r(r.app))return Promise.reject(To(r));const s="reauthenticate";try{const i=await nu(t,lA(r,s,e,t),n);Te(i.idToken,r,"internal-error");const o=lv(i.idToken);Te(o,r,"internal-error");const{sub:a}=o;return Te(t.uid===a,r,"user-mismatch"),el._forOperation(t,s,i)}catch(i){throw(i==null?void 0:i.code)==="auth/user-not-found"&&Ys(r,"user-mismatch"),i}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function t9(t,e,n=!1){if($r(t.app))return Promise.reject(To(t));const r="signIn",s=await lA(t,r,e),i=await el._fromIdTokenResponse(t,r,s);return n||await t._updateCurrentUser(i.user),i}function n9(t,e,n,r){return nn(t).onIdTokenChanged(e,n,r)}function r9(t,e,n){return nn(t).beforeAuthStateChanged(e,n)}const sf="__sak";/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class cA{constructor(e,n){this.storageRetriever=e,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(sf,"1"),this.storage.removeItem(sf),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,n){return this.storage.setItem(e,JSON.stringify(n)),Promise.resolve()}_get(e){const n=this.storage.getItem(e);return Promise.resolve(n?JSON.parse(n):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const s9=1e3,i9=10;class uA extends cA{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,n)=>this.onStorageEvent(e,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=rA(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(const n of Object.keys(this.listeners)){const r=this.storage.getItem(n),s=this.localCache[n];r!==s&&e(n,s,r)}}onStorageEvent(e,n=!1){if(!e.key){this.forAllChangedKeys((o,a,l)=>{this.notifyListeners(o,l)});return}const r=e.key;n?this.detachListener():this.stopPolling();const s=()=>{const o=this.storage.getItem(r);!n&&this.localCache[r]===o||this.notifyListeners(r,o)},i=this.storage.getItem(r);V8()&&i!==e.newValue&&e.newValue!==e.oldValue?setTimeout(s,i9):s()}notifyListeners(e,n){this.localCache[e]=n;const r=this.listeners[e];if(r)for(const s of Array.from(r))s(n&&JSON.parse(n))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,n,r)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:n,newValue:r}),!0)})},s9)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,n){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(e,n){await super._set(e,n),this.localCache[e]=JSON.stringify(n)}async _get(e){const n=await super._get(e);return this.localCache[e]=JSON.stringify(n),n}async _remove(e){await super._remove(e),delete this.localCache[e]}}uA.type="LOCAL";const o9=uA;/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class dA extends cA{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,n){}_removeListener(e,n){}}dA.type="SESSION";const hA=dA;/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function a9(t){return Promise.all(t.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(n){return{fulfilled:!1,reason:n}}}))}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class ip{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){const n=this.receivers.find(s=>s.isListeningto(e));if(n)return n;const r=new ip(e);return this.receivers.push(r),r}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const n=e,{eventId:r,eventType:s,data:i}=n.data,o=this.handlersMap[s];if(!(o!=null&&o.size))return;n.ports[0].postMessage({status:"ack",eventId:r,eventType:s});const a=Array.from(o).map(async c=>c(n.origin,i)),l=await a9(a);n.ports[0].postMessage({status:"done",eventId:r,eventType:s,response:l})}_subscribe(e,n){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(n)}_unsubscribe(e,n){this.handlersMap[e]&&n&&this.handlersMap[e].delete(n),(!n||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}ip.receivers=[];/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function hv(t="",e=10){let n="";for(let r=0;r{const c=hv("",20);s.port1.start();const d=setTimeout(()=>{l(new Error("unsupported_event"))},r);o={messageChannel:s,onMessage(h){const m=h;if(m.data.eventId===c)switch(m.data.status){case"ack":clearTimeout(d),i=setTimeout(()=>{l(new Error("timeout"))},3e3);break;case"done":clearTimeout(i),a(m.data.response);break;default:clearTimeout(d),clearTimeout(i),l(new Error("invalid_response"));break}}},this.handlers.add(o),s.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:c,data:n},[s.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function vs(){return window}function c9(t){vs().location.href=t}/** + * @license + * Copyright 2020 Google LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function fA(){return typeof vs().WorkerGlobalScope<"u"&&typeof vs().importScripts=="function"}async function u9(){if(!(navigator!=null&&navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function d9(){var t;return((t=navigator==null?void 0:navigator.serviceWorker)==null?void 0:t.controller)||null}function h9(){return fA()?self:null}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const pA="firebaseLocalStorageDb",f9=1,of="firebaseLocalStorage",mA="fbase_key";class Pu{constructor(e){this.request=e}toPromise(){return new Promise((e,n)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{n(this.request.error)})})}}function op(t,e){return t.transaction([of],e?"readwrite":"readonly").objectStore(of)}function p9(){const t=indexedDB.deleteDatabase(pA);return new Pu(t).toPromise()}function Py(){const t=indexedDB.open(pA,f9);return new Promise((e,n)=>{t.addEventListener("error",()=>{n(t.error)}),t.addEventListener("upgradeneeded",()=>{const r=t.result;try{r.createObjectStore(of,{keyPath:mA})}catch(s){n(s)}}),t.addEventListener("success",async()=>{const r=t.result;r.objectStoreNames.contains(of)?e(r):(r.close(),await p9(),e(await Py()))})})}async function dS(t,e,n){const r=op(t,!0).put({[mA]:e,value:n});return new Pu(r).toPromise()}async function m9(t,e){const n=op(t,!1).get(e),r=await new Pu(n).toPromise();return r===void 0?null:r.value}function hS(t,e){const n=op(t,!0).delete(e);return new Pu(n).toPromise()}const g9=800,y9=3;class gA{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.db?this.db:(this.db=await Py(),this.db)}async _withRetries(e){let n=0;for(;;)try{const r=await this._openDb();return await e(r)}catch(r){if(n++>y9)throw r;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return fA()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=ip._getInstance(h9()),this.receiver._subscribe("keyChanged",async(e,n)=>({keyProcessed:(await this._poll()).includes(n.key)})),this.receiver._subscribe("ping",async(e,n)=>["keyChanged"])}async initializeSender(){var n,r;if(this.activeServiceWorker=await u9(),!this.activeServiceWorker)return;this.sender=new l9(this.activeServiceWorker);const e=await this.sender._send("ping",{},800);e&&(n=e[0])!=null&&n.fulfilled&&(r=e[0])!=null&&r.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||d9()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;const e=await Py();return await dS(e,sf,"1"),await hS(e,sf),!0}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,n){return this._withPendingWrite(async()=>(await this._withRetries(r=>dS(r,e,n)),this.localCache[e]=n,this.notifyServiceWorker(e)))}async _get(e){const n=await this._withRetries(r=>m9(r,e));return this.localCache[e]=n,n}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(n=>hS(n,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){const e=await this._withRetries(s=>{const i=op(s,!1).getAll();return new Pu(i).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];const n=[],r=new Set;if(e.length!==0)for(const{fbase_key:s,value:i}of e)r.add(s),JSON.stringify(this.localCache[s])!==JSON.stringify(i)&&(this.notifyListeners(s,i),n.push(s));for(const s of Object.keys(this.localCache))this.localCache[s]&&!r.has(s)&&(this.notifyListeners(s,null),n.push(s));return n}notifyListeners(e,n){this.localCache[e]=n;const r=this.listeners[e];if(r)for(const s of Array.from(r))s(n)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),g9)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,n){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&this.stopPolling()}}gA.type="LOCAL";const x9=gA;new Nu(3e4,6e4);/** + * @license + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function v9(t,e){return e?Vs(e):(Te(t._popupRedirectResolver,t,"argument-error"),t._popupRedirectResolver)}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class fv extends oA{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return Va(e,this._buildIdpRequest())}_linkToIdToken(e,n){return Va(e,this._buildIdpRequest(n))}_getReauthenticationResolver(e){return Va(e,this._buildIdpRequest())}_buildIdpRequest(e){const n={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(n.idToken=e),n}}function w9(t){return t9(t.auth,new fv(t),t.bypassAuthState)}function b9(t){const{auth:e,user:n}=t;return Te(n,e,"internal-error"),e9(n,new fv(t),t.bypassAuthState)}async function _9(t){const{auth:e,user:n}=t;return Te(n,e,"internal-error"),Z8(n,new fv(t),t.bypassAuthState)}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class yA{constructor(e,n,r,s,i=!1){this.auth=e,this.resolver=r,this.user=s,this.bypassAuthState=i,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(n)?n:[n]}execute(){return new Promise(async(e,n)=>{this.pendingPromise={resolve:e,reject:n};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(r){this.reject(r)}})}async onAuthEvent(e){const{urlResponse:n,sessionId:r,postBody:s,tenantId:i,error:o,type:a}=e;if(o){this.reject(o);return}const l={auth:this.auth,requestUri:n,sessionId:r,tenantId:i||void 0,postBody:s||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(a)(l))}catch(c){this.reject(c)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return w9;case"linkViaPopup":case"linkViaRedirect":return _9;case"reauthViaPopup":case"reauthViaRedirect":return b9;default:Ys(this.auth,"internal-error")}}resolve(e){Qs(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){Qs(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const S9=new Nu(2e3,1e4);class Ea extends yA{constructor(e,n,r,s,i){super(e,n,s,i),this.provider=r,this.authWindow=null,this.pollId=null,Ea.currentPopupAction&&Ea.currentPopupAction.cancel(),Ea.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return Te(e,this.auth,"internal-error"),e}async onExecution(){Qs(this.filter.length===1,"Popup operations only handle one event");const e=hv();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(n=>{this.reject(n)}),this.resolver._isIframeWebStorageSupported(this.auth,n=>{n||this.reject(xs(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return((e=this.authWindow)==null?void 0:e.associatedEvent)||null}cancel(){this.reject(xs(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,Ea.currentPopupAction=null}pollUserCancellation(){const e=()=>{var n,r;if((r=(n=this.authWindow)==null?void 0:n.window)!=null&&r.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(xs(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,S9.get())};e()}}Ea.currentPopupAction=null;/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const E9="pendingRedirect",eh=new Map;class T9 extends yA{constructor(e,n,r=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,r),this.eventId=null}async execute(){let e=eh.get(this.auth._key());if(!e){try{const r=await k9(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(r)}catch(n){e=()=>Promise.reject(n)}eh.set(this.auth._key(),e)}return this.bypassAuthState||eh.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if(e.type==="signInViaRedirect")return super.onAuthEvent(e);if(e.type==="unknown"){this.resolve(null);return}if(e.eventId){const n=await this.auth._redirectUserForId(e.eventId);if(n)return this.user=n,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}}async function k9(t,e){const n=N9(e),r=I9(t);if(!await r._isAvailable())return!1;const s=await r._get(n)==="true";return await r._remove(n),s}function C9(t,e){eh.set(t._key(),e)}function I9(t){return Vs(t._redirectPersistence)}function N9(t){return Zd(E9,t.config.apiKey,t.name)}async function A9(t,e,n=!1){if($r(t.app))return Promise.reject(To(t));const r=uv(t),s=v9(r,e),o=await new T9(r,s,n).execute();return o&&!n&&(delete o.user._redirectEventId,await r._persistUserIfCurrent(o.user),await r._setRedirectUser(null,e)),o}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const P9=10*60*1e3;class R9{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let n=!1;return this.consumers.forEach(r=>{this.isEventForConsumer(e,r)&&(n=!0,this.sendToConsumer(e,r),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!j9(e)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=e,n=!0)),n}sendToConsumer(e,n){var r;if(e.error&&!xA(e)){const s=((r=e.error.code)==null?void 0:r.split("auth/")[1])||"internal-error";n.onError(xs(this.auth,s))}else n.onAuthEvent(e)}isEventForConsumer(e,n){const r=n.eventId===null||!!e.eventId&&e.eventId===n.eventId;return n.filter.includes(e.type)&&r}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=P9&&this.cachedEventUids.clear(),this.cachedEventUids.has(fS(e))}saveEventToCache(e){this.cachedEventUids.add(fS(e)),this.lastProcessedEventTime=Date.now()}}function fS(t){return[t.type,t.eventId,t.sessionId,t.tenantId].filter(e=>e).join("-")}function xA({type:t,error:e}){return t==="unknown"&&(e==null?void 0:e.code)==="auth/no-auth-event"}function j9(t){switch(t.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return xA(t);default:return!1}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function D9(t,e={}){return ml(t,"GET","/v1/projects",e)}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const M9=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,L9=/^https?/;async function V9(t){if(t.config.emulator)return;const{authorizedDomains:e}=await D9(t);for(const n of e)try{if(O9(n))return}catch{}Ys(t,"unauthorized-domain")}function O9(t){const e=Ny(),{protocol:n,hostname:r}=new URL(e);if(t.startsWith("chrome-extension://")){const o=new URL(t);return o.hostname===""&&r===""?n==="chrome-extension:"&&t.replace("chrome-extension://","")===e.replace("chrome-extension://",""):n==="chrome-extension:"&&o.hostname===r}if(!L9.test(n))return!1;if(M9.test(t))return r===t;const s=t.replace(/\./g,"\\.");return new RegExp("^(.+\\."+s+"|"+s+")$","i").test(r)}/** + * @license + * Copyright 2020 Google LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const F9=new Nu(3e4,6e4);function pS(){const t=vs().___jsl;if(t!=null&&t.H){for(const e of Object.keys(t.H))if(t.H[e].r=t.H[e].r||[],t.H[e].L=t.H[e].L||[],t.H[e].r=[...t.H[e].L],t.CP)for(let n=0;n{var s,i,o;function r(){pS(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{pS(),n(xs(t,"network-request-failed"))},timeout:F9.get()})}if((i=(s=vs().gapi)==null?void 0:s.iframes)!=null&&i.Iframe)e(gapi.iframes.getContext());else if((o=vs().gapi)!=null&&o.load)r();else{const a=q8("iframefcb");return vs()[a]=()=>{gapi.load?r():n(xs(t,"network-request-failed"))},H8(`${G8()}?onload=${a}`).catch(l=>n(l))}}).catch(e=>{throw th=null,e})}let th=null;function B9(t){return th=th||z9(t),th}/** + * @license + * Copyright 2020 Google LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const U9=new Nu(5e3,15e3),$9="__/auth/iframe",H9="emulator/auth/iframe",G9={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},q9=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function W9(t){const e=t.config;Te(e.authDomain,t,"auth-domain-config-required");const n=e.emulator?ov(e,H9):`https://${t.config.authDomain}/${$9}`,r={apiKey:e.apiKey,appName:t.name,v:Go},s=q9.get(t.config.apiHost);s&&(r.eid=s);const i=t._getFrameworks();return i.length&&(r.fw=i.join(",")),`${n}?${yu(r).slice(1)}`}async function K9(t){const e=await B9(t),n=vs().gapi;return Te(n,t,"internal-error"),e.open({where:document.body,url:W9(t),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:G9,dontclear:!0},r=>new Promise(async(s,i)=>{await r.restyle({setHideOnLeave:!1});const o=xs(t,"network-request-failed"),a=vs().setTimeout(()=>{i(o)},U9.get());function l(){vs().clearTimeout(a),s(r)}r.ping(l).then(l,()=>{i(o)})}))}/** + * @license + * Copyright 2020 Google LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Y9={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},Q9=500,X9=600,J9="_blank",Z9="http://localhost";class mS{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function eB(t,e,n,r=Q9,s=X9){const i=Math.max((window.screen.availHeight-s)/2,0).toString(),o=Math.max((window.screen.availWidth-r)/2,0).toString();let a="";const l={...Y9,width:r.toString(),height:s.toString(),top:i,left:o},c=In().toLowerCase();n&&(a=JN(c)?J9:n),QN(c)&&(e=e||Z9,l.scrollbars="yes");const d=Object.entries(l).reduce((m,[p,g])=>`${m}${p}=${g},`,"");if(L8(c)&&a!=="_self")return tB(e||"",a),new mS(null);const h=window.open(e||"",a,d);Te(h,t,"popup-blocked");try{h.focus()}catch{}return new mS(h)}function tB(t,e){const n=document.createElement("a");n.href=t,n.target=e;const r=document.createEvent("MouseEvent");r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(r)}/** + * @license + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const nB="__/auth/handler",rB="emulator/auth/handler",sB=encodeURIComponent("fac");async function gS(t,e,n,r,s,i){Te(t.config.authDomain,t,"auth-domain-config-required"),Te(t.config.apiKey,t,"invalid-api-key");const o={apiKey:t.config.apiKey,appName:t.name,authType:n,redirectUrl:r,v:Go,eventId:s};if(e instanceof aA){e.setDefaultLanguage(t.languageCode),o.providerId=e.providerId||"",uO(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(const[d,h]of Object.entries({}))o[d]=h}if(e instanceof Au){const d=e.getScopes().filter(h=>h!=="");d.length>0&&(o.scopes=d.join(","))}t.tenantId&&(o.tid=t.tenantId);const a=o;for(const d of Object.keys(a))a[d]===void 0&&delete a[d];const l=await t._getAppCheckToken(),c=l?`#${sB}=${encodeURIComponent(l)}`:"";return`${iB(t)}?${yu(a).slice(1)}${c}`}function iB({config:t}){return t.emulator?ov(t,rB):`https://${t.authDomain}/${nB}`}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const bm="webStorageSupport";class oB{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=hA,this._completeRedirectFn=A9,this._overrideRedirectResult=C9}async _openPopup(e,n,r,s){var o;Qs((o=this.eventManagers[e._key()])==null?void 0:o.manager,"_initialize() not called before _openPopup()");const i=await gS(e,n,r,Ny(),s);return eB(e,i,hv())}async _openRedirect(e,n,r,s){await this._originValidation(e);const i=await gS(e,n,r,Ny(),s);return c9(i),new Promise(()=>{})}_initialize(e){const n=e._key();if(this.eventManagers[n]){const{manager:s,promise:i}=this.eventManagers[n];return s?Promise.resolve(s):(Qs(i,"If manager is not set, promise should be"),i)}const r=this.initAndGetManager(e);return this.eventManagers[n]={promise:r},r.catch(()=>{delete this.eventManagers[n]}),r}async initAndGetManager(e){const n=await K9(e),r=new R9(e);return n.register("authEvent",s=>(Te(s==null?void 0:s.authEvent,e,"invalid-auth-event"),{status:r.onEvent(s.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:r},this.iframes[e._key()]=n,r}_isIframeWebStorageSupported(e,n){this.iframes[e._key()].send(bm,{type:bm},s=>{var o;const i=(o=s==null?void 0:s[0])==null?void 0:o[bm];i!==void 0&&n(!!i),Ys(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const n=e._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=V9(e)),this.originValidationPromises[n]}get _shouldInitProactively(){return rA()||XN()||cv()}}const aB=oB;var yS="@firebase/auth",xS="1.12.2";/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class lB{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),((e=this.auth.currentUser)==null?void 0:e.uid)||null}async getToken(e){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;const n=this.auth.onIdTokenChanged(r=>{e((r==null?void 0:r.stsTokenManager.accessToken)||null)});this.internalListeners.set(e,n),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();const n=this.internalListeners.get(e);n&&(this.internalListeners.delete(e),n(),this.updateProactiveRefresh())}assertAuthConfigured(){Te(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function cB(t){switch(t){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function uB(t){jo(new Li("auth",(e,{options:n})=>{const r=e.getProvider("app").getImmediate(),s=e.getProvider("heartbeat"),i=e.getProvider("app-check-internal"),{apiKey:o,authDomain:a}=r.options;Te(o&&!o.includes(":"),"invalid-api-key",{appName:r.name});const l={apiKey:o,authDomain:a,clientPlatform:t,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:sA(t)},c=new U8(r,s,i,l);return K8(c,n),c},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,n,r)=>{e.getProvider("auth-internal").initialize()})),jo(new Li("auth-internal",e=>{const n=uv(e.getProvider("auth").getImmediate());return(r=>new lB(r))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),ps(yS,xS,cB(t)),ps(yS,xS,"esm2020")}/** + * @license + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const dB=5*60,hB=JC("authIdTokenMaxAge")||dB;let vS=null;const fB=t=>async e=>{const n=e&&await e.getIdTokenResult(),r=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(r&&r>hB)return;const s=n==null?void 0:n.token;vS!==s&&(vS=s,await fetch(t,{method:s?"POST":"DELETE",headers:s?{Authorization:`Bearer ${s}`}:{}}))};function pB(t=wx()){const e=zf(t,"auth");if(e.isInitialized())return e.getImmediate();const n=W8(t,{popupRedirectResolver:aB,persistence:[x9,o9,hA]}),r=JC("authTokenSyncURL");if(r&&typeof isSecureContext=="boolean"&&isSecureContext){const i=new URL(r,location.origin);if(location.origin===i.origin){const o=fB(i.toString());r9(n,o,()=>o(n.currentUser)),n9(n,a=>o(a))}}const s=YC("auth");return s&&Y8(n,`http://${s}`),n}function mB(){var t;return((t=document.getElementsByTagName("head"))==null?void 0:t[0])??document}$8({loadJS(t){return new Promise((e,n)=>{const r=document.createElement("script");r.setAttribute("src",t),r.onload=e,r.onerror=s=>{const i=xs("internal-error");i.customData=s,n(i)},r.type="text/javascript",r.charset="UTF-8",mB().appendChild(r)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="});uB("Browser");const gB={apiKey:"TU_NUEVA_API_KEY",authDomain:"twisted-streaming-brody.firebaseapp.com",projectId:"twisted-streaming-brody",storageBucket:"twisted-streaming-brody.firebasestorage.app",messagingSenderId:"TU_NUEVA_SENDER",appId:"TU_NUEVA_APPID",measurementId:"TU_NUEVA_MEASUREMENT"},pv=nI(gB),Ae=Nz(pv);p8(pv);pB(pv);new js;function Ry(t){if(t!=null){if(Array.isArray(t)){const e=t.map(n=>Ry(n)).filter(n=>n!=null&&n!=="");return e.length>0?e:void 0}if(typeof t=="object"&&!(t instanceof Ve)){const e={};for(const n in t)if(t.hasOwnProperty(n)){const r=Ry(t[n]);r!=null&&(e[n]=r)}return Object.keys(e).length>0?e:void 0}return t}}const Mt={ALL_MANGAS:"mangalib_all_v2",MANGA_PREFIX:"mangalib_detail_v2_"};function Qi(t,e){try{localStorage.setItem(t,JSON.stringify(e))}catch(n){console.warn(`Error saving ${t} to localStorage`,n)}}async function yB(t,e){const n=wt(Ae,"videos",t);await Lr(n,{episode:e,updated_at:Ve.now()})}async function mv(t){const e=Ve.now(),n=t.map(async r=>{const s=wt(Ae,"videos",r.id);await Lr(s,{title:r.title,updated_at:e});const i=vn.get(r.id);i&&(i.title=r.title,i.updated_at=e.toDate().toISOString(),vn.set(r.id,i),Qi(`${Mt.MANGA_PREFIX}${r.id}`,i))});await Promise.all(n)}function nr(t){try{localStorage.removeItem(t)}catch(e){console.warn(`Error removing ${t} from localStorage`,e)}}async function gl(){const t=sr(Ot(Ae,"videos"),Fz("created_at","desc")),e=await kn(t),r=(await kn(Ot(Ae,"categories"))).docs.reduce((o,a)=>(o[a.id]={id:a.id,...a.data()},o),{}),s=await Promise.all(e.docs.map(async o=>{var a,l;try{const c=o.data();let d=new Date().toISOString();(a=c.created_at)!=null&&a.toDate?d=c.created_at.toDate().toISOString():c.created_at&&(d=new Date(c.created_at).toISOString());let h=d;(l=c.updated_at)!=null&&l.toDate&&(h=c.updated_at.toDate().toISOString());const m=sr(Ot(Ae,"chapters"),Mr("manga_id","==",o.id)),g=(await kn(m)).docs.map(y=>{var D,k;const v=y.data(),_=(D=v.created_at)!=null&&D.toDate?v.created_at.toDate().toISOString():new Date().toISOString(),P=(k=v.updated_at)!=null&&k.toDate?v.updated_at.toDate().toISOString():new Date().toISOString();return{id:y.id,manga_id:v.manga_id,number:v.number,title:v.title,pages:v.pages||[],page_formats:v.page_formats||[],original_pages:v.original_pages||[],created_at:_,updated_at:P}}).sort((y,v)=>y.number-v.number),E=(c.categories||[]).map(y=>r[y]).filter(y=>y!==void 0);return{id:o.id,...c,created_at:d,updated_at:h,categories:E,chapters:g}}catch(c){return console.error(`[DATA ERROR] Skipping corrupt manga ${o.id}:`,c),null}})),i=s.filter(o=>o!==null);return console.log(`[DATA] Loaded ${i.length} mangas (Skipped ${s.length-i.length} corrupt)`),i}const vn=new Map;async function zo(t){var d,h;const e=wt(Ae,"videos",t),n=await Oo(e);if(!n.exists())return null;const r=n.data(),s=sr(Ot(Ae,"chapters"),Mr("manga_id","==",t)),o=(await kn(s)).docs.map(m=>{const p=m.data();return{id:m.id,manga_id:p.manga_id,number:p.number,title:p.title,pages:p.pages||[],page_formats:p.page_formats||[],original_pages:p.original_pages||[],created_at:p.created_at.toDate().toISOString(),updated_at:p.updated_at.toDate().toISOString()}}).sort((m,p)=>m.number-p.number),a=r.categories||[],l=[];for(const m of a){const p=wt(Ae,"categories",m),g=await Oo(p);g.exists()&&l.push({id:g.id,...g.data(),created_at:((h=(d=g.data().created_at)==null?void 0:d.toDate)==null?void 0:h.call(d).toISOString())||new Date().toISOString()})}const c={id:n.id,...r,created_at:r.created_at.toDate().toISOString(),categories:l,chapters:o,updated_at:r.updated_at?r.updated_at.toDate().toISOString():r.created_at.toDate().toISOString()};return vn.set(t,c),Qi(`${Mt.MANGA_PREFIX}${t}`,c),c}function xB(t,e){const n=wt(Ae,"videos",t);return sv(n,async r=>{if(!r.exists()){e(null);return}const s=r.data();let i=vn.get(t),o=(i==null?void 0:i.chapters)||[],a=(i==null?void 0:i.categories)||[];if(!i){const c=sr(Ot(Ae,"chapters"),Mr("manga_id","==",t));o=(await kn(c)).docs.map(m=>({id:m.id,...m.data(),created_at:m.data().created_at.toDate().toISOString(),updated_at:m.data().updated_at.toDate().toISOString()})).sort((m,p)=>m.number-p.number);const h=s.categories||[];a=[];for(const m of h){const p=await Oo(wt(Ae,"categories",m));p.exists()&&a.push({id:p.id,...p.data()})}}const l={id:r.id,...s,chapters:o,categories:a,created_at:s.created_at.toDate().toISOString(),updated_at:s.updated_at?s.updated_at.toDate().toISOString():s.created_at.toDate().toISOString()};vn.set(t,l),Qi(`${Mt.MANGA_PREFIX}${t}`,l),e(l)})}async function vB(t){const e=Ve.now(),n={title:t.title,created_at:e,updated_at:e,...t.video_url!==void 0&&{video_url:t.video_url},section:t.section||"peliculas",...t.description&&{description:t.description},...t.thumbnail_position&&{thumbnail_position:t.thumbnail_position},...t.servers&&{servers:t.servers},...t.is_folder!==void 0&&{is_folder:t.is_folder},...t.folder_id&&{folder_id:t.folder_id},...t.episode!==void 0&&{episode:t.episode}};t.thumbnail_url&&(n.thumbnail_url=t.thumbnail_url),t.cover_url&&(n.cover_url=t.cover_url);const r=await Cu(Ot(Ae,"videos"),n),s=new Date().toISOString(),i={id:r.id,title:t.title,created_at:s,updated_at:s,...t.video_url!==void 0&&{video_url:t.video_url},section:t.section||"peliculas",thumbnail_position:t.thumbnail_position||"50% center",author:"Anónimo",description:t.description||"",status:"Completado",categories:[],chapters:[],views:0,rating:0};return t.thumbnail_url&&(i.thumbnail_url=t.thumbnail_url),t.cover_url&&(i.cover_url=t.cover_url),vn.set(i.id,i),Qi(`${Mt.MANGA_PREFIX}${i.id}`,i),nr(Mt.ALL_MANGAS),i}async function wB(){return(await kn(Ot(Ae,"categories"))).docs.map(e=>({id:e.id,...e.data()}))}async function bB(t,e="genre"){const n=await Cu(Ot(Ae,"categories"),{name:t,type:e}),r=await Oo(n);return{id:r.id,...r.data()}}async function _B(t){const e=wt(Ae,"categories",t);await tu(e);const n=sr(Ot(Ae,"videos"),Mr("categories","array-contains",t)),s=(await kn(n)).docs.map(i=>{const l=(i.data().categories||[]).filter(c=>c!==t);return Lr(wt(Ae,"videos",i.id),{categories:l})});await Promise.all(s)}async function jy(t){const e=Ve.now(),n=await Cu(Ot(Ae,"chapters"),{manga_id:t.manga_id,number:t.number,title:t.title,pages:t.pages,page_formats:t.page_formats||[],original_pages:t.original_pages||[],created_at:e,updated_at:e}),r=await Oo(n),s=r.data();return{id:r.id,manga_id:s.manga_id,number:s.number,title:s.title,pages:s.pages||[],page_formats:s.page_formats||[],original_pages:s.original_pages||[],created_at:s.created_at.toDate().toISOString(),updated_at:s.updated_at.toDate().toISOString()}}async function SB(t){const e=wt(Ae,"videos",t);await Lr(e,{views:Vz(1)})}async function ru(t,e){var g,b;const n=wt(Ae,"videos",t),r=Ve.now(),s={title:e.title,updated_at:r};e.video_url!==void 0&&(s.video_url=e.video_url),e.description!==void 0&&(s.description=e.description),e.section&&(s.section=e.section),e.thumbnail_position&&(s.thumbnail_position=e.thumbnail_position),e.servers&&(s.servers=e.servers),e.is_folder!==void 0&&(s.is_folder=e.is_folder),e.folder_id!==void 0&&(s.folder_id=e.folder_id),e.episode!==void 0&&(s.episode=e.episode),e.status&&(s.status=e.status),e.status&&(s.status=e.status),e.thumbnail_url&&(s.thumbnail_url=e.thumbnail_url),e.cover_url&&(s.cover_url=e.cover_url);const i=Ry(s);await Lr(n,i);const o=await Oo(n);if(!o.exists())throw new Error("Manga no encontrado");const a=o.data(),l=sr(Ot(Ae,"chapters"),Mr("manga_id","==",t)),d=(await kn(l)).docs.map(E=>{const y=E.data();return{id:E.id,manga_id:y.manga_id,number:y.number,title:y.title,pages:y.pages||[],page_formats:y.page_formats||[],original_pages:y.original_pages||[],created_at:y.created_at.toDate().toISOString(),updated_at:y.updated_at.toDate().toISOString()}}).sort((E,y)=>E.number-y.number),h=a.categories||[],m=[];for(const E of h){const y=wt(Ae,"categories",E),v=await Oo(y);v.exists()&&m.push({id:v.id,...v.data(),created_at:((b=(g=v.data().created_at)==null?void 0:g.toDate)==null?void 0:b.call(g).toISOString())||new Date().toISOString()})}const p={id:o.id,...a,created_at:a.created_at.toDate().toISOString(),categories:m,chapters:d,updated_at:a.updated_at.toDate().toISOString()};return vn.set(p.id,p),Qi(`${Mt.MANGA_PREFIX}${p.id}`,p),nr(Mt.ALL_MANGAS),p}async function gv(t,e,n){const r=wt(Ae,"videos",t);await Lr(r,{is_deleted:e,updated_at:Ve.now()});const s=vn.get(t);s&&(s.is_deleted=e,s.updated_at=n,vn.set(t,s),Qi(`${Mt.MANGA_PREFIX}${t}`,s));const i=sr(Ot(Ae,"videos"),Mr("folder_id","==",t)),o=await kn(i);for(const a of o.docs)await gv(a.id,e,n)}async function af(t){const e=new Date().toISOString();await gv(t,!0,e),nr(Mt.ALL_MANGAS)}async function EB(t){const e=new Date().toISOString();await gv(t,!1,e),nr(Mt.ALL_MANGAS)}async function vA(t){const e=wt(Ae,"videos",t),n=sr(Ot(Ae,"videos"),Mr("folder_id","==",t)),r=await kn(n);for(const o of r.docs)await vA(o.id);const s=sr(Ot(Ae,"chapters"),Mr("manga_id","==",t)),i=await kn(s);for(const o of i.docs)await tu(o.ref);await tu(e),vn.delete(t),nr(`${Mt.MANGA_PREFIX}${t}`)}async function TB(t){await vA(t),nr(Mt.ALL_MANGAS)}function wS(t){const e=t.match(/^(.*?)(?:\s*(?:-|_|#|vol\.?|volume|part|cap\.?|capitulo)?\s*(\d+(?:\.\d+)?))$/i);return e?{baseTitle:e[1].trim().toLowerCase(),number:parseFloat(e[2])}:{baseTitle:t.trim().toLowerCase(),number:null}}async function kB(t,e,n,r){const s=await gl(),i=s.find(p=>p.id===t),o=(i==null?void 0:i.section)||"flow",a=wS(n),l=[],c=[];s.forEach(p=>{if(p.id===t||p.is_folder||(p.section||"flow")!==o)return;const g=wS(p.title);g.baseTitle===a.baseTitle&&g.baseTitle.length>0&&g.number!==null?l.push({manga:p,num:g.number}):c.push(p)}),l.sort((p,g)=>p.num-g.num);let d=[];if(a.number!==null){const p=l.filter(b=>b.num>a.number).map(b=>b.manga),g=l.filter(b=>b.numb.manga);d=[...p,...g]}else d=l.map(p=>p.manga);const h=c.map(p=>{var k,T;let g=0;const b=((k=p.categories)==null?void 0:k.map(w=>w.id))||[],E=e.filter(w=>b.includes(w));g+=E.length*10;const y=n.toLowerCase().split(/\s+/).filter(w=>w.length>2),v=p.title.toLowerCase().split(/\s+/).filter(w=>w.length>2),_=y.filter(w=>v.includes(w));g+=_.length*5;const P=((T=p.author)==null?void 0:T.toLowerCase().split(/\s+/).filter(w=>w.length>2))||[],D=y.filter(w=>P.includes(w));return g+=D.length*3,{manga:p,score:g}}).filter(p=>p.score>0).sort((p,g)=>{if(g.score!==p.score)return g.score-p.score;const b=p.manga.title.toLowerCase(),E=g.manga.title.toLowerCase();return b.localeCompare(E)}).map(p=>p.manga),m=[...d,...h];return r?m.slice(0,r):m}async function CB(t){const e=sr(Ot(Ae,"videos"),Mr("author","==",t)),r=(await kn(e)).docs.map(s=>Lr(wt(Ae,"videos",s.id),{author:""}));await Promise.all(r)}async function IB(){const t=sr(Ot(Ae,"videos")),e=await kn(t),n=new Set;return e.forEach(r=>{const s=r.data();s&&s.author&&typeof s.author=="string"&&s.author.trim()!==""&&n.add(s.author.trim())}),Array.from(n).sort()}async function NB(t,e,n,r="flow"){const s=Ve.now(),i={title:t,author:"Carpeta",description:"",status:"Carpeta",categories:[],views:0,rating:0,created_at:s,updated_at:s,is_folder:!0,section:r};n&&(i.folder_id=n);const a=(await Cu(Ot(Ae,"videos"),i)).id;if(e.length>0){const h=(await gl()).filter(g=>e.includes(g.id)).sort((g,b)=>g.title.localeCompare(b.title)),m=Ve.now(),p=h.map(async(g,b)=>{const E=wt(Ae,"videos",g.id);await Lr(E,{folder_id:a,episode:b+1,updated_at:m})});await Promise.all(p)}const l=new Date().toISOString(),c={id:a,...i,created_at:l,updated_at:l,chapters:[],categories:[]};return vn.set(a,c),nr(Mt.ALL_MANGAS),c}async function AB(t,e){const n=Ve.now(),r=t.map(async s=>{const i=wt(Ae,"videos",s);await Lr(i,{folder_id:e,updated_at:n});const o=vn.get(s);o&&(e?o.folder_id=e:delete o.folder_id,o.updated_at=n.toDate().toISOString(),vn.set(s,o),Qi(`${Mt.MANGA_PREFIX}${s}`,o))});await Promise.all(r),nr(Mt.ALL_MANGAS)}async function PB(t){const n=(await gl()).filter(o=>t.includes(o.id));n.sort((o,a)=>o.title.localeCompare(a.title));const r="coll_"+Math.random().toString(36).substr(2,9),s=Ve.now(),i=n.map(async(o,a)=>{const l=wt(Ae,"videos",o.id);await Lr(l,{folder_id:r,episode:a+1,updated_at:s})});await Promise.all(i),nr(Mt.ALL_MANGAS)}async function RB(t,e){const n=Ve.now(),r=[];for(let i=0;i{const h=c.data().folder_id,m=h&&s.has(h),p={section:e,updated_at:n};m||(p.folder_id=Jl()),o.update(c.ref,p);const g=vn.get(c.id);g&&(g.section=e,m||delete g.folder_id,g.updated_at=n.toDate().toISOString(),vn.set(c.id,g),Qi(`${Mt.MANGA_PREFIX}${c.id}`,g))}),await o.commit()}nr(Mt.ALL_MANGAS)}async function bS(t){if(t.length<2)return;const e=[];for(const p of t){const g=await zo(p);g&&e.push(g)}if(e.length<2)return;const n=e.map(p=>p.title).join(" - "),r=e[0].section||"flow",s=e[0].folder_id,i=new Set;e.forEach(p=>{var g;(g=p.categories)==null||g.forEach(b=>i.add(b.id))});const o=Ve.now(),a={title:n,author:e[0].author,description:e.map(p=>p.description).filter(Boolean).join(` + +`),status:"En curso",categories:Array.from(i),views:0,rating:0,created_at:o,updated_at:o,section:r,is_decensored:e.some(p=>p.is_decensored),is_bn:e.some(p=>p.is_bn),is_color:e.some(p=>p.is_color)};e[0].thumbnail_url&&(a.thumbnail_url=e[0].thumbnail_url),e[0].cover_url&&(a.cover_url=e[0].cover_url),s&&(a.folder_id=s);const c=(await Cu(Ot(Ae,"videos"),a)).id;let d=[],h=[],m=[];e.forEach(p=>{var g;(g=p.chapters)==null||g.forEach(b=>{b.pages&&(d=d.concat(b.pages)),b.original_pages&&(h=h.concat(b.original_pages)),b.page_formats&&(m=m.concat(b.page_formats))})}),m.length>0&&m.length!==d.length&&(m=d.map((p,g)=>m[g]||"webp")),d.length>0&&await jy({manga_id:c,number:1,title:"Capítulo 1",pages:d,page_formats:m,original_pages:h});for(const p of t)await af(p);nr(Mt.ALL_MANGAS)}async function jB(t,e,n,r){const s=sr(Ot(Ae,"chapters"),Mr("manga_id","==",t)),i=await kn(s);for(const h of i.docs)await tu(h.ref);n.length>0&&await jy({manga_id:t,number:1,title:"Capítulo 1",pages:n});const o=sr(Ot(Ae,"chapters"),Mr("manga_id","==",e)),a=await kn(o);for(const h of a.docs)await tu(h.ref);r.length>0&&await jy({manga_id:e,number:1,title:"Capítulo 1",pages:r});const l=Ve.now(),c={updated_at:l};n.length>0?(c.cover_url=n[0],c.thumbnail_url=n[0]):(c.cover_url=Jl(),c.thumbnail_url=Jl());const d={updated_at:l};r.length>0?(d.cover_url=r[0],d.thumbnail_url=r[0]):(d.cover_url=Jl(),d.thumbnail_url=Jl()),await Lr(wt(Ae,"videos",t),c),await Lr(wt(Ae,"videos",e),d),nr(`${Mt.MANGA_PREFIX}${t}`),nr(`${Mt.MANGA_PREFIX}${e}`),nr(Mt.ALL_MANGAS),vn.delete(t),vn.delete(e)}function DB(t){if(typeof document>"u")return;let e=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",e.appendChild(n),n.styleSheet?n.styleSheet.cssText=t:n.appendChild(document.createTextNode(t))}const MB=t=>{switch(t){case"success":return OB;case"info":return zB;case"warning":return FB;case"error":return BB;default:return null}},LB=Array(12).fill(0),VB=({visible:t,className:e})=>Z.createElement("div",{className:["sonner-loading-wrapper",e].filter(Boolean).join(" "),"data-visible":t},Z.createElement("div",{className:"sonner-spinner"},LB.map((n,r)=>Z.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),OB=Z.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Z.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),FB=Z.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},Z.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),zB=Z.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Z.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),BB=Z.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Z.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),UB=Z.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},Z.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),Z.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),$B=()=>{const[t,e]=Z.useState(document.hidden);return Z.useEffect(()=>{const n=()=>{e(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),t};let Dy=1,HB=class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{const n=this.subscribers.indexOf(e);this.subscribers.splice(n,1)}),this.publish=e=>{this.subscribers.forEach(n=>n(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var n;const{message:r,...s}=e,i=typeof(e==null?void 0:e.id)=="number"||((n=e.id)==null?void 0:n.length)>0?e.id:Dy++,o=this.toasts.find(l=>l.id===i),a=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(i)&&this.dismissedToasts.delete(i),o?this.toasts=this.toasts.map(l=>l.id===i?(this.publish({...l,...e,id:i,title:r}),{...l,...e,id:i,dismissible:a,title:r}):l):this.addToast({title:r,...s,dismissible:a,id:i}),i},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(n=>n({id:e,dismiss:!0})))):this.toasts.forEach(n=>{this.subscribers.forEach(r=>r({id:n.id,dismiss:!0}))}),e),this.message=(e,n)=>this.create({...n,message:e}),this.error=(e,n)=>this.create({...n,message:e,type:"error"}),this.success=(e,n)=>this.create({...n,type:"success",message:e}),this.info=(e,n)=>this.create({...n,type:"info",message:e}),this.warning=(e,n)=>this.create({...n,type:"warning",message:e}),this.loading=(e,n)=>this.create({...n,type:"loading",message:e}),this.promise=(e,n)=>{if(!n)return;let r;n.loading!==void 0&&(r=this.create({...n,promise:e,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));const s=Promise.resolve(e instanceof Function?e():e);let i=r!==void 0,o;const a=s.then(async c=>{if(o=["resolve",c],Z.isValidElement(c))i=!1,this.create({id:r,type:"default",message:c});else if(qB(c)&&!c.ok){i=!1;const h=typeof n.error=="function"?await n.error(`HTTP error! status: ${c.status}`):n.error,m=typeof n.description=="function"?await n.description(`HTTP error! status: ${c.status}`):n.description,g=typeof h=="object"&&!Z.isValidElement(h)?h:{message:h};this.create({id:r,type:"error",description:m,...g})}else if(c instanceof Error){i=!1;const h=typeof n.error=="function"?await n.error(c):n.error,m=typeof n.description=="function"?await n.description(c):n.description,g=typeof h=="object"&&!Z.isValidElement(h)?h:{message:h};this.create({id:r,type:"error",description:m,...g})}else if(n.success!==void 0){i=!1;const h=typeof n.success=="function"?await n.success(c):n.success,m=typeof n.description=="function"?await n.description(c):n.description,g=typeof h=="object"&&!Z.isValidElement(h)?h:{message:h};this.create({id:r,type:"success",description:m,...g})}}).catch(async c=>{if(o=["reject",c],n.error!==void 0){i=!1;const d=typeof n.error=="function"?await n.error(c):n.error,h=typeof n.description=="function"?await n.description(c):n.description,p=typeof d=="object"&&!Z.isValidElement(d)?d:{message:d};this.create({id:r,type:"error",description:h,...p})}}).finally(()=>{i&&(this.dismiss(r),r=void 0),n.finally==null||n.finally.call(n)}),l=()=>new Promise((c,d)=>a.then(()=>o[0]==="reject"?d(o[1]):c(o[1])).catch(d));return typeof r!="string"&&typeof r!="number"?{unwrap:l}:Object.assign(r,{unwrap:l})},this.custom=(e,n)=>{const r=(n==null?void 0:n.id)||Dy++;return this.create({jsx:e(r),id:r,...n}),r},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}};const Kn=new HB,GB=(t,e)=>{const n=(e==null?void 0:e.id)||Dy++;return Kn.addToast({title:t,...e,id:n}),n},qB=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",WB=GB,KB=()=>Kn.toasts,YB=()=>Kn.getActiveToasts(),he=Object.assign(WB,{success:Kn.success,info:Kn.info,warning:Kn.warning,error:Kn.error,custom:Kn.custom,message:Kn.message,promise:Kn.promise,dismiss:Kn.dismiss,loading:Kn.loading},{getHistory:KB,getToasts:YB});DB("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function bd(t){return t.label!==void 0}const QB=3,XB="24px",JB="16px",_S=4e3,ZB=356,eU=14,tU=45,nU=200;function ns(...t){return t.filter(Boolean).join(" ")}function rU(t){const[e,n]=t.split("-"),r=[];return e&&r.push(e),n&&r.push(n),r}const sU=t=>{var e,n,r,s,i,o,a,l,c;const{invert:d,toast:h,unstyled:m,interacting:p,setHeights:g,visibleToasts:b,heights:E,index:y,toasts:v,expanded:_,removeToast:P,defaultRichColors:D,closeButton:k,style:T,cancelButtonStyle:w,actionButtonStyle:C,className:I="",descriptionClassName:N="",duration:j,position:A,gap:z,expandByDefault:B,classNames:q,icons:X,closeButtonAriaLabel:O="Close toast"}=t,[H,R]=Z.useState(null),[Y,se]=Z.useState(null),[M,$]=Z.useState(!1),[ee,J]=Z.useState(!1),[ae,ce]=Z.useState(!1),[Ze,Ke]=Z.useState(!1),[Ct,gt]=Z.useState(!1),[zn,le]=Z.useState(0),[xe,Oe]=Z.useState(0),qe=Z.useRef(h.duration||j||_S),ke=Z.useRef(null),Ce=Z.useRef(null),Ye=y===0,or=y+1<=b,It=h.type,ar=h.dismissible!==!1,Ji=h.className||"",Sr=h.descriptionClassName||"",W=Z.useMemo(()=>E.findIndex(_e=>_e.toastId===h.id)||0,[E,h.id]),te=Z.useMemo(()=>{var _e;return(_e=h.closeButton)!=null?_e:k},[h.closeButton,k]),ve=Z.useMemo(()=>h.duration||j||_S,[h.duration,j]),Pe=Z.useRef(0),Me=Z.useRef(0),yt=Z.useRef(0),je=Z.useRef(null),[Kt,et]=A.split("-"),Bn=Z.useMemo(()=>E.reduce((_e,ht,st)=>st>=W?_e:_e+ht.height,0),[E,W]),ot=$B(),Ft=h.invert||d,zt=It==="loading";Me.current=Z.useMemo(()=>W*z+Bn,[W,Bn]),Z.useEffect(()=>{qe.current=ve},[ve]),Z.useEffect(()=>{$(!0)},[]),Z.useEffect(()=>{const _e=Ce.current;if(_e){const ht=_e.getBoundingClientRect().height;return Oe(ht),g(st=>[{toastId:h.id,height:ht,position:h.position},...st]),()=>g(st=>st.filter(Bt=>Bt.toastId!==h.id))}},[g,h.id]),Z.useLayoutEffect(()=>{if(!M)return;const _e=Ce.current,ht=_e.style.height;_e.style.height="auto";const st=_e.getBoundingClientRect().height;_e.style.height=ht,Oe(st),g(Bt=>Bt.find(bt=>bt.toastId===h.id)?Bt.map(bt=>bt.toastId===h.id?{...bt,height:st}:bt):[{toastId:h.id,height:st,position:h.position},...Bt])},[M,h.title,h.description,g,h.id,h.jsx,h.action,h.cancel]);const rn=Z.useCallback(()=>{J(!0),le(Me.current),g(_e=>_e.filter(ht=>ht.toastId!==h.id)),setTimeout(()=>{P(h)},nU)},[h,P,g,Me]);Z.useEffect(()=>{if(h.promise&&It==="loading"||h.duration===1/0||h.type==="loading")return;let _e;return _||p||ot?(()=>{if(yt.current{qe.current!==1/0&&(Pe.current=new Date().getTime(),_e=setTimeout(()=>{h.onAutoClose==null||h.onAutoClose.call(h,h),rn()},qe.current))})(),()=>clearTimeout(_e)},[_,p,h,It,ot,rn]),Z.useEffect(()=>{h.delete&&(rn(),h.onDismiss==null||h.onDismiss.call(h,h))},[rn,h.delete]);function Cs(){var _e;if(X!=null&&X.loading){var ht;return Z.createElement("div",{className:ns(q==null?void 0:q.loader,h==null||(ht=h.classNames)==null?void 0:ht.loader,"sonner-loader"),"data-visible":It==="loading"},X.loading)}return Z.createElement(VB,{className:ns(q==null?void 0:q.loader,h==null||(_e=h.classNames)==null?void 0:_e.loader),visible:It==="loading"})}const Zi=h.icon||(X==null?void 0:X[It])||MB(It);var rt,eo;return Z.createElement("li",{tabIndex:0,ref:Ce,className:ns(I,Ji,q==null?void 0:q.toast,h==null||(e=h.classNames)==null?void 0:e.toast,q==null?void 0:q.default,q==null?void 0:q[It],h==null||(n=h.classNames)==null?void 0:n[It]),"data-sonner-toast":"","data-rich-colors":(rt=h.richColors)!=null?rt:D,"data-styled":!(h.jsx||h.unstyled||m),"data-mounted":M,"data-promise":!!h.promise,"data-swiped":Ct,"data-removed":ee,"data-visible":or,"data-y-position":Kt,"data-x-position":et,"data-index":y,"data-front":Ye,"data-swiping":ae,"data-dismissible":ar,"data-type":It,"data-invert":Ft,"data-swipe-out":Ze,"data-swipe-direction":Y,"data-expanded":!!(_||B&&M),"data-testid":h.testId,style:{"--index":y,"--toasts-before":y,"--z-index":v.length-y,"--offset":`${ee?zn:Me.current}px`,"--initial-height":B?"auto":`${xe}px`,...T,...h.style},onDragEnd:()=>{ce(!1),R(null),je.current=null},onPointerDown:_e=>{_e.button!==2&&(zt||!ar||(ke.current=new Date,le(Me.current),_e.target.setPointerCapture(_e.pointerId),_e.target.tagName!=="BUTTON"&&(ce(!0),je.current={x:_e.clientX,y:_e.clientY})))},onPointerUp:()=>{var _e,ht,st;if(Ze||!ar)return;je.current=null;const Bt=Number(((_e=Ce.current)==null?void 0:_e.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Yt=Number(((ht=Ce.current)==null?void 0:ht.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),bt=new Date().getTime()-((st=ke.current)==null?void 0:st.getTime()),Nt=H==="x"?Bt:Yt,Un=Math.abs(Nt)/bt;if(Math.abs(Nt)>=tU||Un>.11){le(Me.current),h.onDismiss==null||h.onDismiss.call(h,h),se(H==="x"?Bt>0?"right":"left":Yt>0?"down":"up"),rn(),Ke(!0);return}else{var At,Qt;(At=Ce.current)==null||At.style.setProperty("--swipe-amount-x","0px"),(Qt=Ce.current)==null||Qt.style.setProperty("--swipe-amount-y","0px")}gt(!1),ce(!1),R(null)},onPointerMove:_e=>{var ht,st,Bt;if(!je.current||!ar||((ht=window.getSelection())==null?void 0:ht.toString().length)>0)return;const bt=_e.clientY-je.current.y,Nt=_e.clientX-je.current.x;var Un;const At=(Un=t.swipeDirections)!=null?Un:rU(A);!H&&(Math.abs(Nt)>1||Math.abs(bt)>1)&&R(Math.abs(Nt)>Math.abs(bt)?"x":"y");let Qt={x:0,y:0};const $n=sn=>1/(1.5+Math.abs(sn)/20);if(H==="y"){if(At.includes("top")||At.includes("bottom"))if(At.includes("top")&&bt<0||At.includes("bottom")&&bt>0)Qt.y=bt;else{const sn=bt*$n(bt);Qt.y=Math.abs(sn)0)Qt.x=Nt;else{const sn=Nt*$n(Nt);Qt.x=Math.abs(sn)0||Math.abs(Qt.y)>0)&>(!0),(st=Ce.current)==null||st.style.setProperty("--swipe-amount-x",`${Qt.x}px`),(Bt=Ce.current)==null||Bt.style.setProperty("--swipe-amount-y",`${Qt.y}px`)}},te&&!h.jsx&&It!=="loading"?Z.createElement("button",{"aria-label":O,"data-disabled":zt,"data-close-button":!0,onClick:zt||!ar?()=>{}:()=>{rn(),h.onDismiss==null||h.onDismiss.call(h,h)},className:ns(q==null?void 0:q.closeButton,h==null||(r=h.classNames)==null?void 0:r.closeButton)},(eo=X==null?void 0:X.close)!=null?eo:UB):null,(It||h.icon||h.promise)&&h.icon!==null&&((X==null?void 0:X[It])!==null||h.icon)?Z.createElement("div",{"data-icon":"",className:ns(q==null?void 0:q.icon,h==null||(s=h.classNames)==null?void 0:s.icon)},h.promise||h.type==="loading"&&!h.icon?h.icon||Cs():null,h.type!=="loading"?Zi:null):null,Z.createElement("div",{"data-content":"",className:ns(q==null?void 0:q.content,h==null||(i=h.classNames)==null?void 0:i.content)},Z.createElement("div",{"data-title":"",className:ns(q==null?void 0:q.title,h==null||(o=h.classNames)==null?void 0:o.title)},h.jsx?h.jsx:typeof h.title=="function"?h.title():h.title),h.description?Z.createElement("div",{"data-description":"",className:ns(N,Sr,q==null?void 0:q.description,h==null||(a=h.classNames)==null?void 0:a.description)},typeof h.description=="function"?h.description():h.description):null),Z.isValidElement(h.cancel)?h.cancel:h.cancel&&bd(h.cancel)?Z.createElement("button",{"data-button":!0,"data-cancel":!0,style:h.cancelButtonStyle||w,onClick:_e=>{bd(h.cancel)&&ar&&(h.cancel.onClick==null||h.cancel.onClick.call(h.cancel,_e),rn())},className:ns(q==null?void 0:q.cancelButton,h==null||(l=h.classNames)==null?void 0:l.cancelButton)},h.cancel.label):null,Z.isValidElement(h.action)?h.action:h.action&&bd(h.action)?Z.createElement("button",{"data-button":!0,"data-action":!0,style:h.actionButtonStyle||C,onClick:_e=>{bd(h.action)&&(h.action.onClick==null||h.action.onClick.call(h.action,_e),!_e.defaultPrevented&&rn())},className:ns(q==null?void 0:q.actionButton,h==null||(c=h.classNames)==null?void 0:c.actionButton)},h.action.label):null)};function SS(){if(typeof window>"u"||typeof document>"u")return"ltr";const t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}function iU(t,e){const n={};return[t,e].forEach((r,s)=>{const i=s===1,o=i?"--mobile-offset":"--offset",a=i?JB:XB;function l(c){["top","right","bottom","left"].forEach(d=>{n[`${o}-${d}`]=typeof c=="number"?`${c}px`:c})}typeof r=="number"||typeof r=="string"?l(r):typeof r=="object"?["top","right","bottom","left"].forEach(c=>{r[c]===void 0?n[`${o}-${c}`]=a:n[`${o}-${c}`]=typeof r[c]=="number"?`${r[c]}px`:r[c]}):l(a)}),n}const oU=Z.forwardRef(function(e,n){const{id:r,invert:s,position:i="bottom-right",hotkey:o=["altKey","KeyT"],expand:a,closeButton:l,className:c,offset:d,mobileOffset:h,theme:m="light",richColors:p,duration:g,style:b,visibleToasts:E=QB,toastOptions:y,dir:v=SS(),gap:_=eU,icons:P,containerAriaLabel:D="Notifications"}=e,[k,T]=Z.useState([]),w=Z.useMemo(()=>r?k.filter(M=>M.toasterId===r):k.filter(M=>!M.toasterId),[k,r]),C=Z.useMemo(()=>Array.from(new Set([i].concat(w.filter(M=>M.position).map(M=>M.position)))),[w,i]),[I,N]=Z.useState([]),[j,A]=Z.useState(!1),[z,B]=Z.useState(!1),[q,X]=Z.useState(m!=="system"?m:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),O=Z.useRef(null),H=o.join("+").replace(/Key/g,"").replace(/Digit/g,""),R=Z.useRef(null),Y=Z.useRef(!1),se=Z.useCallback(M=>{T($=>{var ee;return(ee=$.find(J=>J.id===M.id))!=null&&ee.delete||Kn.dismiss(M.id),$.filter(({id:J})=>J!==M.id)})},[]);return Z.useEffect(()=>Kn.subscribe(M=>{if(M.dismiss){requestAnimationFrame(()=>{T($=>$.map(ee=>ee.id===M.id?{...ee,delete:!0}:ee))});return}setTimeout(()=>{lD.flushSync(()=>{T($=>{const ee=$.findIndex(J=>J.id===M.id);return ee!==-1?[...$.slice(0,ee),{...$[ee],...M},...$.slice(ee+1)]:[M,...$]})})})}),[k]),Z.useEffect(()=>{if(m!=="system"){X(m);return}if(m==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?X("dark"):X("light")),typeof window>"u")return;const M=window.matchMedia("(prefers-color-scheme: dark)");try{M.addEventListener("change",({matches:$})=>{X($?"dark":"light")})}catch{M.addListener(({matches:ee})=>{try{X(ee?"dark":"light")}catch(J){console.error(J)}})}},[m]),Z.useEffect(()=>{k.length<=1&&A(!1)},[k]),Z.useEffect(()=>{const M=$=>{var ee;if(o.every(ce=>$[ce]||$.code===ce)){var ae;A(!0),(ae=O.current)==null||ae.focus()}$.code==="Escape"&&(document.activeElement===O.current||(ee=O.current)!=null&&ee.contains(document.activeElement))&&A(!1)};return document.addEventListener("keydown",M),()=>document.removeEventListener("keydown",M)},[o]),Z.useEffect(()=>{if(O.current)return()=>{R.current&&(R.current.focus({preventScroll:!0}),R.current=null,Y.current=!1)}},[O.current]),Z.createElement("section",{ref:n,"aria-label":`${D} ${H}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},C.map((M,$)=>{var ee;const[J,ae]=M.split("-");return w.length?Z.createElement("ol",{key:M,dir:v==="auto"?SS():v,tabIndex:-1,ref:O,className:c,"data-sonner-toaster":!0,"data-sonner-theme":q,"data-y-position":J,"data-x-position":ae,style:{"--front-toast-height":`${((ee=I[0])==null?void 0:ee.height)||0}px`,"--width":`${ZB}px`,"--gap":`${_}px`,...b,...iU(d,h)},onBlur:ce=>{Y.current&&!ce.currentTarget.contains(ce.relatedTarget)&&(Y.current=!1,R.current&&(R.current.focus({preventScroll:!0}),R.current=null))},onFocus:ce=>{ce.target instanceof HTMLElement&&ce.target.dataset.dismissible==="false"||Y.current||(Y.current=!0,R.current=ce.relatedTarget)},onMouseEnter:()=>A(!0),onMouseMove:()=>A(!0),onMouseLeave:()=>{z||A(!1)},onDragEnd:()=>A(!1),onPointerDown:ce=>{ce.target instanceof HTMLElement&&ce.target.dataset.dismissible==="false"||B(!0)},onPointerUp:()=>B(!1)},w.filter(ce=>!ce.position&&$===0||ce.position===M).map((ce,Ze)=>{var Ke,Ct;return Z.createElement(sU,{key:ce.id,icons:P,index:Ze,toast:ce,defaultRichColors:p,duration:(Ke=y==null?void 0:y.duration)!=null?Ke:g,className:y==null?void 0:y.className,descriptionClassName:y==null?void 0:y.descriptionClassName,invert:s,visibleToasts:E,closeButton:(Ct=y==null?void 0:y.closeButton)!=null?Ct:l,interacting:z,position:M,style:y==null?void 0:y.style,unstyled:y==null?void 0:y.unstyled,classNames:y==null?void 0:y.classNames,cancelButtonStyle:y==null?void 0:y.cancelButtonStyle,actionButtonStyle:y==null?void 0:y.actionButtonStyle,closeButtonAriaLabel:y==null?void 0:y.closeButtonAriaLabel,removeToast:se,toasts:w.filter(gt=>gt.position==ce.position),heights:I.filter(gt=>gt.position==ce.position),setHeights:N,expandByDefault:a,gap:_,expanded:j,swipeDirections:e.swipeDirections})})):null}))});function aU({currentSection:t,isOpen:e,onClose:n,onMangaCreated:r,editingManga:s,onDelete:i,availableVideos:o=[]}){const a=!!s,[l,c]=V.useState(!1),[d,h]=V.useState([]),[m,p]=V.useState(null),[g,b]=V.useState(null),[E,y]=V.useState(!1),[v,_]=V.useState(null),[P,D]=V.useState({title:"",video_url:"",description:"",section:t==="flow"?"peliculas":t,thumbnail_position:"50",folder_id:"",episode:""}),[k,T]=V.useState([]),[w,C]=V.useState([]),[I,N]=V.useState([]),j=async()=>{const R=await gl();h(R)};V.useEffect(()=>{e&&!o.length&&j()},[e,o]);const A=o.length?o:d;V.useEffect(()=>{if(e)if(s){const R={title:s.title||"",video_url:s.video_url||(s.servers&&s.servers.length>0?s.servers[0]:""),description:s.description||"",section:s.section||t,thumbnail_position:s.thumbnail_position?s.thumbnail_position.split("%")[0]:"50",folder_id:s.folder_id||"",episode:s.episode||""};if(D(R),s.servers&&s.servers.length>1?C(s.servers.slice(1)):C([]),R.folder_id){const Y=A.filter(se=>se.folder_id===R.folder_id&&!se.is_folder).sort((se,M)=>(Number(se.episode)||0)-(Number(M.episode)||0));T(Y)}}else D({title:"",video_url:"",description:"",section:t==="flow"?"peliculas":t,thumbnail_position:"50",folder_id:"",episode:""}),T([]),C([]),N([])},[e,s,t,A]);const z=R=>{const{name:Y,value:se}=R.target;D(M=>({...M,[Y]:se}))},B=()=>{D({title:"",video_url:"",description:"",section:t==="flow"?"peliculas":t,thumbnail_position:"50",folder_id:"",episode:""}),p(null),b(null),C([]),N([]),n()},q=R=>{const Y=/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/,se=R.match(Y);return se&&se[2].length===11?se[2]:null},X=R=>{if(!R)return null;const Y=R.match(/(?:vimeo\.com\/|player\.vimeo\.com\/video\/)([0-9]+)/);return Y?Y[1]:null},O=R=>{if(!R)return null;const Y=R.match(/\/file\/d\/([a-zA-Z0-9_\-]+)/);return Y?Y[1]:null},H=async()=>{var R,Y;if(!P.title.trim()||!P.video_url.trim()){he.error("Tanto el título como el enlace del video son requeridos");return}c(!0);try{let se=(s==null?void 0:s.cover_url)||void 0,M=(s==null?void 0:s.thumbnail_url)||void 0;if(m){const J=new FormData;J.append("image",m);try{const ce=await(await fetch("https://api.imgbb.com/1/upload?key=7355790b4703d6853d1be61aab165411",{method:"POST",body:J})).json();if(ce.success)se=ce.data.url,M=ce.data.url;else throw new Error(((R=ce.error)==null?void 0:R.message)||"Error de ImgBB")}catch(ae){console.error("Upload catch error:",ae),_(ae.message),c(!1);return}}const $=[{title:P.title.trim(),url:P.video_url.trim(),servers:[P.video_url.trim(),...w].filter(J=>J.trim()!=="")},...I.filter(J=>J.title.trim()&&J.video_url.trim()).map(J=>({title:J.title.trim(),url:J.video_url.trim(),servers:[J.video_url.trim()]}))];let ee=s==null?void 0:s.id;for(let J=0;J<$.length;J++){const ae=$[J];let ce=M;if(!ce){const Ke=q(ae.url),Ct=O(ae.url),gt=X(ae.url);if(Ke)ce=`https://img.youtube.com/vi/${Ke}/maxresdefault.jpg`;else if(Ct)ce=`https://drive.google.com/thumbnail?id=${Ct}&sz=w1280-h720`;else if(gt){const zn=await fetch(`https://vimeo.com/api/v2/video/${gt}.json`).catch(()=>null);zn&&(ce=(Y=(await zn.json())[0])==null?void 0:Y.thumbnail_large)}}const Ze={title:ae.title,author:"Anónimo",description:P.description.trim(),video_url:ae.url,thumbnail_url:ce,cover_url:se||ce,section:P.section,servers:ae.servers,episode:P.episode?parseInt(P.episode.toString())+J:J+1,status:"Completado",categoryIds:[],thumbnail_position:`${P.thumbnail_position}% center`};if($.length>1&&(Ze.folder_id=ee),a&&J===0&&s)await ru(s.id,Ze),ee=s.id,$.length===1&&r(s.id);else{const Ke=await vB(Ze);J===0&&(ee=Ke.id,$.length>1&&await ru(Ke.id,{...Ze,folder_id:Ke.id})),J===$.length-1&&r(Ke.id)}}he.success($.length>1?"Colección creada correctamente":a?"Video actualizado":"Video creado correctamente"),B()}catch(se){console.error("Error saving:",se),he.error("Error al guardar: "+(se.message||"Error desconocido"))}finally{c(!1)}};return e?u.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-[60] p-4",children:u.jsxs("div",{className:"bg-gradient-to-b from-[#1f1f1f] to-[#121212] rounded-2xl border border-gray-700/40 w-full max-w-lg shadow-2xl overflow-hidden flex flex-col max-h-[90vh] animate-in fade-in zoom-in-95 duration-200",children:[u.jsxs("div",{className:"bg-gradient-to-b from-[#2a2a2a]/80 to-[#1f1f1f]/80 border-b border-gray-700/30 px-6 py-4 flex items-center justify-between shrink-0",children:[u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx("div",{className:"p-2 bg-gradient-to-br from-[#bb86fc] to-[#9966dd] rounded-lg shadow-lg shadow-[#bb86fc]/30",children:u.jsx(Jk,{className:"w-5 h-5 text-white"})}),u.jsxs("div",{children:[u.jsx("h2",{className:"text-xl font-bold text-white",children:a?"Editar Video":"Subir Video"}),u.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:a?"Actualiza la información del video":"Añade un nuevo enlace (Drive, Mediafire, Telegram, Xvideos, etc)"})]})]}),u.jsx("button",{onClick:B,className:"text-gray-500 hover:text-white transition-colors p-1.5 rounded-lg hover:bg-white/10",children:u.jsx(mt,{className:"w-5 h-5"})})]}),u.jsxs("div",{className:"p-6 space-y-5 overflow-y-auto",children:[u.jsxs("div",{className:"space-y-4",children:[u.jsxs("div",{children:[u.jsxs("div",{className:"flex items-center justify-between mb-2",children:[u.jsxs("label",{className:"text-xs font-semibold text-gray-200",children:["Título del Video ",u.jsx("span",{className:"text-red-400 font-bold",children:"*"})]}),!a&&u.jsxs("button",{type:"button",onClick:()=>N([...I,{title:"",video_url:""}]),className:"text-[10px] bg-[#00d1ff]/10 text-[#00d1ff] px-2 py-1 rounded hover:bg-[#00d1ff]/20 transition-colors flex items-center gap-1 border border-[#00d1ff]/20",children:[u.jsx(as,{className:"w-3 h-3"}),"Crear Colección"]})]}),u.jsx("input",{type:"text",name:"title",placeholder:"El nombre del video",value:P.title,onChange:z,className:"w-full bg-[#1a1a1a] border border-gray-600/50 rounded-lg px-4 py-3 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-[#bb86fc] focus:ring-2 focus:ring-[#bb86fc]/30 transition-all shadow-md hover:border-gray-600/70"})]}),I.map((R,Y)=>u.jsxs("div",{className:"space-y-3 p-4 bg-[#00d1ff]/5 rounded-xl border border-[#00d1ff]/20 animate-in slide-in-from-right-4 duration-300",children:[u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsxs("span",{className:"text-[10px] font-bold text-[#00d1ff] uppercase tracking-widest",children:["Parte ",Y+2]}),u.jsx("button",{type:"button",onClick:()=>N(I.filter((se,M)=>M!==Y)),className:"p-1 text-red-400 hover:bg-red-400/10 rounded-lg transition-colors",children:u.jsx(pn,{className:"w-3.5 h-3.5"})})]}),u.jsxs("div",{className:"space-y-3",children:[u.jsx("input",{type:"text",placeholder:`Título del Video ${Y+2}`,value:R.title,onChange:se=>{const M=[...I];M[Y].title=se.target.value,N(M)},className:"w-full bg-[#1a1a1a] border border-gray-700/50 rounded-lg px-3 py-2 text-xs text-white placeholder-gray-600 focus:outline-none focus:border-[#00d1ff]/50 transition-all"}),u.jsx("input",{type:"url",placeholder:`Enlace del Video ${Y+2}`,value:R.video_url,onChange:se=>{const M=[...I];M[Y].video_url=se.target.value,N(M)},className:"w-full bg-[#1a1a1a] border border-gray-700/50 rounded-lg px-3 py-2 text-xs text-white placeholder-gray-600 focus:outline-none focus:border-[#00d1ff]/50 transition-all"})]})]},Y)),u.jsxs("div",{children:[u.jsxs("div",{className:"flex items-center justify-between mb-2",children:[u.jsxs("label",{className:"text-xs font-semibold text-gray-200",children:["Enlace Principal (Servidor 1) ",u.jsx("span",{className:"text-red-400 font-bold",children:"*"})]}),u.jsxs("button",{type:"button",onClick:()=>C([...w,""]),className:"text-[10px] bg-[#bb86fc]/10 text-[#bb86fc] px-2 py-1 rounded hover:bg-[#bb86fc]/20 transition-colors flex items-center gap-1",children:[u.jsx(as,{className:"w-3 h-3"}),"Añadir Servidor"]})]}),u.jsxs("div",{className:"space-y-3",children:[u.jsx("input",{type:"url",name:"video_url",placeholder:"https://...",value:P.video_url,onChange:z,className:"w-full bg-[#1a1a1a] border border-gray-600/50 rounded-lg px-4 py-3 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-[#bb86fc] focus:ring-2 focus:ring-[#bb86fc]/30 transition-all shadow-md hover:border-gray-600/70"}),w.map((R,Y)=>u.jsxs("div",{className:"flex gap-2 items-center bg-[#1a1a1a]/30 p-2 rounded-xl border border-gray-800/50 animate-in slide-in-from-left-2 duration-200",children:[u.jsx("div",{className:"w-8 h-8 rounded-lg bg-[#bb86fc]/10 flex items-center justify-center text-[#bb86fc] flex-shrink-0",children:u.jsxs("span",{className:"text-[10px] font-bold",children:["V",Y+2]})}),u.jsx("input",{type:"url",value:R,onChange:se=>{const M=[...w];M[Y]=se.target.value,C(M)},placeholder:`Enlace del Servidor ${Y+2}`,className:"flex-1 bg-transparent border-none text-xs text-white placeholder-gray-600 focus:outline-none transition-all py-1"}),u.jsx("button",{type:"button",onClick:()=>{const se=w.filter((M,$)=>$!==Y);C(se)},className:"p-2 text-red-500/50 hover:text-red-500 hover:bg-red-500/10 rounded-lg transition-all",title:"Eliminar servidor",children:u.jsx(pn,{className:"w-3.5 h-3.5"})})]},Y))]})]}),u.jsxs("div",{children:[u.jsx("label",{className:"block text-xs font-semibold text-gray-200 mb-2",children:"Descripción"}),u.jsx("textarea",{name:"description",placeholder:"Añade una descripción para el video (opcional)",value:P.description,onChange:z,rows:3,className:"w-full bg-[#1a1a1a] border border-gray-600/50 rounded-lg px-4 py-3 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-[#bb86fc] focus:ring-2 focus:ring-[#bb86fc]/30 transition-all shadow-md hover:border-gray-600/70 resize-none"})]}),u.jsxs("div",{children:[u.jsxs("label",{className:"block text-xs font-semibold text-gray-200 mb-2",children:["Catálogo ",u.jsx("span",{className:"text-red-400 font-bold",children:"*"})]}),u.jsxs("select",{name:"section",value:P.section,onChange:z,className:"w-full bg-[#1a1a1a] border border-gray-600/50 rounded-lg px-4 py-3 text-sm text-white focus:outline-none focus:border-[#bb86fc] focus:ring-2 focus:ring-[#bb86fc]/30 transition-all shadow-md hover:border-gray-600/70",children:[u.jsx("option",{value:"peliculas",children:"Películas"}),u.jsx("option",{value:"series",children:"Series"})]})]}),u.jsxs("div",{children:[u.jsx("label",{className:"block text-xs font-semibold text-gray-200 mb-2",children:"Portada Personalizada (Opcional)"}),u.jsxs("div",{className:"flex items-center gap-4",children:[u.jsxs("label",{className:"flex items-center justify-center gap-2 bg-[#1a1a1a] border border-gray-600/50 hover:border-[#bb86fc]/50 rounded-lg px-4 py-3 text-sm text-gray-300 font-medium cursor-pointer transition-all shadow-md group flex-1",children:[u.jsx(PD,{className:"w-4 h-4 text-gray-400 group-hover:text-[#bb86fc] transition-colors"}),u.jsx("span",{children:m?"Cambiar Imagen":"Sube tu propia portada"}),u.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:R=>{if(R.target.files&&R.target.files[0]){const Y=R.target.files[0];p(Y),b(URL.createObjectURL(Y))}}})]}),(g||(s==null?void 0:s.thumbnail_url))&&!(!g&&!(s!=null&&s.thumbnail_url))&&u.jsx("div",{className:"w-14 h-14 rounded-lg overflow-hidden border border-gray-600/50 shrink-0",children:u.jsx("img",{src:g||(s==null?void 0:s.thumbnail_url),alt:"Preview",className:"w-full h-full object-cover"})})]}),u.jsx("p",{className:"text-[10px] text-gray-500 mt-1.5",children:"Si dejas esto vacío, el sistema intentará extraer un fotograma automáticamente."})]}),P.folder_id&&u.jsxs("div",{className:"bg-[#1a1a1a] rounded-xl border border-[#bb86fc]/30 p-4 space-y-4 animate-in fade-in zoom-in-95 duration-300",children:[u.jsx("div",{className:"flex items-center justify-between",children:u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx(Ra,{className:"w-4 h-4 text-[#bb86fc]"}),u.jsx("span",{className:"text-[11px] font-bold text-white uppercase tracking-wider",children:"Parte de una Colección"})]})}),u.jsx("div",{className:"space-y-2 max-h-72 overflow-y-auto pr-2 custom-scrollbar p-1",children:u.jsx(DV,{axis:"y",values:k,onReorder:async R=>{T(R);const Y=R.map(async(se,M)=>{if(se.episode!==M+1)return yB(se.id,M+1)});await Promise.all(Y)},className:"space-y-2",children:k.map((R,Y)=>u.jsxs(UV,{value:R,className:`group flex items-center gap-3 p-3 rounded-xl border transition-colors ${R.id===(s==null?void 0:s.id)?"bg-[#bb86fc]/10 border-[#bb86fc]/40":"bg-black/30 border-white/5 hover:border-white/10"}`,children:[u.jsx("div",{className:"text-gray-600 cursor-grab active:cursor-grabbing hover:text-white transition-colors",children:u.jsx(_D,{className:"w-5 h-5"})}),u.jsx("div",{className:"flex flex-col items-center justify-center min-w-[24px] h-6 rounded bg-black/40 text-[9px] font-bold text-[#bb86fc]",children:Y+1}),u.jsx("div",{className:"flex-1 min-w-0",children:u.jsx("p",{className:`text-[11px] font-medium truncate ${R.id===(s==null?void 0:s.id)?"text-white":"text-gray-400"}`,children:R.title})}),R.id===(s==null?void 0:s.id)&&u.jsx("div",{className:"px-2 py-1 bg-[#bb86fc] text-black text-[9px] font-black rounded uppercase",children:"Editando"})]},R.id))})})]}),(a||g||P.video_url&&(q(P.video_url)||O(P.video_url)))&&u.jsxs("div",{className:"bg-[#1a1a1a]/50 p-4 rounded-xl border border-gray-700/30 space-y-3 animate-in fade-in slide-in-from-top-2 duration-300",children:[u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsx("label",{className:"block text-xs font-semibold text-gray-200",children:"Posición de Miniatura (Deslizar)"}),u.jsxs("span",{className:"text-[10px] font-bold text-[#bb86fc] bg-[#bb86fc]/10 px-2 py-0.5 rounded",children:[P.thumbnail_position,"%"]})]}),u.jsx("input",{type:"range",name:"thumbnail_position",min:"0",max:"100",value:P.thumbnail_position,onChange:z,className:"w-full h-1.5 bg-gray-700 rounded-lg appearance-none cursor-pointer accent-[#bb86fc]"}),u.jsxs("div",{className:"flex justify-between text-[10px] text-gray-500 font-medium px-1",children:[u.jsx("span",{children:"Izquierda"}),u.jsx("span",{children:"Centro"}),u.jsx("span",{children:"Derecha"})]})]}),(g||(s==null?void 0:s.thumbnail_url)||P.video_url&&(q(P.video_url)||O(P.video_url)))&&u.jsxs("div",{className:"mt-4 border border-[#bb86fc]/30 rounded-xl overflow-hidden aspect-[2/3] relative shadow-lg",children:[u.jsx("img",{src:g||(P.video_url&&q(P.video_url)?`https://img.youtube.com/vi/${q(P.video_url)}/maxresdefault.jpg`:P.video_url&&O(P.video_url)?`https://drive.google.com/thumbnail?id=${O(P.video_url)}&sz=w1280-h720`:s==null?void 0:s.thumbnail_url),alt:"Miniatura generada",className:"w-full h-full object-cover",style:{objectPosition:`${P.thumbnail_position}% center`}}),u.jsx("div",{className:"absolute inset-x-0 bottom-0 bg-black/60 p-2",children:u.jsxs("p",{className:"text-xs text-white text-center font-medium",children:["Miniatura detectada ",g?"Personalizada (Nueva)":s!=null&&s.thumbnail_url&&!q(P.video_url)&&!O(P.video_url)?"Personalizada (Actual)":O(P.video_url)?"de Google Drive":"de YouTube"]})})]})]}),u.jsxs("div",{className:"flex gap-3 pt-4 border-t border-gray-700/50",children:[a&&i&&u.jsx("button",{onClick:()=>y(!0),className:"text-red-500 bg-red-500/10 hover:bg-red-500/20 shadow border border-red-500/30 px-4 py-2 rounded-lg font-semibold text-sm transition-all mr-auto",children:"Eliminar"}),u.jsx("button",{onClick:B,disabled:l,className:"bg-[#1a1a1a] border border-gray-600/50 hover:bg-[#242424] text-white px-4 py-2 flex-1 md:flex-none rounded-lg font-semibold text-sm transition-all shadow-md",children:"Cancelar"}),u.jsx("button",{onClick:H,disabled:l||!P.title.trim()||!P.video_url.trim(),className:"bg-gradient-to-r from-[#bb86fc] to-[#9966dd] hover:from-[#9966dd] hover:to-[#7744cc] text-white px-6 py-2 flex-1 rounded-lg font-semibold text-sm transition-all shadow-lg disabled:opacity-50",children:l?"Procesando...":a?"Actualizar Video":"Subir Video"})]}),E&&u.jsxs("div",{className:"absolute inset-0 bg-black/80 backdrop-blur-sm flex flex-col items-center justify-center gap-4 rounded-3xl z-50 animate-in fade-in zoom-in-95 duration-200",children:[u.jsx("div",{className:"bg-red-500/10 p-3 rounded-full text-red-500",children:u.jsx(mt,{className:"w-8 h-8"})}),u.jsxs("div",{className:"text-center px-8",children:[u.jsx("h3",{className:"text-lg font-bold text-white mb-2",children:"¿Eliminar video?"}),u.jsx("p",{className:"text-sm text-gray-400",children:"Esta acción no se puede deshacer. El video se moverá a la papelera."})]}),u.jsxs("div",{className:"flex gap-3 w-full max-w-xs px-6",children:[u.jsx("button",{onClick:()=>y(!1),className:"flex-1 bg-gray-800 hover:bg-gray-700 text-white py-3 rounded-xl font-semibold text-sm transition-all",children:"Cancelar"}),u.jsx("button",{onClick:()=>{i(s.id),n()},className:"flex-1 bg-red-600 hover:bg-red-700 text-white py-3 rounded-xl font-bold text-sm transition-all shadow-lg shadow-red-600/20",children:"Eliminar"})]})]}),v&&u.jsxs("div",{className:"absolute inset-0 bg-black/80 backdrop-blur-sm flex flex-col items-center justify-center gap-4 rounded-3xl z-50 animate-in fade-in zoom-in-95 duration-200",children:[u.jsx("div",{className:"bg-yellow-500/10 p-3 rounded-full text-yellow-500",children:u.jsx(Gk,{className:"w-8 h-8"})}),u.jsxs("div",{className:"text-center px-8",children:[u.jsx("h3",{className:"text-lg font-bold text-white mb-2",children:"Error de Portada"}),u.jsxs("p",{className:"text-sm text-gray-400",children:["Hubo un error al subir tu imagen a ImgBB: ",u.jsx("span",{className:"text-yellow-500/80 italic",children:v})]}),u.jsx("p",{className:"text-xs text-gray-500 mt-2",children:"¿Quieres intentar guardarlo usando la portada automática del video?"})]}),u.jsxs("div",{className:"flex gap-3 w-full max-w-xs px-6 mt-2",children:[u.jsx("button",{onClick:()=>_(null),className:"flex-1 bg-gray-800 hover:bg-gray-700 text-white py-3 rounded-xl font-semibold text-sm transition-all",children:"Reintentar"}),u.jsx("button",{onClick:()=>{p(null),b(null),_(null),H()},className:"flex-1 bg-[#bb86fc] hover:bg-[#9966dd] text-white py-3 rounded-xl font-bold text-sm transition-all shadow-lg",children:"Usar Automática"})]})]})]})]})}):null}const wA="settings",bA="announcement";async function ES(t,e){const n=wt(Ae,wA,bA),r=new Date;let s=null;e&&(s=new Date(r.getTime()+e).toISOString());const i={text:t,updatedAt:r.toISOString(),expiresAt:s};await VN(n,i)}function lU(t){const e=wt(Ae,wA,bA);return sv(e,n=>{n.exists()?t(n.data()):t(null)})}function cU({isOpen:t,onClose:e,isAdmin:n,onAdminChange:r,isCategoryPlusEnabled:s,onCategoryPlusChange:i,isCopyIdsEnabled:o,onCopyIdsChange:a,isDeletePlusEnabled:l,onDeletePlusChange:c,isCategoryMinusEnabled:d,onCategoryMinusChange:h,isEditTitlePlusEnabled:m,onEditTitlePlusChange:p,isEtiquetadoraEnabled:g,onEtiquetadoraChange:b,isFolderPlusEnabled:E,onFolderPlusChange:y,isPortalPlusEnabled:v,onPortalPlusChange:_,isFolderAnimationEnabled:P,onFolderAnimationChange:D,isMergePlusEnabled:k,onMergePlusChange:T,isTransferPlusEnabled:w,onTransferPlusChange:C,onOpenTitleManager:I,onOpenFolderMap:N,onCleanKemonoTitles:j}){const[A,z]=V.useState(""),[B,q]=V.useState(24),[X,O]=V.useState("hours"),[H,R]=V.useState(!1),[Y,se]=V.useState(!1),[M,$]=V.useState({current:0,total:0,title:""});V.useEffect(()=>{},[t]);const ee=async()=>{if(!A.trim()){he.error("El texto del anuncio no puede estar vacío");return}let ae=0;X==="seconds"&&(ae=B*1e3),X==="minutes"&&(ae=B*60*1e3),X==="hours"&&(ae=B*60*60*1e3),X==="days"&&(ae=B*24*60*60*1e3);try{await ES(A,ae),he.success("Anuncio publicado exitosamente"),z(""),e()}catch(ce){console.error(ce),he.error("Error al publicar el anuncio")}},J=async()=>{try{await ES("",null),z(""),R(!1),he.success("Anuncio eliminado.")}catch(ae){console.error(ae),he.error("Error al eliminar")}};return t?u.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50 p-4 animate-in fade-in duration-200",children:u.jsxs("div",{className:"bg-[#121212] rounded-2xl border border-gray-800 w-full max-w-lg shadow-2xl overflow-hidden flex flex-col max-h-[90vh]",children:[u.jsxs("div",{className:"bg-[#1a1a1a] border-b border-gray-800 px-6 py-4 flex items-center justify-between sticky top-0 z-10",children:[u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx("div",{className:"p-2 bg-[#bb86fc]/10 rounded-lg text-[#bb86fc]",children:u.jsx(Qk,{className:"w-5 h-5"})}),u.jsx("h2",{className:"text-xl font-bold text-white",children:"Ajustes de Administrador"})]}),u.jsx("button",{onClick:e,className:"text-gray-400 hover:text-white transition-colors p-2 hover:bg-white/5 rounded-lg",children:u.jsx(mt,{className:"w-5 h-5"})})]}),u.jsx("div",{className:"p-6 space-y-8 overflow-y-auto custom-scrollbar",children:u.jsxs(u.Fragment,{children:[u.jsxs("section",{className:"space-y-4",children:[u.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[u.jsx("div",{className:"p-2 bg-purple-500/10 rounded-lg text-purple-400",children:u.jsx(Wk,{className:"w-5 h-5"})}),u.jsxs("div",{children:[u.jsx("h3",{className:"tex-sm font-semibold text-white",children:"Publicar Anuncio"}),u.jsx("p",{className:"text-xs text-gray-400",children:"Visible para todos los usuarios"})]})]}),u.jsxs("div",{className:"space-y-3",children:[u.jsx("textarea",{value:A,onChange:ae=>z(ae.target.value),placeholder:"Escribe el mensaje del anuncio...",className:"w-full bg-[#1a1a1a] border border-gray-700 rounded-lg px-4 py-3 text-sm text-white placeholder-gray-600 focus:outline-none focus:border-[#bb86fc] min-h-[100px] resize-none"}),u.jsxs("div",{className:"flex gap-3",children:[u.jsxs("div",{className:"flex-1 bg-[#1a1a1a] border border-gray-700 rounded-lg px-3 py-2 flex items-center gap-2",children:[u.jsx(vD,{className:"w-4 h-4 text-gray-400"}),u.jsx("input",{type:"number",min:"1",value:B,onChange:ae=>q(Number(ae.target.value)),className:"bg-transparent text-white text-sm w-full focus:outline-none"})]}),u.jsxs("select",{value:X,onChange:ae=>O(ae.target.value),className:"bg-[#1a1a1a] border border-gray-700 rounded-lg px-3 py-2 text-sm text-white focus:outline-none focus:border-[#bb86fc]",children:[u.jsx("option",{value:"seconds",children:"Segundos"}),u.jsx("option",{value:"minutes",children:"Minutos"}),u.jsx("option",{value:"hours",children:"Horas"}),u.jsx("option",{value:"days",children:"Días"})]})]}),u.jsxs("div",{className:"flex gap-2",children:[u.jsx("button",{onClick:()=>R(!0),className:"px-4 py-2.5 rounded-lg font-semibold text-sm bg-red-500/10 text-red-500 border border-red-500/20 hover:bg-red-500/20 transition-colors",title:"Eliminar anuncio",children:u.jsx(pn,{className:"w-5 h-5"})}),u.jsx("button",{onClick:ee,className:"flex-1 bg-gradient-to-r from-[#bb86fc] to-[#9966dd] hover:from-[#9966dd] hover:to-[#7744cc] text-white py-2.5 rounded-lg font-semibold text-sm transition-all shadow-lg shadow-[#bb86fc]/20",children:"Publicar Anuncio"})]})]})]}),u.jsx("div",{className:"h-px w-full bg-gray-800 my-6"}),u.jsxs("section",{className:"space-y-4",children:[u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx("div",{className:"p-2 bg-[#bb86fc]/10 rounded-lg text-[#bb86fc]",children:u.jsx(Hk,{className:"w-5 h-5"})}),u.jsxs("div",{children:[u.jsx("h3",{className:"text-sm font-semibold text-white",children:"Colección Plus"}),u.jsx("p",{className:"text-xs text-gray-400",children:"Agrupar videos en colecciones"})]})]}),u.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[u.jsx("input",{type:"checkbox",className:"sr-only peer",checked:E,onChange:ae=>{y(ae.target.checked),ae.target.checked&&he.success("Colección Plus Activada")}}),u.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-[#bb86fc]"})]})]}),u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx("div",{className:"p-2 bg-red-500/10 rounded-lg text-red-500",children:u.jsx(wD,{className:"w-5 h-5"})}),u.jsxs("div",{children:[u.jsx("h3",{className:"text-sm font-semibold text-white",children:"Eliminación Plus"}),u.jsx("p",{className:"text-xs text-gray-400",children:"Eliminar múltiples videos a la vez"})]})]}),u.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[u.jsx("input",{type:"checkbox",className:"sr-only peer",checked:l,onChange:ae=>{c(ae.target.checked),ae.target.checked&&he.success("Eliminación Plus Activada")}}),u.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-red-500"})]})]}),u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx("div",{className:"p-2 bg-blue-500/10 rounded-lg text-blue-400",children:u.jsx(Uk,{className:"w-5 h-5"})}),u.jsxs("div",{children:[u.jsx("h3",{className:"text-sm font-semibold text-white",children:"ID Plus"}),u.jsx("p",{className:"text-xs text-gray-400",children:"Copiar múltiples IDs al portapapeles"})]})]}),u.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[u.jsx("input",{type:"checkbox",className:"sr-only peer",checked:o,onChange:ae=>{a(ae.target.checked),ae.target.checked&&he.success("ID Plus Activada")}}),u.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-blue-500"})]})]}),u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx("div",{className:"p-2 bg-pink-500/10 rounded-lg text-pink-400",children:u.jsx(jf,{className:"w-5 h-5"})}),u.jsxs("div",{children:[u.jsx("h3",{className:"text-sm font-semibold text-white",children:"Nombre Plus"}),u.jsx("p",{className:"text-xs text-gray-400",children:"Editar nombres de forma masiva"})]})]}),u.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[u.jsx("input",{type:"checkbox",className:"sr-only peer",checked:m,onChange:ae=>{p(ae.target.checked),ae.target.checked&&he.success("Nombre Plus Activado")}}),u.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-pink-500"})]})]})]})]})}),H&&u.jsx("div",{className:"absolute inset-0 bg-black/80 backdrop-blur-sm flex items-center justify-center z-50 p-6 animate-in fade-in duration-200",children:u.jsx("div",{className:"bg-[#1a1a1a] border border-gray-700 w-full max-w-sm rounded-xl shadow-2xl p-6 transform scale-100 animate-in zoom-in-95 duration-200",children:u.jsxs("div",{className:"flex flex-col items-center text-center gap-4",children:[u.jsx("div",{className:"p-3 bg-red-500/10 rounded-full text-red-500",children:u.jsx(pn,{className:"w-8 h-8"})}),u.jsxs("div",{children:[u.jsx("h3",{className:"text-lg font-bold text-white mb-1",children:"¿Eliminar anuncio?"}),u.jsx("p",{className:"text-sm text-gray-400",children:"Esta acción eliminará el anuncio actual inmediatamente. No se puede deshacer."})]}),u.jsxs("div",{className:"flex gap-3 w-full mt-2",children:[u.jsx("button",{onClick:()=>R(!1),className:"flex-1 px-4 py-2 rounded-lg text-sm font-semibold text-gray-300 hover:bg-gray-800 transition-colors",children:"Cancelar"}),u.jsx("button",{onClick:J,className:"flex-1 px-4 py-2 rounded-lg text-sm font-semibold bg-red-500 hover:bg-red-600 text-white transition-colors shadow-lg shadow-red-500/20",children:"Eliminar"})]})]})})})]})}):null}function uU({isAdmin:t}){const[e,n]=V.useState(""),[r,s]=V.useState(null),[i,o]=V.useState(""),[a,l]=V.useState(!0);return V.useEffect(()=>{const c=lU(d=>{d?(n(d.text),s(d.expiresAt)):(n(""),s(null)),l(!1)});return()=>c()},[]),V.useEffect(()=>{if(!r){o("");return}const c=setInterval(()=>{const d=new Date().getTime(),m=new Date(r).getTime()-d;if(m<=0)n(""),s(null),clearInterval(c);else{const p=Math.floor(m/864e5),g=Math.floor(m%(1e3*60*60*24)/(1e3*60*60)),b=Math.floor(m%(1e3*60*60)/(1e3*60)),E=Math.floor(m%(1e3*60)/1e3);let y="";p>0&&(y+=`${p}d `),y+=`${g.toString().padStart(2,"0")}h ${b.toString().padStart(2,"0")}m ${E.toString().padStart(2,"0")}s`,o(y)}},1e3);return()=>clearInterval(c)},[r]),!e&&!a||!e?null:u.jsx("div",{className:"w-full max-w-[1800px] mx-auto px-4 sm:px-6 md:px-12 mt-6 mb-8 animate-in fade-in slide-in-from-top-4 duration-500 flex justify-center",children:u.jsxs("div",{className:"bg-gradient-to-r from-[#bb86fc]/20 to-[#121212] border border-[#bb86fc]/30 rounded-xl p-6 flex flex-col items-center gap-4 shadow-lg shadow-[#bb86fc]/10 relative group backdrop-blur-sm max-w-2xl w-full text-center",children:[u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx("div",{className:"p-2.5 bg-[#bb86fc]/20 rounded-lg animate-pulse",children:u.jsx(Wk,{className:"w-6 h-6 text-[#bb86fc]"})}),u.jsxs("h3",{className:"text-sm font-bold text-[#bb86fc] uppercase tracking-wider flex items-center gap-2",children:["Información Importante",u.jsx("span",{className:"w-2 h-2 rounded-full bg-[#bb86fc] animate-ping"})]})]}),u.jsx("div",{className:"text-base text-gray-200 leading-relaxed whitespace-pre-wrap font-medium max-w-lg",children:e}),i&&u.jsxs("div",{className:"flex items-center gap-2 text-xs font-mono text-gray-400 bg-black/30 px-3 py-1.5 rounded-full border border-gray-800",children:[u.jsx(ND,{className:"w-3.5 h-3.5"}),u.jsxs("span",{children:["Expira en: ",i]})]})]})})}function Bo({size:t=40,borderWidth:e=2,className:n=""}){return u.jsx("div",{className:`flex items-center justify-center ${n}`,children:u.jsx("div",{className:"relative",style:{width:`${t}px`,height:`${t}px`},children:u.jsx("div",{className:"rounded-full animate-spin",style:{width:`${t}px`,height:`${t}px`,borderWidth:`${e}px`,borderStyle:"solid",borderColor:"rgba(187, 134, 252, 0.3)",borderTopColor:"#bb86fc",animation:"spin 1.2s linear infinite",boxShadow:"0 0 20px rgba(139, 92, 246, 0.2)"}})})})}const _A=()=>"",ui=t=>{if(!t)return;if(t.startsWith("blob:")||t.startsWith("data:"))return t;const e=_A(),n=new URLSearchParams({url:t,width:"600",quality:"85",format:"webp"});return`${e}/api/image-proxy?${n.toString()}`},dU=(t,e)=>{if(!t)return"";if(t.startsWith("blob:")||t.startsWith("data:"))return t;const n=_A(),r=new URLSearchParams({url:t});return`${n}/api/image-proxy?${r.toString()}`};function TS(t){return t!==null&&typeof t=="object"&&"constructor"in t&&t.constructor===Object}function yv(t={},e={}){const n=["__proto__","constructor","prototype"];Object.keys(e).filter(r=>n.indexOf(r)<0).forEach(r=>{typeof t[r]>"u"?t[r]=e[r]:TS(e[r])&&TS(t[r])&&Object.keys(e[r]).length>0&&yv(t[r],e[r])})}const SA={body:{},addEventListener(){},removeEventListener(){},activeElement:{blur(){},nodeName:""},querySelector(){return null},querySelectorAll(){return[]},getElementById(){return null},createEvent(){return{initEvent(){}}},createElement(){return{children:[],childNodes:[],style:{},setAttribute(){},getElementsByTagName(){return[]}}},createElementNS(){return{}},importNode(){return null},location:{hash:"",host:"",hostname:"",href:"",origin:"",pathname:"",protocol:"",search:""}};function Ko(){const t=typeof document<"u"?document:{};return yv(t,SA),t}const hU={document:SA,navigator:{userAgent:""},location:{hash:"",host:"",hostname:"",href:"",origin:"",pathname:"",protocol:"",search:""},history:{replaceState(){},pushState(){},go(){},back(){}},CustomEvent:function(){return this},addEventListener(){},removeEventListener(){},getComputedStyle(){return{getPropertyValue(){return""}}},Image(){},Date(){},screen:{},setTimeout(){},clearTimeout(){},matchMedia(){return{}},requestAnimationFrame(t){return typeof setTimeout>"u"?(t(),null):setTimeout(t,0)},cancelAnimationFrame(t){typeof setTimeout>"u"||clearTimeout(t)}};function Fn(){const t=typeof window<"u"?window:{};return yv(t,hU),t}function fU(t=""){return t.trim().split(" ").filter(e=>!!e.trim())}function pU(t){const e=t;Object.keys(e).forEach(n=>{try{e[n]=null}catch{}try{delete e[n]}catch{}})}function EA(t,e=0){return setTimeout(t,e)}function lf(){return Date.now()}function mU(t){const e=Fn();let n;return e.getComputedStyle&&(n=e.getComputedStyle(t,null)),!n&&t.currentStyle&&(n=t.currentStyle),n||(n=t.style),n}function gU(t,e="x"){const n=Fn();let r,s,i;const o=mU(t);return n.WebKitCSSMatrix?(s=o.transform||o.webkitTransform,s.split(",").length>6&&(s=s.split(", ").map(a=>a.replace(",",".")).join(", ")),i=new n.WebKitCSSMatrix(s==="none"?"":s)):(i=o.MozTransform||o.OTransform||o.MsTransform||o.msTransform||o.transform||o.getPropertyValue("transform").replace("translate(","matrix(1, 0, 0, 1,"),r=i.toString().split(",")),e==="x"&&(n.WebKitCSSMatrix?s=i.m41:r.length===16?s=parseFloat(r[12]):s=parseFloat(r[4])),e==="y"&&(n.WebKitCSSMatrix?s=i.m42:r.length===16?s=parseFloat(r[13]):s=parseFloat(r[5])),s||0}function _d(t){return typeof t=="object"&&t!==null&&t.constructor&&Object.prototype.toString.call(t).slice(8,-1)==="Object"}function yU(t){return typeof window<"u"&&typeof window.HTMLElement<"u"?t instanceof HTMLElement:t&&(t.nodeType===1||t.nodeType===11)}function fr(...t){const e=Object(t[0]);for(let n=1;ni!=="__proto__"&&i!=="constructor"&&i!=="prototype");for(let i=0,o=s.length;is?"next":"prev",c=(h,m)=>l==="next"&&h>=m||l==="prev"&&h<=m,d=()=>{o=new Date().getTime(),i===null&&(i=o);const h=Math.max(Math.min((o-i)/a,1),0),m=.5-Math.cos(h*Math.PI)/2;let p=s+m*(e-s);if(c(p,e)&&(p=e),t.wrapperEl.scrollTo({[n]:p}),c(p,e)){t.wrapperEl.style.overflow="hidden",t.wrapperEl.style.scrollSnapType="",setTimeout(()=>{t.wrapperEl.style.overflow="",t.wrapperEl.scrollTo({[n]:p})}),r.cancelAnimationFrame(t.cssModeFrameID);return}t.cssModeFrameID=r.requestAnimationFrame(d)};d()}function xv(t){return t.querySelector(".swiper-slide-transform")||t.shadowRoot&&t.shadowRoot.querySelector(".swiper-slide-transform")||t}function Os(t,e=""){const n=Fn(),r=[...t.children];return n.HTMLSlotElement&&t instanceof HTMLSlotElement&&r.push(...t.assignedElements()),e?r.filter(s=>s.matches(e)):r}function xU(t,e){const n=[e];for(;n.length>0;){const r=n.shift();if(t===r)return!0;n.push(...r.children,...r.shadowRoot?r.shadowRoot.children:[],...r.assignedElements?r.assignedElements():[])}}function vU(t,e){const n=Fn();let r=e.contains(t);return!r&&n.HTMLSlotElement&&e instanceof HTMLSlotElement&&(r=[...e.assignedElements()].includes(t),r||(r=xU(t,e))),r}function cf(t){try{console.warn(t);return}catch{}}function uf(t,e=[]){const n=document.createElement(t);return n.classList.add(...Array.isArray(e)?e:fU(e)),n}function wU(t,e){const n=[];for(;t.previousElementSibling;){const r=t.previousElementSibling;e?r.matches(e)&&n.push(r):n.push(r),t=r}return n}function bU(t,e){const n=[];for(;t.nextElementSibling;){const r=t.nextElementSibling;e?r.matches(e)&&n.push(r):n.push(r),t=r}return n}function wi(t,e){return Fn().getComputedStyle(t,null).getPropertyValue(e)}function kS(t){let e=t,n;if(e){for(n=0;(e=e.previousSibling)!==null;)e.nodeType===1&&(n+=1);return n}}function _U(t,e){const n=[];let r=t.parentElement;for(;r;)n.push(r),r=r.parentElement;return n}function SU(t,e){function n(r){r.target===t&&(e.call(t,r),t.removeEventListener("transitionend",n))}e&&t.addEventListener("transitionend",n)}function CS(t,e,n){const r=Fn();return t[e==="width"?"offsetWidth":"offsetHeight"]+parseFloat(r.getComputedStyle(t,null).getPropertyValue(e==="width"?"margin-right":"margin-top"))+parseFloat(r.getComputedStyle(t,null).getPropertyValue(e==="width"?"margin-left":"margin-bottom"))}function EU(t){return e=>Math.abs(e)>0&&t.browser&&t.browser.need3dFix&&Math.abs(e)%90===0?e+.001:e}function IS(t,e=""){typeof trustedTypes<"u"?t.innerHTML=trustedTypes.createPolicy("html",{createHTML:n=>n}).createHTML(e):t.innerHTML=e}let _m;function TU(){const t=Fn(),e=Ko();return{smoothScroll:e.documentElement&&e.documentElement.style&&"scrollBehavior"in e.documentElement.style,touch:!!("ontouchstart"in t||t.DocumentTouch&&e instanceof t.DocumentTouch)}}function kA(){return _m||(_m=TU()),_m}let Sm;function kU({userAgent:t}={}){const e=kA(),n=Fn(),r=n.navigator.platform,s=t||n.navigator.userAgent,i={ios:!1,android:!1},o=n.screen.width,a=n.screen.height,l=s.match(/(Android);?[\s\/]+([\d.]+)?/);let c=s.match(/(iPad)(?!\1).*OS\s([\d_]+)/);const d=s.match(/(iPod)(.*OS\s([\d_]+))?/),h=!c&&s.match(/(iPhone\sOS|iOS)\s([\d_]+)/),m=r==="Win32";let p=r==="MacIntel";const g=["1024x1366","1366x1024","834x1194","1194x834","834x1112","1112x834","768x1024","1024x768","820x1180","1180x820","810x1080","1080x810"];return!c&&p&&e.touch&&g.indexOf(`${o}x${a}`)>=0&&(c=s.match(/(Version)\/([\d.]+)/),c||(c=[0,1,"13_0_0"]),p=!1),l&&!m&&(i.os="android",i.android=!0),(c||h||d)&&(i.os="ios",i.ios=!0),i}function CA(t={}){return Sm||(Sm=kU(t)),Sm}let Em;function CU(){const t=Fn(),e=CA();let n=!1;function r(){const a=t.navigator.userAgent.toLowerCase();return a.indexOf("safari")>=0&&a.indexOf("chrome")<0&&a.indexOf("android")<0}if(r()){const a=String(t.navigator.userAgent);if(a.includes("Version/")){const[l,c]=a.split("Version/")[1].split(" ")[0].split(".").map(d=>Number(d));n=l<16||l===16&&c<2}}const s=/(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(t.navigator.userAgent),i=r(),o=i||s&&e.ios;return{isSafari:n||i,needPerspectiveFix:n,need3dFix:o,isWebView:s}}function IA(){return Em||(Em=CU()),Em}function IU({swiper:t,on:e,emit:n}){const r=Fn();let s=null,i=null;const o=()=>{!t||t.destroyed||!t.initialized||(n("beforeResize"),n("resize"))},a=()=>{!t||t.destroyed||!t.initialized||(s=new ResizeObserver(d=>{i=r.requestAnimationFrame(()=>{const{width:h,height:m}=t;let p=h,g=m;d.forEach(({contentBoxSize:b,contentRect:E,target:y})=>{y&&y!==t.el||(p=E?E.width:(b[0]||b).inlineSize,g=E?E.height:(b[0]||b).blockSize)}),(p!==h||g!==m)&&o()})}),s.observe(t.el))},l=()=>{i&&r.cancelAnimationFrame(i),s&&s.unobserve&&t.el&&(s.unobserve(t.el),s=null)},c=()=>{!t||t.destroyed||!t.initialized||n("orientationchange")};e("init",()=>{if(t.params.resizeObserver&&typeof r.ResizeObserver<"u"){a();return}r.addEventListener("resize",o),r.addEventListener("orientationchange",c)}),e("destroy",()=>{l(),r.removeEventListener("resize",o),r.removeEventListener("orientationchange",c)})}function NU({swiper:t,extendParams:e,on:n,emit:r}){const s=[],i=Fn(),o=(c,d={})=>{const h=i.MutationObserver||i.WebkitMutationObserver,m=new h(p=>{if(t.__preventObserver__)return;if(p.length===1){r("observerUpdate",p[0]);return}const g=function(){r("observerUpdate",p[0])};i.requestAnimationFrame?i.requestAnimationFrame(g):i.setTimeout(g,0)});m.observe(c,{attributes:typeof d.attributes>"u"?!0:d.attributes,childList:t.isElement||(typeof d.childList>"u"?!0:d).childList,characterData:typeof d.characterData>"u"?!0:d.characterData}),s.push(m)},a=()=>{if(t.params.observer){if(t.params.observeParents){const c=_U(t.hostEl);for(let d=0;d{s.forEach(c=>{c.disconnect()}),s.splice(0,s.length)};e({observer:!1,observeParents:!1,observeSlideChildren:!1}),n("init",a),n("destroy",l)}var AU={on(t,e,n){const r=this;if(!r.eventsListeners||r.destroyed||typeof e!="function")return r;const s=n?"unshift":"push";return t.split(" ").forEach(i=>{r.eventsListeners[i]||(r.eventsListeners[i]=[]),r.eventsListeners[i][s](e)}),r},once(t,e,n){const r=this;if(!r.eventsListeners||r.destroyed||typeof e!="function")return r;function s(...i){r.off(t,s),s.__emitterProxy&&delete s.__emitterProxy,e.apply(r,i)}return s.__emitterProxy=e,r.on(t,s,n)},onAny(t,e){const n=this;if(!n.eventsListeners||n.destroyed||typeof t!="function")return n;const r=e?"unshift":"push";return n.eventsAnyListeners.indexOf(t)<0&&n.eventsAnyListeners[r](t),n},offAny(t){const e=this;if(!e.eventsListeners||e.destroyed||!e.eventsAnyListeners)return e;const n=e.eventsAnyListeners.indexOf(t);return n>=0&&e.eventsAnyListeners.splice(n,1),e},off(t,e){const n=this;return!n.eventsListeners||n.destroyed||!n.eventsListeners||t.split(" ").forEach(r=>{typeof e>"u"?n.eventsListeners[r]=[]:n.eventsListeners[r]&&n.eventsListeners[r].forEach((s,i)=>{(s===e||s.__emitterProxy&&s.__emitterProxy===e)&&n.eventsListeners[r].splice(i,1)})}),n},emit(...t){const e=this;if(!e.eventsListeners||e.destroyed||!e.eventsListeners)return e;let n,r,s;return typeof t[0]=="string"||Array.isArray(t[0])?(n=t[0],r=t.slice(1,t.length),s=e):(n=t[0].events,r=t[0].data,s=t[0].context||e),r.unshift(s),(Array.isArray(n)?n:n.split(" ")).forEach(o=>{e.eventsAnyListeners&&e.eventsAnyListeners.length&&e.eventsAnyListeners.forEach(a=>{a.apply(s,[o,...r])}),e.eventsListeners&&e.eventsListeners[o]&&e.eventsListeners[o].forEach(a=>{a.apply(s,r)})}),e}};function PU(){const t=this;let e,n;const r=t.el;typeof t.params.width<"u"&&t.params.width!==null?e=t.params.width:e=r.clientWidth,typeof t.params.height<"u"&&t.params.height!==null?n=t.params.height:n=r.clientHeight,!(e===0&&t.isHorizontal()||n===0&&t.isVertical())&&(e=e-parseInt(wi(r,"padding-left")||0,10)-parseInt(wi(r,"padding-right")||0,10),n=n-parseInt(wi(r,"padding-top")||0,10)-parseInt(wi(r,"padding-bottom")||0,10),Number.isNaN(e)&&(e=0),Number.isNaN(n)&&(n=0),Object.assign(t,{width:e,height:n,size:t.isHorizontal()?e:n}))}function RU(){const t=this;function e(I,N){return parseFloat(I.getPropertyValue(t.getDirectionLabel(N))||0)}const n=t.params,{wrapperEl:r,slidesEl:s,rtlTranslate:i,wrongRTL:o}=t,a=t.virtual&&n.virtual.enabled,l=a?t.virtual.slides.length:t.slides.length,c=Os(s,`.${t.params.slideClass}, swiper-slide`),d=a?t.virtual.slides.length:c.length;let h=[];const m=[],p=[];let g=n.slidesOffsetBefore;typeof g=="function"&&(g=n.slidesOffsetBefore.call(t));let b=n.slidesOffsetAfter;typeof b=="function"&&(b=n.slidesOffsetAfter.call(t));const E=t.snapGrid.length,y=t.slidesGrid.length,v=t.size-g-b;let _=n.spaceBetween,P=-g,D=0,k=0;if(typeof v>"u")return;typeof _=="string"&&_.indexOf("%")>=0?_=parseFloat(_.replace("%",""))/100*v:typeof _=="string"&&(_=parseFloat(_)),t.virtualSize=-_-g-b,c.forEach(I=>{i?I.style.marginLeft="":I.style.marginRight="",I.style.marginBottom="",I.style.marginTop=""}),n.centeredSlides&&n.cssMode&&(na(r,"--swiper-centered-offset-before",""),na(r,"--swiper-centered-offset-after","")),n.cssMode&&(na(r,"--swiper-slides-offset-before",`${g}px`),na(r,"--swiper-slides-offset-after",`${b}px`));const T=n.grid&&n.grid.rows>1&&t.grid;T?t.grid.initSlides(c):t.grid&&t.grid.unsetSlides();let w;const C=n.slidesPerView==="auto"&&n.breakpoints&&Object.keys(n.breakpoints).filter(I=>typeof n.breakpoints[I].slidesPerView<"u").length>0;for(let I=0;I=0&&(B+=p[q]+(q1&&(N||h.push(t.virtualSize-v))}if(a&&n.loop){const I=p[0]+_;if(n.slidesPerGroup>1){const N=Math.ceil((t.virtual.slidesBefore+t.virtual.slidesAfter)/n.slidesPerGroup),j=I*n.slidesPerGroup;for(let A=0;A!n.cssMode||n.loop?!0:j!==c.length-1).forEach(N=>{N.style[I]=`${_}px`})}if(n.centeredSlides&&n.centeredSlidesBounds){let I=0;p.forEach(j=>{I+=j+(_||0)}),I-=_;const N=I>v?I-v:0;h=h.map(j=>j<=0?-g:j>N?N+b:j)}if(n.centerInsufficientSlides){let I=0;if(p.forEach(N=>{I+=N+(_||0)}),I-=_,I{h[A]=j-N}),m.forEach((j,A)=>{m[A]=j+N})}}if(Object.assign(t,{slides:c,snapGrid:h,slidesGrid:m,slidesSizesGrid:p}),n.centeredSlides&&n.cssMode&&!n.centeredSlidesBounds){na(r,"--swiper-centered-offset-before",`${-h[0]}px`),na(r,"--swiper-centered-offset-after",`${t.size/2-p[p.length-1]/2}px`);const I=-t.snapGrid[0],N=-t.slidesGrid[0];t.snapGrid=t.snapGrid.map(j=>j+I),t.slidesGrid=t.slidesGrid.map(j=>j+N)}if(d!==l&&t.emit("slidesLengthChange"),h.length!==E&&(t.params.watchOverflow&&t.checkOverflow(),t.emit("snapGridLengthChange")),m.length!==y&&t.emit("slidesGridLengthChange"),n.watchSlidesProgress&&t.updateSlidesOffset(),t.emit("slidesUpdated"),!a&&!n.cssMode&&(n.effect==="slide"||n.effect==="fade")){const I=`${n.containerModifierClass}backface-hidden`,N=t.el.classList.contains(I);d<=n.maxBackfaceHiddenSlides?N||t.el.classList.add(I):N&&t.el.classList.remove(I)}}function jU(t){const e=this,n=[],r=e.virtual&&e.params.virtual.enabled;let s=0,i;typeof t=="number"?e.setTransition(t):t===!0&&e.setTransition(e.params.speed);const o=a=>r?e.slides[e.getSlideIndexByData(a)]:e.slides[a];if(e.params.slidesPerView!=="auto"&&e.params.slidesPerView>1)if(e.params.centeredSlides)(e.visibleSlides||[]).forEach(a=>{n.push(a)});else for(i=0;ie.slides.length&&!r)break;n.push(o(a))}else n.push(o(e.activeIndex));for(i=0;is?a:s}(s||s===0)&&(e.wrapperEl.style.height=`${s}px`)}function DU(){const t=this,e=t.slides,n=t.isElement?t.isHorizontal()?t.wrapperEl.offsetLeft:t.wrapperEl.offsetTop:0;for(let r=0;r{e&&!t.classList.contains(n)?t.classList.add(n):!e&&t.classList.contains(n)&&t.classList.remove(n)};function MU(t=this&&this.translate||0){const e=this,n=e.params,{slides:r,rtlTranslate:s,snapGrid:i}=e;if(r.length===0)return;typeof r[0].swiperSlideOffset>"u"&&e.updateSlidesOffset();let o=-t;s&&(o=t),e.visibleSlidesIndexes=[],e.visibleSlides=[];let a=n.spaceBetween;typeof a=="string"&&a.indexOf("%")>=0?a=parseFloat(a.replace("%",""))/100*e.size:typeof a=="string"&&(a=parseFloat(a));for(let l=0;l=0&&p<=e.size-e.slidesSizesGrid[l],E=p>=0&&p1&&g<=e.size||p<=0&&g>=e.size;E&&(e.visibleSlides.push(c),e.visibleSlidesIndexes.push(l)),NS(c,E,n.slideVisibleClass),NS(c,b,n.slideFullyVisibleClass),c.progress=s?-h:h,c.originalProgress=s?-m:m}}function LU(t){const e=this;if(typeof t>"u"){const d=e.rtlTranslate?-1:1;t=e&&e.translate&&e.translate*d||0}const n=e.params,r=e.maxTranslate()-e.minTranslate();let{progress:s,isBeginning:i,isEnd:o,progressLoop:a}=e;const l=i,c=o;if(r===0)s=0,i=!0,o=!0;else{s=(t-e.minTranslate())/r;const d=Math.abs(t-e.minTranslate())<1,h=Math.abs(t-e.maxTranslate())<1;i=d||s<=0,o=h||s>=1,d&&(s=0),h&&(s=1)}if(n.loop){const d=e.getSlideIndexByData(0),h=e.getSlideIndexByData(e.slides.length-1),m=e.slidesGrid[d],p=e.slidesGrid[h],g=e.slidesGrid[e.slidesGrid.length-1],b=Math.abs(t);b>=m?a=(b-m)/g:a=(b+g-p)/g,a>1&&(a-=1)}Object.assign(e,{progress:s,progressLoop:a,isBeginning:i,isEnd:o}),(n.watchSlidesProgress||n.centeredSlides&&n.autoHeight)&&e.updateSlidesProgress(t),i&&!l&&e.emit("reachBeginning toEdge"),o&&!c&&e.emit("reachEnd toEdge"),(l&&!i||c&&!o)&&e.emit("fromEdge"),e.emit("progress",s)}const Tm=(t,e,n)=>{e&&!t.classList.contains(n)?t.classList.add(n):!e&&t.classList.contains(n)&&t.classList.remove(n)};function VU(){const t=this,{slides:e,params:n,slidesEl:r,activeIndex:s}=t,i=t.virtual&&n.virtual.enabled,o=t.grid&&n.grid&&n.grid.rows>1,a=h=>Os(r,`.${n.slideClass}${h}, swiper-slide${h}`)[0];let l,c,d;if(i)if(n.loop){let h=s-t.virtual.slidesBefore;h<0&&(h=t.virtual.slides.length+h),h>=t.virtual.slides.length&&(h-=t.virtual.slides.length),l=a(`[data-swiper-slide-index="${h}"]`)}else l=a(`[data-swiper-slide-index="${s}"]`);else o?(l=e.find(h=>h.column===s),d=e.find(h=>h.column===s+1),c=e.find(h=>h.column===s-1)):l=e[s];l&&(o||(d=bU(l,`.${n.slideClass}, swiper-slide`)[0],n.loop&&!d&&(d=e[0]),c=wU(l,`.${n.slideClass}, swiper-slide`)[0],n.loop&&!c===0&&(c=e[e.length-1]))),e.forEach(h=>{Tm(h,h===l,n.slideActiveClass),Tm(h,h===d,n.slideNextClass),Tm(h,h===c,n.slidePrevClass)}),t.emitSlidesClasses()}const nh=(t,e)=>{if(!t||t.destroyed||!t.params)return;const n=()=>t.isElement?"swiper-slide":`.${t.params.slideClass}`,r=e.closest(n());if(r){let s=r.querySelector(`.${t.params.lazyPreloaderClass}`);!s&&t.isElement&&(r.shadowRoot?s=r.shadowRoot.querySelector(`.${t.params.lazyPreloaderClass}`):requestAnimationFrame(()=>{r.shadowRoot&&(s=r.shadowRoot.querySelector(`.${t.params.lazyPreloaderClass}`),s&&!s.lazyPreloaderManaged&&s.remove())})),s&&!s.lazyPreloaderManaged&&s.remove()}},km=(t,e)=>{if(!t.slides[e])return;const n=t.slides[e].querySelector('[loading="lazy"]');n&&n.removeAttribute("loading")},My=t=>{if(!t||t.destroyed||!t.params)return;let e=t.params.lazyPreloadPrevNext;const n=t.slides.length;if(!n||!e||e<0)return;e=Math.min(e,n);const r=t.params.slidesPerView==="auto"?t.slidesPerViewDynamic():Math.ceil(t.params.slidesPerView),s=t.activeIndex;if(t.params.grid&&t.params.grid.rows>1){const o=s,a=[o-e];a.push(...Array.from({length:e}).map((l,c)=>o+r+c)),t.slides.forEach((l,c)=>{a.includes(l.column)&&km(t,c)});return}const i=s+r-1;if(t.params.rewind||t.params.loop)for(let o=s-e;o<=i+e;o+=1){const a=(o%n+n)%n;(ai)&&km(t,a)}else for(let o=Math.max(s-e,0);o<=Math.min(i+e,n-1);o+=1)o!==s&&(o>i||o=e[i]&&r=e[i]&&r=e[i]&&(s=i);return n.normalizeSlideIndex&&(s<0||typeof s>"u")&&(s=0),s}function FU(t){const e=this,n=e.rtlTranslate?e.translate:-e.translate,{snapGrid:r,params:s,activeIndex:i,realIndex:o,snapIndex:a}=e;let l=t,c;const d=p=>{let g=p-e.virtual.slidesBefore;return g<0&&(g=e.virtual.slides.length+g),g>=e.virtual.slides.length&&(g-=e.virtual.slides.length),g};if(typeof l>"u"&&(l=OU(e)),r.indexOf(n)>=0)c=r.indexOf(n);else{const p=Math.min(s.slidesPerGroupSkip,l);c=p+Math.floor((l-p)/s.slidesPerGroup)}if(c>=r.length&&(c=r.length-1),l===i&&!e.params.loop){c!==a&&(e.snapIndex=c,e.emit("snapIndexChange"));return}if(l===i&&e.params.loop&&e.virtual&&e.params.virtual.enabled){e.realIndex=d(l);return}const h=e.grid&&s.grid&&s.grid.rows>1;let m;if(e.virtual&&s.virtual.enabled)s.loop?m=d(l):m=l;else if(h){const p=e.slides.find(b=>b.column===l);let g=parseInt(p.getAttribute("data-swiper-slide-index"),10);Number.isNaN(g)&&(g=Math.max(e.slides.indexOf(p),0)),m=Math.floor(g/s.grid.rows)}else if(e.slides[l]){const p=e.slides[l].getAttribute("data-swiper-slide-index");p?m=parseInt(p,10):m=l}else m=l;Object.assign(e,{previousSnapIndex:a,snapIndex:c,previousRealIndex:o,realIndex:m,previousIndex:i,activeIndex:l}),e.initialized&&My(e),e.emit("activeIndexChange"),e.emit("snapIndexChange"),(e.initialized||e.params.runCallbacksOnInit)&&(o!==m&&e.emit("realIndexChange"),e.emit("slideChange"))}function zU(t,e){const n=this,r=n.params;let s=t.closest(`.${r.slideClass}, swiper-slide`);!s&&n.isElement&&e&&e.length>1&&e.includes(t)&&[...e.slice(e.indexOf(t)+1,e.length)].forEach(a=>{!s&&a.matches&&a.matches(`.${r.slideClass}, swiper-slide`)&&(s=a)});let i=!1,o;if(s){for(let a=0;al?d=l:r&&ti?o="next":s"u"&&(e=i.params.speed);const b=Math.min(i.params.slidesPerGroupSkip,o);let E=b+Math.floor((o-b)/i.params.slidesPerGroup);E>=l.length&&(E=l.length-1);const y=-l[E];if(a.normalizeSlideIndex)for(let T=0;T=C&&w=C&&w=C&&(o=T)}if(i.initialized&&o!==h&&(!i.allowSlideNext&&(m?y>i.translate&&y>i.minTranslate():yi.translate&&y>i.maxTranslate()&&(h||0)!==o))return!1;o!==(d||0)&&n&&i.emit("beforeSlideChangeStart"),i.updateProgress(y);let v;o>h?v="next":o0?(i._cssModeVirtualInitialSet=!0,requestAnimationFrame(()=>{p[T?"scrollLeft":"scrollTop"]=w})):p[T?"scrollLeft":"scrollTop"]=w,_&&requestAnimationFrame(()=>{i.wrapperEl.style.scrollSnapType="",i._immediateVirtual=!1});else{if(!i.support.smoothScroll)return TA({swiper:i,targetPosition:w,side:T?"left":"top"}),!0;p.scrollTo({[T?"left":"top"]:w,behavior:"smooth"})}return!0}const k=IA().isSafari;return _&&!s&&k&&i.isElement&&i.virtual.update(!1,!1,o),i.setTransition(e),i.setTranslate(y),i.updateActiveIndex(o),i.updateSlidesClasses(),i.emit("beforeTransitionStart",e,r),i.transitionStart(n,v),e===0?i.transitionEnd(n,v):i.animating||(i.animating=!0,i.onSlideToWrapperTransitionEnd||(i.onSlideToWrapperTransitionEnd=function(w){!i||i.destroyed||w.target===this&&(i.wrapperEl.removeEventListener("transitionend",i.onSlideToWrapperTransitionEnd),i.onSlideToWrapperTransitionEnd=null,delete i.onSlideToWrapperTransitionEnd,i.transitionEnd(n,v))}),i.wrapperEl.addEventListener("transitionend",i.onSlideToWrapperTransitionEnd)),!0}function ZU(t=0,e,n=!0,r){typeof t=="string"&&(t=parseInt(t,10));const s=this;if(s.destroyed)return;typeof e>"u"&&(e=s.params.speed);const i=s.grid&&s.params.grid&&s.params.grid.rows>1;let o=t;if(s.params.loop)if(s.virtual&&s.params.virtual.enabled)o=o+s.virtual.slidesBefore;else{let a;if(i){const b=o*s.params.grid.rows;a=s.slides.find(E=>E.getAttribute("data-swiper-slide-index")*1===b).column}else a=s.getSlideIndexByData(o);const l=i?Math.ceil(s.slides.length/s.params.grid.rows):s.slides.length,{centeredSlides:c,slidesOffsetBefore:d,slidesOffsetAfter:h}=s.params,m=c||!!d||!!h;let p=s.params.slidesPerView;p==="auto"?p=s.slidesPerViewDynamic():(p=Math.ceil(parseFloat(s.params.slidesPerView,10)),m&&p%2===0&&(p=p+1));let g=l-aE.getAttribute("data-swiper-slide-index")*1===b).column}else o=s.getSlideIndexByData(o)}return requestAnimationFrame(()=>{s.slideTo(o,e,n,r)}),s}function e$(t,e=!0,n){const r=this,{enabled:s,params:i,animating:o}=r;if(!s||r.destroyed)return r;typeof t>"u"&&(t=r.params.speed);let a=i.slidesPerGroup;i.slidesPerView==="auto"&&i.slidesPerGroup===1&&i.slidesPerGroupAuto&&(a=Math.max(r.slidesPerViewDynamic("current",!0),1));const l=r.activeIndex{r.slideTo(r.activeIndex+l,t,e,n)}),!0}return i.rewind&&r.isEnd?r.slideTo(0,t,e,n):r.slideTo(r.activeIndex+l,t,e,n)}function t$(t,e=!0,n){const r=this,{params:s,snapGrid:i,slidesGrid:o,rtlTranslate:a,enabled:l,animating:c}=r;if(!l||r.destroyed)return r;typeof t>"u"&&(t=r.params.speed);const d=r.virtual&&s.virtual.enabled;if(s.loop){if(c&&!d&&s.loopPreventsSliding)return!1;r.loopFix({direction:"prev"}),r._clientLeft=r.wrapperEl.clientLeft}const h=a?r.translate:-r.translate;function m(v){return v<0?-Math.floor(Math.abs(v)):Math.floor(v)}const p=m(h),g=i.map(v=>m(v)),b=s.freeMode&&s.freeMode.enabled;let E=i[g.indexOf(p)-1];if(typeof E>"u"&&(s.cssMode||b)){let v;i.forEach((_,P)=>{p>=_&&(v=P)}),typeof v<"u"&&(E=b?i[v]:i[v>0?v-1:v])}let y=0;if(typeof E<"u"&&(y=o.indexOf(E),y<0&&(y=r.activeIndex-1),s.slidesPerView==="auto"&&s.slidesPerGroup===1&&s.slidesPerGroupAuto&&(y=y-r.slidesPerViewDynamic("previous",!0)+1,y=Math.max(y,0))),s.rewind&&r.isBeginning){const v=r.params.virtual&&r.params.virtual.enabled&&r.virtual?r.virtual.slides.length-1:r.slides.length-1;return r.slideTo(v,t,e,n)}else if(s.loop&&r.activeIndex===0&&s.cssMode)return requestAnimationFrame(()=>{r.slideTo(y,t,e,n)}),!0;return r.slideTo(y,t,e,n)}function n$(t,e=!0,n){const r=this;if(!r.destroyed)return typeof t>"u"&&(t=r.params.speed),r.slideTo(r.activeIndex,t,e,n)}function r$(t,e=!0,n,r=.5){const s=this;if(s.destroyed)return;typeof t>"u"&&(t=s.params.speed);let i=s.activeIndex;const o=Math.min(s.params.slidesPerGroupSkip,i),a=o+Math.floor((i-o)/s.params.slidesPerGroup),l=s.rtlTranslate?s.translate:-s.translate;if(l>=s.snapGrid[a]){const c=s.snapGrid[a],d=s.snapGrid[a+1];l-c>(d-c)*r&&(i+=s.params.slidesPerGroup)}else{const c=s.snapGrid[a-1],d=s.snapGrid[a];l-c<=(d-c)*r&&(i-=s.params.slidesPerGroup)}return i=Math.max(i,0),i=Math.min(i,s.slidesGrid.length-1),s.slideTo(i,t,e,n)}function s$(){const t=this;if(t.destroyed)return;const{params:e,slidesEl:n}=t,r=e.slidesPerView==="auto"?t.slidesPerViewDynamic():e.slidesPerView;let s=t.getSlideIndexWhenGrid(t.clickedIndex),i;const o=t.isElement?"swiper-slide":`.${e.slideClass}`,a=t.grid&&t.params.grid&&t.params.grid.rows>1;if(e.loop){if(t.animating)return;i=parseInt(t.clickedSlide.getAttribute("data-swiper-slide-index"),10),e.centeredSlides?t.slideToLoop(i):s>(a?(t.slides.length-r)/2-(t.params.grid.rows-1):t.slides.length-r)?(t.loopFix(),s=t.getSlideIndex(Os(n,`${o}[data-swiper-slide-index="${i}"]`)[0]),EA(()=>{t.slideTo(s)})):t.slideTo(s)}else t.slideTo(s)}var i$={slideTo:JU,slideToLoop:ZU,slideNext:e$,slidePrev:t$,slideReset:n$,slideToClosest:r$,slideToClickedSlide:s$};function o$(t,e){const n=this,{params:r,slidesEl:s}=n;if(!r.loop||n.virtual&&n.params.virtual.enabled)return;const i=()=>{Os(s,`.${r.slideClass}, swiper-slide`).forEach((g,b)=>{g.setAttribute("data-swiper-slide-index",b)})},o=()=>{const p=Os(s,`.${r.slideBlankClass}`);p.forEach(g=>{g.remove()}),p.length>0&&(n.recalcSlides(),n.updateSlides())},a=n.grid&&r.grid&&r.grid.rows>1;r.loopAddBlankSlides&&(r.slidesPerGroup>1||a)&&o();const l=r.slidesPerGroup*(a?r.grid.rows:1),c=n.slides.length%l!==0,d=a&&n.slides.length%r.grid.rows!==0,h=p=>{for(let g=0;g1;c.length<_+D||l.params.effect==="cards"&&c.length<_+D*2?cf("Swiper Loop Warning: The number of slides is not enough for loop mode, it will be disabled or not function properly. You need to add more slides (or make duplicates) or lower the values of slidesPerView and slidesPerGroup parameters"):k&&p.grid.fill==="row"&&cf("Swiper Loop Warning: Loop mode is not compatible with grid.fill = `row`");const T=[],w=[],C=k?Math.ceil(c.length/p.grid.rows):c.length,I=i&&C-y<_&&!v;let N=I?y:l.activeIndex;typeof s>"u"?s=l.getSlideIndex(c.find(O=>O.classList.contains(p.slideActiveClass))):N=s;const j=n==="next"||!n,A=n==="prev"||!n;let z=0,B=0;const X=(k?c[s].column:s)+(v&&typeof r>"u"?-_/2+.5:0);if(X=0;Y-=1)c[Y].column===R&&T.push(Y)}else T.push(C-H-1)}}else if(X+_>C-D){B=Math.max(X-(C-D*2),P),I&&(B=Math.max(B,_-C+y+1));for(let O=0;O{R.column===H&&w.push(Y)}):w.push(H)}}if(l.__preventObserver__=!0,requestAnimationFrame(()=>{l.__preventObserver__=!1}),l.params.effect==="cards"&&c.length<_+D*2&&(w.includes(s)&&w.splice(w.indexOf(s),1),T.includes(s)&&T.splice(T.indexOf(s),1)),A&&T.forEach(O=>{c[O].swiperLoopMoveDOM=!0,m.prepend(c[O]),c[O].swiperLoopMoveDOM=!1}),j&&w.forEach(O=>{c[O].swiperLoopMoveDOM=!0,m.append(c[O]),c[O].swiperLoopMoveDOM=!1}),l.recalcSlides(),p.slidesPerView==="auto"?l.updateSlides():k&&(T.length>0&&A||w.length>0&&j)&&l.slides.forEach((O,H)=>{l.grid.updateSlide(H,O,l.slides)}),p.watchSlidesProgress&&l.updateSlidesOffset(),e){if(T.length>0&&A){if(typeof t>"u"){const O=l.slidesGrid[N],R=l.slidesGrid[N+z]-O;a?l.setTranslate(l.translate-R):(l.slideTo(N+Math.ceil(z),0,!1,!0),r&&(l.touchEventsData.startTranslate=l.touchEventsData.startTranslate-R,l.touchEventsData.currentTranslate=l.touchEventsData.currentTranslate-R))}else if(r){const O=k?T.length/p.grid.rows:T.length;l.slideTo(l.activeIndex+O,0,!1,!0),l.touchEventsData.currentTranslate=l.translate}}else if(w.length>0&&j)if(typeof t>"u"){const O=l.slidesGrid[N],R=l.slidesGrid[N-B]-O;a?l.setTranslate(l.translate-R):(l.slideTo(N-B,0,!1,!0),r&&(l.touchEventsData.startTranslate=l.touchEventsData.startTranslate-R,l.touchEventsData.currentTranslate=l.touchEventsData.currentTranslate-R))}else{const O=k?w.length/p.grid.rows:w.length;l.slideTo(l.activeIndex-O,0,!1,!0)}}if(l.allowSlidePrev=d,l.allowSlideNext=h,l.controller&&l.controller.control&&!o){const O={slideRealIndex:t,direction:n,setTranslate:r,activeSlideIndex:s,byController:!0};Array.isArray(l.controller.control)?l.controller.control.forEach(H=>{!H.destroyed&&H.params.loop&&H.loopFix({...O,slideTo:H.params.slidesPerView===p.slidesPerView?e:!1})}):l.controller.control instanceof l.constructor&&l.controller.control.params.loop&&l.controller.control.loopFix({...O,slideTo:l.controller.control.params.slidesPerView===p.slidesPerView?e:!1})}l.emit("loopFix")}function l$(){const t=this,{params:e,slidesEl:n}=t;if(!e.loop||!n||t.virtual&&t.params.virtual.enabled)return;t.recalcSlides();const r=[];t.slides.forEach(s=>{const i=typeof s.swiperSlideIndex>"u"?s.getAttribute("data-swiper-slide-index")*1:s.swiperSlideIndex;r[i]=s}),t.slides.forEach(s=>{s.removeAttribute("data-swiper-slide-index")}),r.forEach(s=>{n.append(s)}),t.recalcSlides(),t.slideTo(t.realIndex,0)}var c$={loopCreate:o$,loopFix:a$,loopDestroy:l$};function u$(t){const e=this;if(!e.params.simulateTouch||e.params.watchOverflow&&e.isLocked||e.params.cssMode)return;const n=e.params.touchEventsTarget==="container"?e.el:e.wrapperEl;e.isElement&&(e.__preventObserver__=!0),n.style.cursor="move",n.style.cursor=t?"grabbing":"grab",e.isElement&&requestAnimationFrame(()=>{e.__preventObserver__=!1})}function d$(){const t=this;t.params.watchOverflow&&t.isLocked||t.params.cssMode||(t.isElement&&(t.__preventObserver__=!0),t[t.params.touchEventsTarget==="container"?"el":"wrapperEl"].style.cursor="",t.isElement&&requestAnimationFrame(()=>{t.__preventObserver__=!1}))}var h$={setGrabCursor:u$,unsetGrabCursor:d$};function f$(t,e=this){function n(r){if(!r||r===Ko()||r===Fn())return null;r.assignedSlot&&(r=r.assignedSlot);const s=r.closest(t);return!s&&!r.getRootNode?null:s||n(r.getRootNode().host)}return n(e)}function AS(t,e,n){const r=Fn(),{params:s}=t,i=s.edgeSwipeDetection,o=s.edgeSwipeThreshold;return i&&(n<=o||n>=r.innerWidth-o)?i==="prevent"?(e.preventDefault(),!0):!1:!0}function p$(t){const e=this,n=Ko();let r=t;r.originalEvent&&(r=r.originalEvent);const s=e.touchEventsData;if(r.type==="pointerdown"){if(s.pointerId!==null&&s.pointerId!==r.pointerId)return;s.pointerId=r.pointerId}else r.type==="touchstart"&&r.targetTouches.length===1&&(s.touchId=r.targetTouches[0].identifier);if(r.type==="touchstart"){AS(e,r,r.targetTouches[0].pageX);return}const{params:i,touches:o,enabled:a}=e;if(!a||!i.simulateTouch&&r.pointerType==="mouse"||e.animating&&i.preventInteractionOnTransition)return;!e.animating&&i.cssMode&&i.loop&&e.loopFix();let l=r.target;if(i.touchEventsTarget==="wrapper"&&!vU(l,e.wrapperEl)||"which"in r&&r.which===3||"button"in r&&r.button>0||s.isTouched&&s.isMoved)return;const c=!!i.noSwipingClass&&i.noSwipingClass!=="",d=r.composedPath?r.composedPath():r.path;c&&r.target&&r.target.shadowRoot&&d&&(l=d[0]);const h=i.noSwipingSelector?i.noSwipingSelector:`.${i.noSwipingClass}`,m=!!(r.target&&r.target.shadowRoot);if(i.noSwiping&&(m?f$(h,l):l.closest(h))){e.allowClick=!0;return}if(i.swipeHandler&&!l.closest(i.swipeHandler))return;o.currentX=r.pageX,o.currentY=r.pageY;const p=o.currentX,g=o.currentY;if(!AS(e,r,p))return;Object.assign(s,{isTouched:!0,isMoved:!1,allowTouchCallbacks:!0,isScrolling:void 0,startMoving:void 0}),o.startX=p,o.startY=g,s.touchStartTime=lf(),e.allowClick=!0,e.updateSize(),e.swipeDirection=void 0,i.threshold>0&&(s.allowThresholdMove=!1);let b=!0;l.matches(s.focusableElements)&&(b=!1,l.nodeName==="SELECT"&&(s.isTouched=!1)),n.activeElement&&n.activeElement.matches(s.focusableElements)&&n.activeElement!==l&&(r.pointerType==="mouse"||r.pointerType!=="mouse"&&!l.matches(s.focusableElements))&&n.activeElement.blur();const E=b&&e.allowTouchMove&&i.touchStartPreventDefault;(i.touchStartForcePreventDefault||E)&&!l.isContentEditable&&r.preventDefault(),i.freeMode&&i.freeMode.enabled&&e.freeMode&&e.animating&&!i.cssMode&&e.freeMode.onTouchStart(),e.emit("touchStart",r)}function m$(t){const e=Ko(),n=this,r=n.touchEventsData,{params:s,touches:i,rtlTranslate:o,enabled:a}=n;if(!a||!s.simulateTouch&&t.pointerType==="mouse")return;let l=t;if(l.originalEvent&&(l=l.originalEvent),l.type==="pointermove"&&(r.touchId!==null||l.pointerId!==r.pointerId))return;let c;if(l.type==="touchmove"){if(c=[...l.changedTouches].find(D=>D.identifier===r.touchId),!c||c.identifier!==r.touchId)return}else c=l;if(!r.isTouched){r.startMoving&&r.isScrolling&&n.emit("touchMoveOpposite",l);return}const d=c.pageX,h=c.pageY;if(l.preventedByNestedSwiper){i.startX=d,i.startY=h;return}if(!n.allowTouchMove){l.target.matches(r.focusableElements)||(n.allowClick=!1),r.isTouched&&(Object.assign(i,{startX:d,startY:h,currentX:d,currentY:h}),r.touchStartTime=lf());return}if(s.touchReleaseOnEdges&&!s.loop)if(n.isVertical()){if(hi.startY&&n.translate>=n.minTranslate()){r.isTouched=!1,r.isMoved=!1;return}}else{if(o&&(d>i.startX&&-n.translate<=n.maxTranslate()||d=n.minTranslate()))return;if(!o&&(di.startX&&n.translate>=n.minTranslate()))return}if(e.activeElement&&e.activeElement.matches(r.focusableElements)&&e.activeElement!==l.target&&l.pointerType!=="mouse"&&e.activeElement.blur(),e.activeElement&&l.target===e.activeElement&&l.target.matches(r.focusableElements)){r.isMoved=!0,n.allowClick=!1;return}r.allowTouchCallbacks&&n.emit("touchMove",l),i.previousX=i.currentX,i.previousY=i.currentY,i.currentX=d,i.currentY=h;const m=i.currentX-i.startX,p=i.currentY-i.startY;if(n.params.threshold&&Math.sqrt(m**2+p**2)"u"){let D;n.isHorizontal()&&i.currentY===i.startY||n.isVertical()&&i.currentX===i.startX?r.isScrolling=!1:m*m+p*p>=25&&(D=Math.atan2(Math.abs(p),Math.abs(m))*180/Math.PI,r.isScrolling=n.isHorizontal()?D>s.touchAngle:90-D>s.touchAngle)}if(r.isScrolling&&n.emit("touchMoveOpposite",l),typeof r.startMoving>"u"&&(i.currentX!==i.startX||i.currentY!==i.startY)&&(r.startMoving=!0),r.isScrolling||l.type==="touchmove"&&r.preventTouchMoveFromPointerMove){r.isTouched=!1;return}if(!r.startMoving)return;n.allowClick=!1,!s.cssMode&&l.cancelable&&l.preventDefault(),s.touchMoveStopPropagation&&!s.nested&&l.stopPropagation();let g=n.isHorizontal()?m:p,b=n.isHorizontal()?i.currentX-i.previousX:i.currentY-i.previousY;s.oneWayMovement&&(g=Math.abs(g)*(o?1:-1),b=Math.abs(b)*(o?1:-1)),i.diff=g,g*=s.touchRatio,o&&(g=-g,b=-b);const E=n.touchesDirection;n.swipeDirection=g>0?"prev":"next",n.touchesDirection=b>0?"prev":"next";const y=n.params.loop&&!s.cssMode,v=n.touchesDirection==="next"&&n.allowSlideNext||n.touchesDirection==="prev"&&n.allowSlidePrev;if(!r.isMoved){if(y&&v&&n.loopFix({direction:n.swipeDirection}),r.startTranslate=n.getTranslate(),n.setTransition(0),n.animating){const D=new window.CustomEvent("transitionend",{bubbles:!0,cancelable:!0,detail:{bySwiperTouchMove:!0}});n.wrapperEl.dispatchEvent(D)}r.allowMomentumBounce=!1,s.grabCursor&&(n.allowSlideNext===!0||n.allowSlidePrev===!0)&&n.setGrabCursor(!0),n.emit("sliderFirstMove",l)}if(new Date().getTime(),s._loopSwapReset!==!1&&r.isMoved&&r.allowThresholdMove&&E!==n.touchesDirection&&y&&v&&Math.abs(g)>=1){Object.assign(i,{startX:d,startY:h,currentX:d,currentY:h,startTranslate:r.currentTranslate}),r.loopSwapReset=!0,r.startTranslate=r.currentTranslate;return}n.emit("sliderMove",l),r.isMoved=!0,r.currentTranslate=g+r.startTranslate;let _=!0,P=s.resistanceRatio;if(s.touchReleaseOnEdges&&(P=0),g>0?(y&&v&&r.allowThresholdMove&&r.currentTranslate>(s.centeredSlides?n.minTranslate()-n.slidesSizesGrid[n.activeIndex+1]-(s.slidesPerView!=="auto"&&n.slides.length-s.slidesPerView>=2?n.slidesSizesGrid[n.activeIndex+1]+n.params.spaceBetween:0)-n.params.spaceBetween:n.minTranslate())&&n.loopFix({direction:"prev",setTranslate:!0,activeSlideIndex:0}),r.currentTranslate>n.minTranslate()&&(_=!1,s.resistance&&(r.currentTranslate=n.minTranslate()-1+(-n.minTranslate()+r.startTranslate+g)**P))):g<0&&(y&&v&&r.allowThresholdMove&&r.currentTranslate<(s.centeredSlides?n.maxTranslate()+n.slidesSizesGrid[n.slidesSizesGrid.length-1]+n.params.spaceBetween+(s.slidesPerView!=="auto"&&n.slides.length-s.slidesPerView>=2?n.slidesSizesGrid[n.slidesSizesGrid.length-1]+n.params.spaceBetween:0):n.maxTranslate())&&n.loopFix({direction:"next",setTranslate:!0,activeSlideIndex:n.slides.length-(s.slidesPerView==="auto"?n.slidesPerViewDynamic():Math.ceil(parseFloat(s.slidesPerView,10)))}),r.currentTranslater.startTranslate&&(r.currentTranslate=r.startTranslate),!n.allowSlidePrev&&!n.allowSlideNext&&(r.currentTranslate=r.startTranslate),s.threshold>0)if(Math.abs(g)>s.threshold||r.allowThresholdMove){if(!r.allowThresholdMove){r.allowThresholdMove=!0,i.startX=i.currentX,i.startY=i.currentY,r.currentTranslate=r.startTranslate,i.diff=n.isHorizontal()?i.currentX-i.startX:i.currentY-i.startY;return}}else{r.currentTranslate=r.startTranslate;return}!s.followFinger||s.cssMode||((s.freeMode&&s.freeMode.enabled&&n.freeMode||s.watchSlidesProgress)&&(n.updateActiveIndex(),n.updateSlidesClasses()),s.freeMode&&s.freeMode.enabled&&n.freeMode&&n.freeMode.onTouchMove(),n.updateProgress(r.currentTranslate),n.setTranslate(r.currentTranslate))}function g$(t){const e=this,n=e.touchEventsData;let r=t;r.originalEvent&&(r=r.originalEvent);let s;if(r.type==="touchend"||r.type==="touchcancel"){if(s=[...r.changedTouches].find(D=>D.identifier===n.touchId),!s||s.identifier!==n.touchId)return}else{if(n.touchId!==null||r.pointerId!==n.pointerId)return;s=r}if(["pointercancel","pointerout","pointerleave","contextmenu"].includes(r.type)&&!(["pointercancel","contextmenu"].includes(r.type)&&(e.browser.isSafari||e.browser.isWebView)))return;n.pointerId=null,n.touchId=null;const{params:o,touches:a,rtlTranslate:l,slidesGrid:c,enabled:d}=e;if(!d||!o.simulateTouch&&r.pointerType==="mouse")return;if(n.allowTouchCallbacks&&e.emit("touchEnd",r),n.allowTouchCallbacks=!1,!n.isTouched){n.isMoved&&o.grabCursor&&e.setGrabCursor(!1),n.isMoved=!1,n.startMoving=!1;return}o.grabCursor&&n.isMoved&&n.isTouched&&(e.allowSlideNext===!0||e.allowSlidePrev===!0)&&e.setGrabCursor(!1);const h=lf(),m=h-n.touchStartTime;if(e.allowClick){const D=r.path||r.composedPath&&r.composedPath();e.updateClickedSlide(D&&D[0]||r.target,D),e.emit("tap click",r),m<300&&h-n.lastClickTime<300&&e.emit("doubleTap doubleClick",r)}if(n.lastClickTime=lf(),EA(()=>{e.destroyed||(e.allowClick=!0)}),!n.isTouched||!n.isMoved||!e.swipeDirection||a.diff===0&&!n.loopSwapReset||n.currentTranslate===n.startTranslate&&!n.loopSwapReset){n.isTouched=!1,n.isMoved=!1,n.startMoving=!1;return}n.isTouched=!1,n.isMoved=!1,n.startMoving=!1;let p;if(o.followFinger?p=l?e.translate:-e.translate:p=-n.currentTranslate,o.cssMode)return;if(o.freeMode&&o.freeMode.enabled){e.freeMode.onTouchEnd({currentPos:p});return}const g=p>=-e.maxTranslate()&&!e.params.loop;let b=0,E=e.slidesSizesGrid[0];for(let D=0;D=c[D]&&p=c[D])&&(b=D,E=c[c.length-1]-c[c.length-2])}let y=null,v=null;o.rewind&&(e.isBeginning?v=o.virtual&&o.virtual.enabled&&e.virtual?e.virtual.slides.length-1:e.slides.length-1:e.isEnd&&(y=0));const _=(p-c[b])/E,P=bo.longSwipesMs){if(!o.longSwipes){e.slideTo(e.activeIndex);return}e.swipeDirection==="next"&&(_>=o.longSwipesRatio?e.slideTo(o.rewind&&e.isEnd?y:b+P):e.slideTo(b)),e.swipeDirection==="prev"&&(_>1-o.longSwipesRatio?e.slideTo(b+P):v!==null&&_<0&&Math.abs(_)>o.longSwipesRatio?e.slideTo(v):e.slideTo(b))}else{if(!o.shortSwipes){e.slideTo(e.activeIndex);return}e.navigation&&(r.target===e.navigation.nextEl||r.target===e.navigation.prevEl)?r.target===e.navigation.nextEl?e.slideTo(b+P):e.slideTo(b):(e.swipeDirection==="next"&&e.slideTo(y!==null?y:b+P),e.swipeDirection==="prev"&&e.slideTo(v!==null?v:b))}}function PS(){const t=this,{params:e,el:n}=t;if(n&&n.offsetWidth===0)return;e.breakpoints&&t.setBreakpoint();const{allowSlideNext:r,allowSlidePrev:s,snapGrid:i}=t,o=t.virtual&&t.params.virtual.enabled;t.allowSlideNext=!0,t.allowSlidePrev=!0,t.updateSize(),t.updateSlides(),t.updateSlidesClasses();const a=o&&e.loop;if((e.slidesPerView==="auto"||e.slidesPerView>1)&&t.isEnd&&!t.isBeginning&&!t.params.centeredSlides&&!a){const l=o?t.virtual.slides:t.slides;t.slideTo(l.length-1,0,!1,!0)}else t.params.loop&&!o?t.slideToLoop(t.realIndex,0,!1,!0):t.slideTo(t.activeIndex,0,!1,!0);t.autoplay&&t.autoplay.running&&t.autoplay.paused&&(clearTimeout(t.autoplay.resizeTimeout),t.autoplay.resizeTimeout=setTimeout(()=>{t.autoplay&&t.autoplay.running&&t.autoplay.paused&&t.autoplay.resume()},500)),t.allowSlidePrev=s,t.allowSlideNext=r,t.params.watchOverflow&&i!==t.snapGrid&&t.checkOverflow()}function y$(t){const e=this;e.enabled&&(e.allowClick||(e.params.preventClicks&&t.preventDefault(),e.params.preventClicksPropagation&&e.animating&&(t.stopPropagation(),t.stopImmediatePropagation())))}function x$(){const t=this,{wrapperEl:e,rtlTranslate:n,enabled:r}=t;if(!r)return;t.previousTranslate=t.translate,t.isHorizontal()?t.translate=-e.scrollLeft:t.translate=-e.scrollTop,t.translate===0&&(t.translate=0),t.updateActiveIndex(),t.updateSlidesClasses();let s;const i=t.maxTranslate()-t.minTranslate();i===0?s=0:s=(t.translate-t.minTranslate())/i,s!==t.progress&&t.updateProgress(n?-t.translate:t.translate),t.emit("setTranslate",t.translate,!1)}function v$(t){const e=this;nh(e,t.target),!(e.params.cssMode||e.params.slidesPerView!=="auto"&&!e.params.autoHeight)&&e.update()}function w$(){const t=this;t.documentTouchHandlerProceeded||(t.documentTouchHandlerProceeded=!0,t.params.touchReleaseOnEdges&&(t.el.style.touchAction="auto"))}const AA=(t,e)=>{const n=Ko(),{params:r,el:s,wrapperEl:i,device:o}=t,a=!!r.nested,l=e==="on"?"addEventListener":"removeEventListener",c=e;!s||typeof s=="string"||(n[l]("touchstart",t.onDocumentTouchStart,{passive:!1,capture:a}),s[l]("touchstart",t.onTouchStart,{passive:!1}),s[l]("pointerdown",t.onTouchStart,{passive:!1}),n[l]("touchmove",t.onTouchMove,{passive:!1,capture:a}),n[l]("pointermove",t.onTouchMove,{passive:!1,capture:a}),n[l]("touchend",t.onTouchEnd,{passive:!0}),n[l]("pointerup",t.onTouchEnd,{passive:!0}),n[l]("pointercancel",t.onTouchEnd,{passive:!0}),n[l]("touchcancel",t.onTouchEnd,{passive:!0}),n[l]("pointerout",t.onTouchEnd,{passive:!0}),n[l]("pointerleave",t.onTouchEnd,{passive:!0}),n[l]("contextmenu",t.onTouchEnd,{passive:!0}),(r.preventClicks||r.preventClicksPropagation)&&s[l]("click",t.onClick,!0),r.cssMode&&i[l]("scroll",t.onScroll),r.updateOnWindowResize?t[c](o.ios||o.android?"resize orientationchange observerUpdate":"resize observerUpdate",PS,!0):t[c]("observerUpdate",PS,!0),s[l]("load",t.onLoad,{capture:!0}))};function b$(){const t=this,{params:e}=t;t.onTouchStart=p$.bind(t),t.onTouchMove=m$.bind(t),t.onTouchEnd=g$.bind(t),t.onDocumentTouchStart=w$.bind(t),e.cssMode&&(t.onScroll=x$.bind(t)),t.onClick=y$.bind(t),t.onLoad=v$.bind(t),AA(t,"on")}function _$(){AA(this,"off")}var S$={attachEvents:b$,detachEvents:_$};const RS=(t,e)=>t.grid&&e.grid&&e.grid.rows>1;function E$(){const t=this,{realIndex:e,initialized:n,params:r,el:s}=t,i=r.breakpoints;if(!i||i&&Object.keys(i).length===0)return;const o=Ko(),a=r.breakpointsBase==="window"||!r.breakpointsBase?r.breakpointsBase:"container",l=["window","container"].includes(r.breakpointsBase)||!r.breakpointsBase?t.el:o.querySelector(r.breakpointsBase),c=t.getBreakpoint(i,a,l);if(!c||t.currentBreakpoint===c)return;const h=(c in i?i[c]:void 0)||t.originalParams,m=RS(t,r),p=RS(t,h),g=t.params.grabCursor,b=h.grabCursor,E=r.enabled;m&&!p?(s.classList.remove(`${r.containerModifierClass}grid`,`${r.containerModifierClass}grid-column`),t.emitContainerClasses()):!m&&p&&(s.classList.add(`${r.containerModifierClass}grid`),(h.grid.fill&&h.grid.fill==="column"||!h.grid.fill&&r.grid.fill==="column")&&s.classList.add(`${r.containerModifierClass}grid-column`),t.emitContainerClasses()),g&&!b?t.unsetGrabCursor():!g&&b&&t.setGrabCursor(),["navigation","pagination","scrollbar"].forEach(k=>{if(typeof h[k]>"u")return;const T=r[k]&&r[k].enabled,w=h[k]&&h[k].enabled;T&&!w&&t[k].disable(),!T&&w&&t[k].enable()});const y=h.direction&&h.direction!==r.direction,v=r.loop&&(h.slidesPerView!==r.slidesPerView||y),_=r.loop;y&&n&&t.changeDirection(),fr(t.params,h);const P=t.params.enabled,D=t.params.loop;Object.assign(t,{allowTouchMove:t.params.allowTouchMove,allowSlideNext:t.params.allowSlideNext,allowSlidePrev:t.params.allowSlidePrev}),E&&!P?t.disable():!E&&P&&t.enable(),t.currentBreakpoint=c,t.emit("_beforeBreakpoint",h),n&&(v?(t.loopDestroy(),t.loopCreate(e),t.updateSlides()):!_&&D?(t.loopCreate(e),t.updateSlides()):_&&!D&&t.loopDestroy()),t.emit("breakpoint",h)}function T$(t,e="window",n){if(!t||e==="container"&&!n)return;let r=!1;const s=Fn(),i=e==="window"?s.innerHeight:n.clientHeight,o=Object.keys(t).map(a=>{if(typeof a=="string"&&a.indexOf("@")===0){const l=parseFloat(a.substr(1));return{value:i*l,point:a}}return{value:a,point:a}});o.sort((a,l)=>parseInt(a.value,10)-parseInt(l.value,10));for(let a=0;a{typeof r=="object"?Object.keys(r).forEach(s=>{r[s]&&n.push(e+s)}):typeof r=="string"&&n.push(e+r)}),n}function I$(){const t=this,{classNames:e,params:n,rtl:r,el:s,device:i}=t,o=C$(["initialized",n.direction,{"free-mode":t.params.freeMode&&n.freeMode.enabled},{autoheight:n.autoHeight},{rtl:r},{grid:n.grid&&n.grid.rows>1},{"grid-column":n.grid&&n.grid.rows>1&&n.grid.fill==="column"},{android:i.android},{ios:i.ios},{"css-mode":n.cssMode},{centered:n.cssMode&&n.centeredSlides},{"watch-progress":n.watchSlidesProgress}],n.containerModifierClass);e.push(...o),s.classList.add(...e),t.emitContainerClasses()}function N$(){const t=this,{el:e,classNames:n}=t;!e||typeof e=="string"||(e.classList.remove(...n),t.emitContainerClasses())}var A$={addClasses:I$,removeClasses:N$};function P$(){const t=this,{isLocked:e,params:n}=t,{slidesOffsetBefore:r}=n;if(r){const s=t.slides.length-1,i=t.slidesGrid[s]+t.slidesSizesGrid[s]+r*2;t.isLocked=t.size>i}else t.isLocked=t.snapGrid.length===1;n.allowSlideNext===!0&&(t.allowSlideNext=!t.isLocked),n.allowSlidePrev===!0&&(t.allowSlidePrev=!t.isLocked),e&&e!==t.isLocked&&(t.isEnd=!1),e!==t.isLocked&&t.emit(t.isLocked?"lock":"unlock")}var R$={checkOverflow:P$},Ly={init:!0,direction:"horizontal",oneWayMovement:!1,swiperElementNodeName:"SWIPER-CONTAINER",touchEventsTarget:"wrapper",initialSlide:0,speed:300,cssMode:!1,updateOnWindowResize:!0,resizeObserver:!0,nested:!1,createElements:!1,eventsPrefix:"swiper",enabled:!0,focusableElements:"input, select, option, textarea, button, video, label",width:null,height:null,preventInteractionOnTransition:!1,userAgent:null,url:null,edgeSwipeDetection:!1,edgeSwipeThreshold:20,autoHeight:!1,setWrapperSize:!1,virtualTranslate:!1,effect:"slide",breakpoints:void 0,breakpointsBase:"window",spaceBetween:0,slidesPerView:1,slidesPerGroup:1,slidesPerGroupSkip:0,slidesPerGroupAuto:!1,centeredSlides:!1,centeredSlidesBounds:!1,slidesOffsetBefore:0,slidesOffsetAfter:0,normalizeSlideIndex:!0,centerInsufficientSlides:!1,snapToSlideEdge:!1,watchOverflow:!0,roundLengths:!1,touchRatio:1,touchAngle:45,simulateTouch:!0,shortSwipes:!0,longSwipes:!0,longSwipesRatio:.5,longSwipesMs:300,followFinger:!0,allowTouchMove:!0,threshold:5,touchMoveStopPropagation:!1,touchStartPreventDefault:!0,touchStartForcePreventDefault:!1,touchReleaseOnEdges:!1,uniqueNavElements:!0,resistance:!0,resistanceRatio:.85,watchSlidesProgress:!1,grabCursor:!1,preventClicks:!0,preventClicksPropagation:!0,slideToClickedSlide:!1,loop:!1,loopAddBlankSlides:!0,loopAdditionalSlides:0,loopPreventsSliding:!0,rewind:!1,allowSlidePrev:!0,allowSlideNext:!0,swipeHandler:null,noSwiping:!0,noSwipingClass:"swiper-no-swiping",noSwipingSelector:null,passiveListeners:!0,maxBackfaceHiddenSlides:10,containerModifierClass:"swiper-",slideClass:"swiper-slide",slideBlankClass:"swiper-slide-blank",slideActiveClass:"swiper-slide-active",slideVisibleClass:"swiper-slide-visible",slideFullyVisibleClass:"swiper-slide-fully-visible",slideNextClass:"swiper-slide-next",slidePrevClass:"swiper-slide-prev",wrapperClass:"swiper-wrapper",lazyPreloaderClass:"swiper-lazy-preloader",lazyPreloadPrevNext:0,runCallbacksOnInit:!0,_emitClasses:!1};function j$(t,e){return function(r={}){const s=Object.keys(r)[0],i=r[s];if(typeof i!="object"||i===null){fr(e,r);return}if(t[s]===!0&&(t[s]={enabled:!0}),s==="navigation"&&t[s]&&t[s].enabled&&!t[s].prevEl&&!t[s].nextEl&&(t[s].auto=!0),["pagination","scrollbar"].indexOf(s)>=0&&t[s]&&t[s].enabled&&!t[s].el&&(t[s].auto=!0),!(s in t&&"enabled"in i)){fr(e,r);return}typeof t[s]=="object"&&!("enabled"in t[s])&&(t[s].enabled=!0),t[s]||(t[s]={enabled:!1}),fr(e,r)}}const Cm={eventsEmitter:AU,update:BU,translate:WU,transition:XU,slide:i$,loop:c$,grabCursor:h$,events:S$,breakpoints:k$,checkOverflow:R$,classes:A$},Im={};let vv=class As{constructor(...e){let n,r;e.length===1&&e[0].constructor&&Object.prototype.toString.call(e[0]).slice(8,-1)==="Object"?r=e[0]:[n,r]=e,r||(r={}),r=fr({},r),n&&!r.el&&(r.el=n);const s=Ko();if(r.el&&typeof r.el=="string"&&s.querySelectorAll(r.el).length>1){const l=[];return s.querySelectorAll(r.el).forEach(c=>{const d=fr({},r,{el:c});l.push(new As(d))}),l}const i=this;i.__swiper__=!0,i.support=kA(),i.device=CA({userAgent:r.userAgent}),i.browser=IA(),i.eventsListeners={},i.eventsAnyListeners=[],i.modules=[...i.__modules__],r.modules&&Array.isArray(r.modules)&&r.modules.forEach(l=>{typeof l=="function"&&i.modules.indexOf(l)<0&&i.modules.push(l)});const o={};i.modules.forEach(l=>{l({params:r,swiper:i,extendParams:j$(r,o),on:i.on.bind(i),once:i.once.bind(i),off:i.off.bind(i),emit:i.emit.bind(i)})});const a=fr({},Ly,o);return i.params=fr({},a,Im,r),i.originalParams=fr({},i.params),i.passedParams=fr({},r),i.params&&i.params.on&&Object.keys(i.params.on).forEach(l=>{i.on(l,i.params.on[l])}),i.params&&i.params.onAny&&i.onAny(i.params.onAny),Object.assign(i,{enabled:i.params.enabled,el:n,classNames:[],slides:[],slidesGrid:[],snapGrid:[],slidesSizesGrid:[],isHorizontal(){return i.params.direction==="horizontal"},isVertical(){return i.params.direction==="vertical"},activeIndex:0,realIndex:0,isBeginning:!0,isEnd:!1,translate:0,previousTranslate:0,progress:0,velocity:0,animating:!1,cssOverflowAdjustment(){return Math.trunc(this.translate/2**23)*2**23},allowSlideNext:i.params.allowSlideNext,allowSlidePrev:i.params.allowSlidePrev,touchEventsData:{isTouched:void 0,isMoved:void 0,allowTouchCallbacks:void 0,touchStartTime:void 0,isScrolling:void 0,currentTranslate:void 0,startTranslate:void 0,allowThresholdMove:void 0,focusableElements:i.params.focusableElements,lastClickTime:0,clickTimeout:void 0,velocities:[],allowMomentumBounce:void 0,startMoving:void 0,pointerId:null,touchId:null},allowClick:!0,allowTouchMove:i.params.allowTouchMove,touches:{startX:0,startY:0,currentX:0,currentY:0,diff:0},imagesToLoad:[],imagesLoaded:0}),i.emit("_swiper"),i.params.init&&i.init(),i}getDirectionLabel(e){return this.isHorizontal()?e:{width:"height","margin-top":"margin-left","margin-bottom ":"margin-right","margin-left":"margin-top","margin-right":"margin-bottom","padding-left":"padding-top","padding-right":"padding-bottom",marginRight:"marginBottom"}[e]}getSlideIndex(e){const{slidesEl:n,params:r}=this,s=Os(n,`.${r.slideClass}, swiper-slide`),i=kS(s[0]);return kS(e)-i}getSlideIndexByData(e){return this.getSlideIndex(this.slides.find(n=>n.getAttribute("data-swiper-slide-index")*1===e))}getSlideIndexWhenGrid(e){return this.grid&&this.params.grid&&this.params.grid.rows>1&&(this.params.grid.fill==="column"?e=Math.floor(e/this.params.grid.rows):this.params.grid.fill==="row"&&(e=e%Math.ceil(this.slides.length/this.params.grid.rows))),e}recalcSlides(){const e=this,{slidesEl:n,params:r}=e;e.slides=Os(n,`.${r.slideClass}, swiper-slide`)}enable(){const e=this;e.enabled||(e.enabled=!0,e.params.grabCursor&&e.setGrabCursor(),e.emit("enable"))}disable(){const e=this;e.enabled&&(e.enabled=!1,e.params.grabCursor&&e.unsetGrabCursor(),e.emit("disable"))}setProgress(e,n){const r=this;e=Math.min(Math.max(e,0),1);const s=r.minTranslate(),o=(r.maxTranslate()-s)*e+s;r.translateTo(o,typeof n>"u"?0:n),r.updateActiveIndex(),r.updateSlidesClasses()}emitContainerClasses(){const e=this;if(!e.params._emitClasses||!e.el)return;const n=e.el.className.split(" ").filter(r=>r.indexOf("swiper")===0||r.indexOf(e.params.containerModifierClass)===0);e.emit("_containerClasses",n.join(" "))}getSlideClasses(e){const n=this;return n.destroyed?"":e.className.split(" ").filter(r=>r.indexOf("swiper-slide")===0||r.indexOf(n.params.slideClass)===0).join(" ")}emitSlidesClasses(){const e=this;if(!e.params._emitClasses||!e.el)return;const n=[];e.slides.forEach(r=>{const s=e.getSlideClasses(r);n.push({slideEl:r,classNames:s}),e.emit("_slideClass",r,s)}),e.emit("_slideClasses",n)}slidesPerViewDynamic(e="current",n=!1){const r=this,{params:s,slides:i,slidesGrid:o,slidesSizesGrid:a,size:l,activeIndex:c}=r;let d=1;if(typeof s.slidesPerView=="number")return s.slidesPerView;if(s.centeredSlides){let h=i[c]?Math.ceil(i[c].swiperSlideSize):0,m;for(let p=c+1;pl&&(m=!0));for(let p=c-1;p>=0;p-=1)i[p]&&!m&&(h+=i[p].swiperSlideSize,d+=1,h>l&&(m=!0))}else if(e==="current")for(let h=c+1;h=0;h-=1)o[c]-o[h]{o.complete&&nh(e,o)}),e.updateSize(),e.updateSlides(),e.updateProgress(),e.updateSlidesClasses();function s(){const o=e.rtlTranslate?e.translate*-1:e.translate,a=Math.min(Math.max(o,e.maxTranslate()),e.minTranslate());e.setTranslate(a),e.updateActiveIndex(),e.updateSlidesClasses()}let i;if(r.freeMode&&r.freeMode.enabled&&!r.cssMode)s(),r.autoHeight&&e.updateAutoHeight();else{if((r.slidesPerView==="auto"||r.slidesPerView>1)&&e.isEnd&&!r.centeredSlides){const o=e.virtual&&r.virtual.enabled?e.virtual.slides:e.slides;i=e.slideTo(o.length-1,0,!1,!0)}else i=e.slideTo(e.activeIndex,0,!1,!0);i||s()}r.watchOverflow&&n!==e.snapGrid&&e.checkOverflow(),e.emit("update")}changeDirection(e,n=!0){const r=this,s=r.params.direction;return e||(e=s==="horizontal"?"vertical":"horizontal"),e===s||e!=="horizontal"&&e!=="vertical"||(r.el.classList.remove(`${r.params.containerModifierClass}${s}`),r.el.classList.add(`${r.params.containerModifierClass}${e}`),r.emitContainerClasses(),r.params.direction=e,r.slides.forEach(i=>{e==="vertical"?i.style.width="":i.style.height=""}),r.emit("changeDirection"),n&&r.update()),r}changeLanguageDirection(e){const n=this;n.rtl&&e==="rtl"||!n.rtl&&e==="ltr"||(n.rtl=e==="rtl",n.rtlTranslate=n.params.direction==="horizontal"&&n.rtl,n.rtl?(n.el.classList.add(`${n.params.containerModifierClass}rtl`),n.el.dir="rtl"):(n.el.classList.remove(`${n.params.containerModifierClass}rtl`),n.el.dir="ltr"),n.update())}mount(e){const n=this;if(n.mounted)return!0;let r=e||n.params.el;if(typeof r=="string"&&(r=document.querySelector(r)),!r)return!1;r.swiper=n,r.parentNode&&r.parentNode.host&&r.parentNode.host.nodeName===n.params.swiperElementNodeName.toUpperCase()&&(n.isElement=!0);const s=()=>`.${(n.params.wrapperClass||"").trim().split(" ").join(".")}`;let o=r&&r.shadowRoot&&r.shadowRoot.querySelector?r.shadowRoot.querySelector(s()):Os(r,s())[0];return!o&&n.params.createElements&&(o=uf("div",n.params.wrapperClass),r.append(o),Os(r,`.${n.params.slideClass}`).forEach(a=>{o.append(a)})),Object.assign(n,{el:r,wrapperEl:o,slidesEl:n.isElement&&!r.parentNode.host.slideSlots?r.parentNode.host:o,hostEl:n.isElement?r.parentNode.host:r,mounted:!0,rtl:r.dir.toLowerCase()==="rtl"||wi(r,"direction")==="rtl",rtlTranslate:n.params.direction==="horizontal"&&(r.dir.toLowerCase()==="rtl"||wi(r,"direction")==="rtl"),wrongRTL:wi(o,"display")==="-webkit-box"}),!0}init(e){const n=this;if(n.initialized||n.mount(e)===!1)return n;n.emit("beforeInit"),n.params.breakpoints&&n.setBreakpoint(),n.addClasses(),n.updateSize(),n.updateSlides(),n.params.watchOverflow&&n.checkOverflow(),n.params.grabCursor&&n.enabled&&n.setGrabCursor(),n.params.loop&&n.virtual&&n.params.virtual.enabled?n.slideTo(n.params.initialSlide+n.virtual.slidesBefore,0,n.params.runCallbacksOnInit,!1,!0):n.slideTo(n.params.initialSlide,0,n.params.runCallbacksOnInit,!1,!0),n.params.loop&&n.loopCreate(void 0,!0),n.attachEvents();const s=[...n.el.querySelectorAll('[loading="lazy"]')];return n.isElement&&s.push(...n.hostEl.querySelectorAll('[loading="lazy"]')),s.forEach(i=>{i.complete?nh(n,i):i.addEventListener("load",o=>{nh(n,o.target)})}),My(n),n.initialized=!0,My(n),n.emit("init"),n.emit("afterInit"),n}destroy(e=!0,n=!0){const r=this,{params:s,el:i,wrapperEl:o,slides:a}=r;return typeof r.params>"u"||r.destroyed||(r.emit("beforeDestroy"),r.initialized=!1,r.detachEvents(),s.loop&&r.loopDestroy(),n&&(r.removeClasses(),i&&typeof i!="string"&&i.removeAttribute("style"),o&&o.removeAttribute("style"),a&&a.length&&a.forEach(l=>{l.classList.remove(s.slideVisibleClass,s.slideFullyVisibleClass,s.slideActiveClass,s.slideNextClass,s.slidePrevClass),l.removeAttribute("style"),l.removeAttribute("data-swiper-slide-index")})),r.emit("destroy"),Object.keys(r.eventsListeners).forEach(l=>{r.off(l)}),e!==!1&&(r.el&&typeof r.el!="string"&&(r.el.swiper=null),pU(r)),r.destroyed=!0),null}static extendDefaults(e){fr(Im,e)}static get extendedDefaults(){return Im}static get defaults(){return Ly}static installModule(e){As.prototype.__modules__||(As.prototype.__modules__=[]);const n=As.prototype.__modules__;typeof e=="function"&&n.indexOf(e)<0&&n.push(e)}static use(e){return Array.isArray(e)?(e.forEach(n=>As.installModule(n)),As):(As.installModule(e),As)}};Object.keys(Cm).forEach(t=>{Object.keys(Cm[t]).forEach(e=>{vv.prototype[e]=Cm[t][e]})});vv.use([IU,NU]);const PA=["eventsPrefix","injectStyles","injectStylesUrls","modules","init","_direction","oneWayMovement","swiperElementNodeName","touchEventsTarget","initialSlide","_speed","cssMode","updateOnWindowResize","resizeObserver","nested","focusableElements","_enabled","_width","_height","preventInteractionOnTransition","userAgent","url","_edgeSwipeDetection","_edgeSwipeThreshold","_freeMode","_autoHeight","setWrapperSize","virtualTranslate","_effect","breakpoints","breakpointsBase","_spaceBetween","_slidesPerView","maxBackfaceHiddenSlides","_grid","_slidesPerGroup","_slidesPerGroupSkip","_slidesPerGroupAuto","_centeredSlides","_centeredSlidesBounds","_slidesOffsetBefore","_slidesOffsetAfter","normalizeSlideIndex","_centerInsufficientSlides","_snapToSlideEdge","_watchOverflow","roundLengths","touchRatio","touchAngle","simulateTouch","_shortSwipes","_longSwipes","longSwipesRatio","longSwipesMs","_followFinger","allowTouchMove","_threshold","touchMoveStopPropagation","touchStartPreventDefault","touchStartForcePreventDefault","touchReleaseOnEdges","uniqueNavElements","_resistance","_resistanceRatio","_watchSlidesProgress","_grabCursor","preventClicks","preventClicksPropagation","_slideToClickedSlide","_loop","loopAdditionalSlides","loopAddBlankSlides","loopPreventsSliding","_rewind","_allowSlidePrev","_allowSlideNext","_swipeHandler","_noSwiping","noSwipingClass","noSwipingSelector","passiveListeners","containerModifierClass","slideClass","slideActiveClass","slideVisibleClass","slideFullyVisibleClass","slideNextClass","slidePrevClass","slideBlankClass","wrapperClass","lazyPreloaderClass","lazyPreloadPrevNext","runCallbacksOnInit","observer","observeParents","observeSlideChildren","a11y","_autoplay","_controller","coverflowEffect","cubeEffect","fadeEffect","flipEffect","creativeEffect","cardsEffect","hashNavigation","history","keyboard","mousewheel","_navigation","_pagination","parallax","_scrollbar","_thumbs","virtual","zoom","control"];function Uo(t){return typeof t=="object"&&t!==null&&t.constructor&&Object.prototype.toString.call(t).slice(8,-1)==="Object"&&!t.__swiper__}function Oa(t,e){const n=["__proto__","constructor","prototype"];Object.keys(e).filter(r=>n.indexOf(r)<0).forEach(r=>{typeof t[r]>"u"?t[r]=e[r]:Uo(e[r])&&Uo(t[r])&&Object.keys(e[r]).length>0?e[r].__swiper__?t[r]=e[r]:Oa(t[r],e[r]):t[r]=e[r]})}function RA(t={}){return t.navigation&&typeof t.navigation.nextEl>"u"&&typeof t.navigation.prevEl>"u"}function jA(t={}){return t.pagination&&typeof t.pagination.el>"u"}function DA(t={}){return t.scrollbar&&typeof t.scrollbar.el>"u"}function MA(t=""){const e=t.split(" ").map(r=>r.trim()).filter(r=>!!r),n=[];return e.forEach(r=>{n.indexOf(r)<0&&n.push(r)}),n.join(" ")}function D$(t=""){return t?t.includes("swiper-wrapper")?t:`swiper-wrapper ${t}`:"swiper-wrapper"}function M$({swiper:t,slides:e,passedParams:n,changedParams:r,nextEl:s,prevEl:i,scrollbarEl:o,paginationEl:a}){const l=r.filter(w=>w!=="children"&&w!=="direction"&&w!=="wrapperClass"),{params:c,pagination:d,navigation:h,scrollbar:m,virtual:p,thumbs:g}=t;let b,E,y,v,_,P,D,k;r.includes("thumbs")&&n.thumbs&&n.thumbs.swiper&&!n.thumbs.swiper.destroyed&&c.thumbs&&(!c.thumbs.swiper||c.thumbs.swiper.destroyed)&&(b=!0),r.includes("controller")&&n.controller&&n.controller.control&&c.controller&&!c.controller.control&&(E=!0),r.includes("pagination")&&n.pagination&&(n.pagination.el||a)&&(c.pagination||c.pagination===!1)&&d&&!d.el&&(y=!0),r.includes("scrollbar")&&n.scrollbar&&(n.scrollbar.el||o)&&(c.scrollbar||c.scrollbar===!1)&&m&&!m.el&&(v=!0),r.includes("navigation")&&n.navigation&&(n.navigation.prevEl||i)&&(n.navigation.nextEl||s)&&(c.navigation||c.navigation===!1)&&h&&!h.prevEl&&!h.nextEl&&(_=!0);const T=w=>{t[w]&&(t[w].destroy(),w==="navigation"?(t.isElement&&(t[w].prevEl.remove(),t[w].nextEl.remove()),c[w].prevEl=void 0,c[w].nextEl=void 0,t[w].prevEl=void 0,t[w].nextEl=void 0):(t.isElement&&t[w].el.remove(),c[w].el=void 0,t[w].el=void 0))};r.includes("loop")&&t.isElement&&(c.loop&&!n.loop?P=!0:!c.loop&&n.loop?D=!0:k=!0),l.forEach(w=>{if(Uo(c[w])&&Uo(n[w]))Object.assign(c[w],n[w]),(w==="navigation"||w==="pagination"||w==="scrollbar")&&"enabled"in n[w]&&!n[w].enabled&&T(w);else{const C=n[w];(C===!0||C===!1)&&(w==="navigation"||w==="pagination"||w==="scrollbar")?C===!1&&T(w):c[w]=n[w]}}),l.includes("controller")&&!E&&t.controller&&t.controller.control&&c.controller&&c.controller.control&&(t.controller.control=c.controller.control),r.includes("children")&&e&&p&&c.virtual.enabled?(p.slides=e,p.update(!0)):r.includes("virtual")&&p&&c.virtual.enabled&&(e&&(p.slides=e),p.update(!0)),r.includes("children")&&e&&c.loop&&(k=!0),b&&g.init()&&g.update(!0),E&&(t.controller.control=c.controller.control),y&&(t.isElement&&(!a||typeof a=="string")&&(a=document.createElement("div"),a.classList.add("swiper-pagination"),a.part.add("pagination"),t.el.appendChild(a)),a&&(c.pagination.el=a),d.init(),d.render(),d.update()),v&&(t.isElement&&(!o||typeof o=="string")&&(o=document.createElement("div"),o.classList.add("swiper-scrollbar"),o.part.add("scrollbar"),t.el.appendChild(o)),o&&(c.scrollbar.el=o),m.init(),m.updateSize(),m.setTranslate()),_&&(t.isElement&&((!s||typeof s=="string")&&(s=document.createElement("div"),s.classList.add("swiper-button-next"),IS(s,t.navigation.arrowSvg),s.part.add("button-next"),t.el.appendChild(s)),(!i||typeof i=="string")&&(i=document.createElement("div"),i.classList.add("swiper-button-prev"),IS(i,t.navigation.arrowSvg),i.part.add("button-prev"),t.el.appendChild(i))),s&&(c.navigation.nextEl=s),i&&(c.navigation.prevEl=i),h.init(),h.update()),r.includes("allowSlideNext")&&(t.allowSlideNext=n.allowSlideNext),r.includes("allowSlidePrev")&&(t.allowSlidePrev=n.allowSlidePrev),r.includes("direction")&&t.changeDirection(n.direction,!1),(P||k)&&t.loopDestroy(),(D||k)&&t.loopCreate(),t.update()}function L$(t={},e=!0){const n={on:{}},r={},s={};Oa(n,Ly),n._emitClasses=!0,n.init=!1;const i={},o=PA.map(l=>l.replace(/_/,"")),a=Object.assign({},t);return Object.keys(a).forEach(l=>{typeof t[l]>"u"||(o.indexOf(l)>=0?Uo(t[l])?(n[l]={},s[l]={},Oa(n[l],t[l]),Oa(s[l],t[l])):(n[l]=t[l],s[l]=t[l]):l.search(/on[A-Z]/)===0&&typeof t[l]=="function"?e?r[`${l[2].toLowerCase()}${l.substr(3)}`]=t[l]:n.on[`${l[2].toLowerCase()}${l.substr(3)}`]=t[l]:i[l]=t[l])}),["navigation","pagination","scrollbar"].forEach(l=>{n[l]===!0&&(n[l]={}),n[l]===!1&&delete n[l]}),{params:n,passedParams:s,rest:i,events:r}}function V$({el:t,nextEl:e,prevEl:n,paginationEl:r,scrollbarEl:s,swiper:i},o){RA(o)&&e&&n&&(i.params.navigation.nextEl=e,i.originalParams.navigation.nextEl=e,i.params.navigation.prevEl=n,i.originalParams.navigation.prevEl=n),jA(o)&&r&&(i.params.pagination.el=r,i.originalParams.pagination.el=r),DA(o)&&s&&(i.params.scrollbar.el=s,i.originalParams.scrollbar.el=s),i.init(t)}function O$(t,e,n,r,s){const i=[];if(!e)return i;const o=l=>{i.indexOf(l)<0&&i.push(l)};if(n&&r){const l=r.map(s),c=n.map(s);l.join("")!==c.join("")&&o("children"),r.length!==n.length&&o("children")}return PA.filter(l=>l[0]==="_").map(l=>l.replace(/_/,"")).forEach(l=>{if(l in t&&l in e)if(Uo(t[l])&&Uo(e[l])){const c=Object.keys(t[l]),d=Object.keys(e[l]);c.length!==d.length?o(l):(c.forEach(h=>{t[l][h]!==e[l][h]&&o(l)}),d.forEach(h=>{t[l][h]!==e[l][h]&&o(l)}))}else t[l]!==e[l]&&o(l)}),i}const F$=t=>{!t||t.destroyed||!t.params.virtual||t.params.virtual&&!t.params.virtual.enabled||(t.updateSlides(),t.updateProgress(),t.updateSlidesClasses(),t.emit("_virtualUpdated"),t.parallax&&t.params.parallax&&t.params.parallax.enabled&&t.parallax.setTranslate())};function df(){return df=Object.assign?Object.assign.bind():function(t){for(var e=1;e{LA(n)?e.push(n):n.props&&n.props.children&&VA(n.props.children).forEach(r=>e.push(r))}),e}function z$(t){const e=[],n={"container-start":[],"container-end":[],"wrapper-start":[],"wrapper-end":[]};return Z.Children.toArray(t).forEach(r=>{if(LA(r))e.push(r);else if(r.props&&r.props.slot&&n[r.props.slot])n[r.props.slot].push(r);else if(r.props&&r.props.children){const s=VA(r.props.children);s.length>0?s.forEach(i=>e.push(i)):n["container-end"].push(r)}else n["container-end"].push(r)}),{slides:e,slots:n}}function B$(t,e,n){if(!n)return null;const r=d=>{let h=d;return d<0?h=e.length+d:h>=e.length&&(h=h-e.length),h},s=t.isHorizontal()?{[t.rtlTranslate?"right":"left"]:`${n.offset}px`}:{top:`${n.offset}px`},{from:i,to:o}=n,a=t.params.loop?-e.length:0,l=t.params.loop?e.length*2:e.length,c=[];for(let d=a;d=i&&d<=o&&c.push(e[r(d)]);return c.map((d,h)=>Z.cloneElement(d,{swiper:t,style:s,key:d.props.virtualIndex||d.key||`slide-${h}`}))}function bc(t,e){return typeof window>"u"?V.useEffect(t,e):V.useLayoutEffect(t,e)}const jS=V.createContext(null),U$=V.createContext(null),OA=V.forwardRef(({className:t,tag:e="div",wrapperTag:n="div",children:r,onSwiper:s,...i}={},o)=>{let a=!1;const[l,c]=V.useState("swiper"),[d,h]=V.useState(null),[m,p]=V.useState(!1),g=V.useRef(!1),b=V.useRef(null),E=V.useRef(null),y=V.useRef(null),v=V.useRef(null),_=V.useRef(null),P=V.useRef(null),D=V.useRef(null),k=V.useRef(null),{params:T,passedParams:w,rest:C,events:I}=L$(i),{slides:N,slots:j}=z$(r),A=()=>{p(!m)};Object.assign(T.on,{_containerClasses(O,H){c(H)}});const z=()=>{Object.assign(T.on,I),a=!0;const O={...T};if(delete O.wrapperClass,E.current=new vv(O),E.current.virtual&&E.current.params.virtual.enabled){E.current.virtual.slides=N;const H={cache:!1,slides:N,renderExternal:h,renderExternalUpdate:!1};Oa(E.current.params.virtual,H),Oa(E.current.originalParams.virtual,H)}};b.current||z(),E.current&&E.current.on("_beforeBreakpoint",A);const B=()=>{a||!I||!E.current||Object.keys(I).forEach(O=>{E.current.on(O,I[O])})},q=()=>{!I||!E.current||Object.keys(I).forEach(O=>{E.current.off(O,I[O])})};V.useEffect(()=>()=>{E.current&&E.current.off("_beforeBreakpoint",A)}),V.useEffect(()=>{!g.current&&E.current&&(E.current.emitSlidesClasses(),g.current=!0)}),bc(()=>{if(o&&(o.current=b.current),!!b.current)return E.current.destroyed&&z(),V$({el:b.current,nextEl:_.current,prevEl:P.current,paginationEl:D.current,scrollbarEl:k.current,swiper:E.current},T),s&&!E.current.destroyed&&s(E.current),()=>{E.current&&!E.current.destroyed&&E.current.destroy(!0,!1)}},[]),bc(()=>{B();const O=O$(w,y.current,N,v.current,H=>H.key);return y.current=w,v.current=N,O.length&&E.current&&!E.current.destroyed&&M$({swiper:E.current,slides:N,passedParams:w,changedParams:O,nextEl:_.current,prevEl:P.current,scrollbarEl:k.current,paginationEl:D.current}),()=>{q()}}),bc(()=>{F$(E.current)},[d]);function X(){return T.virtual?B$(E.current,N,d):N.map((O,H)=>Z.cloneElement(O,{swiper:E.current,swiperSlideIndex:H}))}return Z.createElement(e,df({ref:b,className:MA(`${l}${t?` ${t}`:""}`)},C),Z.createElement(U$.Provider,{value:E.current},j["container-start"],Z.createElement(n,{className:D$(T.wrapperClass)},j["wrapper-start"],X(),j["wrapper-end"]),RA(T)&&Z.createElement(Z.Fragment,null,Z.createElement("div",{ref:P,className:"swiper-button-prev"}),Z.createElement("div",{ref:_,className:"swiper-button-next"})),DA(T)&&Z.createElement("div",{ref:k,className:"swiper-scrollbar"}),jA(T)&&Z.createElement("div",{ref:D,className:"swiper-pagination"}),j["container-end"]))});OA.displayName="Swiper";const FA=V.forwardRef(({tag:t="div",children:e,className:n="",swiper:r,zoom:s,lazy:i,virtualIndex:o,swiperSlideIndex:a,...l}={},c)=>{const d=V.useRef(null),[h,m]=V.useState("swiper-slide"),[p,g]=V.useState(!1);function b(_,P,D){P===d.current&&m(D)}bc(()=>{if(typeof a<"u"&&(d.current.swiperSlideIndex=a),c&&(c.current=d.current),!(!d.current||!r)){if(r.destroyed){h!=="swiper-slide"&&m("swiper-slide");return}return r.on("_slideClass",b),()=>{r&&r.off("_slideClass",b)}}}),bc(()=>{r&&d.current&&!r.destroyed&&m(r.getSlideClasses(d.current))},[r]);const E={isActive:h.indexOf("swiper-slide-active")>=0,isVisible:h.indexOf("swiper-slide-visible")>=0,isPrev:h.indexOf("swiper-slide-prev")>=0,isNext:h.indexOf("swiper-slide-next")>=0},y=()=>typeof e=="function"?e(E):e,v=()=>{g(!0)};return Z.createElement(t,df({ref:d,className:MA(`${h}${n?` ${n}`:""}`),"data-swiper-slide-index":o,onLoad:v},l),s&&Z.createElement(jS.Provider,{value:E},Z.createElement("div",{className:"swiper-zoom-container","data-swiper-zoom":typeof s=="number"?s:void 0},y(),i&&!p&&Z.createElement("div",{className:"swiper-lazy-preloader",ref:_=>{_&&(_.lazyPreloaderManaged=!0)}}))),!s&&Z.createElement(jS.Provider,{value:E},y(),i&&!p&&Z.createElement("div",{className:"swiper-lazy-preloader",ref:_=>{_&&(_.lazyPreloaderManaged=!0)}})))});FA.displayName="SwiperSlide";const hf=({className:t})=>u.jsxs("svg",{viewBox:"0 0 569 546",fill:"currentColor",className:t,xmlns:"http://www.w3.org/2000/svg",children:[u.jsx("circle",{cx:"362.59",cy:"204.59",r:"204.59"}),u.jsx("rect",{height:"545.8",width:"100",x:"0",y:"0"})]});function $$(t){const{effect:e,swiper:n,on:r,setTranslate:s,setTransition:i,overwriteParams:o,perspective:a,recreateShadows:l,getEffectParams:c}=t;r("beforeInit",()=>{if(n.params.effect!==e)return;n.classNames.push(`${n.params.containerModifierClass}${e}`),a&&a()&&n.classNames.push(`${n.params.containerModifierClass}3d`);const h=o?o():{};Object.assign(n.params,h),Object.assign(n.originalParams,h)}),r("setTranslate _virtualUpdated",()=>{n.params.effect===e&&s()}),r("setTransition",(h,m)=>{n.params.effect===e&&i(m)}),r("transitionEnd",()=>{if(n.params.effect===e&&l){if(!c||!c().slideShadows)return;n.slides.forEach(h=>{h.querySelectorAll(".swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left").forEach(m=>m.remove())}),l()}});let d;r("virtualUpdate",()=>{n.params.effect===e&&(n.slides.length||(d=!0),requestAnimationFrame(()=>{d&&n.slides&&n.slides.length&&(s(),d=!1)}))})}function H$(t,e){const n=xv(e);return n!==e&&(n.style.backfaceVisibility="hidden",n.style["-webkit-backface-visibility"]="hidden"),n}function G$({swiper:t,duration:e,transformElements:n,allSlides:r}){const{activeIndex:s}=t;if(t.params.virtualTranslate&&e!==0){let i=!1,o;o=n,o.forEach(a=>{SU(a,()=>{if(i||!t||t.destroyed)return;i=!0,t.animating=!1;const l=new window.CustomEvent("transitionend",{bubbles:!0,cancelable:!0});t.wrapperEl.dispatchEvent(l)})})}}function q$(t,e,n){const r=`swiper-slide-shadow${` swiper-slide-shadow-${t}`}`,s=xv(e);let i=s.querySelector(`.${r.split(" ").join(".")}`);return i||(i=uf("div",r.split(" ")),s.append(i)),i}function W$({swiper:t,extendParams:e,on:n}){e({creativeEffect:{limitProgress:1,shadowPerProgress:!1,progressMultiplier:1,perspective:!0,prev:{translate:[0,0,0],rotate:[0,0,0],opacity:1,scale:1},next:{translate:[0,0,0],rotate:[0,0,0],opacity:1,scale:1}}});const r=o=>typeof o=="string"?o:`${o}px`;$$({effect:"creative",swiper:t,on:n,setTranslate:()=>{const{slides:o,wrapperEl:a,slidesSizesGrid:l}=t,c=t.params.creativeEffect,{progressMultiplier:d}=c,h=t.params.centeredSlides,m=EU(t);if(h){const p=l[0]/2-t.params.slidesOffsetBefore||0;a.style.transform=`translateX(calc(50% - ${p}px))`}for(let p=0;p0&&(k=c.prev,D=!0),_.forEach((A,z)=>{_[z]=`calc(${A}px + (${r(k.translate[z])} * ${Math.abs(E*d)}))`}),P.forEach((A,z)=>{let B=k.rotate[z]*Math.abs(E*d);P[z]=B}),g.style.zIndex=-Math.abs(Math.round(b))+o.length;const T=_.join(", "),w=`rotateX(${m(P[0])}deg) rotateY(${m(P[1])}deg) rotateZ(${m(P[2])}deg)`,C=y<0?`scale(${1+(1-k.scale)*y*d})`:`scale(${1-(1-k.scale)*y*d})`,I=y<0?1+(1-k.opacity)*y*d:1-(1-k.opacity)*y*d,N=`translate3d(${T}) ${w} ${C}`;if(D&&k.shadow||!D){let A=g.querySelector(".swiper-slide-shadow");if(!A&&k.shadow&&(A=q$("creative",g)),A){const z=c.shadowPerProgress?E*(1/c.limitProgress):E;A.style.opacity=Math.min(Math.max(Math.abs(z),0),1)}}const j=H$(c,g);j.style.transform=N,j.style.opacity=I,k.origin&&(j.style.transformOrigin=k.origin)}},setTransition:o=>{const a=t.slides.map(l=>xv(l));a.forEach(l=>{l.style.transitionDuration=`${o}ms`,l.querySelectorAll(".swiper-slide-shadow").forEach(c=>{c.style.transitionDuration=`${o}ms`})}),G$({swiper:t,duration:o,transformElements:a,allSlides:!0})},perspective:()=>t.params.creativeEffect.perspective,overwriteParams:()=>({watchSlidesProgress:!0,virtualTranslate:!t.params.cssMode})})}function K$({id:t,title:e,author:n,pageCount:r,thumbnail:s,manga:i,onSelect:o,onEdit:a,onDelete:l,isCategoryPlusEnabled:c,isSelected:d,onMouseDown:h,onMouseEnter:m,folderItemCount:p,folderThumbnails:g,hasSubfolders:b,isFolderAnimationEnabled:E=!0,currentSection:y,dragStateParams:v,hasAnySelection:_,onToggleSelect:P}){const[D,k]=V.useState(!1),[T,w]=V.useState(0),C=M=>{if(!M)return null;const $=/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/,ee=M.match($);return ee&&ee[2].length===11?ee[2]:null},I=M=>{if(!M)return null;const $=M.match(/\/file\/d\/([a-zA-Z0-9_\-]+)/);return $?$[1]:null};let N=s?ui(s):void 0;if(!N&&(i!=null&&i.video_url)){const M=C(i.video_url),$=I(i.video_url);M?N=`https://img.youtube.com/vi/${M}/maxresdefault.jpg`:$&&(N=`https://drive.google.com/thumbnail?id=${$}&sz=w1280-h720`)}const[j,A]=V.useState(null),[z,B]=V.useState(!0),[q,X]=V.useState(!1),H=!!(i!=null&&i.is_folder&&e.toLowerCase().includes("patreon"))&&!(i!=null&&i.folder_id)&&!!(g&&g.length>=2);V.useEffect(()=>{let M;if(!q||!E){i!=null&&i.is_folder&&g&&g.length>2&&B(!0);return}if(i!=null&&i.is_folder&&g&&g.length===2){const $=()=>{w(ee=>(ee+1)%g.length)};$(),M=setInterval($,4e3)}if(j&&(i!=null&&i.is_folder)&&g&&g.length>2){const $=()=>{B(!1),setTimeout(()=>{j==null||j.slideNext(600),setTimeout(()=>{B(!0)},700)},400)};$(),M=setInterval($,4500)}return()=>clearInterval(M)},[i==null?void 0:i.is_folder,g,j,q]);const R=M=>{M.stopPropagation(),k(!0)},Y=M=>{M.stopPropagation(),l==null||l(t),k(!1)},se=M=>{M.stopPropagation(),i&&(a==null||a(i))};return u.jsxs("div",{className:"group cursor-pointer flex flex-col w-full h-full",children:[u.jsxs("div",{onMouseDown:h,onMouseEnter:M=>{X(!0),m==null||m(M)},onMouseLeave:()=>X(!1),onDragStart:M=>{M.preventDefault()},onClick:M=>{v!=null&&v.hasDragged?M.preventDefault():c||_?(M.preventDefault(),P==null||P()):(SB(t),o==null||o(t))},className:`relative bg-black rounded-lg shadow-lg overflow-hidden transition-transform duration-300 hover:scale-[1.02] aspect-[2/3] ${d?"ring-4 ring-[#bb86fc]":""}`,children:[i!=null&&i.is_folder?u.jsx("div",{className:"w-full aspect-[2/3] relative flex items-center justify-center bg-gradient-to-br from-[#1a1a1a] to-[#2a2a2a] rounded-lg border-2 border-gray-800 transition-colors duration-300 overflow-hidden group-hover:border-purple-500/50",children:g&&g.length>0?u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"absolute inset-0 w-full h-full bg-black flex items-center justify-center overflow-hidden pointer-events-none",children:y!=="flow"&&g.length>=2?u.jsx("div",{className:"w-full h-full bg-[#111] p-[3px] grid gap-[3px]",style:{gridTemplateColumns:"1fr 1fr",gridTemplateRows:g.length>=3?"1fr 1fr":"1fr"},children:g.slice(0,4).map((M,$)=>u.jsx("div",{className:`relative overflow-hidden bg-gray-900 rounded-[3px] ${g.length===3&&$===0?"col-span-2":""}`,children:u.jsx(pr,{src:ui(M)||"",alt:"Patreon Collage",aspectRatio:"auto",objectFit:"cover",className:"absolute inset-0 w-full h-full",imgClassName:"w-full h-full object-cover transition-transform duration-700 group-hover:scale-110",objectPosition:i==null?void 0:i.thumbnail_position})},M+$))}):g.length>2?q&&E?u.jsx(OA,{onSwiper:A,effect:"creative",grabCursor:!1,centeredSlides:!0,slidesPerView:1,loop:g.length>2,allowTouchMove:!1,speed:600,creativeEffect:{limitProgress:2,prev:{shadow:!0,translate:["-65%",0,-300],rotate:[0,45,0]},next:{shadow:!0,translate:["65%",0,-300],rotate:[0,-45,0]}},modules:[W$],className:"w-full h-full flex items-center justify-center overflow-visible",children:g.map((M,$)=>u.jsx(FA,{style:{width:"100%",height:"100%"},className:"flex items-center justify-center overflow-visible",children:({isActive:ee})=>u.jsx("div",{className:`w-full h-full transition-transform duration-[400ms] ease-in-out origin-center rounded-lg overflow-hidden shadow-2xl border-2 border-white/5 ${ee&&z?"scale-100":"scale-[0.80]"}`,children:u.jsx(pr,{src:ui(M)||"",alt:"Folder Cover",aspectRatio:"2/3",objectFit:"cover",className:"w-full h-full",objectPosition:i==null?void 0:i.thumbnail_position})})},M+$))}):u.jsx(pr,{src:ui(g[0])||"",alt:"Folder Cover",aspectRatio:"2/3",objectFit:"cover",className:"w-full h-full",imgClassName:"transition-transform duration-700",objectPosition:i==null?void 0:i.thumbnail_position}):g.length===2?g.map((M,$)=>u.jsx("div",{className:`absolute inset-0 w-full h-full transition-all duration-[600ms] ease-out ${$===T?"opacity-100 scale-100 blur-0 z-10":"opacity-0 scale-110 blur-md z-0"} pointer-events-none`,children:u.jsx(pr,{src:ui(M)||"",alt:"Folder Cover",aspectRatio:"2/3",objectFit:"cover",className:"w-full h-full",imgClassName:"",objectPosition:i==null?void 0:i.thumbnail_position})},M+$)):u.jsx(pr,{src:ui(g[0])||"",alt:"Folder Cover",aspectRatio:"2/3",objectFit:"cover",className:"w-full h-full",imgClassName:"transition-transform duration-700 group-hover:scale-110",objectPosition:i==null?void 0:i.thumbnail_position})}),u.jsx("div",{className:"absolute inset-x-0 bottom-0 h-1/3 bg-gradient-to-t from-black/60 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300 pointer-events-none z-10"}),H&&u.jsx("div",{className:"absolute inset-0 z-30 flex items-center justify-center pointer-events-none",children:u.jsxs("div",{className:"bg-gray-800/50 backdrop-blur-[8px] rounded-2xl w-[55%] aspect-square border border-white/10 shadow-[0_8px_32px_0_rgba(0,0,0,0.5)] flex flex-col items-center justify-center gap-2 sm:gap-3 transition-transform duration-500 group-hover:scale-105",children:[u.jsx(hf,{className:"w-[40%] h-[40%] text-white drop-shadow-[0_2px_4px_rgba(0,0,0,0.6)]"}),u.jsx("span",{className:"text-white font-bold text-[9px] sm:text-[11px] tracking-widest uppercase drop-shadow-[0_2px_4px_rgba(0,0,0,0.6)]",children:"Patreon"})]})}),!H&&u.jsx("div",{className:"absolute bottom-2 right-2 z-20 flex items-center justify-center bg-gray-800/70 backdrop-blur-md rounded-lg p-1.5 border border-gray-500/50 shadow-xl transition-all duration-300 group-hover:bg-gray-700/80 group-hover:scale-110",children:b?u.jsxs("div",{className:"relative w-[20px] h-[20px]",children:[u.jsx(hr,{className:"absolute top-0 right-0 w-3.5 h-3.5 text-white/50"}),u.jsx(hr,{className:"absolute bottom-0 left-0 w-4 h-4 text-white drop-shadow-[0_0_5px_rgba(255,255,255,0.5)] fill-black/20"})]}):u.jsx(hr,{className:"w-4 h-4 text-white drop-shadow-[0_0_5px_rgba(255,255,255,0.5)]"})})]}):u.jsxs(u.Fragment,{children:[H&&u.jsx("div",{className:"absolute inset-0 z-30 flex items-center justify-center pointer-events-none",children:u.jsxs("div",{className:"bg-gray-800/50 backdrop-blur-[8px] rounded-2xl w-[55%] aspect-square border border-white/10 shadow-[0_8px_32px_0_rgba(0,0,0,0.5)] flex flex-col items-center justify-center gap-2 sm:gap-3 transition-transform duration-500 group-hover:scale-105",children:[u.jsx(hf,{className:"w-[40%] h-[40%] text-white drop-shadow-[0_2px_4px_rgba(0,0,0,0.6)]"}),u.jsx("span",{className:"text-white font-bold text-[9px] sm:text-[11px] tracking-widest uppercase drop-shadow-[0_2px_4px_rgba(0,0,0,0.6)]",children:"Patreon"})]})}),!H&&u.jsx("div",{className:"absolute bottom-2 right-2 z-20 flex items-center justify-center bg-gray-800/70 backdrop-blur-md rounded-lg p-1.5 border border-gray-500/50 shadow-xl transition-all duration-300 group-hover:bg-gray-700/80 group-hover:scale-110",children:b?u.jsxs("div",{className:"relative w-[20px] h-[20px]",children:[u.jsx(hr,{className:"absolute top-0 right-0 w-3.5 h-3.5 text-white/50"}),u.jsx(hr,{className:"absolute bottom-0 left-0 w-4 h-4 text-white drop-shadow-[0_0_5px_rgba(255,255,255,0.5)] fill-black/20"})]}):u.jsx(hr,{className:"w-4 h-4 text-white drop-shadow-[0_0_5px_rgba(255,255,255,0.5)]"})}),u.jsx("div",{className:"relative z-10 flex flex-col items-center justify-center opacity-30",children:!H&&u.jsx(hr,{className:"w-16 h-16 text-gray-400 mb-2"})})]})}):N?u.jsxs(u.Fragment,{children:[u.jsx(pr,{src:N,alt:e,aspectRatio:"2/3",objectFit:"cover",loading:"lazy",imgClassName:"group-hover:scale-110",objectPosition:i==null?void 0:i.thumbnail_position}),u.jsx("div",{className:"absolute inset-x-0 bottom-0 h-1/3 bg-gradient-to-t from-black/60 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300 pointer-events-none"})]}):u.jsx("div",{className:"w-full aspect-[2/3] flex items-center justify-center text-white/40 bg-gradient-to-br from-gray-800 to-gray-900 rounded-lg group-hover:text-white/60",children:u.jsx(Bk,{className:"w-12 h-12"})}),!(i!=null&&i.is_folder)&&u.jsxs("div",{className:"absolute bottom-2 left-2 flex gap-1 flex-wrap pointer-events-none items-end",children:[(i==null?void 0:i.is_decensored)&&u.jsx("div",{className:"bg-black/70 text-white text-xs px-2 py-1 rounded-md font-semibold opacity-0 group-hover:opacity-100 transition-opacity duration-300 shadow-md",children:"Sin censura"}),(i==null?void 0:i.is_bn)&&u.jsx("div",{className:"bg-black/70 text-white text-xs px-2 py-1 rounded-md font-semibold opacity-0 group-hover:opacity-100 transition-opacity duration-300 shadow-md",children:"B/N"}),(i==null?void 0:i.is_color)&&u.jsx("div",{className:"bg-black/70 text-white text-xs px-2 py-1 rounded-md font-semibold opacity-0 group-hover:opacity-100 transition-opacity duration-300 shadow-md",children:"a color"}),((i==null?void 0:i.season)??0)>0&&((i==null?void 0:i.episode)??0)>0&&u.jsxs("div",{className:"bg-[#00AFF0]/90 text-white text-xs px-2 py-1 rounded-md font-bold transition-opacity duration-300 shadow-md border border-[#00AFF0]/30 shadow-[#00AFF0]/20",children:["T",i==null?void 0:i.season," - C",i==null?void 0:i.episode]})]}),(c||_)&&u.jsx("div",{className:`absolute top-2 left-2 w-6 h-6 rounded-md border-2 flex items-center justify-center transition-all ${d?"bg-[#bb86fc] border-[#bb86fc]":"bg-black/50 border-white/50 hover:border-white"}`,children:d&&u.jsx(Rf,{className:"w-4 h-4 text-white"})}),!c&&!_&&u.jsxs("div",{className:"absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity duration-300 flex gap-1",children:[i&&a&&u.jsx("button",{onClick:se,className:"bg-black/60 hover:bg-purple-600 text-white p-1.5 rounded-full transition-colors backdrop-blur-sm",title:"Editar manga",children:u.jsx(Kk,{className:"w-3 h-3"})}),l&&u.jsx("button",{onClick:R,className:"bg-black/60 hover:bg-red-600 text-white p-1.5 rounded-full transition-colors backdrop-blur-sm",title:"Eliminar manga",children:u.jsx(pn,{className:"w-3 h-3"})})]}),D&&u.jsxs("div",{className:"absolute inset-0 bg-black/80 backdrop-blur-sm flex flex-col items-center justify-center gap-3 rounded-lg z-20 animate-in fade-in duration-200",children:[u.jsx("p",{className:"text-white text-sm font-semibold text-center px-3",children:"Eliminar manga?"}),u.jsxs("div",{className:"flex gap-2",children:[u.jsx("button",{onClick:M=>{M.stopPropagation(),k(!1)},className:"bg-gray-600 hover:bg-gray-700 text-white px-3 py-1.5 rounded-md text-xs font-semibold transition-all duration-200 transform hover:scale-105 active:scale-95",children:"Cancelar"}),u.jsx("button",{onClick:Y,className:"bg-red-600 hover:bg-red-700 text-white px-3 py-1.5 rounded-md text-xs font-semibold transition-all duration-200 transform hover:scale-105 active:scale-95",children:"Eliminar"})]})]})]}),u.jsxs("div",{className:"mt-1 sm:mt-2 flex flex-col gap-0.5 text-center mb-2",children:[u.jsx("h3",{onClick:()=>o==null?void 0:o(t),className:"font-semibold text-xs sm:text-sm text-white line-clamp-2 cursor-pointer text-center group-hover:text-purple-400 transition-colors duration-300 ease-out",children:e}),n&&n.trim()!==""&&n.toLowerCase()!=="anónimo"&&n.toLowerCase()!=="anonimo"&&u.jsx("p",{className:"text-xs text-gray-400 text-center group-hover:text-gray-300 transition-colors duration-300 ease-out",children:n==="Carpeta"?"Colección":n})]})]})}function Y$(){return u.jsxs("div",{className:"flex flex-col w-full h-full",children:[u.jsx("div",{className:"relative bg-black rounded-lg shadow-lg overflow-hidden aspect-[2/3] mb-2",children:u.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:u.jsx("div",{className:"rounded-full animate-spin",style:{width:"30px",height:"30px",borderWidth:"2px",borderStyle:"solid",borderColor:"rgba(187, 134, 252, 0.2)",borderTopColor:"#bb86fc",animation:"spin 0.6s linear infinite"}})})}),u.jsxs("div",{className:"flex flex-col gap-2 items-center animate-pulse",children:[u.jsx("div",{className:"h-4 bg-gray-800 rounded w-3/4"}),u.jsx("div",{className:"h-3 bg-gray-800 rounded w-1/2"})]})]})}const Nm=24;function zA(t,e,n=new Set){if(n.has(t))return[];n.add(t);const r=e.filter(i=>i.folder_id===t),s=[];for(const i of r){const o=i.cover_url||i.thumbnail_url;if(o&&!s.includes(o)&&s.push(o),i.is_folder){const a=zA(i.id,e,n);for(const l of a)s.includes(l)||s.push(l)}}return s}function Q$(t,e,n=12){const r=e.filter(d=>d.folder_id===t),s=r.filter(d=>d.is_folder),i=r.filter(d=>!d.is_folder&&(d.cover_url||d.thumbnail_url)),o=[];for(const d of s){const h=zA(d.id,e,new Set);h.length>0&&o.push(h)}if(i.length>0){const d=i.map(h=>h.cover_url||h.thumbnail_url).filter(Boolean);d.length>0&&o.push(d)}const a=[];let l=!0,c=0;for(;l&&a.length=n)break;c{const w=()=>{p.isDragging&&g({isDragging:!1,action:null,startId:null,hasDragged:!1})};return window.addEventListener("mouseup",w),()=>window.removeEventListener("mouseup",w)},[p.isDragging]);const b=(w,C)=>{c&&c(w,C)},E=(w,C)=>{if(w.button!==0)return;const N=l.includes(C)?"deselect":"select";g({isDragging:!0,action:N,startId:C,hasDragged:!1})},y=w=>{!p.isDragging||!p.action||(!p.hasDragged&&p.startId&&(b(p.startId,p.action==="select"),g(C=>({...C,hasDragged:!0}))),b(w,p.action==="select"))},[v,_]=V.useState(()=>{const C=new URLSearchParams(window.location.search).get("page");return C?Math.max(1,Number(C)):1});V.useEffect(()=>{const w=()=>{const I=new URLSearchParams(window.location.search).get("page");_(I?Math.max(1,Number(I)):1)};return window.addEventListener("popstate",w),()=>window.removeEventListener("popstate",w)},[]);const P=Math.ceil(t.length/Nm);V.useEffect(()=>{if(P>0&&v>P){_(P);const w=new URL(window.location.href);w.searchParams.set("page",String(P)),window.history.replaceState({},"",w)}},[P,v]),V.useEffect(()=>{if(e){_(1);const w=new URL(window.location.href);w.searchParams.delete("page"),window.history.replaceState({},"",w)}},[e]);const D=t.slice((v-1)*Nm,v*Nm),k=w=>{_(w);const C=new URL(window.location.href);C.searchParams.set("page",String(w)),window.history.pushState({},"",C),window.scrollTo({top:0,behavior:"smooth"})},T=()=>{if(P<=1)return null;const w=[],C=5;let I=Math.max(1,v-Math.floor(C/2)),N=Math.min(P,I+C-1);N-I+1k(1),disabled:v===1,className:"p-2 rounded-lg bg-[#1a1a1a] text-white hover:bg-[#bb86fc] disabled:opacity-50 disabled:hover:bg-[#1a1a1a] transition-colors",title:"Primera página",children:u.jsx(gD,{className:"w-4 h-4"})}),u.jsx("button",{onClick:()=>k(v-1),disabled:v===1,className:"p-2 rounded-lg bg-[#1a1a1a] text-white hover:bg-[#bb86fc] disabled:opacity-50 disabled:hover:bg-[#1a1a1a] transition-colors",title:"Anterior",children:u.jsx(U0,{className:"w-4 h-4"})}),I>1&&u.jsx("span",{className:"text-gray-500 px-1",children:"..."}),w.map(j=>u.jsx("button",{onClick:()=>k(j),className:`w-8 h-8 rounded-lg text-sm font-medium transition-colors ${v===j?"bg-[#bb86fc] text-white":"bg-[#1a1a1a] text-gray-400 hover:bg-[#333] hover:text-white"}`,children:j},j)),Nk(v+1),disabled:v===P,className:"p-2 rounded-lg bg-[#1a1a1a] text-white hover:bg-[#bb86fc] disabled:opacity-50 disabled:hover:bg-[#1a1a1a] transition-colors",title:"Siguiente",children:u.jsx(uu,{className:"w-4 h-4"})}),u.jsx("button",{onClick:()=>k(P),disabled:v===P,className:"p-2 rounded-lg bg-[#1a1a1a] text-white hover:bg-[#bb86fc] disabled:opacity-50 disabled:hover:bg-[#1a1a1a] transition-colors",title:"Última página",children:u.jsx(yD,{className:"w-4 h-4"})})]})};return n&&e?u.jsx("div",{className:"flex flex-col items-center justify-center py-16 animate-in fade-in duration-300",children:u.jsxs("div",{className:"text-gray-400 text-sm animate-pulse",children:['Buscando "',e,'"...']})}):o?u.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 gap-3 sm:gap-4 md:gap-5 justify-center items-start animate-in fade-in duration-300",children:Array.from({length:12}).map((w,C)=>u.jsx(Y$,{},C))}):e&&t.length===0?u.jsxs("div",{className:"flex flex-col items-center justify-center py-16 animate-in fade-in duration-300",children:[u.jsx(Dg,{className:"w-16 h-16 text-gray-600 mb-4 animate-bounce"}),u.jsx("p",{className:"text-gray-400 text-lg mb-2",children:"No se encontraron resultados"}),u.jsx("p",{className:"text-gray-500 text-sm",children:"Intenta con otros términos de búsqueda"})]}):!e&&t.length===0?u.jsxs("div",{className:"flex flex-col items-center justify-center py-20 animate-in fade-in duration-300",children:[u.jsx(Dg,{className:"w-16 h-16 text-gray-600 mb-4 animate-bounce"}),u.jsx("p",{className:"text-gray-400 text-lg mb-2",children:"No hay videos disponibles"}),u.jsx("p",{className:"text-gray-500 text-sm",children:'Crea tu primer video usando el botón "Nuevo"'})]}):u.jsxs("div",{className:"flex flex-col gap-6",children:[u.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 gap-3 sm:gap-4 md:gap-5 justify-center items-start",children:D.map(w=>u.jsx("div",{children:u.jsx(K$,{id:w.id,title:w.title,author:w.author,pageCount:w.pageCount,thumbnail:w.thumbnail,manga:w.manga,onSelect:()=>r(w.id),onEdit:s,onDelete:i?()=>i(w.id):void 0,isCategoryPlusEnabled:a,isSelected:l.includes(w.id),onMouseDown:C=>E(C,w.id),onMouseEnter:()=>y(w.id),dragStateParams:p,hasAnySelection:l.length>0,onToggleSelect:()=>b(w.id,!l.includes(w.id)),folderItemCount:(()=>{const C=d.filter(I=>I.folder_id===w.id).length;return C>0?C:void 0})(),folderThumbnails:(()=>{var I;return d.filter(N=>N.folder_id===w.id).length>0||(I=w.manga)!=null&&I.is_folder?Q$(w.id,d):void 0})(),hasSubfolders:d.some(C=>C.folder_id===w.id&&C.is_folder),isFolderAnimationEnabled:h,currentSection:m})},w.id))}),T()]})}function Ta(t){return t?t.toLowerCase().trim().normalize("NFD").replace(/[\u0300-\u036f]/g,""):""}function Am(t,e){const n=Ta(t),r=Ta(e);if(n===r)return 1;if(n.length<2||r.length<2)return n.includes(r)?.8:0;const s=n.length>r.length?n:r,i=n.length>r.length?r:n,o=X$(i,s);return(s.length-o)/s.length}function X$(t,e){const n=[];for(let r=0;r<=t.length;r++){let s=r;for(let i=0;i<=e.length;i++)if(r===0)n[i]=i;else if(i>0){let o=n[i-1];t.charAt(r-1)!==e.charAt(i-1)&&(o=Math.min(Math.min(o,s),n[i])+1),n[i-1]=s,s=o}r>0&&(n[e.length]=s)}return n[e.length]}function UA(t,e,n={}){const{minChars:r=1,fuzzyMatch:s=!0}=n;if(!e.trim()||e.length{let l=0;const c=Am(a.title,e),d=Am(a.author,e),h=Ta(a.title).includes(i)?.3:0,m=Ta(a.author).includes(i)?.2:0;let p=0,g=0;if(a.categories&&a.categories.length>0){const b=a.categories.map(y=>Am(y,e));p=Math.max(...b),g=a.categories.some(y=>Ta(y).includes(i))?.3:0}return l=Math.max(c*.6+h,d*.4+m,p*.5+g),{item:a,score:l}}).filter(a=>s?a.score>.3:a.score>.7).sort((a,l)=>l.score-a.score).map(a=>a.item);return{items:o,query:e,resultCount:o.length}}function J$({id:t,onBack:e,onNavigateToManga:n,onMangaLoaded:r,onSelectCategory:s,onSelectAuthor:i,isAdmin:o=!1,allMangas:a=[],searchTerm:l="",onSearchChange:c}){const[d,h]=V.useState(null),[m,p]=V.useState(!0),[g,b]=V.useState([]),[E,y]=V.useState(!1),[v,_]=V.useState([]),[P,D]=V.useState(!1),[k,T]=V.useState(0),[w,C]=V.useState(!0),[I,N]=V.useState(!1),[j,A]=V.useState(l);V.useEffect(()=>{A(l)},[l]),V.useEffect(()=>{if(j!==l&&j.trim()!==""){const le=setTimeout(()=>{c==null||c(j)},800);return()=>clearTimeout(le)}},[j,l,c]),V.useEffect(()=>{C(!0)},[k,t]),V.useEffect(()=>{async function le(){D(!0);try{const xe=a.length>0?a:await gl();let Oe=[];if(d!=null&&d.is_folder)Oe=xe.filter(qe=>!qe.is_deleted&&qe.folder_id===d.id);else if(d!=null&&d.folder_id)Oe=xe.filter(qe=>!qe.is_deleted&&qe.folder_id===d.folder_id);else if(d){const qe=xe.filter(ke=>!ke.is_deleted&&ke.folder_id===d.id);qe.length>0&&(Oe=[d,...qe])}Oe.length>0&&Oe.sort((qe,ke)=>{const Ce=qe.season??0,Ye=ke.season??0;if(Ce!==Ye)return Ce-Ye;const or=Number(qe.episode)||0,It=Number(ke.episode)||0;return or!==It?or-It:qe.title.localeCompare(ke.title)}),_(Oe)}catch(xe){console.error("Error loading collection:",xe)}finally{D(!1)}}d&&le()},[d==null?void 0:d.id,d==null?void 0:d.folder_id,d==null?void 0:d.is_folder]),V.useEffect(()=>{let le;return p(!0),le=xB(t,xe=>{h(xe),xe&&r&&r(xe),xe&&z(xe),p(!1)}),()=>{le&&le()}},[t]);async function z(le){var xe;try{y(!0);const Oe=((xe=le.categories)==null?void 0:xe.map(ke=>ke.id))||[],qe=await kB(le.id,Oe,le.title);b(qe)}catch(Oe){console.error("Error loading recommendations:",Oe)}finally{y(!1)}}const B=le=>{if(!le)return null;const xe=/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=|shorts\/)([^#\&\?]*).*/,Oe=le.match(xe);return Oe&&Oe[2].length===11?Oe[2]:null},q=le=>{if(!le)return null;const xe=le.match(/(?:vimeo\.com\/|player\.vimeo\.com\/video\/)([0-9]+)/);return xe?xe[1]:null},X=le=>{if(!le)return null;const xe=le.match(/\/file\/d\/([a-zA-Z0-9_\-]+)/);return xe?xe[1]:null},O=le=>le&&le.includes("dropbox.com")?le.includes("dl=0")?le.replace("dl=0","raw=1"):le.includes("?")?le+"&raw=1":le+"?raw=1":null,H=le=>{if(!le)return null;const xe=le.match(/viewkey=([a-zA-Z0-9]+)/);return xe?xe[1]:null},R=le=>{if(!le)return null;const xe=le.match(/video\.([a-z0-9]+)/);return xe?xe[1]:null};if(m)return u.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center p-8 min-h-screen pt-24 pb-24 relative bg-[#0f0f0f]",children:[u.jsx(Bo,{size:"lg",className:"mb-4"}),u.jsx("p",{className:"text-gray-400 font-medium tracking-wide animate-pulse",children:"Cargando video..."})]});if(!d)return u.jsxs("div",{className:"flex-1 flex items-center justify-center p-8 text-red-500 font-semibold min-h-screen pt-24 pb-24 relative z-10 flex-col gap-4 bg-[#0f0f0f]",children:["Video no encontrado",u.jsxs("button",{onClick:e,className:"bg-[#1a1a1a] hover:bg-[#333] text-white px-4 py-2 rounded-lg transition-colors flex items-center gap-2 border border-gray-800",children:[u.jsx(Nr,{className:"w-5 h-5"})," Regresar"]})]});const Y=d.servers&&d.servers.length>0?d.servers:d.video_url?[d.video_url]:[],se=Y[k]||d.video_url||"",M=B(se),$=q(se),ee=X(se),J=O(se),ae=H(se),ce=R(se),Ze=se.includes("hf.space")||se.includes("/stream/")||se.includes("player")||se.includes("embed"),Ke=d.thumbnail_url||d.cover_url||(M?`https://img.youtube.com/vi/${M}/maxresdefault.jpg`:ee?`https://drive.google.com/thumbnail?id=${ee}&sz=w1280-h720`:""),Ct=V.useMemo(()=>!j.trim()||a.length===0?{items:[],query:"",resultCount:0}:UA(a.map(le=>({id:le.id,title:le.title,author:le.author,categories:le.categories?le.categories.map(xe=>xe.name):[]})),j,{fuzzyMatch:!0,minChars:1}),[a,j]),gt=V.useMemo(()=>!Ct.items||Ct.items.length===0?[]:Ct.items.map(le=>a.find(xe=>xe.id===le.id)).filter(Boolean),[a,Ct.items]),zn=V.useMemo(()=>gt.map(le=>{var xe,Oe;return{id:le.id,title:le.title,author:le.author,chapterCount:((xe=le.chapters)==null?void 0:xe.length)||0,pageCount:((Oe=le.chapters)==null?void 0:Oe.reduce((qe,ke)=>{var Ce;return qe+(((Ce=ke.pages)==null?void 0:Ce.length)||0)},0))||0,thumbnail:le.cover_url||le.thumbnail_url||void 0,manga:le}}),[gt]);return u.jsxs("div",{className:"flex flex-col min-h-screen w-full relative bg-[#0f0f0f]",children:[u.jsxs("div",{className:"max-w-[1600px] mx-auto w-full px-4 sm:px-6 md:px-8 flex-1 py-6 flex flex-col relative z-20",children:[u.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mb-8",children:[u.jsxs("button",{onClick:()=>{window.scrollTo({top:0,behavior:"smooth"}),e()},className:"bg-transparent hover:bg-white/10 text-white w-full sm:w-fit px-3 py-2 rounded-lg transition-colors flex items-center justify-center sm:justify-start gap-2 group font-medium",children:[u.jsx(Nr,{className:"w-5 h-5 transition-transform group-hover:-translate-x-1"}),"Volver al Inicio"]}),u.jsxs("div",{className:"relative w-full sm:max-w-md",children:[u.jsx(il,{className:`absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 pointer-events-none transition-colors duration-300 ${I?"text-[#bb86fc]":"text-gray-400"}`}),u.jsx("input",{type:"text",placeholder:"Buscar...",value:j,onChange:le=>A(le.target.value),onKeyDown:le=>{le.key==="Enter"&&(c==null||c(j))},onFocus:()=>N(!0),onBlur:()=>N(!1),className:`w-full bg-[#161616] text-white rounded-xl pl-10 pr-10 py-2.5 text-sm placeholder-gray-500 border transition-all duration-300 ${I?"border-[#bb86fc] ring-1 ring-[#bb86fc]/20 bg-[#1a1a1a]":"border-gray-800 hover:border-gray-700"} focus:outline-none`}),j&&u.jsx("button",{onClick:()=>{A(""),c==null||c("")},className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-400 hover:text-[#bb86fc] transition-all p-1 hover:scale-110",children:u.jsx(mt,{className:"w-4 h-4"})})]})]}),j.trim()!==""?u.jsxs("div",{className:"w-full bg-[#121212] rounded-2xl p-4 sm:p-6 border border-gray-800/50 mt-4 animate-in fade-in slide-in-from-top-4 duration-300",children:[u.jsxs("h2",{className:"text-xl font-bold text-white mb-6",children:["Resultados de búsqueda (",Ct.resultCount," resultados)"]}),u.jsx(BA,{items:zn,searchTerm:j,isSearching:!1,isLoading:!1,onSelectComic:le=>{n&&n(le),A(""),c&&c("")},allMangas:a})]}):u.jsxs("div",{className:"flex flex-col gap-10 w-full",children:[u.jsxs("div",{className:"flex flex-col md:flex-row gap-8 lg:gap-12 animate-in fade-in slide-in-from-top-4 duration-700",children:[u.jsx("div",{className:"w-48 sm:w-56 lg:w-64 shrink-0 mx-auto md:mx-0",children:u.jsx("div",{className:"aspect-[2/3] rounded-2xl overflow-hidden shadow-2xl border border-gray-800 bg-[#161616] relative group",children:Ke?u.jsx(pr,{src:Ke,alt:d.title,aspectRatio:"2/3",objectFit:"cover",objectPosition:d.thumbnail_position,className:"w-full h-full",imgClassName:"group-hover:scale-105 transition-transform duration-700"}):u.jsxs("div",{className:"w-full h-full flex flex-col items-center justify-center text-white/40 bg-gradient-to-br from-[#1a1a1a] to-[#2a2a2a]",children:[u.jsx(Jk,{className:"w-16 h-16 mb-4 opacity-30"}),u.jsx("span",{className:"text-sm font-medium opacity-50",children:"Sin Portada"})]})})}),u.jsxs("div",{className:"flex-1 space-y-4 flex flex-col justify-start items-start text-left",children:[u.jsx("h1",{className:"text-lg sm:text-xl lg:text-2xl font-bold text-white mb-1.5 leading-tight tracking-tight",children:d.title}),d.description&&u.jsx("p",{className:"text-gray-400 text-xs sm:text-sm lg:text-base leading-relaxed max-w-2xl pt-0.5 line-clamp-[8] whitespace-pre-wrap",children:d.description}),d.section&&u.jsxs("div",{className:"flex items-center gap-1.5 text-gray-300 text-xs font-medium pt-1",children:[u.jsx(hr,{className:"w-4 h-4 text-[#bb86fc]"}),"Catálogo: ",u.jsx("span",{className:"capitalize",children:d.section==="peliculas"?"Película":d.section==="series"?"Serie":d.section})]}),u.jsxs("div",{className:"flex flex-wrap items-center justify-start gap-4 text-xs font-medium pt-1",children:[u.jsxs("span",{className:"flex items-center gap-1.5 text-gray-300",children:[u.jsx(yb,{className:"w-4 h-4 text-[#bb86fc]"}),d.views||0," vistas"]}),d.created_at&&u.jsxs("span",{className:"flex items-center gap-1.5 text-gray-300",children:[u.jsx(gb,{className:"w-4 h-4 text-[#bb86fc]"}),new Date(d.created_at).toLocaleDateString()]}),d.author&&d.author!=="Anónimo"&&d.author!=="Anonimo"&&u.jsxs("span",{className:"text-[#bb86fc] font-bold",children:["• ",d.author]})]}),u.jsx("div",{className:"flex flex-wrap items-center gap-3 pt-2",children:u.jsxs("a",{href:"#",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 px-4 py-2 rounded-xl border border-[#bb86fc]/30 hover:bg-[#bb86fc]/10 transition-all group",children:[u.jsx(Eb,{className:"w-4 h-4 text-[#bb86fc] group-hover:-translate-y-0.5 group-hover:translate-x-0.5 transition-transform"}),u.jsx("span",{className:"text-[#bb86fc] font-medium text-sm",children:"Bot Telegram"})]})})]})]}),u.jsx("div",{className:"flex flex-col xl:flex-row gap-8 lg:gap-12 w-full",children:u.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[Y.length>0&&u.jsx("div",{className:"flex flex-wrap gap-2 mb-5 animate-in fade-in slide-in-from-top-4 duration-500",children:Y.map((le,xe)=>u.jsxs("button",{onClick:()=>T(xe),className:` + px-4 py-2 rounded-xl text-[11px] font-bold transition-all duration-300 transform hover:scale-[1.02] active:scale-[0.98] + flex items-center gap-2.5 shadow-lg group/btn + ${k===xe?"bg-gradient-to-br from-[#1a1a1a] via-[#222] to-[#1a1a1a] text-[#bb86fc] border border-[#bb86fc]/40 shadow-[#bb86fc]/10 ring-1 ring-[#bb86fc]/10":"bg-[#121212] text-gray-500 hover:text-white border border-gray-800/80 hover:border-gray-700 shadow-none"} + `,children:[u.jsx("div",{className:` + p-1 rounded-md transition-all duration-300 + ${k===xe?"bg-[#bb86fc]/10 text-[#bb86fc]":"bg-gray-800/30 text-gray-600 group-hover/btn:text-gray-400"} + `,children:u.jsx(ID,{className:`w-3 h-3 ${k===xe?"animate-pulse":""}`})}),u.jsxs("span",{className:"tracking-widest uppercase text-[10px] font-bold",children:["SERVIDOR V",xe+1]}),k===xe&&u.jsx("div",{className:"ml-1 w-1.5 h-1.5 rounded-full bg-[#bb86fc] animate-pulse shadow-[0_0_8px_#bb86fc]"})]},xe))}),u.jsxs("div",{className:"bg-[#000000] rounded-3xl overflow-hidden shadow-[0_20px_50px_rgba(0,0,0,0.8)] border border-gray-900 aspect-video relative group animate-in zoom-in-95 duration-700 delay-300 w-full mb-2",children:[w&&u.jsx("div",{className:"absolute inset-0 flex flex-col items-center justify-center bg-black z-50",children:u.jsx("div",{className:"w-10 h-10 border-2 border-[#bb86fc] border-t-transparent rounded-full animate-spin shadow-[0_0_15px_rgba(187,134,252,0.2)]"})}),u.jsx("div",{className:"relative z-10 w-full h-full overflow-hidden",children:M?u.jsx("iframe",{className:"absolute inset-0 w-full h-full scale-[1.01]",src:`https://www.youtube-nocookie.com/embed/${M}?autoplay=0&controls=1&rel=0&origin=${window.location.origin}`,title:d.title,frameBorder:"0",onLoad:()=>C(!1),allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",allowFullScreen:!0}):$?u.jsx("iframe",{className:"absolute inset-0 w-full h-full scale-[1.01]",src:`https://player.vimeo.com/video/${$}?title=0&byline=0&portrait=0`,title:d.title,frameBorder:"0",onLoad:()=>C(!1),allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0}):ee?u.jsx("iframe",{className:"absolute inset-0 w-full h-full",src:`https://drive.google.com/file/d/${ee}/preview`,title:d.title,frameBorder:"0",onLoad:()=>C(!1),allow:"autoplay; fullscreen",allowFullScreen:!0}):ae?u.jsx("iframe",{className:"absolute inset-0 w-full h-full",src:`https://www.pornhub.com/embed/${ae}`,title:d.title,frameBorder:"0",onLoad:()=>C(!1),allowFullScreen:!0}):ce?u.jsx("iframe",{className:"absolute inset-0 w-full h-full",src:`https://www.xvideos.com/embedframe/${ce}`,title:d.title,frameBorder:"0",onLoad:()=>C(!1),allowFullScreen:!0}):Ze?u.jsx("div",{className:"absolute inset-0 w-full h-full bg-black",children:u.jsx("iframe",{className:"absolute inset-0 w-full h-full",src:se,title:d.title,frameBorder:"0",onLoad:()=>C(!1),allowFullScreen:!0})}):J?u.jsx("video",{className:"absolute inset-0 w-full h-full object-contain bg-black",src:J,controls:!0,autoPlay:!0,onLoadedData:()=>C(!1),controlsList:"nodownload"}):d.video_url?u.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center bg-[#000] text-white p-6",onMouseEnter:()=>C(!1),children:[d.video_url.includes("t.me")?u.jsx(Eb,{className:"w-16 h-16 text-[#0088cc] mb-4"}):u.jsx(Hp,{className:"w-16 h-16 text-gray-500 mb-4"}),u.jsx("p",{className:"text-xl font-bold bg-gradient-to-r from-gray-200 to-gray-400 bg-clip-text text-transparent mb-2",children:d.video_url.includes("t.me")?"Enlace de Telegram Disponible":"Video Disponible"}),u.jsxs("a",{href:d.video_url,target:"_blank",rel:"noopener noreferrer",className:"text-[#3ea6ff] hover:text-[#bb86fc] text-lg font-semibold flex items-center gap-2 transition-colors",children:[d.video_url.includes("t.me")?"Ir a Telegram":"Abrir enlace de video externo"," ",u.jsx(Nr,{className:"w-4 h-4 rotate-[135deg]"})]})]}):u.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center bg-[#000] text-gray-400",children:[u.jsx(Hp,{className:"w-16 h-16 mb-4 opacity-50"}),u.jsx("span",{children:"No hay enlace de video disponible"})]})})]}),u.jsxs("div",{className:"mt-6 mb-4 space-y-3 px-1",children:[u.jsx("h2",{className:"text-xl sm:text-2xl font-bold text-white leading-tight",children:d.title}),d.description&&u.jsx("p",{className:"text-gray-400 text-sm leading-relaxed whitespace-pre-wrap",children:d.description}),d.section&&u.jsxs("div",{className:"flex items-center gap-1.5 text-gray-300 text-xs font-medium pt-1",children:[u.jsx(hr,{className:"w-4 h-4 text-[#bb86fc]"}),"Catálogo: ",u.jsx("span",{className:"capitalize",children:d.section==="peliculas"?"Película":d.section==="series"?"Serie":d.section})]}),u.jsxs("div",{className:"flex flex-wrap items-center gap-4 text-xs font-medium pt-1",children:[u.jsxs("span",{className:"flex items-center gap-1.5 text-gray-300",children:[u.jsx(yb,{className:"w-4 h-4 text-[#bb86fc]"}),d.views||0," vistas"]}),d.created_at&&u.jsxs("span",{className:"flex items-center gap-1.5 text-gray-300",children:[u.jsx(gb,{className:"w-4 h-4 text-[#bb86fc]"}),new Date(d.created_at).toLocaleDateString()]})]})]}),!P&&v.length>1&&u.jsxs("div",{className:"mt-6 mb-2 animate-in slide-in-from-bottom-4 duration-700 fill-mode-both border border-gray-800/30 bg-[#121212] p-4 rounded-2xl relative overflow-hidden group",children:[u.jsxs("div",{className:"flex items-center gap-2 mb-3 relative z-10",children:[u.jsx("div",{className:"p-1 bg-[#bb86fc]/10 rounded",children:u.jsx(kD,{className:"w-3.5 h-3.5 text-[#bb86fc]"})}),u.jsx("h2",{className:"text-xs font-bold text-gray-300 tracking-wider uppercase",children:"Colección"})]}),(()=>{const le=v.findIndex(ke=>ke.id===d.id),xe=le>0?v[le-1]:null,Oe=le!==-1&&le+1ke.section==="series"||ke.season!==void 0||ke.episode!==void 0);return u.jsxs("div",{className:"flex flex-col gap-3 relative z-10",children:[u.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 w-full",children:[xe&&u.jsxs("div",{onClick:()=>{window.scrollTo({top:0,behavior:"smooth"}),n&&n(xe.id)},className:"flex-1 bg-black/20 hover:bg-[#bb86fc]/5 border border-gray-800/50 hover:border-[#bb86fc]/30 transition-all rounded-xl p-2.5 flex items-center gap-3 cursor-pointer group/prev",children:[u.jsx(Nr,{className:"w-4 h-4 text-gray-600 transform group-hover/prev:text-[#bb86fc] group-hover/prev:-translate-x-0.5 flex-shrink-0 transition-transform"}),u.jsxs("div",{className:"flex flex-col overflow-hidden w-full",children:[u.jsx("span",{className:"text-[9px] text-gray-600 font-bold group-hover/prev:text-[#bb86fc]/80 mb-0.5 uppercase tracking-tighter",children:"Anterior"}),u.jsx("span",{className:"text-xs font-medium text-gray-400 group-hover/prev:text-white transition-colors truncate",children:xe.title})]})]}),Oe&&u.jsxs("div",{onClick:()=>{window.scrollTo({top:0,behavior:"smooth"}),n&&n(Oe.id)},className:"flex-1 bg-black/20 hover:bg-[#bb86fc]/5 border border-gray-800/50 hover:border-[#bb86fc]/30 transition-all rounded-xl p-2.5 flex items-center justify-between cursor-pointer group/next",children:[u.jsxs("div",{className:"flex flex-col mr-3 overflow-hidden items-end w-full",children:[u.jsx("span",{className:"text-[9px] text-gray-600 font-bold group-hover/next:text-[#bb86fc]/80 mb-0.5 uppercase tracking-tighter text-right",children:"Siguiente"}),u.jsx("span",{className:"text-xs font-medium text-gray-400 group-hover/next:text-white transition-colors truncate text-right",children:Oe.title})]}),u.jsx(uu,{className:"w-4 h-4 text-gray-600 transform group-hover/next:text-[#bb86fc] group-hover/next:translate-x-0.5 flex-shrink-0 transition-transform"})]})]}),u.jsx("div",{className:"flex gap-2.5 overflow-x-auto pb-2 scrollbar-thin scrollbar-thumb-gray-800 scrollbar-track-transparent snap-x",children:v.map((ke,Ce)=>{const Ye=ke.id===d.id;return u.jsxs("div",{onClick:()=>{!Ye&&n&&(window.scrollTo({top:0,behavior:"smooth"}),n(ke.id))},className:`flex-shrink-0 flex items-center gap-2 p-1.5 rounded-lg transition-all snap-start ${Ye?"bg-[#bb86fc]/10 border border-[#bb86fc]/30 cursor-default":"bg-[#1a1a1a]/50 border border-gray-800/50 hover:bg-white/5 hover:border-gray-700 cursor-pointer"} w-[250px] max-w-[80vw]`,children:[u.jsx("div",{className:`w-12 h-12 rounded flex-shrink-0 flex items-center justify-center overflow-hidden border ${Ye?"border-[#bb86fc]/20 bg-[#bb86fc]/5":"border-white/5 bg-black"}`,children:ke.thumbnail_url||ke.cover_url?u.jsx("img",{src:ke.thumbnail_url||ke.cover_url||"",className:"w-full h-full object-cover opacity-80"}):u.jsx(Hp,{className:`w-5 h-5 ${Ye?"text-[#bb86fc]":"text-gray-600"}`})}),u.jsxs("div",{className:"flex flex-col min-w-0 pr-1",children:[u.jsx("span",{className:`text-[8px] font-black tracking-widest uppercase ${Ye?"text-[#bb86fc]":"text-gray-600"}`,children:qe?(ke.season??0)>0&&(ke.episode??0)>0?`T${ke.season} • C${ke.episode}`:`Cap. ${Ce+1}`:`Vid. ${Ce+1}`}),u.jsx("span",{className:`text-[11px] font-medium truncate ${Ye?"text-white":"text-gray-400"}`,children:ke.title})]})]},ke.id)})})]})})(),u.jsx("div",{className:"absolute -top-32 -right-32 w-64 h-64 bg-[#bb86fc]/5 rounded-full blur-3xl pointer-events-none"})]})]})})]})]}),u.jsx(Df,{})]})}function Z$({manga:t,chapter:e,onBack:n}){const[r,s]=V.useState(0);if(!e.pages||e.pages.length===0)return u.jsxs("div",{className:"h-screen bg-[#121212] flex flex-col items-center justify-center",children:[u.jsx("button",{onClick:n,className:"absolute top-6 left-6 p-2 hover:bg-[#333] rounded-lg transition-colors text-gray-300 hover:text-white",children:u.jsx(Nr,{className:"w-5 h-5"})}),u.jsx("div",{className:"text-gray-400 text-lg",children:"No hay páginas disponibles"})]});const i=()=>{r>0&&s(r-1)},o=()=>{r{const c=l<2,d=dU(a);return u.jsx("div",{className:"w-full flex justify-center",children:u.jsx(pr,{src:d,alt:`Página ${l+1}`,aspectRatio:"auto",objectFit:"contain",loading:c?"eager":"lazy",className:"max-w-full shadow-2xl",showPlaceholder:l>0})},l)}),u.jsx("div",{className:"w-full mt-8",children:u.jsx(Df,{})})]})}),u.jsx("div",{className:"border-t border-gray-700/60 bg-gradient-to-r from-[#2a2a2a] to-[#252525] px-6 py-6 flex-shrink-0",children:u.jsxs("div",{className:"max-w-7xl mx-auto flex items-center justify-between",children:[u.jsxs("button",{onClick:i,disabled:r===0,className:"flex items-center gap-2 px-4 py-2 rounded-lg bg-gray-800 hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed text-white transition-all",children:[u.jsx(U0,{className:"w-5 h-5"}),"Anterior"]}),u.jsxs("div",{className:"flex items-center gap-2",children:[u.jsx("input",{type:"range",min:"0",max:e.pages.length-1,value:r,onChange:a=>s(parseInt(a.target.value)),className:"w-64 h-2 bg-gray-700 rounded-lg appearance-none cursor-pointer accent-[#bb86fc]"}),u.jsxs("span",{className:"text-sm text-gray-400 w-12 text-right",children:[r+1,"/",e.pages.length]})]}),u.jsxs("button",{onClick:o,disabled:r===e.pages.length-1,className:"flex items-center gap-2 px-4 py-2 rounded-lg bg-gray-800 hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed text-white transition-all",children:["Siguiente",u.jsx(uu,{className:"w-5 h-5"})]})]})})]})}const $A="settings",HA="info",e7=`# Bienvenid@ a Twisted Streaming Brody +¡Tu plataforma definitiva para la gestión y lectura de mangas! + +Este proyecto nació con la misión de ofrecer una experiencia de lectura fluida, moderna y sin interrupciones, diseñada por fans para fans. + +## 🌟 Características Principales + +* **⚡ Lectura sin límites:** Disfruta de una interfaz optimizada, rápida y responsiva. +* **📥 Descargas Flexibles:** Baja tus capítulos favoritos en formato **ZIP** o **PDF** para leer offline. +* **🔄 Conversión Inteligente:** Nuestro servidor procesa las imágenes para darte la mejor calidad y compatibilidad. + +## 🤝 Comunidad y Apoyo + +Este es un proyecto **sin fines de lucro**, desarrollado por pura pasión. + +Sin embargo, si valoras mi trabajo y quieres apoyarme para mantener el proyecto vivo, puedes suscribirte a mi **Patreon**. ¡Tu apoyo significa mucho! + +* [**💜 Apóyame en Patreon**](https://www.patreon.com/cw/Twistedbrody) + +### 💡 ¿Tienes nuevas ideas? +¡Quiero escucharlas! Si tienes sugerencias, feedback o ideas locas, háblame directamente: + +* **Telegram:** [@twistedbrodyoficial](https://t.me/twistedbrodyoficial) + +También puedes unirte a nuestros canales: +* [Canal Principal](https://t.me/twistedbrody) +* [Canal Hub](https://t.me/+CmmZFHM9hpViYzMx) +* [X (Twitter)](https://x.com/TwistedBrody) + +--- +> **Disclaimer:** Todo el contenido es propiedad de sus respectivos autores. Apoya el material original siempre que sea posible. + + +`;async function t7(t){const e=wt(Ae,$A,HA),n={content:t,updatedAt:new Date().toISOString()};await VN(e,n)}function n7(t){const e=wt(Ae,$A,HA);return sv(e,n=>{n.exists()?t(n.data()):t({content:e7,updatedAt:new Date().toISOString()})})}function r7(t,e){const n={};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const s7=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,i7=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,o7={};function DS(t,e){return(o7.jsx?i7:s7).test(t)}const a7=/[ \t\n\f\r]/g;function l7(t){return typeof t=="object"?t.type==="text"?MS(t.value):!1:MS(t)}function MS(t){return t.replace(a7,"")===""}class Ru{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}Ru.prototype.normal={};Ru.prototype.property={};Ru.prototype.space=void 0;function GA(t,e){const n={},r={};for(const s of t)Object.assign(n,s.property),Object.assign(r,s.normal);return new Ru(n,r,e)}function Vy(t){return t.toLowerCase()}class ir{constructor(e,n){this.attribute=n,this.property=e}}ir.prototype.attribute="";ir.prototype.booleanish=!1;ir.prototype.boolean=!1;ir.prototype.commaOrSpaceSeparated=!1;ir.prototype.commaSeparated=!1;ir.prototype.defined=!1;ir.prototype.mustUseProperty=!1;ir.prototype.number=!1;ir.prototype.overloadedBoolean=!1;ir.prototype.property="";ir.prototype.spaceSeparated=!1;ir.prototype.space=void 0;let c7=0;const De=Yo(),$t=Yo(),Oy=Yo(),ie=Yo(),at=Yo(),Fa=Yo(),ur=Yo();function Yo(){return 2**++c7}const Fy=Object.freeze(Object.defineProperty({__proto__:null,boolean:De,booleanish:$t,commaOrSpaceSeparated:ur,commaSeparated:Fa,number:ie,overloadedBoolean:Oy,spaceSeparated:at},Symbol.toStringTag,{value:"Module"})),Pm=Object.keys(Fy);class wv extends ir{constructor(e,n,r,s){let i=-1;if(super(e,n),LS(this,"space",s),typeof r=="number")for(;++i4&&n.slice(0,4)==="data"&&p7.test(e)){if(e.charAt(4)==="-"){const i=e.slice(5).replace(VS,y7);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=e.slice(4);if(!VS.test(i)){let o=i.replace(f7,g7);o.charAt(0)!=="-"&&(o="-"+o),e="data"+o}}s=wv}return new s(r,e)}function g7(t){return"-"+t.toLowerCase()}function y7(t){return t.charAt(1).toUpperCase()}const x7=GA([qA,u7,YA,QA,XA],"html"),bv=GA([qA,d7,YA,QA,XA],"svg");function v7(t){return t.join(" ").trim()}var _v={},OS=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,w7=/\n/g,b7=/^\s*/,_7=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,S7=/^:\s*/,E7=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,T7=/^[;\s]*/,k7=/^\s+|\s+$/g,C7=` +`,FS="/",zS="*",ho="",I7="comment",N7="declaration";function A7(t,e){if(typeof t!="string")throw new TypeError("First argument must be a string");if(!t)return[];e=e||{};var n=1,r=1;function s(g){var b=g.match(w7);b&&(n+=b.length);var E=g.lastIndexOf(C7);r=~E?g.length-E:r+g.length}function i(){var g={line:n,column:r};return function(b){return b.position=new o(g),c(),b}}function o(g){this.start=g,this.end={line:n,column:r},this.source=e.source}o.prototype.content=t;function a(g){var b=new Error(e.source+":"+n+":"+r+": "+g);if(b.reason=g,b.filename=e.source,b.line=n,b.column=r,b.source=t,!e.silent)throw b}function l(g){var b=g.exec(t);if(b){var E=b[0];return s(E),t=t.slice(E.length),b}}function c(){l(b7)}function d(g){var b;for(g=g||[];b=h();)b!==!1&&g.push(b);return g}function h(){var g=i();if(!(FS!=t.charAt(0)||zS!=t.charAt(1))){for(var b=2;ho!=t.charAt(b)&&(zS!=t.charAt(b)||FS!=t.charAt(b+1));)++b;if(b+=2,ho===t.charAt(b-1))return a("End of comment missing");var E=t.slice(2,b-2);return r+=2,s(E),t=t.slice(b),r+=2,g({type:I7,comment:E})}}function m(){var g=i(),b=l(_7);if(b){if(h(),!l(S7))return a("property missing ':'");var E=l(E7),y=g({type:N7,property:BS(b[0].replace(OS,ho)),value:E?BS(E[0].replace(OS,ho)):ho});return l(T7),y}}function p(){var g=[];d(g);for(var b;b=m();)b!==!1&&(g.push(b),d(g));return g}return c(),p()}function BS(t){return t?t.replace(k7,ho):ho}var P7=A7,R7=ih&&ih.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(_v,"__esModule",{value:!0});_v.default=D7;const j7=R7(P7);function D7(t,e){let n=null;if(!t||typeof t!="string")return n;const r=(0,j7.default)(t),s=typeof e=="function";return r.forEach(i=>{if(i.type!=="declaration")return;const{property:o,value:a}=i;s?e(o,a,i):a&&(n=n||{},n[o]=a)}),n}var ap={};Object.defineProperty(ap,"__esModule",{value:!0});ap.camelCase=void 0;var M7=/^--[a-zA-Z0-9_-]+$/,L7=/-([a-z])/g,V7=/^[^-]+$/,O7=/^-(webkit|moz|ms|o|khtml)-/,F7=/^-(ms)-/,z7=function(t){return!t||V7.test(t)||M7.test(t)},B7=function(t,e){return e.toUpperCase()},US=function(t,e){return"".concat(e,"-")},U7=function(t,e){return e===void 0&&(e={}),z7(t)?t:(t=t.toLowerCase(),e.reactCompat?t=t.replace(F7,US):t=t.replace(O7,US),t.replace(L7,B7))};ap.camelCase=U7;var $7=ih&&ih.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},H7=$7(_v),G7=ap;function zy(t,e){var n={};return!t||typeof t!="string"||(0,H7.default)(t,function(r,s){r&&s&&(n[(0,G7.camelCase)(r,e)]=s)}),n}zy.default=zy;var q7=zy;const W7=mf(q7),JA=ZA("end"),Sv=ZA("start");function ZA(t){return e;function e(n){const r=n&&n.position&&n.position[t]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function K7(t){const e=Sv(t),n=JA(t);if(e&&n)return{start:e,end:n}}function _c(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?$S(t.position):"start"in t||"end"in t?$S(t):"line"in t||"column"in t?By(t):""}function By(t){return HS(t&&t.line)+":"+HS(t&&t.column)}function $S(t){return By(t&&t.start)+"-"+By(t&&t.end)}function HS(t){return t&&typeof t=="number"?t:1}class Nn extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",i={},o=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof e=="string"?s=e:!i.cause&&e&&(o=!0,s=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?i.ruleId=r:(i.source=r.slice(0,l),i.ruleId=r.slice(l+1))}if(!i.place&&i.ancestors&&i.ancestors){const l=i.ancestors[i.ancestors.length-1];l&&(i.place=l.position)}const a=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=a?a.line:void 0,this.name=_c(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=o&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Nn.prototype.file="";Nn.prototype.name="";Nn.prototype.reason="";Nn.prototype.message="";Nn.prototype.stack="";Nn.prototype.column=void 0;Nn.prototype.line=void 0;Nn.prototype.ancestors=void 0;Nn.prototype.cause=void 0;Nn.prototype.fatal=void 0;Nn.prototype.place=void 0;Nn.prototype.ruleId=void 0;Nn.prototype.source=void 0;const Ev={}.hasOwnProperty,Y7=new Map,Q7=/[A-Z]/g,X7=new Set(["table","tbody","thead","tfoot","tr"]),J7=new Set(["td","th"]),eP="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Z7(t,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=e.filePath||void 0;let r;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=aH(n,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=oH(n,e.jsx,e.jsxs)}const s={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:r,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?bv:x7,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},i=tP(s,t,void 0);return i&&typeof i!="string"?i:s.create(t,s.Fragment,{children:i||void 0},void 0)}function tP(t,e,n){if(e.type==="element")return eH(t,e,n);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return tH(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return rH(t,e,n);if(e.type==="mdxjsEsm")return nH(t,e);if(e.type==="root")return sH(t,e,n);if(e.type==="text")return iH(t,e)}function eH(t,e,n){const r=t.schema;let s=r;e.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=bv,t.schema=s),t.ancestors.push(e);const i=rP(t,e.tagName,!1),o=lH(t,e);let a=kv(t,e);return X7.has(e.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!l7(l):!0})),nP(t,o,i,e),Tv(o,a),t.ancestors.pop(),t.schema=r,t.create(e,i,o,n)}function tH(t,e){if(e.data&&e.data.estree&&t.evaluater){const r=e.data.estree.body[0];return r.type,t.evaluater.evaluateExpression(r.expression)}su(t,e.position)}function nH(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);su(t,e.position)}function rH(t,e,n){const r=t.schema;let s=r;e.name==="svg"&&r.space==="html"&&(s=bv,t.schema=s),t.ancestors.push(e);const i=e.name===null?t.Fragment:rP(t,e.name,!0),o=cH(t,e),a=kv(t,e);return nP(t,o,i,e),Tv(o,a),t.ancestors.pop(),t.schema=r,t.create(e,i,o,n)}function sH(t,e,n){const r={};return Tv(r,kv(t,e)),t.create(e,t.Fragment,r,n)}function iH(t,e){return e.value}function nP(t,e,n,r){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=r)}function Tv(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function oH(t,e,n){return r;function r(s,i,o,a){const c=Array.isArray(o.children)?n:e;return a?c(i,o,a):c(i,o)}}function aH(t,e){return n;function n(r,s,i,o){const a=Array.isArray(i.children),l=Sv(r);return e(s,i,o,a,{columnNumber:l?l.column-1:void 0,fileName:t,lineNumber:l?l.line:void 0},void 0)}}function lH(t,e){const n={};let r,s;for(s in e.properties)if(s!=="children"&&Ev.call(e.properties,s)){const i=uH(t,s,e.properties[s]);if(i){const[o,a]=i;t.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&J7.has(e.tagName)?r=a:n[o]=a}}if(r){const i=n.style||(n.style={});i[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function cH(t,e){const n={};for(const r of e.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&t.evaluater){const i=r.data.estree.body[0];i.type;const o=i.expression;o.type;const a=o.properties[0];a.type,Object.assign(n,t.evaluater.evaluateExpression(a.argument))}else su(t,e.position);else{const s=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&t.evaluater){const a=r.value.data.estree.body[0];a.type,i=t.evaluater.evaluateExpression(a.expression)}else su(t,e.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function kv(t,e){const n=[];let r=-1;const s=t.passKeys?new Map:Y7;for(;++rs?0:s+e:e=e>s?s:e,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(e,n),t.splice(...o);else for(n&&t.splice(e,n);i0?(Es(t,t.length,0,e),t):e}const WS={}.hasOwnProperty;function xH(t){const e={};let n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function za(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const us=Xi(/[A-Za-z]/),yr=Xi(/[\dA-Za-z]/),bH=Xi(/[#-'*+\--9=?A-Z^-~]/);function Uy(t){return t!==null&&(t<32||t===127)}const $y=Xi(/\d/),_H=Xi(/[\dA-Fa-f]/),SH=Xi(/[!-/:-@[-`{-~]/);function Ee(t){return t!==null&&t<-2}function rr(t){return t!==null&&(t<0||t===32)}function Qe(t){return t===-2||t===-1||t===32}const EH=Xi(new RegExp("\\p{P}|\\p{S}","u")),TH=Xi(/\s/);function Xi(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function xl(t){const e=[];let n=-1,r=0,s=0;for(;++n55295&&i<57344){const a=t.charCodeAt(n+1);i<56320&&a>56319&&a<57344?(o=String.fromCharCode(i,a),s=1):o="�"}else o=String.fromCharCode(i);o&&(e.push(t.slice(r,n),encodeURIComponent(o)),r=n+s+1,o=""),s&&(n+=s,s=0)}return e.join("")+t.slice(r)}function dt(t,e,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return o;function o(l){return Qe(l)?(t.enter(n),a(l)):e(l)}function a(l){return Qe(l)&&i++o))return;const T=e.events.length;let w=T,C,I;for(;w--;)if(e.events[w][0]==="exit"&&e.events[w][1].type==="chunkFlow"){if(C){I=e.events[w][1].end;break}C=!0}for(y(r),k=T;k_;){const D=n[P];e.containerState=D[1],D[0].exit.call(e,t)}n.length=_}function v(){s.write([null]),i=void 0,s=void 0,e.containerState._closeFlow=void 0}}function AH(t,e,n){return dt(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function YS(t){if(t===null||rr(t)||TH(t))return 1;if(EH(t))return 2}function Iv(t,e,n){const r=[];let s=-1;for(;++s1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const h={...t[r][1].end},m={...t[n][1].start};QS(h,-l),QS(m,l),o={type:l>1?"strongSequence":"emphasisSequence",start:h,end:{...t[r][1].end}},a={type:l>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:m},i={type:l>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},s={type:l>1?"strong":"emphasis",start:{...o.start},end:{...a.end}},t[r][1].end={...o.start},t[n][1].start={...a.end},c=[],t[r][1].end.offset-t[r][1].start.offset&&(c=kr(c,[["enter",t[r][1],e],["exit",t[r][1],e]])),c=kr(c,[["enter",s,e],["enter",o,e],["exit",o,e],["enter",i,e]]),c=kr(c,Iv(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),c=kr(c,[["exit",i,e],["enter",a,e],["exit",a,e],["exit",s,e]]),t[n][1].end.offset-t[n][1].start.offset?(d=2,c=kr(c,[["enter",t[n][1],e],["exit",t[n][1],e]])):d=0,Es(t,r-1,n-r+3,c),n=r+c.length-d-2;break}}for(n=-1;++n0&&Qe(k)?dt(t,v,"linePrefix",i+1)(k):v(k)}function v(k){return k===null||Ee(k)?t.check(XS,b,P)(k):(t.enter("codeFlowValue"),_(k))}function _(k){return k===null||Ee(k)?(t.exit("codeFlowValue"),v(k)):(t.consume(k),_)}function P(k){return t.exit("codeFenced"),e(k)}function D(k,T,w){let C=0;return I;function I(B){return k.enter("lineEnding"),k.consume(B),k.exit("lineEnding"),N}function N(B){return k.enter("codeFencedFence"),Qe(B)?dt(k,j,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):j(B)}function j(B){return B===a?(k.enter("codeFencedFenceSequence"),A(B)):w(B)}function A(B){return B===a?(C++,k.consume(B),A):C>=o?(k.exit("codeFencedFenceSequence"),Qe(B)?dt(k,z,"whitespace")(B):z(B)):w(B)}function z(B){return B===null||Ee(B)?(k.exit("codeFencedFence"),T(B)):w(B)}}}function UH(t,e,n){const r=this;return s;function s(o){return o===null?n(o):(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),i)}function i(o){return r.parser.lazy[r.now().line]?n(o):e(o)}}const jm={name:"codeIndented",tokenize:HH},$H={partial:!0,tokenize:GH};function HH(t,e,n){const r=this;return s;function s(c){return t.enter("codeIndented"),dt(t,i,"linePrefix",5)(c)}function i(c){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?o(c):n(c)}function o(c){return c===null?l(c):Ee(c)?t.attempt($H,o,l)(c):(t.enter("codeFlowValue"),a(c))}function a(c){return c===null||Ee(c)?(t.exit("codeFlowValue"),o(c)):(t.consume(c),a)}function l(c){return t.exit("codeIndented"),e(c)}}function GH(t,e,n){const r=this;return s;function s(o){return r.parser.lazy[r.now().line]?n(o):Ee(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s):dt(t,i,"linePrefix",5)(o)}function i(o){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(o):Ee(o)?s(o):n(o)}}const qH={name:"codeText",previous:KH,resolve:WH,tokenize:YH};function WH(t){let e=t.length-4,n=3,r,s;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(r=n;++r=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return ethis.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(e,n,r){const s=n||0;this.setCursor(Math.trunc(e));const i=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&Bl(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),Bl(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Bl(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e=4?e(o):t.interrupt(r.parser.constructs.flow,n,e)(o)}}function uP(t,e,n,r,s,i,o,a,l){const c=l||Number.POSITIVE_INFINITY;let d=0;return h;function h(y){return y===60?(t.enter(r),t.enter(s),t.enter(i),t.consume(y),t.exit(i),m):y===null||y===32||y===41||Uy(y)?n(y):(t.enter(r),t.enter(o),t.enter(a),t.enter("chunkString",{contentType:"string"}),b(y))}function m(y){return y===62?(t.enter(i),t.consume(y),t.exit(i),t.exit(s),t.exit(r),e):(t.enter(a),t.enter("chunkString",{contentType:"string"}),p(y))}function p(y){return y===62?(t.exit("chunkString"),t.exit(a),m(y)):y===null||y===60||Ee(y)?n(y):(t.consume(y),y===92?g:p)}function g(y){return y===60||y===62||y===92?(t.consume(y),p):p(y)}function b(y){return!d&&(y===null||y===41||rr(y))?(t.exit("chunkString"),t.exit(a),t.exit(o),t.exit(r),e(y)):d999||p===null||p===91||p===93&&!l||p===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?n(p):p===93?(t.exit(i),t.enter(s),t.consume(p),t.exit(s),t.exit(r),e):Ee(p)?(t.enter("lineEnding"),t.consume(p),t.exit("lineEnding"),d):(t.enter("chunkString",{contentType:"string"}),h(p))}function h(p){return p===null||p===91||p===93||Ee(p)||a++>999?(t.exit("chunkString"),d(p)):(t.consume(p),l||(l=!Qe(p)),p===92?m:h)}function m(p){return p===91||p===92||p===93?(t.consume(p),a++,h):h(p)}}function hP(t,e,n,r,s,i){let o;return a;function a(m){return m===34||m===39||m===40?(t.enter(r),t.enter(s),t.consume(m),t.exit(s),o=m===40?41:m,l):n(m)}function l(m){return m===o?(t.enter(s),t.consume(m),t.exit(s),t.exit(r),e):(t.enter(i),c(m))}function c(m){return m===o?(t.exit(i),l(o)):m===null?n(m):Ee(m)?(t.enter("lineEnding"),t.consume(m),t.exit("lineEnding"),dt(t,c,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),d(m))}function d(m){return m===o||m===null||Ee(m)?(t.exit("chunkString"),c(m)):(t.consume(m),m===92?h:d)}function h(m){return m===o||m===92?(t.consume(m),d):d(m)}}function Sc(t,e){let n;return r;function r(s){return Ee(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),n=!0,r):Qe(s)?dt(t,r,n?"linePrefix":"lineSuffix")(s):e(s)}}const rG={name:"definition",tokenize:iG},sG={partial:!0,tokenize:oG};function iG(t,e,n){const r=this;let s;return i;function i(p){return t.enter("definition"),o(p)}function o(p){return dP.call(r,t,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function a(p){return s=za(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(t.enter("definitionMarker"),t.consume(p),t.exit("definitionMarker"),l):n(p)}function l(p){return rr(p)?Sc(t,c)(p):c(p)}function c(p){return uP(t,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function d(p){return t.attempt(sG,h,h)(p)}function h(p){return Qe(p)?dt(t,m,"whitespace")(p):m(p)}function m(p){return p===null||Ee(p)?(t.exit("definition"),r.parser.defined.push(s),e(p)):n(p)}}function oG(t,e,n){return r;function r(a){return rr(a)?Sc(t,s)(a):n(a)}function s(a){return hP(t,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function i(a){return Qe(a)?dt(t,o,"whitespace")(a):o(a)}function o(a){return a===null||Ee(a)?e(a):n(a)}}const aG={name:"hardBreakEscape",tokenize:lG};function lG(t,e,n){return r;function r(i){return t.enter("hardBreakEscape"),t.consume(i),s}function s(i){return Ee(i)?(t.exit("hardBreakEscape"),e(i)):n(i)}}const cG={name:"headingAtx",resolve:uG,tokenize:dG};function uG(t,e){let n=t.length-2,r=3,s,i;return t[r][1].type==="whitespace"&&(r+=2),n-2>r&&t[n][1].type==="whitespace"&&(n-=2),t[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&t[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(s={type:"atxHeadingText",start:t[r][1].start,end:t[n][1].end},i={type:"chunkText",start:t[r][1].start,end:t[n][1].end,contentType:"text"},Es(t,r,n-r+1,[["enter",s,e],["enter",i,e],["exit",i,e],["exit",s,e]])),t}function dG(t,e,n){let r=0;return s;function s(d){return t.enter("atxHeading"),i(d)}function i(d){return t.enter("atxHeadingSequence"),o(d)}function o(d){return d===35&&r++<6?(t.consume(d),o):d===null||rr(d)?(t.exit("atxHeadingSequence"),a(d)):n(d)}function a(d){return d===35?(t.enter("atxHeadingSequence"),l(d)):d===null||Ee(d)?(t.exit("atxHeading"),e(d)):Qe(d)?dt(t,a,"whitespace")(d):(t.enter("atxHeadingText"),c(d))}function l(d){return d===35?(t.consume(d),l):(t.exit("atxHeadingSequence"),a(d))}function c(d){return d===null||d===35||rr(d)?(t.exit("atxHeadingText"),a(d)):(t.consume(d),c)}}const hG=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],ZS=["pre","script","style","textarea"],fG={concrete:!0,name:"htmlFlow",resolveTo:gG,tokenize:yG},pG={partial:!0,tokenize:vG},mG={partial:!0,tokenize:xG};function gG(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function yG(t,e,n){const r=this;let s,i,o,a,l;return c;function c(M){return d(M)}function d(M){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(M),h}function h(M){return M===33?(t.consume(M),m):M===47?(t.consume(M),i=!0,b):M===63?(t.consume(M),s=3,r.interrupt?e:R):us(M)?(t.consume(M),o=String.fromCharCode(M),E):n(M)}function m(M){return M===45?(t.consume(M),s=2,p):M===91?(t.consume(M),s=5,a=0,g):us(M)?(t.consume(M),s=4,r.interrupt?e:R):n(M)}function p(M){return M===45?(t.consume(M),r.interrupt?e:R):n(M)}function g(M){const $="CDATA[";return M===$.charCodeAt(a++)?(t.consume(M),a===$.length?r.interrupt?e:j:g):n(M)}function b(M){return us(M)?(t.consume(M),o=String.fromCharCode(M),E):n(M)}function E(M){if(M===null||M===47||M===62||rr(M)){const $=M===47,ee=o.toLowerCase();return!$&&!i&&ZS.includes(ee)?(s=1,r.interrupt?e(M):j(M)):hG.includes(o.toLowerCase())?(s=6,$?(t.consume(M),y):r.interrupt?e(M):j(M)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(M):i?v(M):_(M))}return M===45||yr(M)?(t.consume(M),o+=String.fromCharCode(M),E):n(M)}function y(M){return M===62?(t.consume(M),r.interrupt?e:j):n(M)}function v(M){return Qe(M)?(t.consume(M),v):I(M)}function _(M){return M===47?(t.consume(M),I):M===58||M===95||us(M)?(t.consume(M),P):Qe(M)?(t.consume(M),_):I(M)}function P(M){return M===45||M===46||M===58||M===95||yr(M)?(t.consume(M),P):D(M)}function D(M){return M===61?(t.consume(M),k):Qe(M)?(t.consume(M),D):_(M)}function k(M){return M===null||M===60||M===61||M===62||M===96?n(M):M===34||M===39?(t.consume(M),l=M,T):Qe(M)?(t.consume(M),k):w(M)}function T(M){return M===l?(t.consume(M),l=null,C):M===null||Ee(M)?n(M):(t.consume(M),T)}function w(M){return M===null||M===34||M===39||M===47||M===60||M===61||M===62||M===96||rr(M)?D(M):(t.consume(M),w)}function C(M){return M===47||M===62||Qe(M)?_(M):n(M)}function I(M){return M===62?(t.consume(M),N):n(M)}function N(M){return M===null||Ee(M)?j(M):Qe(M)?(t.consume(M),N):n(M)}function j(M){return M===45&&s===2?(t.consume(M),q):M===60&&s===1?(t.consume(M),X):M===62&&s===4?(t.consume(M),Y):M===63&&s===3?(t.consume(M),R):M===93&&s===5?(t.consume(M),H):Ee(M)&&(s===6||s===7)?(t.exit("htmlFlowData"),t.check(pG,se,A)(M)):M===null||Ee(M)?(t.exit("htmlFlowData"),A(M)):(t.consume(M),j)}function A(M){return t.check(mG,z,se)(M)}function z(M){return t.enter("lineEnding"),t.consume(M),t.exit("lineEnding"),B}function B(M){return M===null||Ee(M)?A(M):(t.enter("htmlFlowData"),j(M))}function q(M){return M===45?(t.consume(M),R):j(M)}function X(M){return M===47?(t.consume(M),o="",O):j(M)}function O(M){if(M===62){const $=o.toLowerCase();return ZS.includes($)?(t.consume(M),Y):j(M)}return us(M)&&o.length<8?(t.consume(M),o+=String.fromCharCode(M),O):j(M)}function H(M){return M===93?(t.consume(M),R):j(M)}function R(M){return M===62?(t.consume(M),Y):M===45&&s===2?(t.consume(M),R):j(M)}function Y(M){return M===null||Ee(M)?(t.exit("htmlFlowData"),se(M)):(t.consume(M),Y)}function se(M){return t.exit("htmlFlow"),e(M)}}function xG(t,e,n){const r=this;return s;function s(o){return Ee(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),i):n(o)}function i(o){return r.parser.lazy[r.now().line]?n(o):e(o)}}function vG(t,e,n){return r;function r(s){return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),t.attempt(lp,e,n)}}const wG={name:"htmlText",tokenize:bG};function bG(t,e,n){const r=this;let s,i,o;return a;function a(R){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(R),l}function l(R){return R===33?(t.consume(R),c):R===47?(t.consume(R),D):R===63?(t.consume(R),_):us(R)?(t.consume(R),w):n(R)}function c(R){return R===45?(t.consume(R),d):R===91?(t.consume(R),i=0,g):us(R)?(t.consume(R),v):n(R)}function d(R){return R===45?(t.consume(R),p):n(R)}function h(R){return R===null?n(R):R===45?(t.consume(R),m):Ee(R)?(o=h,X(R)):(t.consume(R),h)}function m(R){return R===45?(t.consume(R),p):h(R)}function p(R){return R===62?q(R):R===45?m(R):h(R)}function g(R){const Y="CDATA[";return R===Y.charCodeAt(i++)?(t.consume(R),i===Y.length?b:g):n(R)}function b(R){return R===null?n(R):R===93?(t.consume(R),E):Ee(R)?(o=b,X(R)):(t.consume(R),b)}function E(R){return R===93?(t.consume(R),y):b(R)}function y(R){return R===62?q(R):R===93?(t.consume(R),y):b(R)}function v(R){return R===null||R===62?q(R):Ee(R)?(o=v,X(R)):(t.consume(R),v)}function _(R){return R===null?n(R):R===63?(t.consume(R),P):Ee(R)?(o=_,X(R)):(t.consume(R),_)}function P(R){return R===62?q(R):_(R)}function D(R){return us(R)?(t.consume(R),k):n(R)}function k(R){return R===45||yr(R)?(t.consume(R),k):T(R)}function T(R){return Ee(R)?(o=T,X(R)):Qe(R)?(t.consume(R),T):q(R)}function w(R){return R===45||yr(R)?(t.consume(R),w):R===47||R===62||rr(R)?C(R):n(R)}function C(R){return R===47?(t.consume(R),q):R===58||R===95||us(R)?(t.consume(R),I):Ee(R)?(o=C,X(R)):Qe(R)?(t.consume(R),C):q(R)}function I(R){return R===45||R===46||R===58||R===95||yr(R)?(t.consume(R),I):N(R)}function N(R){return R===61?(t.consume(R),j):Ee(R)?(o=N,X(R)):Qe(R)?(t.consume(R),N):C(R)}function j(R){return R===null||R===60||R===61||R===62||R===96?n(R):R===34||R===39?(t.consume(R),s=R,A):Ee(R)?(o=j,X(R)):Qe(R)?(t.consume(R),j):(t.consume(R),z)}function A(R){return R===s?(t.consume(R),s=void 0,B):R===null?n(R):Ee(R)?(o=A,X(R)):(t.consume(R),A)}function z(R){return R===null||R===34||R===39||R===60||R===61||R===96?n(R):R===47||R===62||rr(R)?C(R):(t.consume(R),z)}function B(R){return R===47||R===62||rr(R)?C(R):n(R)}function q(R){return R===62?(t.consume(R),t.exit("htmlTextData"),t.exit("htmlText"),e):n(R)}function X(R){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(R),t.exit("lineEnding"),O}function O(R){return Qe(R)?dt(t,H,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):H(R)}function H(R){return t.enter("htmlTextData"),o(R)}}const Nv={name:"labelEnd",resolveAll:TG,resolveTo:kG,tokenize:CG},_G={tokenize:IG},SG={tokenize:NG},EG={tokenize:AG};function TG(t){let e=-1;const n=[];for(;++e=3&&(c===null||Ee(c))?(t.exit("thematicBreak"),e(c)):n(c)}function l(c){return c===s?(t.consume(c),r++,l):(t.exit("thematicBreakSequence"),Qe(c)?dt(t,a,"whitespace")(c):a(c))}}const Wn={continuation:{tokenize:zG},exit:UG,name:"list",tokenize:FG},VG={partial:!0,tokenize:$G},OG={partial:!0,tokenize:BG};function FG(t,e,n){const r=this,s=r.events[r.events.length-1];let i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,o=0;return a;function a(p){const g=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:$y(p)){if(r.containerState.type||(r.containerState.type=g,t.enter(g,{_container:!0})),g==="listUnordered")return t.enter("listItemPrefix"),p===42||p===45?t.check(rh,n,c)(p):c(p);if(!r.interrupt||p===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),l(p)}return n(p)}function l(p){return $y(p)&&++o<10?(t.consume(p),l):(!r.interrupt||o<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(t.exit("listItemValue"),c(p)):n(p)}function c(p){return t.enter("listItemMarker"),t.consume(p),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,t.check(lp,r.interrupt?n:d,t.attempt(VG,m,h))}function d(p){return r.containerState.initialBlankLine=!0,i++,m(p)}function h(p){return Qe(p)?(t.enter("listItemPrefixWhitespace"),t.consume(p),t.exit("listItemPrefixWhitespace"),m):n(p)}function m(p){return r.containerState.size=i+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(p)}}function zG(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(lp,s,i);function s(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,dt(t,e,"listItemIndent",r.containerState.size+1)(a)}function i(a){return r.containerState.furtherBlankLines||!Qe(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(OG,e,o)(a))}function o(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,dt(t,t.attempt(Wn,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function BG(t,e,n){const r=this;return dt(t,s,"listItemIndent",r.containerState.size+1);function s(i){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?e(i):n(i)}}function UG(t){t.exit(this.containerState.type)}function $G(t,e,n){const r=this;return dt(t,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(i){const o=r.events[r.events.length-1];return!Qe(i)&&o&&o[1].type==="listItemPrefixWhitespace"?e(i):n(i)}}const eE={name:"setextUnderline",resolveTo:HG,tokenize:GG};function HG(t,e){let n=t.length,r,s,i;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){r=n;break}t[n][1].type==="paragraph"&&(s=n)}else t[n][1].type==="content"&&t.splice(n,1),!i&&t[n][1].type==="definition"&&(i=n);const o={type:"setextHeading",start:{...t[r][1].start},end:{...t[t.length-1][1].end}};return t[s][1].type="setextHeadingText",i?(t.splice(s,0,["enter",o,e]),t.splice(i+1,0,["exit",t[r][1],e]),t[r][1].end={...t[i][1].end}):t[r][1]=o,t.push(["exit",o,e]),t}function GG(t,e,n){const r=this;let s;return i;function i(c){let d=r.events.length,h;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){h=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||h)?(t.enter("setextHeadingLine"),s=c,o(c)):n(c)}function o(c){return t.enter("setextHeadingLineSequence"),a(c)}function a(c){return c===s?(t.consume(c),a):(t.exit("setextHeadingLineSequence"),Qe(c)?dt(t,l,"lineSuffix")(c):l(c))}function l(c){return c===null||Ee(c)?(t.exit("setextHeadingLine"),e(c)):n(c)}}const qG={tokenize:WG};function WG(t){const e=this,n=t.attempt(lp,r,t.attempt(this.parser.constructs.flowInitial,s,dt(t,t.attempt(this.parser.constructs.flow,s,t.attempt(JH,s)),"linePrefix")));return n;function r(i){if(i===null){t.consume(i);return}return t.enter("lineEndingBlank"),t.consume(i),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n}function s(i){if(i===null){t.consume(i);return}return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),e.currentConstruct=void 0,n}}const KG={resolveAll:pP()},YG=fP("string"),QG=fP("text");function fP(t){return{resolveAll:pP(t==="text"?XG:void 0),tokenize:e};function e(n){const r=this,s=this.parser.constructs[t],i=n.attempt(s,o,a);return o;function o(d){return c(d)?i(d):a(d)}function a(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),l}function l(d){return c(d)?(n.exit("data"),i(d)):(n.consume(d),l)}function c(d){if(d===null)return!0;const h=s[d];let m=-1;if(h)for(;++m-1){const a=o[0];typeof a=="string"?o[0]=a.slice(r):o.shift()}i>0&&o.push(t[s].slice(0,i))}return o}function uq(t,e){let n=-1;const r=[];let s;for(;++n0){const yt=ve.tokenStack[ve.tokenStack.length-1];(yt[1]||nE).call(ve,void 0,yt[0])}for(te.position={start:ii(W.length>0?W[0][1].start:{line:1,column:1,offset:0}),end:ii(W.length>0?W[W.length-2][1].end:{line:1,column:1,offset:0})},Me=-1;++Me0&&(r.className=["language-"+s[0]]);let i={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return e.meta&&(i.data={meta:e.meta}),t.patch(e,i),i=t.applyData(e,i),i={type:"element",tagName:"pre",properties:{},children:[i]},t.patch(e,i),i}function Eq(t,e){const n={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function Tq(t,e){const n={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function kq(t,e){const n=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=String(e.identifier).toUpperCase(),s=xl(r.toLowerCase()),i=t.footnoteOrder.indexOf(r);let o,a=t.footnoteCounts.get(r);a===void 0?(a=0,t.footnoteOrder.push(r),o=t.footnoteOrder.length):o=i+1,a+=1,t.footnoteCounts.set(r,a);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};t.patch(e,l);const c={type:"element",tagName:"sup",properties:{},children:[l]};return t.patch(e,c),t.applyData(e,c)}function Cq(t,e){const n={type:"element",tagName:"h"+e.depth,properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function Iq(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}}function yP(t,e){const n=e.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+r}];const s=t.all(e),i=s[0];i&&i.type==="text"?i.value="["+i.value:s.unshift({type:"text",value:"["});const o=s[s.length-1];return o&&o.type==="text"?o.value+=r:s.push({type:"text",value:r}),s}function Nq(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return yP(t,e);const s={src:xl(r.url||""),alt:e.alt};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"img",properties:s,children:[]};return t.patch(e,i),t.applyData(e,i)}function Aq(t,e){const n={src:xl(e.url)};e.alt!==null&&e.alt!==void 0&&(n.alt=e.alt),e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"img",properties:n,children:[]};return t.patch(e,r),t.applyData(e,r)}function Pq(t,e){const n={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};t.patch(e,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return t.patch(e,r),t.applyData(e,r)}function Rq(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return yP(t,e);const s={href:xl(r.url||"")};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"a",properties:s,children:t.all(e)};return t.patch(e,i),t.applyData(e,i)}function jq(t,e){const n={href:xl(e.url)};e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"a",properties:n,children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function Dq(t,e,n){const r=t.all(e),s=n?Mq(n):xP(e),i={},o=[];if(typeof e.checked=="boolean"){const d=r[0];let h;d&&d.type==="element"&&d.tagName==="p"?h=d:(h={type:"element",tagName:"p",properties:{},children:[]},r.unshift(h)),h.children.length>0&&h.children.unshift({type:"text",value:" "}),h.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let a=-1;for(;++a1}function Lq(t,e){const n={},r=t.all(e);let s=-1;for(typeof e.start=="number"&&e.start!==1&&(n.start=e.start);++s0){const o={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},a=Sv(e.children[1]),l=JA(e.children[e.children.length-1]);a&&l&&(o.position={start:a,end:l}),s.push(o)}const i={type:"element",tagName:"table",properties:{},children:t.wrap(s,!0)};return t.patch(e,i),t.applyData(e,i)}function Bq(t,e,n){const r=n?n.children:void 0,i=(r?r.indexOf(e):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,a=o?o.length:e.children.length;let l=-1;const c=[];for(;++l0,!0),r[0]),s=r.index+r[0].length,r=n.exec(e);return i.push(iE(e.slice(s),s>0,!1)),i.join("")}function iE(t,e,n){let r=0,s=t.length;if(e){let i=t.codePointAt(r);for(;i===rE||i===sE;)r++,i=t.codePointAt(r)}if(n){let i=t.codePointAt(s-1);for(;i===rE||i===sE;)s--,i=t.codePointAt(s-1)}return s>r?t.slice(r,s):""}function Hq(t,e){const n={type:"text",value:$q(String(e.value))};return t.patch(e,n),t.applyData(e,n)}function Gq(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)}const qq={blockquote:bq,break:_q,code:Sq,delete:Eq,emphasis:Tq,footnoteReference:kq,heading:Cq,html:Iq,imageReference:Nq,image:Aq,inlineCode:Pq,linkReference:Rq,link:jq,listItem:Dq,list:Lq,paragraph:Vq,root:Oq,strong:Fq,table:zq,tableCell:Uq,tableRow:Bq,text:Hq,thematicBreak:Gq,toml:Sd,yaml:Sd,definition:Sd,footnoteDefinition:Sd};function Sd(){}const vP=-1,cp=0,Ec=1,ff=2,Av=3,Pv=4,Rv=5,jv=6,wP=7,bP=8,oE=typeof self=="object"?self:globalThis,Wq=(t,e)=>{const n=(s,i)=>(t.set(i,s),s),r=s=>{if(t.has(s))return t.get(s);const[i,o]=e[s];switch(i){case cp:case vP:return n(o,s);case Ec:{const a=n([],s);for(const l of o)a.push(r(l));return a}case ff:{const a=n({},s);for(const[l,c]of o)a[r(l)]=r(c);return a}case Av:return n(new Date(o),s);case Pv:{const{source:a,flags:l}=o;return n(new RegExp(a,l),s)}case Rv:{const a=n(new Map,s);for(const[l,c]of o)a.set(r(l),r(c));return a}case jv:{const a=n(new Set,s);for(const l of o)a.add(r(l));return a}case wP:{const{name:a,message:l}=o;return n(new oE[a](l),s)}case bP:return n(BigInt(o),s);case"BigInt":return n(Object(BigInt(o)),s);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:a}=new Uint8Array(o);return n(new DataView(a),o)}}return n(new oE[i](o),s)};return r},aE=t=>Wq(new Map,t)(0),ra="",{toString:Kq}={},{keys:Yq}=Object,Ul=t=>{const e=typeof t;if(e!=="object"||!t)return[cp,e];const n=Kq.call(t).slice(8,-1);switch(n){case"Array":return[Ec,ra];case"Object":return[ff,ra];case"Date":return[Av,ra];case"RegExp":return[Pv,ra];case"Map":return[Rv,ra];case"Set":return[jv,ra];case"DataView":return[Ec,n]}return n.includes("Array")?[Ec,n]:n.includes("Error")?[wP,n]:[ff,n]},Ed=([t,e])=>t===cp&&(e==="function"||e==="symbol"),Qq=(t,e,n,r)=>{const s=(o,a)=>{const l=r.push(o)-1;return n.set(a,l),l},i=o=>{if(n.has(o))return n.get(o);let[a,l]=Ul(o);switch(a){case cp:{let d=o;switch(l){case"bigint":a=bP,d=o.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+l);d=null;break;case"undefined":return s([vP],o)}return s([a,d],o)}case Ec:{if(l){let m=o;return l==="DataView"?m=new Uint8Array(o.buffer):l==="ArrayBuffer"&&(m=new Uint8Array(o)),s([l,[...m]],o)}const d=[],h=s([a,d],o);for(const m of o)d.push(i(m));return h}case ff:{if(l)switch(l){case"BigInt":return s([l,o.toString()],o);case"Boolean":case"Number":case"String":return s([l,o.valueOf()],o)}if(e&&"toJSON"in o)return i(o.toJSON());const d=[],h=s([a,d],o);for(const m of Yq(o))(t||!Ed(Ul(o[m])))&&d.push([i(m),i(o[m])]);return h}case Av:return s([a,o.toISOString()],o);case Pv:{const{source:d,flags:h}=o;return s([a,{source:d,flags:h}],o)}case Rv:{const d=[],h=s([a,d],o);for(const[m,p]of o)(t||!(Ed(Ul(m))||Ed(Ul(p))))&&d.push([i(m),i(p)]);return h}case jv:{const d=[],h=s([a,d],o);for(const m of o)(t||!Ed(Ul(m)))&&d.push(i(m));return h}}const{message:c}=o;return s([a,{name:l,message:c}],o)};return i},lE=(t,{json:e,lossy:n}={})=>{const r=[];return Qq(!(e||n),!!e,new Map,r)(t),r},pf=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?aE(lE(t,e)):structuredClone(t):(t,e)=>aE(lE(t,e));function Xq(t,e){const n=[{type:"text",value:"↩"}];return e>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),n}function Jq(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function Zq(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=t.options.footnoteBackContent||Xq,r=t.options.footnoteBackLabel||Jq,s=t.options.footnoteLabel||"Footnotes",i=t.options.footnoteLabelTagName||"h2",o=t.options.footnoteLabelProperties||{className:["sr-only"]},a=[];let l=-1;for(;++l0&&g.push({type:"text",value:" "});let v=typeof n=="string"?n:n(l,p);typeof v=="string"&&(v={type:"text",value:v}),g.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+m+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(l,p),className:["data-footnote-backref"]},children:Array.isArray(v)?v:[v]})}const E=d[d.length-1];if(E&&E.type==="element"&&E.tagName==="p"){const v=E.children[E.children.length-1];v&&v.type==="text"?v.value+=" ":E.children.push({type:"text",value:" "}),E.children.push(...g)}else d.push(...g);const y={type:"element",tagName:"li",properties:{id:e+"fn-"+m},children:t.wrap(d,!0)};t.patch(c,y),a.push(y)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...pf(o),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:` +`},{type:"element",tagName:"ol",properties:{},children:t.wrap(a,!0)},{type:"text",value:` +`}]}}const _P=function(t){if(t==null)return rW;if(typeof t=="function")return up(t);if(typeof t=="object")return Array.isArray(t)?eW(t):tW(t);if(typeof t=="string")return nW(t);throw new Error("Expected function, string, or object as test")};function eW(t){const e=[];let n=-1;for(;++n":""))+")"})}return m;function m(){let p=SP,g,b,E;if((!e||i(l,c,d[d.length-1]||void 0))&&(p=lW(n(l,d)),p[0]===cE))return p;if("children"in l&&l.children){const y=l;if(y.children&&p[0]!==oW)for(b=(r?y.children.length:-1)+o,E=d.concat(y);b>-1&&b0&&n.push({type:"text",value:` +`}),n}function uE(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function dE(t,e){const n=uW(t,e),r=n.one(t,void 0),s=Zq(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&i.children.push({type:"text",value:` +`},s),i}function mW(t,e){return t&&"run"in t?async function(n,r){const s=dE(n,{file:r,...e});await t.run(s,r)}:function(n,r){return dE(n,{file:r,...t||e})}}function hE(t){if(t)throw t}var sh=Object.prototype.hasOwnProperty,TP=Object.prototype.toString,fE=Object.defineProperty,pE=Object.getOwnPropertyDescriptor,mE=function(e){return typeof Array.isArray=="function"?Array.isArray(e):TP.call(e)==="[object Array]"},gE=function(e){if(!e||TP.call(e)!=="[object Object]")return!1;var n=sh.call(e,"constructor"),r=e.constructor&&e.constructor.prototype&&sh.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!r)return!1;var s;for(s in e);return typeof s>"u"||sh.call(e,s)},yE=function(e,n){fE&&n.name==="__proto__"?fE(e,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):e[n.name]=n.newValue},xE=function(e,n){if(n==="__proto__")if(sh.call(e,n)){if(pE)return pE(e,n).value}else return;return e[n]},gW=function t(){var e,n,r,s,i,o,a=arguments[0],l=1,c=arguments.length,d=!1;for(typeof a=="boolean"&&(d=a,a=arguments[1]||{},l=2),(a==null||typeof a!="object"&&typeof a!="function")&&(a={});lo.length;let l;a&&o.push(s);try{l=t.apply(this,o)}catch(c){const d=c;if(a&&n)throw d;return s(d)}a||(l&&l.then&&typeof l.then=="function"?l.then(i,s):l instanceof Error?s(l):i(l))}function s(o,...a){n||(n=!0,e(o,...a))}function i(o){s(null,o)}}const is={basename:vW,dirname:wW,extname:bW,join:_W,sep:"/"};function vW(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');ju(t);let n=0,r=-1,s=t.length,i;if(e===void 0||e.length===0||e.length>t.length){for(;s--;)if(t.codePointAt(s)===47){if(i){n=s+1;break}}else r<0&&(i=!0,r=s+1);return r<0?"":t.slice(n,r)}if(e===t)return"";let o=-1,a=e.length-1;for(;s--;)if(t.codePointAt(s)===47){if(i){n=s+1;break}}else o<0&&(i=!0,o=s+1),a>-1&&(t.codePointAt(s)===e.codePointAt(a--)?a<0&&(r=s):(a=-1,r=o));return n===r?r=o:r<0&&(r=t.length),t.slice(n,r)}function wW(t){if(ju(t),t.length===0)return".";let e=-1,n=t.length,r;for(;--n;)if(t.codePointAt(n)===47){if(r){e=n;break}}else r||(r=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function bW(t){ju(t);let e=t.length,n=-1,r=0,s=-1,i=0,o;for(;e--;){const a=t.codePointAt(e);if(a===47){if(o){r=e+1;break}continue}n<0&&(o=!0,n=e+1),a===46?s<0?s=e:i!==1&&(i=1):s>-1&&(i=-1)}return s<0||n<0||i===0||i===1&&s===n-1&&s===r+1?"":t.slice(s,n)}function _W(...t){let e=-1,n;for(;++e0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function EW(t,e){let n="",r=0,s=-1,i=0,o=-1,a,l;for(;++o<=t.length;){if(o2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),s=o,i=0;continue}}else if(n.length>0){n="",r=0,s=o,i=0;continue}}e&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+t.slice(s+1,o):n=t.slice(s+1,o),r=o-s-1;s=o,i=0}else a===46&&i>-1?i++:i=-1}return n}function ju(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const TW={cwd:kW};function kW(){return"/"}function Wy(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function CW(t){if(typeof t=="string")t=new URL(t);else if(!Wy(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return IW(t)}function IW(t){if(t.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const e=t.pathname;let n=-1;for(;++n0){let[p,...g]=d;const b=r[m][1];qy(b)&&qy(p)&&(p=Mm(!0,b,p)),r[m]=[c,p,...g]}}}}const RW=new Dv().freeze();function Fm(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function zm(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function Bm(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function wE(t){if(!qy(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function bE(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function Td(t){return jW(t)?t:new kP(t)}function jW(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function DW(t){return typeof t=="string"||MW(t)}function MW(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const LW="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",_E=[],SE={allowDangerousHtml:!0},VW=/^(https?|ircs?|mailto|xmpp)$/i,OW=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function FW(t){const e=zW(t),n=BW(t);return UW(e.runSync(e.parse(n),n),t)}function zW(t){const e=t.rehypePlugins||_E,n=t.remarkPlugins||_E,r=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...SE}:SE;return RW().use(wq).use(n).use(mW,r).use(e)}function BW(t){const e=t.children||"",n=new kP;return typeof e=="string"&&(n.value=e),n}function UW(t,e){const n=e.allowedElements,r=e.allowElement,s=e.components,i=e.disallowedElements,o=e.skipHtml,a=e.unwrapDisallowed,l=e.urlTransform||$W;for(const d of OW)Object.hasOwn(e,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+LW+d.id,void 0);return EP(t,c),Z7(t,{Fragment:u.Fragment,components:s,ignoreInvalidStyle:!0,jsx:u.jsx,jsxs:u.jsxs,passKeys:!0,passNode:!0});function c(d,h,m){if(d.type==="raw"&&m&&typeof h=="number")return o?m.children.splice(h,1):m.children[h]={type:"text",value:d.value},h;if(d.type==="element"){let p;for(p in Rm)if(Object.hasOwn(Rm,p)&&Object.hasOwn(d.properties,p)){const g=d.properties[p],b=Rm[p];(b===null||b.includes(d.tagName))&&(d.properties[p]=l(String(g||""),p,d))}}if(d.type==="element"){let p=n?!n.includes(d.tagName):i?i.includes(d.tagName):!1;if(!p&&r&&typeof h=="number"&&(p=!r(d,h,m)),p&&m&&typeof h=="number")return a&&d.children?m.children.splice(h,1,...d.children):m.children.splice(h,1),h}}}function $W(t){const e=t.indexOf(":"),n=t.indexOf("?"),r=t.indexOf("#"),s=t.indexOf("/");return e===-1||s!==-1&&e>s||n!==-1&&e>n||r!==-1&&e>r||VW.test(t.slice(0,e))?t:""}function HW({onBack:t,isAdmin:e}){const[n,r]=V.useState(""),[s,i]=V.useState(!1),[o,a]=V.useState(""),[l,c]=V.useState(!0);V.useEffect(()=>{const m=n7(p=>{p&&r(p.content),c(!1)});return()=>m()},[]);const d=async()=>{try{await t7(o),i(!1)}catch(m){console.error("Error saving info:",m),he.error("Error al guardar la información.")}},h=()=>{a(n),i(!0)};return u.jsx("div",{className:"min-h-screen bg-[#0a0a0a] text-white p-4 sm:p-6 md:p-12 animate-in fade-in slide-in-from-bottom-4 duration-300",children:u.jsxs("div",{className:"max-w-4xl mx-auto",children:[u.jsxs("button",{onClick:t,className:"flex items-center gap-2 text-gray-400 hover:text-white transition-colors mb-8 group",children:[u.jsx(Nr,{className:"w-5 h-5 group-hover:-translate-x-1 transition-transform"}),u.jsx("span",{className:"font-medium",children:"Volver al inicio"})]}),u.jsxs("div",{className:"bg-[#1a1a1a] rounded-2xl border border-gray-800 p-8 sm:p-12 shadow-2xl relative",children:[e&&!s&&u.jsx("button",{onClick:h,className:"absolute top-8 right-8 p-2 rounded-lg bg-gray-800 text-gray-400 hover:text-[#bb86fc] hover:bg-[#bb86fc]/10 transition-colors",title:"Editar información",children:u.jsx(Kk,{className:"w-5 h-5"})}),u.jsxs("div",{className:"flex items-center gap-4 mb-8 border-b border-gray-800 pb-8",children:[u.jsx("div",{className:"p-3 bg-gradient-to-br from-[#bb86fc] to-[#9966dd] rounded-xl shadow-lg shadow-[#bb86fc]/20",children:u.jsx(qk,{className:"w-8 h-8 text-white"})}),u.jsxs("div",{children:[u.jsx("h1",{className:"text-3xl font-bold bg-gradient-to-r from-white to-gray-400 bg-clip-text text-transparent",children:"Información"}),u.jsx("p",{className:"text-gray-400 mt-1",children:"Sobre Twisted Streaming Brody"})]})]}),s?u.jsxs("div",{className:"space-y-4",children:[u.jsx("textarea",{value:o,onChange:m=>a(m.target.value),className:"w-full h-[500px] bg-black/50 border border-[#bb86fc]/50 rounded-lg p-4 text-sm text-white focus:outline-none focus:border-[#bb86fc] font-mono",placeholder:"Escribe el contenido en Markdown..."}),u.jsxs("div",{className:"flex gap-3 justify-end",children:[u.jsxs("button",{onClick:()=>i(!1),className:"px-4 py-2 rounded-lg font-semibold text-gray-400 hover:text-white hover:bg-white/10 transition-colors flex items-center gap-2",children:[u.jsx(mt,{className:"w-4 h-4"}),"Cancelar"]}),u.jsxs("button",{onClick:d,className:"px-4 py-2 rounded-lg font-semibold bg-[#bb86fc] hover:bg-[#9966dd] text-white transition-colors shadow-lg shadow-[#bb86fc]/20 flex items-center gap-2",children:[u.jsx(sl,{className:"w-4 h-4"}),"Guardar Cambios"]})]})]}):u.jsx("div",{className:"prose prose-invert prose-p:text-gray-300 prose-headings:text-white prose-a:no-underline max-w-none",children:u.jsx(FW,{components:{h1:({node:m,...p})=>u.jsx("h1",{className:"text-3xl font-bold bg-gradient-to-r from-[#bb86fc] to-[#7744cc] bg-clip-text text-transparent mb-6 pb-2 border-b border-gray-800",...p}),h2:({node:m,...p})=>u.jsx("h2",{className:"text-xl font-semibold text-white mt-8 mb-4 flex items-center gap-2",...p}),p:({node:m,...p})=>u.jsx("p",{className:"text-gray-300 leading-relaxed mb-4",...p}),ul:({node:m,...p})=>u.jsx("ul",{className:"space-y-2 mb-6",...p}),li:({node:m,...p})=>u.jsx("li",{className:"flex items-start gap-2 text-gray-300",...p}),a:({node:m,href:p,children:g,...b})=>{const E=p==null?void 0:p.startsWith("http");if((p==null?void 0:p.includes("t.me"))||(p==null?void 0:p.includes("patreon.com"))||(p==null?void 0:p.includes("x.com"))){let v="bg-[#1a1a1a] border border-gray-700 hover:border-gray-500",_="text-gray-300 hover:text-white";return p!=null&&p.includes("patreon")&&(v="bg-[#1a1a1a] border border-gray-700 hover:border-[#FF424D] hover:text-[#FF424D]"),p!=null&&p.includes("t.me")&&(v="bg-[#1a1a1a] border border-gray-700 hover:border-[#24A1DE] hover:text-[#24A1DE]"),p!=null&&p.includes("x.com")&&(v="bg-[#1a1a1a] border border-gray-700 hover:border-white hover:text-white"),u.jsx("a",{href:p,target:E?"_blank":void 0,rel:E?"noopener noreferrer":void 0,className:`inline-flex items-center gap-2 px-3 py-1.5 rounded-lg transition-all transform hover:scale-105 shadow-sm my-1 mr-2 no-underline text-xs sm:text-sm font-medium ${v} ${_}`,...b,children:g})}return u.jsx("a",{href:p,className:"text-[#bb86fc] hover:underline",target:E?"_blank":void 0,rel:E?"noopener noreferrer":void 0,...b,children:g})},blockquote:({node:m,...p})=>u.jsx("blockquote",{className:"border-l-4 border-[#bb86fc] pl-4 py-2 bg-[#bb86fc]/10 rounded-r-lg italic text-gray-400 my-6",...p}),hr:({node:m,...p})=>u.jsx("hr",{className:"border-gray-800 my-8",...p}),img:()=>null},children:n})}),!s&&u.jsxs("div",{className:"pt-8 border-t border-gray-800 text-center text-sm text-gray-500 mt-8",children:["© ",new Date().getFullYear()," Twisted Streaming Brody. Todos los derechos reservados."]})]})]})})}function kd({label:t,type:e,categories:n,selectedIds:r,onSelect:s,onRemove:i,onCreate:o,onDeleteCategory:a,colorClass:l,placeholder:c="Añadir..."}){const[d,h]=V.useState(""),[m,p]=V.useState(!1),g=V.useRef(null),b=V.useMemo(()=>n.filter(k=>k.type===e||!k.type&&e==="genre"),[n,e]),E=V.useMemo(()=>d.trim()?b.filter(k=>k.name.toLowerCase().includes(d.toLowerCase())):b,[b,d]);V.useEffect(()=>{const k=T=>{g.current&&!g.current.contains(T.target)&&p(!1)};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[]);const y=k=>{k.key==="Enter"&&(k.preventDefault(),v())},v=()=>{if(!d.trim())return;const k=b.find(T=>T.name.toLowerCase()===d.trim().toLowerCase());k?r.includes(k.id)||s(k.id):o(d.trim()),h(""),p(!1)},_=(k,T)=>{k.stopPropagation(),he("¿Eliminar esta categoría permanentemente?",{description:"Esta acción no se puede deshacer.",action:{label:"Eliminar",onClick:()=>a(T)},cancel:{label:"Cancelar",onClick:()=>{}},duration:5e3})},D=l.includes("blue")?{bg:"bg-blue-500/20",text:"text-blue-300",border:"border-blue-500/30"}:l.includes("green")?{bg:"bg-green-500/20",text:"text-green-300",border:"border-green-500/30"}:l.includes("purple")?{bg:"bg-purple-500/20",text:"text-purple-300",border:"border-purple-500/30"}:l.includes("pink")?{bg:"bg-pink-500/20",text:"text-pink-300",border:"border-pink-500/30"}:{bg:"bg-gray-500/20",text:"text-gray-300",border:"border-gray-500/30"};return u.jsxs("div",{className:"space-y-3 mb-6",ref:g,children:[u.jsx("label",{className:`text-xs uppercase font-bold tracking-wider ${l}`,children:t}),u.jsxs("div",{className:"relative",children:[u.jsxs("div",{className:"flex gap-2",children:[u.jsxs("div",{className:"relative flex-1",children:[u.jsx("input",{type:"text",value:d,onChange:k=>{h(k.target.value),p(!0)},onFocus:()=>p(!0),onKeyDown:y,placeholder:c,className:"w-full bg-[#1a1a1a] border border-gray-600/50 rounded-lg px-4 py-2 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-[#bb86fc] transition-all"}),d&&u.jsx("button",{onClick:()=>h(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-500 hover:text-white",children:u.jsx(mt,{className:"w-3 h-3"})})]}),u.jsx("button",{onClick:v,disabled:!d.trim(),className:"bg-[#bb86fc]/20 hover:bg-[#bb86fc]/30 text-[#bb86fc] px-3 rounded-lg transition-all",children:u.jsx(as,{className:"w-5 h-5"})})]}),m&&(E.length>0||d)&&u.jsx("div",{className:"absolute top-full left-0 right-0 mt-1 bg-[#1a1a1a] border border-gray-700/50 rounded-lg shadow-xl z-50 max-h-60 overflow-y-auto w-full custom-scrollbar",children:E.length>0?E.map(k=>{const T=r.includes(k.id);return u.jsxs("div",{className:"flex items-center justify-between px-4 py-2 hover:bg-white/5 cursor-pointer group",onClick:()=>{T||(s(k.id),h(""),p(!1))},children:[u.jsx("span",{className:`text-sm ${T?"text-[#bb86fc]":"text-gray-300"}`,children:k.name}),u.jsxs("div",{className:"flex items-center gap-2",children:[T&&u.jsx(Rf,{className:"w-4 h-4 text-[#bb86fc]"}),u.jsx("button",{onClick:w=>_(w,k.id),className:"opacity-0 group-hover:opacity-100 p-1 hover:bg-red-500/20 text-gray-500 hover:text-red-400 rounded transition-all",title:"Eliminar permanentemente",children:u.jsx(pn,{className:"w-3.5 h-3.5"})})]})]},k.id)}):u.jsxs("div",{className:"px-4 py-3 text-center",children:[u.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"No encontrado."}),u.jsxs("button",{onClick:v,className:"text-xs text-[#bb86fc] hover:underline font-semibold",children:['Crear "',d,'"']})]})})]}),u.jsx("div",{className:"flex gap-2 flex-wrap",children:r.map(k=>{const T=n.find(w=>w.id===k);return!T||T.type!==e&&!(e==="genre"&&!T.type)?null:u.jsxs("span",{className:`px-3 py-1 ${D.bg} ${D.text} text-xs rounded-full border ${D.border} flex items-center gap-2`,children:[T.name,u.jsx("button",{onClick:()=>i(k),className:"hover:text-white",children:u.jsx(mt,{className:"w-3 h-3"})})]},k)})})]})}function GW({label:t,authors:e,value:n,onChange:r,onDelete:s,placeholder:i="Añadir autor...",colorClass:o="text-gray-400"}){const[a,l]=V.useState(""),[c,d]=V.useState(!1),h=V.useRef(null),m=V.useMemo(()=>a.trim()?e.filter(v=>v.toLowerCase().includes(a.toLowerCase())):e,[e,a]);V.useEffect(()=>{const v=_=>{h.current&&!h.current.contains(_.target)&&d(!1)};return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[]);const p=v=>{v.key==="Enter"&&(v.preventDefault(),g())},g=()=>{const v=a.trim();v&&(n.includes(v)||r([...n,v]),l(""),d(!1))},b=v=>{const _=v.trim();_&&!n.includes(_)&&r([...n,_]),l(""),d(!1)},E=v=>{r(n.filter(_=>_!==v))},y=(v,_)=>{v.stopPropagation(),v.preventDefault(),s&&s(_)};return u.jsxs("div",{className:"space-y-3 mb-6",ref:h,children:[u.jsx("label",{className:`text-xs uppercase font-bold tracking-wider ${o}`,children:t}),u.jsxs("div",{className:"relative",children:[u.jsxs("div",{className:"flex gap-2",children:[u.jsxs("div",{className:"relative flex-1",children:[u.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:u.jsx(Xk,{className:"h-4 w-4 text-gray-500"})}),u.jsx("input",{type:"text",value:a,onChange:v=>{l(v.target.value),d(!0)},onFocus:()=>d(!0),onKeyDown:p,placeholder:i,className:"w-full bg-[#1a1a1a] border border-gray-600/50 rounded-lg pl-10 pr-10 py-2.5 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-[#bb86fc] transition-all"}),a&&u.jsx("button",{onClick:()=>l(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-500 hover:text-white",children:u.jsx(mt,{className:"w-3.5 h-3.5"})})]}),u.jsx("button",{onClick:g,disabled:!a.trim(),className:"bg-[#bb86fc]/20 hover:bg-[#bb86fc]/30 text-[#bb86fc] px-4 rounded-lg flex items-center justify-center transition-all disabled:opacity-50 disabled:cursor-not-allowed",children:u.jsx(as,{className:"w-5 h-5"})})]}),c&&(m.length>0||a)&&u.jsx("div",{className:"absolute top-full left-0 right-0 mt-1 bg-[#1a1a1a] border border-gray-700/50 rounded-lg shadow-xl z-50 max-h-60 overflow-y-auto w-full custom-scrollbar",children:m.length>0?m.map((v,_)=>{const P=n.includes(v);return u.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5 hover:bg-white/5 cursor-pointer group",onMouseDown:D=>{D.preventDefault(),b(v)},children:[u.jsx("span",{className:`text-sm ${P?"text-[#bb86fc]":"text-gray-300"}`,children:v}),u.jsxs("div",{className:"flex items-center gap-2",children:[P&&u.jsx(Rf,{className:"w-4 h-4 text-[#bb86fc]"}),s&&u.jsx("button",{onMouseDown:D=>y(D,v),className:"opacity-0 group-hover:opacity-100 p-1 hover:bg-red-500/20 text-gray-500 hover:text-red-400 rounded transition-all",title:"Eliminar autor de todos los mangas",children:u.jsx(pn,{className:"w-3.5 h-3.5"})})]})]},_)}):u.jsxs("div",{className:"px-4 py-3 text-center",children:[u.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"No encontrado."}),u.jsxs("button",{onMouseDown:v=>{v.preventDefault(),g()},className:"text-xs text-[#bb86fc] hover:underline font-semibold",children:['Añadir "',a,'"']})]})})]}),u.jsx("div",{className:"flex gap-2 flex-wrap mt-3",children:n.map((v,_)=>u.jsxs("span",{className:"px-3 py-1 bg-[#2a2a2a] text-[#bb86fc] text-xs rounded-full border border-gray-600/50 flex items-center gap-2",children:[v,u.jsx("button",{onClick:()=>E(v),className:"hover:text-white",children:u.jsx(mt,{className:"w-3 h-3"})})]},_))}),u.jsx("p",{className:"text-[10px] text-gray-500 mt-2",children:n.length>0?`Autores seleccionados: ${n.join(", ")}`:"Deja en blanco para no modificar el autor."})]})}function qW({isOpen:t,onClose:e,selectedMangaIds:n,onSaveComplete:r}){const[s,i]=V.useState([]),[o,a]=V.useState([]),[l,c]=V.useState([]),[d,h]=V.useState([]),[m,p]=V.useState(!1),[g,b]=V.useState(!1),[E,y]=V.useState(!1),[v,_]=V.useState(!1),[P,D]=V.useState(!1);V.useEffect(()=>{t&&(k(),a([]),h([]),p(!1),b(!1),y(!1))},[t]);const k=async()=>{try{D(!0);const A=await wB();i(A);const z=await IB();c(z)}catch(A){console.error("Error loading categories:",A)}finally{D(!1)}},T=async(A,z)=>{if(A.trim()){if(z==="tag"){const B=A.split(" ").map(q=>q.trim()).filter(q=>q.length>0);for(const q of B)await w(q,z);return}await w(A,z)}},w=async(A,z)=>{try{const B=s.find(q=>q.name.toLowerCase()===A.trim().toLowerCase()&&q.type===z);if(B)a(q=>q.includes(B.id)?q:[...q,B.id]);else{const q=await bB(A.trim(),z);i(X=>X.find(O=>O.id===q.id)?X:[...X,q]),a(X=>X.includes(q.id)?X:[...X,q.id])}}catch(B){console.error("Error creating category:",B)}},C=A=>{a(z=>z.filter(B=>B!==A))},I=async A=>{try{await _B(A),i(z=>z.filter(B=>B.id!==A)),a(z=>z.filter(B=>B!==A))}catch(z){console.error("Error deleting category:",z),he.error("Error al eliminar la categoría")}},N=A=>{he(`¿Eliminar al autor "${A}" permanentemente?`,{description:"Se eliminará este autor de TODOS los mangas. Esta acción no se puede deshacer.",action:{label:"Eliminar",onClick:async()=>{try{D(!0),await CB(A),he.success(`Autor "${A}" eliminado correctamente.`),c(z=>z.filter(B=>B!==A)),d.includes(A)&&h(z=>z.filter(B=>B!==A))}catch(z){console.error("Error deleting author:",z),he.error("Error al eliminar el autor.")}finally{D(!1)}}},cancel:{label:"Cancelar",onClick:()=>{}},duration:5e3})},j=async()=>{if(o.length===0&&d.length===0&&!m&&!g&&!E){he.error("Selecciona al menos una categoría, autor o clasificación para aplicar.");return}_(!0);try{const A=n.map(async z=>{var B;try{const q=await zo(z);if(!q)return;const X=((B=q.categories)==null?void 0:B.map(R=>R.id))||[],O=Array.from(new Set([...X,...o])),H={title:q.title,author:q.author,categoryIds:O};d.length>0&&(H.author=d.join(", ")),m&&(H.is_decensored=!0),g&&(H.is_bn=!0,H.is_color=!1),E&&(H.is_color=!0,H.is_bn=!1),await ru(z,H)}catch(q){console.error(`Error updating manga ${z}`,q)}});await Promise.all(A),he.success("Categorías aplicadas correctamente."),r(),e()}catch(A){console.error("Error bulk updating mangas:",A),he.error("Error al aplicar cambios.")}finally{_(!1)}};return t?u.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50 p-4 animate-in fade-in duration-200",children:u.jsxs("div",{className:"bg-[#121212] rounded-2xl border border-gray-800 w-full max-w-2xl shadow-2xl overflow-hidden flex flex-col max-h-[90vh]",children:[u.jsxs("div",{className:"bg-[#1a1a1a] border-b border-gray-800 px-6 py-4 flex items-center justify-between sticky top-0 z-10",children:[u.jsxs("h2",{className:"text-xl font-bold text-white",children:["Aplicar Categorías a ",n.length," Mangas"]}),u.jsx("button",{onClick:e,className:"text-gray-400 hover:text-white transition-colors p-2 hover:bg-white/5 rounded-lg",children:u.jsx(mt,{className:"w-5 h-5"})})]}),u.jsx("div",{className:"p-6 overflow-y-auto custom-scrollbar flex-1",children:P?u.jsx("div",{className:"flex justify-center p-8",children:u.jsx(Bo,{size:32})}):u.jsxs("div",{className:"space-y-6",children:[u.jsx("div",{className:"bg-[#1f1f1f] p-4 rounded-xl border border-gray-800",children:u.jsx(GW,{label:"Autor",authors:l,value:d,onChange:h,onDelete:N,placeholder:"Seleccionar o escribir autor..."})}),u.jsxs("div",{className:"bg-[#1f1f1f] p-4 rounded-xl border border-gray-800 space-y-4",children:[u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsxs("div",{children:[u.jsx("h4",{className:"text-sm font-semibold text-white",children:"Sin censura"}),u.jsx("p",{className:"text-xs text-gray-400",children:"Marcar todos como sin censura"})]}),u.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[u.jsx("input",{type:"checkbox",className:"sr-only peer",checked:m,onChange:A=>p(A.target.checked)}),u.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-[#bb86fc]"})]})]}),u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsxs("div",{children:[u.jsx("h4",{className:"text-sm font-semibold text-white",children:"B/N"}),u.jsx("p",{className:"text-xs text-gray-400",children:"Marcar todos como Blanco y Negro"})]}),u.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[u.jsx("input",{type:"checkbox",className:"sr-only peer",checked:g,onChange:A=>{b(A.target.checked),A.target.checked&&y(!1)}}),u.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-[#bb86fc]"})]})]}),u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsxs("div",{children:[u.jsx("h4",{className:"text-sm font-semibold text-white",children:"a color"}),u.jsx("p",{className:"text-xs text-gray-400",children:"Marcar todos como a color"})]}),u.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[u.jsx("input",{type:"checkbox",className:"sr-only peer",checked:E,onChange:A=>{y(A.target.checked),A.target.checked&&b(!1)}}),u.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-[#bb86fc]"})]})]})]}),u.jsx(kd,{label:"Personajes",type:"character",categories:s,selectedIds:o,onSelect:A=>{o.includes(A)||a(z=>[...z,A])},onRemove:C,onCreate:A=>T(A,"character"),onDeleteCategory:I,colorClass:"text-blue-400",placeholder:"Añadir personaje..."}),u.jsx(kd,{label:"Series",type:"series",categories:s,selectedIds:o,onSelect:A=>{o.includes(A)||a(z=>[...z,A])},onRemove:C,onCreate:A=>T(A,"series"),onDeleteCategory:I,colorClass:"text-green-400",placeholder:"Añadir serie..."}),u.jsx(kd,{label:"Géneros",type:"genre",categories:s,selectedIds:o,onSelect:A=>{o.includes(A)||a(z=>[...z,A])},onRemove:C,onCreate:A=>T(A,"genre"),onDeleteCategory:I,colorClass:"text-purple-400",placeholder:"Añadir género..."}),u.jsx(kd,{label:"Etiquetas",type:"tag",categories:s,selectedIds:o,onSelect:A=>{o.includes(A)||a(z=>[...z,A])},onRemove:C,onCreate:A=>T(A,"tag"),onDeleteCategory:I,colorClass:"text-pink-400",placeholder:"Añadir etiqueta..."})]})}),u.jsxs("div",{className:"p-6 border-t border-gray-800 flex justify-end gap-3 bg-[#1a1a1a]",children:[u.jsx("button",{onClick:e,className:"px-4 py-2 rounded-lg text-sm font-semibold text-gray-300 hover:text-white transition-colors",children:"Cancelar"}),u.jsx("button",{onClick:j,disabled:v||o.length===0&&d.length===0&&!m&&!g&&!E,className:"bg-[#bb86fc] hover:bg-[#9966dd] text-white px-6 py-2 rounded-lg font-semibold text-sm transition-all shadow-lg shadow-[#bb86fc]/20 flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",children:v?u.jsxs(u.Fragment,{children:[u.jsx(Bo,{size:16}),"Guardando..."]}):u.jsxs(u.Fragment,{children:[u.jsx(sl,{className:"w-4 h-4"}),"Aplicar Cambios"]})})]})]})}):null}function WW({isOpen:t,onClose:e,selectedMangaIds:n,onSaveComplete:r}){const[s,i]=V.useState([]),[o,a]=V.useState([]),[l,c]=V.useState([]),[d,h]=V.useState([]),[m,p]=V.useState(!1),[g,b]=V.useState(!1);V.useEffect(()=>{t&&(E(),c([]),h([]))},[t]);const E=async()=>{try{b(!0);const k=(await Promise.all(n.map(C=>zo(C).catch(()=>null)))).filter(Boolean),T=new Map,w=new Set;k.forEach(C=>{C.author&&w.add(C.author),C.categories&&C.categories.forEach(I=>T.set(I.id,I))}),i(Array.from(T.values())),a(Array.from(w))}catch(D){console.error("Error loading mangas data:",D),he.error("Error al cargar datos de los mangas")}finally{b(!1)}},y=D=>{c(k=>k.includes(D)?k.filter(T=>T!==D):[...k,D])},v=D=>{h(k=>k.includes(D)?k.filter(T=>T!==D):[...k,D])},_=async()=>{if(l.length===0&&d.length===0){he.error("Selecciona al menos una categoría o autor para eliminar.");return}p(!0);try{const D=n.map(async k=>{try{const T=await zo(k);if(!T)return;let w=!1;const C={title:T.title,author:T.author};if(d.includes(T.author)&&(C.author="Desconocido",w=!0),T.categories&&T.categories.length>0){const I=T.categories.map(j=>j.id),N=I.filter(j=>!l.includes(j));N.length!==I.length?(C.categoryIds=N,w=!0):C.categoryIds=I}else C.categoryIds=[];w&&await ru(k,C)}catch(T){console.error(`Error updating manga ${k}`,T)}});await Promise.all(D),he.success("Categorías eliminadas de los mangas correctamente."),r(),e()}catch(D){console.error("Error bulk updating mangas:",D),he.error("Error al aplicar cambios.")}finally{p(!1)}};if(!t)return null;const P=(D,k,T)=>{const w=s.filter(C=>C.type===D);return w.length===0?null:u.jsxs("div",{className:"bg-[#1f1f1f] p-4 rounded-xl border border-gray-800 space-y-3",children:[u.jsx("span",{className:"text-xs font-bold text-gray-400 uppercase tracking-wider",children:k}),u.jsx("div",{className:"flex flex-wrap gap-2",children:w.map(C=>{const I=l.includes(C.id);return u.jsxs("button",{onClick:()=>y(C.id),className:`px-3 py-1.5 rounded-full text-sm font-medium flex items-center gap-2 border transition-all ${I?"bg-red-500/20 text-red-500 border-red-500/50 hover:bg-red-500/30":`bg-[#1a1a1a] ${T} border-gray-700 hover:border-gray-500`}`,children:[C.name,I&&u.jsx(pn,{className:"w-3.5 h-3.5"})]},C.id)})})]})};return u.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50 p-4 animate-in fade-in duration-200",children:u.jsxs("div",{className:"bg-[#121212] rounded-2xl border border-gray-800 w-full max-w-2xl shadow-2xl overflow-hidden flex flex-col max-h-[90vh]",children:[u.jsxs("div",{className:"bg-[#1a1a1a] border-b border-gray-800 px-6 py-4 flex items-center justify-between sticky top-0 z-10",children:[u.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[u.jsx(pn,{className:"w-5 h-5 text-red-500"}),"Remover Categorías en ",n.length," Mangas"]}),u.jsx("button",{onClick:e,className:"text-gray-400 hover:text-white transition-colors p-2 hover:bg-white/5 rounded-lg",children:u.jsx(mt,{className:"w-5 h-5"})})]}),u.jsx("div",{className:"p-6 overflow-y-auto custom-scrollbar flex-1",children:g?u.jsxs("div",{className:"flex flex-col items-center justify-center py-12 gap-4",children:[u.jsx(Bo,{size:32}),u.jsx("p",{className:"text-gray-400 text-sm",children:"Escaneando mangas seleccionados..."})]}):s.length===0&&o.length===0?u.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[u.jsx(pn,{className:"w-12 h-12 text-gray-600 mb-3"}),u.jsx("h3",{className:"text-lg font-semibold text-white",children:"Sin categorías"}),u.jsx("p",{className:"text-gray-400 text-sm max-w-sm mt-1",children:"Los mangas seleccionados no tienen autores ni categorías para remover."})]}):u.jsxs("div",{className:"space-y-6",children:[u.jsxs("p",{className:"text-sm text-gray-400",children:["Selecciona los autores y categorías que deseas ",u.jsx("b",{className:"text-red-400",children:"eliminar"})," de los mangas seleccionados."]}),o.length>0&&u.jsxs("div",{className:"bg-[#1f1f1f] p-4 rounded-xl border border-gray-800 space-y-3",children:[u.jsx("span",{className:"text-xs font-bold text-gray-400 uppercase tracking-wider",children:"Autor"}),u.jsx("div",{className:"flex flex-wrap gap-2",children:o.map(D=>{const k=d.includes(D);return u.jsxs("button",{onClick:()=>v(D),className:`px-3 py-1.5 rounded-full text-sm font-medium flex items-center gap-2 border transition-all ${k?"bg-red-500/20 text-red-500 border-red-500/50 hover:bg-red-500/30":"bg-[#1a1a1a] text-purple-400 border-gray-700 hover:border-gray-500"}`,children:[D,k&&u.jsx(pn,{className:"w-3.5 h-3.5"})]},D)})}),u.jsx("p",{className:"text-xs text-red-500/80 mt-2",children:'* Remover al autor lo dejará como "Desconocido".'})]}),P("character","Personajes","text-blue-400"),P("series","Series","text-green-400"),P("genre","Géneros","text-purple-400"),P("tag","Etiquetas","text-pink-400")]})}),u.jsxs("div",{className:"p-6 border-t border-gray-800 flex justify-end gap-3 bg-[#1a1a1a]",children:[u.jsx("button",{onClick:e,className:"px-4 py-2 rounded-lg text-sm font-semibold text-gray-300 hover:text-white transition-colors",children:"Cancelar"}),u.jsx("button",{onClick:_,disabled:m||l.length===0&&d.length===0,className:"bg-red-600 hover:bg-red-700 text-white px-6 py-2 rounded-lg font-semibold text-sm transition-all shadow-lg shadow-red-600/20 flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",children:m?u.jsxs(u.Fragment,{children:[u.jsx(Bo,{size:16}),"Eliminando..."]}):u.jsxs(u.Fragment,{children:[u.jsx(pn,{className:"w-4 h-4"}),"Remover Selección"]})})]})]})})}const EE=["series","character","genre","tag","other"],KW={series:"Series",character:"Personajes",genre:"Géneros",tag:"Etiquetas",other:"Otros"};function YW({isOpen:t,onClose:e,categories:n,selectedCategories:r,onToggleCategory:s,onClearFilters:i,filterDecensored:o,setFilterDecensored:a,filterBN:l,setFilterBN:c,filterColor:d,setFilterColor:h}){const[m,p]=V.useState(""),g=V.useMemo(()=>{const b=n.filter(y=>y.name.toLowerCase().includes(m.toLowerCase())),E={};return EE.forEach(y=>{E[y]=[]}),E.other=[],b.forEach(y=>{const v=y.type||"other";E[v]||(E[v]=[]),E[v].push(y)}),E},[n,m]);return t?u.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/80 backdrop-blur-sm animate-in fade-in duration-200",children:u.jsxs("div",{className:"bg-[#1a1a1a] w-full max-w-4xl max-h-[85vh] rounded-2xl border border-gray-800 shadow-2xl flex flex-col overflow-hidden animate-in zoom-in-95 duration-200",onClick:b=>b.stopPropagation(),children:[u.jsxs("div",{className:"p-4 sm:p-6 border-b border-gray-800 flex items-center justify-between bg-[#1a1a1a]",children:[u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx("div",{className:"bg-purple-500/20 p-2 rounded-lg",children:u.jsx(bD,{className:"w-5 h-5 text-purple-400"})}),u.jsxs("div",{children:[u.jsx("h2",{className:"text-xl font-bold text-white",children:"Filtrar por Categorías"}),u.jsx("p",{className:"text-sm text-gray-400",children:"Selecciona múltiples opciones para refinar tu búsqueda"})]})]}),u.jsx("button",{onClick:e,className:"text-gray-400 hover:text-white hover:bg-gray-800 p-2 rounded-lg transition-all",children:u.jsx(mt,{className:"w-5 h-5"})})]}),u.jsx("div",{className:"p-4 border-b border-gray-800 bg-[#151515]",children:u.jsxs("div",{className:"relative",children:[u.jsx(il,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400"}),u.jsx("input",{type:"text",placeholder:"Buscar categorías...",value:m,onChange:b=>p(b.target.value),className:"w-full bg-[#0f0f0f] border border-gray-700/50 rounded-lg pl-10 pr-4 py-2.5 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-purple-500/50 focus:ring-1 focus:ring-purple-500/50 transition-all"})]})}),u.jsxs("div",{className:"flex-1 overflow-y-auto p-4 sm:p-6 space-y-8 custom-scrollbar",children:[u.jsxs("div",{className:"animate-in slide-in-from-bottom-2 duration-300",children:[u.jsxs("h3",{className:"text-sm font-bold text-purple-400 uppercase tracking-wider mb-3 flex items-center gap-2",children:[u.jsx("span",{className:"w-1 h-4 bg-purple-500 rounded-full"}),"Propiedades Especiales"]}),u.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3 mb-8",children:[u.jsxs("button",{onClick:()=>a(!o),className:`relative group flex flex-col p-3 rounded-lg text-left transition-all duration-200 border ${o?"bg-purple-500/20 border-purple-500/50 shadow-[0_0_15px_-3px_rgba(168,85,247,0.3)]":"bg-[#252525] border-transparent hover:bg-[#2a2a2a] hover:border-gray-700"}`,children:[u.jsxs("div",{className:"flex items-center justify-between w-full mb-1",children:[u.jsx("span",{className:"font-bold text-white text-sm",children:"Sin censura"}),u.jsx("div",{className:`w-8 h-4 rounded-full transition-colors ${o?"bg-purple-500":"bg-gray-600"} relative`,children:u.jsx("div",{className:`absolute top-0.5 left-0.5 w-3 h-3 rounded-full bg-white transition-transform duration-200 ${o?"translate-x-4":"translate-x-0"}`})})]}),u.jsx("span",{className:"text-xs text-gray-400",children:"Mostrar solo contenido sin censura"})]}),u.jsxs("button",{onClick:()=>c(!l),className:`relative group flex flex-col p-3 rounded-lg text-left transition-all duration-200 border ${l?"bg-purple-500/20 border-purple-500/50 shadow-[0_0_15px_-3px_rgba(168,85,247,0.3)]":"bg-[#252525] border-transparent hover:bg-[#2a2a2a] hover:border-gray-700"}`,children:[u.jsxs("div",{className:"flex items-center justify-between w-full mb-1",children:[u.jsx("span",{className:"font-bold text-white text-sm",children:"B/N"}),u.jsx("div",{className:`w-8 h-4 rounded-full transition-colors ${l?"bg-purple-500":"bg-gray-600"} relative`,children:u.jsx("div",{className:`absolute top-0.5 left-0.5 w-3 h-3 rounded-full bg-white transition-transform duration-200 ${l?"translate-x-4":"translate-x-0"}`})})]}),u.jsx("span",{className:"text-xs text-gray-400",children:"Mostrar solo Blanco y Negro"})]}),u.jsxs("button",{onClick:()=>h(!d),className:`relative group flex flex-col p-3 rounded-lg text-left transition-all duration-200 border ${d?"bg-purple-500/20 border-purple-500/50 shadow-[0_0_15px_-3px_rgba(168,85,247,0.3)]":"bg-[#252525] border-transparent hover:bg-[#2a2a2a] hover:border-gray-700"}`,children:[u.jsxs("div",{className:"flex items-center justify-between w-full mb-1",children:[u.jsx("span",{className:"font-bold text-white text-sm",children:"A color"}),u.jsx("div",{className:`w-8 h-4 rounded-full transition-colors ${d?"bg-purple-500":"bg-gray-600"} relative`,children:u.jsx("div",{className:`absolute top-0.5 left-0.5 w-3 h-3 rounded-full bg-white transition-transform duration-200 ${d?"translate-x-4":"translate-x-0"}`})})]}),u.jsx("span",{className:"text-xs text-gray-400",children:"Mostrar solo contenido a color"})]})]})]}),EE.map(b=>{const E=g[b];return!E||E.length===0?null:u.jsxs("div",{className:"animate-in slide-in-from-bottom-2 duration-300",children:[u.jsxs("h3",{className:"text-sm font-bold text-purple-400 uppercase tracking-wider mb-3 flex items-center gap-2",children:[u.jsx("span",{className:"w-1 h-4 bg-purple-500 rounded-full"}),KW[b]||b]}),u.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-2",children:E.sort((y,v)=>y.name.localeCompare(v.name)).map(y=>{const v=r.includes(y.name);return u.jsxs("button",{onClick:()=>s(y.name),className:` + relative group flex items-center justify-between px-3 py-2 rounded-lg text-sm text-left transition-all duration-200 border + ${v?"bg-purple-500/20 border-purple-500/50 text-purple-100 shadow-[0_0_15px_-3px_rgba(168,85,247,0.3)]":"bg-[#252525] border-transparent text-gray-300 hover:bg-[#2a2a2a] hover:border-gray-700"} + `,children:[u.jsx("span",{className:"truncate mr-2 font-medium",children:y.name}),v&&u.jsx("div",{className:"bg-purple-500 rounded-full p-0.5 animate-in zoom-in duration-200",children:u.jsx(Rf,{className:"w-3 h-3 text-white"})})]},y.id)})})]},b)})]}),u.jsxs("div",{className:"p-4 border-t border-gray-800 bg-[#1a1a1a] flex items-center justify-between",children:[u.jsxs("div",{className:"text-sm text-gray-400",children:[r.length+(o?1:0)+(l?1:0)+(d?1:0)," filtros activos"]}),u.jsxs("div",{className:"flex items-center gap-3",children:[(r.length>0||o||l||d)&&u.jsx("button",{onClick:i,className:"px-4 py-2 text-sm text-gray-400 hover:text-white transition-colors",children:"Limpiar todo"}),u.jsx("button",{onClick:e,className:"px-6 py-2 bg-purple-600 hover:bg-purple-700 text-white rounded-lg text-sm font-semibold shadow-lg shadow-purple-900/20 transition-all hover:scale-105 active:scale-95",children:"Listo"})]})]})]})}):null}function QW({isOpen:t,onClose:e,mangas:n,onSaveComplete:r}){const[s,i]=V.useState(""),[o,a]=V.useState({}),[l,c]=V.useState(!1);V.useEffect(()=>{t&&(i(""),a({}))},[t]);const d=V.useMemo(()=>{let p=[...n];if(s){const g=s.toLowerCase();p=p.filter(b=>b.title.toLowerCase().includes(g))}return p.sort((g,b)=>g.title.localeCompare(b.title))},[n,s]),h=(p,g)=>{a(b=>({...b,[p]:g}))},m=async()=>{const p=Object.entries(o).filter(([g,b])=>{const E=n.find(y=>y.id===g);return E&&E.title!==b.trim()&&b.trim()!==""});if(p.length===0){he.info("No hay cambios para guardar");return}try{c(!0);const g=p.map(([b,E])=>({id:b,title:E.trim()}));await mv(g),he.success(`Se actualizaron ${g.length} nombres correctamente`),r(),e()}catch(g){console.error("Error saving titles:",g),he.error("Error al guardar los cambios")}finally{c(!1)}};return t?u.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-[60] p-4 animate-in fade-in duration-200",children:u.jsxs("div",{className:"bg-[#121212] rounded-2xl border border-gray-800 w-full max-w-2xl shadow-2xl overflow-hidden flex flex-col max-h-[85vh]",children:[u.jsxs("div",{className:"bg-[#1a1a1a] border-b border-gray-800 px-6 py-4 flex items-center justify-between sticky top-0 z-10 flex-shrink-0",children:[u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx("div",{className:"p-2 bg-blue-500/10 rounded-lg text-blue-400",children:u.jsx(jf,{className:"w-5 h-5"})}),u.jsxs("div",{children:[u.jsx("h2",{className:"text-xl font-bold text-white",children:"Gestor de Nombres"}),u.jsx("p",{className:"text-xs text-gray-400",children:"Edita los títulos de los mangas masivamente"})]})]}),u.jsx("button",{onClick:e,className:"text-gray-400 hover:text-white transition-colors p-2 hover:bg-white/5 rounded-lg",children:u.jsx(mt,{className:"w-5 h-5"})})]}),u.jsx("div",{className:"p-4 border-b border-gray-800 bg-[#121212] flex-shrink-0",children:u.jsxs("div",{className:"relative",children:[u.jsx(il,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400"}),u.jsx("input",{type:"text",value:s,onChange:p=>i(p.target.value),placeholder:"Buscar manga por título...",className:"w-full bg-[#1a1a1a] border border-gray-700 rounded-xl pl-10 pr-4 py-3 text-sm text-white focus:outline-none focus:border-blue-500 transition-colors"})]})}),u.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-2 custom-scrollbar",children:[d.map(p=>{const g=p.cover_url||p.thumbnail_url,b=g?ui(g):void 0;return u.jsxs("div",{className:"flex items-center gap-3 bg-[#1a1a1a] p-3 rounded-lg border border-gray-800/50 hover:border-gray-700 transition-colors",children:[b?u.jsx("img",{src:b,alt:"",className:"w-10 h-10 rounded object-cover"}):u.jsx("div",{className:"w-10 h-10 rounded bg-gray-800 flex items-center justify-center",children:u.jsx("span",{className:"text-xs text-gray-500 text-center",children:"Sin img"})}),u.jsx("div",{className:"flex-1",children:u.jsx("input",{type:"text",value:o[p.id]!==void 0?o[p.id]:p.title,onChange:E=>h(p.id,E.target.value),className:`w-full bg-transparent border-b pl-2 py-1 text-sm focus:outline-none transition-colors ${o[p.id]!==void 0&&o[p.id].trim()!==p.title?"border-blue-500 text-blue-300":"border-transparent hover:border-gray-700 text-white focus:border-gray-600"}`,placeholder:"Título del manga"})})]},p.id)}),d.length===0&&u.jsx("div",{className:"text-center py-8 text-gray-500",children:"No se encontraron mangas con ese nombre"})]}),u.jsxs("div",{className:"bg-[#1a1a1a] border-t border-gray-800 px-6 py-4 flex justify-between items-center sticky bottom-0 flex-shrink-0",children:[u.jsxs("span",{className:"text-sm text-gray-400",children:[Object.keys(o).filter(p=>{var g;return o[p].trim()!==((g=n.find(b=>b.id===p))==null?void 0:g.title)}).length," cambios pendientes"]}),u.jsxs("div",{className:"flex gap-3",children:[u.jsx("button",{onClick:e,className:"px-4 py-2 text-sm font-semibold text-gray-300 hover:text-white transition-colors",disabled:l,children:"Cancelar"}),u.jsx("button",{onClick:m,disabled:l,className:"bg-blue-600 hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed text-white px-6 py-2 rounded-lg text-sm font-bold shadow-lg shadow-blue-500/20 transition-all flex items-center gap-2",children:l?u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):u.jsxs(u.Fragment,{children:[u.jsx(sl,{className:"w-4 h-4"}),"Guardar Cambios"]})})]})]})]})}):null}function XW({isOpen:t,onClose:e,mangas:n,selectedMangaIds:r,onSaveComplete:s}){const[i,o]=V.useState(""),[a,l]=V.useState(""),[c,d]=V.useState({}),[h,m]=V.useState(!1);V.useEffect(()=>{t&&(o(""),l(""),d({}))},[t]);const p=()=>{if(!a.trim())return;const y={...c};n.filter(v=>r.includes(v.id)).forEach(v=>{y[v.id]=a}),d(y),he.success(`Nombre aplicado a ${r.length} mangas localmente`)},g=V.useMemo(()=>{let y=n.filter(v=>r.includes(v.id));if(i){const v=i.toLowerCase();y=y.filter(_=>_.title.toLowerCase().includes(v))}return y.sort((v,_)=>v.title.localeCompare(_.title))},[n,r,i]),b=(y,v)=>{d(_=>({..._,[y]:v}))},E=async()=>{const y=Object.entries(c).filter(([v,_])=>{const P=n.find(D=>D.id===v);return P&&P.title!==_.trim()&&_.trim()!==""});if(y.length===0){he.info("No hay cambios para guardar");return}try{m(!0);const v=y.map(([_,P])=>({id:_,title:P.trim()}));await mv(v),he.success(`Se actualizaron ${v.length} nombres correctamente`),s(),e()}catch(v){console.error("Error saving titles:",v),he.error("Error al guardar los cambios")}finally{m(!1)}};return t?u.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-[60] p-4 animate-in fade-in duration-200",children:u.jsxs("div",{className:"bg-[#121212] rounded-2xl border border-gray-800 w-full max-w-2xl shadow-2xl overflow-hidden flex flex-col max-h-[85vh]",children:[u.jsxs("div",{className:"bg-[#1a1a1a] border-b border-gray-800 px-6 py-4 flex items-center justify-between sticky top-0 z-10 flex-shrink-0",children:[u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx("div",{className:"p-2 bg-pink-500/10 rounded-lg text-pink-400",children:u.jsx(jf,{className:"w-5 h-5"})}),u.jsxs("div",{children:[u.jsx("h2",{className:"text-xl font-bold text-white",children:"Editar Nombres"}),u.jsxs("p",{className:"text-xs text-gray-400",children:["Edita los títulos de los ",r.length," mangas seleccionados"]})]})]}),u.jsx("button",{onClick:e,className:"text-gray-400 hover:text-white transition-colors p-2 hover:bg-white/5 rounded-lg",children:u.jsx(mt,{className:"w-5 h-5"})})]}),u.jsxs("div",{className:"p-4 border-b border-gray-800 bg-[#121212] flex-shrink-0 space-y-3",children:[u.jsxs("div",{className:"relative",children:[u.jsx(il,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400"}),u.jsx("input",{type:"text",value:i,onChange:y=>o(y.target.value),placeholder:"Filtrar manga por título...",className:"w-full bg-[#1a1a1a] border border-gray-700 rounded-xl pl-10 pr-4 py-3 text-sm text-white focus:outline-none focus:border-pink-500 transition-colors"})]}),u.jsxs("div",{className:"flex gap-2",children:[u.jsx("input",{type:"text",value:a,onChange:y=>l(y.target.value),placeholder:"Pon un nombre para aplicar a todos los seleccionados (Opcional)",className:"flex-1 bg-[#1a1a1a] border border-gray-700 rounded-xl px-4 py-3 text-sm text-white focus:outline-none focus:border-pink-500 transition-colors"}),u.jsx("button",{onClick:p,className:"bg-gray-800 hover:bg-gray-700 text-white px-6 py-3 rounded-xl text-sm font-medium transition-colors whitespace-nowrap",children:"Aplicar a todos"})]})]}),u.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-2 custom-scrollbar",children:[g.map(y=>{const v=y.cover_url||y.thumbnail_url,_=v?ui(v):void 0;return u.jsxs("div",{className:"flex items-center gap-3 bg-[#1a1a1a] p-3 rounded-lg border border-gray-800/50 hover:border-gray-700 transition-colors",children:[_?u.jsx("img",{src:_,alt:"",className:"w-10 h-10 rounded object-cover"}):u.jsx("div",{className:"w-10 h-10 rounded bg-gray-800 flex items-center justify-center",children:u.jsx("span",{className:"text-xs text-gray-500 text-center",children:"Sin img"})}),u.jsx("div",{className:"flex-1",children:u.jsx("input",{type:"text",value:c[y.id]!==void 0?c[y.id]:y.title,onChange:P=>b(y.id,P.target.value),className:`w-full bg-transparent border-b pl-2 py-1 text-sm focus:outline-none transition-colors ${c[y.id]!==void 0&&c[y.id].trim()!==y.title?"border-pink-500 text-pink-300":"border-transparent hover:border-gray-700 text-white focus:border-gray-600"}`,placeholder:"Título del manga"})})]},y.id)}),g.length===0&&u.jsx("div",{className:"text-center py-8 text-gray-500",children:"No se encontraron mangas con ese nombre en la selección"})]}),u.jsxs("div",{className:"bg-[#1a1a1a] border-t border-gray-800 px-6 py-4 flex justify-between items-center sticky bottom-0 flex-shrink-0",children:[u.jsxs("span",{className:"text-sm text-gray-400",children:[Object.keys(c).filter(y=>{var v;return c[y].trim()!==((v=n.find(_=>_.id===y))==null?void 0:v.title)}).length," cambios pendientes"]}),u.jsxs("div",{className:"flex gap-3",children:[u.jsx("button",{onClick:e,className:"px-4 py-2 text-sm font-semibold text-gray-300 hover:text-white transition-colors",disabled:h,children:"Cancelar"}),u.jsx("button",{onClick:E,disabled:h,className:"bg-pink-600 hover:bg-pink-700 disabled:opacity-50 disabled:cursor-not-allowed text-white px-6 py-2 rounded-lg text-sm font-bold shadow-lg shadow-pink-500/20 transition-all flex items-center gap-2",children:h?u.jsxs(u.Fragment,{children:[u.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):u.jsxs(u.Fragment,{children:[u.jsx(sl,{className:"w-4 h-4"}),"Guardar Cambios"]})})]})]})]})}):null}function JW({isOpen:t,onClose:e,selectedMangaIds:n,onSaveComplete:r}){const[s,i]=V.useState([]),[o,a]=V.useState(!1),[l,c]=V.useState(!1),[d,h]=V.useState(!1),[m,p]=V.useState(!1),[g,b]=V.useState(!1);V.useEffect(()=>{t&&(E(),h(!1),p(!1),b(!1))},[t,n]);const E=async()=>{a(!0);try{const k=await Promise.all(n.map(async T=>{const w=await zo(T);return w?{id:w.id,title:w.title,is_decensored:!!w.is_decensored,is_bn:!!w.is_bn,is_color:!!w.is_color,hasChanged:!1}:null}));i(k.filter(T=>T!==null))}catch(k){console.error("Error loading mangas:",k),he.error("Error al cargar la información de los mangas")}finally{a(!1)}},y=k=>{h(k),i(T=>T.map(w=>({...w,is_decensored:k,hasChanged:!0})))},v=k=>{p(k),k&&b(!1),i(T=>T.map(w=>({...w,is_bn:k,is_color:k?!1:w.is_color,hasChanged:!0})))},_=k=>{b(k),k&&p(!1),i(T=>T.map(w=>({...w,is_color:k,is_bn:k?!1:w.is_bn,hasChanged:!0})))},P=(k,T,w)=>{i(C=>C.map(I=>{if(I.id!==k)return I;const N={...I,[T]:w,hasChanged:!0};return T==="is_bn"&&w&&(N.is_color=!1),T==="is_color"&&w&&(N.is_bn=!1),N}))},D=async()=>{const k=s.filter(T=>T.hasChanged);if(k.length===0){he.info("No hay cambios para guardar"),e();return}c(!0);try{const T=k.map(w=>ru(w.id,{is_decensored:w.is_decensored,is_bn:w.is_bn,is_color:w.is_color}));await Promise.all(T),he.success(`Se actualizaron las etiquetas de ${k.length} mangas`),r(),e()}catch(T){console.error("Error updating mangas:",T),he.error("Ocurrió un error al guardar los cambios")}finally{c(!1)}};return t?u.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50 p-4 animate-in fade-in duration-200",children:u.jsxs("div",{className:"bg-[#121212] rounded-2xl border border-gray-800 w-full max-w-4xl shadow-2xl overflow-hidden flex flex-col max-h-[90vh]",children:[u.jsxs("div",{className:"bg-[#1a1a1a] border-b border-gray-800 px-6 py-4 flex items-center justify-between sticky top-0 z-10",children:[u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx("div",{className:"p-2 bg-[#bb86fc]/10 rounded-lg text-[#bb86fc]",children:u.jsx(Mg,{className:"w-5 h-5"})}),u.jsxs("h2",{className:"text-xl font-bold text-white",children:["Etiquetadora (",n.length," mangas)"]})]}),u.jsx("button",{onClick:e,className:"text-gray-400 hover:text-white transition-colors p-2 hover:bg-white/5 rounded-lg",children:u.jsx(mt,{className:"w-5 h-5"})})]}),u.jsx("div",{className:"p-6 overflow-y-auto custom-scrollbar flex-1 space-y-6",children:o?u.jsx("div",{className:"flex justify-center p-8",children:u.jsx(Bo,{size:32})}):u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"bg-[#1f1f1f] p-5 rounded-xl border border-gray-700 shadow-lg",children:[u.jsxs("h3",{className:"text-md font-bold text-white mb-4 flex items-center gap-2",children:[u.jsx(Mg,{className:"w-4 h-4 text-[#bb86fc]"})," Opciones Generales"]}),u.jsxs("div",{className:"flex flex-col sm:flex-row gap-6",children:[u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[u.jsx("input",{type:"checkbox",className:"sr-only peer",checked:d,onChange:k=>y(k.target.checked)}),u.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-[#bb86fc]"})]}),u.jsx("div",{children:u.jsx("span",{className:"text-sm font-semibold text-white",children:"Sin censura (Todos)"})})]}),u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[u.jsx("input",{type:"checkbox",className:"sr-only peer",checked:m,onChange:k=>v(k.target.checked)}),u.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-[#bb86fc]"})]}),u.jsx("div",{children:u.jsx("span",{className:"text-sm font-semibold text-white",children:"B/N (Todos)"})})]}),u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[u.jsx("input",{type:"checkbox",className:"sr-only peer",checked:g,onChange:k=>_(k.target.checked)}),u.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-[#bb86fc]"})]}),u.jsx("div",{children:u.jsx("span",{className:"text-sm font-semibold text-white",children:"a color (Todos)"})})]})]})]}),u.jsxs("div",{className:"space-y-3",children:[u.jsxs("h3",{className:"text-sm font-bold text-gray-400 uppercase tracking-wider px-2",children:["Mangas Individuales (",s.length,")"]}),u.jsx("div",{className:"bg-[#1a1a1a] rounded-xl border border-gray-800 divide-y divide-gray-800",children:s.map(k=>u.jsxs("div",{className:`p-4 flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4 transition-colors ${k.hasChanged?"bg-[#bb86fc]/5":"hover:bg-[#1f1f1f]"}`,children:[u.jsxs("div",{className:"flex-1 min-w-0 pr-4",children:[u.jsx("h4",{className:"text-sm font-semibold text-white truncate",title:k.title,children:k.title}),k.hasChanged&&u.jsx("span",{className:"text-[10px] text-[#bb86fc] uppercase tracking-widest font-bold",children:"Modificado"})]}),u.jsxs("div",{className:"flex items-center gap-4 sm:gap-6 shrink-0",children:[u.jsxs("div",{className:"flex flex-col items-center gap-1",children:[u.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[u.jsx("input",{type:"checkbox",className:"sr-only peer",checked:k.is_decensored,onChange:T=>P(k.id,"is_decensored",T.target.checked)}),u.jsx("div",{className:"w-9 h-5 bg-gray-700 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-[#bb86fc]"})]}),u.jsx("span",{className:"text-[10px] text-gray-400 font-medium",children:"Sin censura"})]}),u.jsxs("div",{className:"flex flex-col items-center gap-1",children:[u.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[u.jsx("input",{type:"checkbox",className:"sr-only peer",checked:k.is_bn,onChange:T=>P(k.id,"is_bn",T.target.checked)}),u.jsx("div",{className:"w-9 h-5 bg-gray-700 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-[#bb86fc]"})]}),u.jsx("span",{className:"text-[10px] text-gray-400 font-medium",children:"B/N"})]}),u.jsxs("div",{className:"flex flex-col items-center gap-1",children:[u.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[u.jsx("input",{type:"checkbox",className:"sr-only peer",checked:k.is_color,onChange:T=>P(k.id,"is_color",T.target.checked)}),u.jsx("div",{className:"w-9 h-5 bg-gray-700 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-[#bb86fc]"})]}),u.jsx("span",{className:"text-[10px] text-gray-400 font-medium",children:"a color"})]})]})]},k.id))})]})]})}),u.jsxs("div",{className:"p-6 border-t border-gray-800 flex justify-end gap-3 bg-[#1a1a1a]",children:[u.jsx("button",{onClick:e,className:"px-4 py-2 rounded-lg text-sm font-semibold text-gray-300 hover:text-white transition-colors",children:"Cancelar"}),u.jsx("button",{onClick:D,disabled:l||o||s.filter(k=>k.hasChanged).length===0,className:"bg-[#bb86fc] hover:bg-[#9966dd] text-white px-6 py-2 rounded-lg font-semibold text-sm transition-all shadow-lg shadow-[#bb86fc]/20 flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",children:l?u.jsxs(u.Fragment,{children:[u.jsx(Bo,{size:16}),"Guardando..."]}):u.jsxs(u.Fragment,{children:[u.jsx(sl,{className:"w-4 h-4"}),"Guardar Cambios (",s.filter(k=>k.hasChanged).length,")"]})})]})]})}):null}function ZW({isOpen:t,onClose:e,selectedMangaIds:n,onSaveComplete:r,currentFolderId:s,currentSection:i}){const[o,a]=V.useState(""),[l,c]=V.useState(!1),d=async()=>{if(!o.trim()){he.error("Gamba: Escribe un nombre para la colección");return}try{c(!0),await NB(o.trim(),n,s,i),he.success(`Colección "${o}" creada exitosamente.`),r(),e(),a("")}catch(h){console.error("Error creating folder:",h),he.error("Error al crear la colección")}finally{c(!1)}};return t?u.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-[70] p-4 animate-in fade-in duration-200",children:u.jsxs("div",{className:"bg-[#121212] rounded-2xl border border-gray-800 w-full max-w-sm shadow-2xl overflow-hidden flex flex-col",children:[u.jsxs("div",{className:"bg-[#1a1a1a] border-b border-gray-800 px-6 py-4 flex items-center justify-between",children:[u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx("div",{className:"p-2 bg-purple-500/10 rounded-lg text-purple-400",children:u.jsx(Hk,{className:"w-5 h-5"})}),u.jsxs("div",{children:[u.jsx("h2",{className:"text-xl font-bold text-white",children:"Crear Colección"}),u.jsxs("p",{className:"text-xs text-gray-400",children:[n.length," elementos seleccionados"]})]})]}),u.jsx("button",{onClick:e,className:"text-gray-400 hover:text-white transition-colors p-2 hover:bg-white/5 rounded-lg",children:u.jsx(mt,{className:"w-5 h-5"})})]}),u.jsx("div",{className:"p-6",children:u.jsx("input",{type:"text",value:o,onChange:h=>a(h.target.value),placeholder:"Nombre de la nueva colección",className:"w-full bg-[#1a1a1a] border border-gray-700 rounded-xl px-4 py-3 text-sm text-white focus:outline-none focus:border-purple-500 transition-colors",autoFocus:!0})}),u.jsxs("div",{className:"bg-[#1a1a1a] border-t border-gray-800 px-6 py-4 flex justify-end gap-3",children:[u.jsx("button",{onClick:e,className:"px-4 py-2 text-sm font-semibold text-gray-300 hover:text-white transition-colors",disabled:l,children:"Cancelar"}),u.jsx("button",{onClick:d,disabled:l||!o.trim(),className:"bg-purple-600 hover:bg-purple-700 disabled:opacity-50 disabled:cursor-not-allowed text-white px-6 py-2 rounded-lg text-sm font-bold shadow-lg shadow-purple-500/20 transition-all flex items-center gap-2",children:l?"Creando...":"Crear"})]})]})}):null}function eK({isOpen:t,onClose:e,selectedMangaIds:n,mangas:r,onSaveComplete:s}){const[i,o]=V.useState(""),[a,l]=V.useState(!1),[c,d]=V.useState(null),[h,m]=V.useState(new Set),p=(v,_)=>{v.stopPropagation(),m(P=>{const D=new Set(P);return D.has(_)?D.delete(_):D.add(_),D})},g=V.useMemo(()=>{const v=r.filter(k=>(k.is_folder||r.some(T=>T.folder_id===k.id))&&!n.includes(k.id)),_=new Map;v.forEach(k=>{_.set(k.id,{folder:k,children:[]})});const P=[];v.forEach(k=>{const T=_.get(k.id);k.folder_id&&_.has(k.folder_id)?_.get(k.folder_id).children.push(T):P.push(T)});const D=k=>{k.sort((T,w)=>T.folder.title.localeCompare(w.folder.title)),k.forEach(T=>D(T.children))};return D(P),P},[r,n]),b=V.useMemo(()=>{const v=[],_=i.toLowerCase(),P=k=>!_||k.folder.title.toLowerCase().includes(_)?!0:k.children.some(P),D=(k,T,w)=>{k.forEach(C=>{if(P(C)){v.push({folder:C.folder,level:T,hasChildren:C.children.length>0});const N=w||h.has(C.folder.id);C.children.length>0&&N&&D(C.children,T+1,w)}})};return D(g,0,!!_),v},[g,h,i]),E=async v=>{try{l(!0);const _=new Set(r.filter(k=>n.includes(k.id)&&k.is_folder).map(k=>k.id)),P=k=>{var C,I;let T=(C=r.find(N=>N.id===k))==null?void 0:C.folder_id,w=0;for(;T&&w<20;){if(_.has(T))return!0;T=(I=r.find(N=>N.id===T))==null?void 0:I.folder_id,w++}return!1},D=n.filter(k=>!P(k));await AB(D,v),v?he.success("Movido exitosamente a la colección."):he.success("Removido de la colección exitosamente."),s(),e()}catch(_){console.error("Error moving to folder:",_),he.error("Error al mover a la colección")}finally{l(!1)}},y=async v=>{try{l(!0),await af(v),he.success("Colección eliminada correctamente"),d(null),s()}catch(_){console.error("Error deleting folder:",_),he.error("Error al eliminar la colección")}finally{l(!1)}};return t?u.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-[70] p-4 animate-in fade-in duration-200",children:u.jsxs("div",{className:"bg-[#121212] rounded-2xl border border-gray-800 w-full max-w-4xl shadow-2xl overflow-hidden flex flex-col max-h-[90vh] min-h-[60vh]",children:[u.jsxs("div",{className:"bg-[#1a1a1a] border-b border-gray-800 px-6 py-4 flex items-center justify-between sticky top-0 z-10 flex-shrink-0",children:[u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx("div",{className:"p-2 bg-blue-500/10 rounded-lg text-blue-400",children:u.jsx(xb,{className:"w-5 h-5"})}),u.jsxs("div",{children:[u.jsx("h2",{className:"text-xl font-bold text-white",children:"Mover a Colección"}),u.jsx("p",{className:"text-xs text-gray-400",children:"Selecciona la colección de destino"})]})]}),u.jsx("button",{onClick:e,className:"text-gray-400 hover:text-white transition-colors p-2 hover:bg-white/5 rounded-lg",children:u.jsx(mt,{className:"w-5 h-5"})})]}),u.jsx("div",{className:"p-4 border-b border-gray-800 bg-[#121212] flex-shrink-0",children:u.jsxs("div",{className:"relative",children:[u.jsx(il,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400"}),u.jsx("input",{type:"text",value:i,onChange:v=>o(v.target.value),placeholder:"Buscar colección...",className:"w-full bg-[#1a1a1a] border border-gray-700 rounded-xl pl-10 pr-4 py-3 text-sm text-white focus:outline-none focus:border-blue-500 transition-colors"})]})}),u.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-2 custom-scrollbar overscroll-contain",style:{contain:"content"},children:[u.jsxs("button",{onClick:()=>E(null),disabled:a,className:"w-full flex items-center gap-3 p-3 rounded-xl border border-dashed border-gray-700 hover:border-blue-500 hover:bg-blue-500/5 transition-colors text-left group",children:[u.jsx("div",{className:"w-10 h-10 rounded-lg bg-gray-800 flex items-center justify-center group-hover:bg-blue-500/20 transition-colors",children:u.jsx("span",{className:"text-lg",children:"🏠"})}),u.jsxs("div",{className:"flex-1",children:[u.jsx("h3",{className:"text-sm font-semibold text-white",children:"Raíz (Pantalla principal)"}),u.jsx("p",{className:"text-xs text-gray-400 border-gray-700",children:"Sacar de cualquier colección"})]})]}),u.jsx("div",{className:"h-px bg-gray-800 my-4"}),b.map(({folder:v,level:_,hasChildren:P})=>{const D=!!i||h.has(v.id);return u.jsxs("div",{className:"w-full flex items-center gap-2",style:{contentVisibility:"auto",containIntrinsicSize:"0 64px"},children:[u.jsx("div",{style:{width:`${_*1.5}rem`},className:"flex-shrink-0"}),u.jsx("div",{className:"w-6 flex items-center justify-center flex-shrink-0",children:P&&u.jsx("button",{onClick:k=>p(k,v.id),className:"p-1 rounded hover:bg-gray-700 text-gray-400 hover:text-white transition-colors",children:D?u.jsx(mD,{className:"w-4 h-4"}):u.jsx(uu,{className:"w-4 h-4"})})}),u.jsxs("button",{onClick:()=>E(v.id),disabled:a,className:"flex-1 flex items-center gap-3 p-3 rounded-xl border border-gray-800 bg-[#1a1a1a] hover:border-blue-500 transition-colors text-left group",children:[u.jsx("div",{className:"w-10 h-10 rounded-lg bg-gray-800 flex items-center justify-center overflow-hidden flex-shrink-0",children:u.jsx(xb,{className:"w-5 h-5 text-gray-400 group-hover:text-blue-400 transition-colors"})}),u.jsxs("div",{className:"flex-1 min-w-0",children:[u.jsx("h3",{className:"text-sm font-semibold text-white group-hover:text-blue-400 transition-colors truncate",children:v.title}),u.jsx("p",{className:"text-xs text-gray-400",children:"Colección"})]})]}),u.jsx("button",{onClick:k=>{k.stopPropagation(),d(v.id)},disabled:a,className:"p-3 rounded-xl border border-gray-800 bg-[#1a1a1a] hover:bg-red-600 hover:border-red-500 transition-colors text-gray-400 hover:text-white flex items-center justify-center flex-shrink-0",title:"Eliminar colección",children:u.jsx(pn,{className:"w-5 h-5"})})]},v.id)}),b.length===0&&u.jsx("div",{className:"text-center py-8 text-gray-500",children:"No hay colecciones disponibles"})]}),c&&u.jsxs("div",{className:"absolute inset-0 bg-black/80 backdrop-blur-sm flex flex-col items-center justify-center gap-4 rounded-2xl z-[80] animate-in fade-in duration-200",children:[u.jsxs("p",{className:"text-white text-base font-semibold text-center px-6",children:["¿Seguro que deseas eliminar esta colección?",u.jsx("br",{}),u.jsx("span",{className:"text-gray-400 text-sm font-normal mt-2 block",children:"Los cómics dentro de ella volverán a la vista principal."})]}),u.jsxs("div",{className:"flex gap-3",children:[u.jsx("button",{onClick:v=>{v.stopPropagation(),d(null)},disabled:a,className:"bg-gray-700 hover:bg-gray-600 text-white px-5 py-2.5 rounded-xl text-sm font-semibold transition-all duration-200 transform hover:scale-105 active:scale-95",children:"Cancelar"}),u.jsx("button",{onClick:v=>{v.stopPropagation(),y(c)},disabled:a,className:"bg-red-600 hover:bg-red-700 text-white px-5 py-2.5 rounded-xl text-sm font-semibold transition-all duration-200 transform hover:scale-105 active:scale-95",children:a?"Eliminando...":"Eliminar"})]})]})]})}):null}function tK({className:t=""}){return u.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:t,children:u.jsx("path",{d:"M12 0C5.373 0 0 5.373 0 12c0 6.628 5.373 12 12 12 6.628 0 12-5.373 12-12C24 5.373 18.628 0 12 0zm5.663 11.233c-.015.004-.37.108-1.077.306a4.426 4.426 0 00-2.316-1.527c1.332-.387 2.37-1.4 2.37-2.671 0-1.637-1.464-2.964-3.266-2.964-1.801 0-3.264 1.327-3.264 2.964 0 .918.461 1.745 1.189 2.29.076.057.155.112.235.163-.64.062-1.242.062-1.803.04l-.066-.003c-2.387-.145-3.593-1.603-3.615-1.636l-.612-.872-1.073.49s1.396 3.1 4.545 3.327c.489.034.996.035 1.503.003-.021.054-.04.11-.059.167-.718 1.956-1.248 3.906-1.264 3.966l-.161.642.553.376c1.037.706 2.308 1.08 3.611 1.08h.084c3.42 0 6.138-2.607 6.138-5.91 0-.916-.217-1.782-.6-2.553l-.052-.1zM11.964 5.568c1.139 0 2.064.881 2.064 1.964 0 .864-.593 1.6-1.405 1.86a4.576 4.576 0 00-1.318-1.583c.196-1.198.814-2.241 2.241-2.241z"})})}function nK({className:t=""}){return u.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:u.jsx("path",{d:"M11.5 0a1.5 1.5 0 00-1.42.997A49.192 49.192 0 009.68 5.68a49.192 49.192 0 00-4.683.4A1.5 1.5 0 004 7.5c0 .762.568 1.402 1.325 1.488a49.192 49.192 0 004.354.346 49.192 49.192 0 00.346 4.354A1.5 1.5 0 0011.5 15c.762 0 1.402-.568 1.488-1.325a49.192 49.192 0 00.346-4.354 49.192 49.192 0 004.354-.346A1.5 1.5 0 0019 7.5c0-.762-.568-1.402-1.325-1.488a49.192 49.192 0 00-4.683-.4 49.192 49.192 0 00-.399-4.683A1.5 1.5 0 0011.5 0z",fill:"currentColor"})})}function rK({isOpen:t,onClose:e,selectedMangaIds:n,onSaveComplete:r,currentSection:s}){const[i,o]=V.useState(s==="flow"?"patreon":"flow"),[a,l]=V.useState(!1),c=async()=>{if(i===s){he.error("Gamba: Ya estás en esta sección");return}try{l(!0),await RB(n,i);let d="Flow";i==="patreon"&&(d="Patreon"),i==="onlyfans"&&(d="OnlyFans"),i==="grok"&&(d="Grok"),he.success(`${n.length} elementos movidos a ${d}`),r(),e()}catch(d){console.error("Error moving section:",d),he.error("Error al mover los elementos de sección")}finally{l(!1)}};return t?u.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-[70] p-4 animate-in fade-in duration-200",children:u.jsxs("div",{className:"bg-[#121212] rounded-2xl border border-gray-800 w-full max-w-sm shadow-2xl overflow-hidden flex flex-col",children:[u.jsxs("div",{className:"bg-[#1a1a1a] border-b border-gray-800 px-6 py-4 flex items-center justify-between",children:[u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx("div",{className:"p-2 bg-indigo-500/10 rounded-lg text-indigo-400",children:u.jsx($k,{className:"w-5 h-5"})}),u.jsxs("div",{children:[u.jsx("h2",{className:"text-xl font-bold text-white",children:"Mover a Sección"}),u.jsxs("p",{className:"text-xs text-gray-400",children:[n.length," elementos seleccionados"]})]})]}),u.jsx("button",{onClick:e,className:"text-gray-400 hover:text-white transition-colors p-2 hover:bg-white/5 rounded-lg",children:u.jsx(mt,{className:"w-5 h-5"})})]}),u.jsxs("div",{className:"p-6 space-y-4",children:[u.jsx("p",{className:"text-sm text-gray-300 text-center mb-4",children:"¿A qué sección deseas enviar estos elementos?"}),u.jsxs("button",{onClick:()=>o("flow"),disabled:s==="flow",className:`w-full flex items-center justify-between p-4 rounded-xl border transition-all ${s==="flow"?"border-gray-800 bg-[#121212] opacity-50 cursor-not-allowed":i==="flow"?"border-[#bb86fc] bg-[#bb86fc]/10 text-white":"border-gray-700 bg-[#1a1a1a] text-gray-400 hover:border-gray-500"}`,children:[u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx("div",{className:`p-2 rounded-lg ${s==="flow"?"bg-gray-800 text-gray-500":i==="flow"?"bg-[#bb86fc]/20 text-[#bb86fc]":"bg-gray-800 text-gray-400"}`,children:u.jsx(Ra,{className:"w-5 h-5"})}),u.jsxs("div",{className:"text-left",children:[u.jsx("h3",{className:"font-semibold text-sm",children:"Flow"}),u.jsx("p",{className:"text-xs opacity-70",children:"Galería principal"})]})]}),s==="flow"&&u.jsx("span",{className:"text-xs font-bold px-2 py-1 rounded bg-gray-800 text-gray-400",children:"Actual"})]}),u.jsxs("button",{onClick:()=>o("patreon"),disabled:s==="patreon",className:`w-full flex items-center justify-between p-4 rounded-xl border transition-all ${s==="patreon"?"border-gray-800 bg-[#121212] opacity-50 cursor-not-allowed":i==="patreon"?"border-[#f96854] bg-[#f96854]/10 text-white":"border-gray-700 bg-[#1a1a1a] text-gray-400 hover:border-gray-500"}`,children:[u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx("div",{className:`p-2 rounded-lg ${s==="patreon"?"bg-gray-800 text-gray-500":i==="patreon"?"bg-[#f96854]/20 text-[#f96854]":"bg-gray-800 text-gray-400"}`,children:u.jsx(hf,{className:"w-5 h-5"})}),u.jsxs("div",{className:"text-left",children:[u.jsx("h3",{className:"font-semibold text-sm",children:"Patreon"}),u.jsx("p",{className:"text-xs opacity-70",children:"Contenido exclusivo"})]})]}),s==="patreon"&&u.jsx("span",{className:"text-xs font-bold px-2 py-1 rounded bg-gray-800 text-gray-400",children:"Actual"})]}),u.jsxs("button",{onClick:()=>o("onlyfans"),disabled:s==="onlyfans",className:`w-full flex items-center justify-between p-4 rounded-xl border transition-all ${s==="onlyfans"?"border-gray-800 bg-[#121212] opacity-50 cursor-not-allowed":i==="onlyfans"?"border-[#00AFF0] bg-[#00AFF0]/10 text-white":"border-gray-700 bg-[#1a1a1a] text-gray-400 hover:border-gray-500"}`,children:[u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx("div",{className:`p-2 rounded-lg ${s==="onlyfans"?"bg-gray-800 text-gray-500":i==="onlyfans"?"bg-[#00AFF0]/20 text-[#00AFF0]":"bg-gray-800 text-gray-400"}`,children:u.jsx(tK,{className:"w-5 h-5"})}),u.jsxs("div",{className:"text-left",children:[u.jsx("h3",{className:"font-semibold text-sm",children:"OnlyFans"}),u.jsx("p",{className:"text-xs opacity-70",children:"Contenido premium"})]})]}),s==="onlyfans"&&u.jsx("span",{className:"text-xs font-bold px-2 py-1 rounded bg-gray-800 text-gray-400",children:"Actual"})]}),u.jsxs("button",{onClick:()=>o("grok"),disabled:s==="grok",className:`w-full flex items-center justify-between p-4 rounded-xl border transition-all ${s==="grok"?"border-gray-800 bg-[#121212] opacity-50 cursor-not-allowed":i==="grok"?"border-[#1D9BF0] bg-[#1D9BF0]/10 text-white":"border-gray-700 bg-[#1a1a1a] text-gray-400 hover:border-gray-500"}`,children:[u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx("div",{className:`p-2 rounded-lg ${s==="grok"?"bg-gray-800 text-gray-500":i==="grok"?"bg-[#1D9BF0]/20 text-[#1D9BF0]":"bg-gray-800 text-gray-400"}`,children:u.jsx(nK,{className:"w-5 h-5"})}),u.jsxs("div",{className:"text-left",children:[u.jsx("h3",{className:"font-semibold text-sm",children:"Grok"}),u.jsx("p",{className:"text-xs opacity-70",children:"Contenido IA"})]})]}),s==="grok"&&u.jsx("span",{className:"text-xs font-bold px-2 py-1 rounded bg-gray-800 text-gray-400",children:"Actual"})]})]}),u.jsxs("div",{className:"bg-[#1a1a1a] border-t border-gray-800 px-6 py-4 flex justify-end gap-3",children:[u.jsx("button",{onClick:e,className:"px-4 py-2 text-sm font-semibold text-gray-300 hover:text-white transition-colors",disabled:a,children:"Cancelar"}),u.jsx("button",{onClick:c,disabled:a||i===s,className:"bg-indigo-600 hover:bg-indigo-700 disabled:opacity-50 disabled:cursor-not-allowed text-white px-6 py-2 rounded-lg text-sm font-bold shadow-lg shadow-indigo-500/20 transition-all flex items-center gap-2",children:a?"Moviendo...":"Mover"})]})]})}):null}function sK({isOpen:t,onClose:e,mangas:n}){const r=V.useMemo(()=>{const i=new Map;n.forEach(a=>{i.set(a.id,{item:a,children:[]})});const o=[];return n.forEach(a=>{const l=i.get(a.id);a.folder_id&&i.has(a.folder_id)?i.get(a.folder_id).children.push(l):o.push(l)}),o},[n]);if(!t)return null;const s=(i,o=0)=>{if(i.length===0)return null;const a=[...i].sort((l,c)=>l.item.is_folder&&!c.item.is_folder?-1:!l.item.is_folder&&c.item.is_folder?1:l.item.title.localeCompare(c.item.title));return u.jsxs("div",{className:"flex flex-col gap-3 relative",style:{marginLeft:o>0?"2.5rem":"0"},children:[o>0&&u.jsx("div",{className:"absolute -left-6 top-0 bottom-6 w-px bg-gray-700/50"}),a.map((l,c)=>{var m;const d=c===a.length-1,h=o===0&&l.item.is_folder;return u.jsxs("div",{className:"relative",children:[o>0&&u.jsx("div",{className:"absolute -left-6 top-6 w-6 h-px bg-gray-700/50"}),o>0&&d&&u.jsx("div",{className:"absolute -left-6 top-6 bottom-0 w-px bg-[#1a1a1a]"}),u.jsxs("div",{className:`p-4 rounded-xl border flex flex-col gap-3 transition-colors ${l.item.is_folder?h?"bg-purple-900/10 border-purple-500/30":"bg-blue-900/10 border-blue-500/20":"bg-gray-800/40 border-gray-700/50"}`,children:[u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx("div",{className:`p-2 rounded-lg ${l.item.is_folder?h?"bg-purple-500/20 text-purple-400":"bg-blue-500/20 text-blue-400":"bg-emerald-500/10 text-emerald-500"}`,children:l.item.is_folder?u.jsx(hr,{className:"w-5 h-5"}):u.jsx(Gk,{className:"w-5 h-5"})}),u.jsxs("div",{className:"flex-1",children:[u.jsx("h4",{className:"text-sm font-bold text-white whitespace-normal",children:l.item.title}),u.jsx("span",{className:"text-xs text-gray-500",children:l.item.is_folder?`Colección (${l.children.length} elementos)`:`Manga (${((m=l.item.chapters)==null?void 0:m.length)||0} caps)`})]})]}),l.children.length>0&&u.jsx("div",{className:"mt-2",children:s(l.children,o+1)})]})]},l.item.id)})]})};return u.jsx("div",{className:"fixed inset-0 bg-black/80 backdrop-blur-md flex items-center justify-center z-[80] p-4 animate-in fade-in duration-200",children:u.jsxs("div",{className:"bg-[#121212] rounded-2xl border border-gray-800 w-full max-w-6xl shadow-2xl overflow-hidden flex flex-col h-[90vh]",children:[u.jsxs("div",{className:"bg-[#1a1a1a] border-b border-gray-800 px-6 py-4 flex items-center justify-between sticky top-0 z-10 flex-shrink-0",children:[u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx("div",{className:"p-2 bg-indigo-500/10 rounded-lg text-indigo-400",children:u.jsx(TD,{className:"w-6 h-6"})}),u.jsxs("div",{children:[u.jsx("h2",{className:"text-xl font-bold text-white",children:"Mapa Mental de Organización"}),u.jsx("p",{className:"text-xs text-gray-400",children:"Vista general de toda tu estructura de colecciones y mangas"})]})]}),u.jsx("button",{onClick:e,className:"text-gray-400 hover:text-white transition-colors p-2 hover:bg-white/5 rounded-lg border border-transparent hover:border-gray-700",children:u.jsx(mt,{className:"w-6 h-6"})})]}),u.jsx("div",{className:"flex-1 overflow-auto p-8 custom-scrollbar relative bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGNpcmNsZSBjeD0iMSIgY3k9IjEiIHI9IjEiIGZpbGw9IiMzMzMiLz48L3N2Zz4=')]",children:u.jsx("div",{className:"max-w-4xl mx-auto",children:s(r)})})]})})}function iK({isOpen:t,onClose:e,deletedMangas:n,onRestore:r,onPermanentDelete:s}){const[i,o]=V.useState(new Set);if(!t)return null;const a=async c=>{o(d=>new Set(d).add(c));try{await r(c),he.success("Elemento restaurado. Sus hijos también fueron recuperados si era una carpeta.")}catch{he.error("Error al restaurar elemento")}finally{o(d=>{const h=new Set(d);return h.delete(c),h})}},l=async c=>{if(window.confirm("¿ELIMINAR DEFINITIVAMENTE? Esta acción borrará el registro y los capítulos para siempre de la base de datos y no se puede deshacer.")){o(d=>new Set(d).add(c));try{await s(c),he.success("Elemento purgado de la base de datos.")}catch{he.error("Error purgando elemento")}finally{o(d=>{const h=new Set(d);return h.delete(c),h})}}};return u.jsx("div",{className:"fixed inset-0 bg-black/80 flex items-center justify-center z-50 p-4 sm:p-6 backdrop-blur-sm animate-[fadeIn_0.2s_ease-out]",children:u.jsxs("div",{className:"bg-[#121212] rounded-2xl w-full max-w-4xl max-h-[90vh] flex flex-col shadow-2xl border border-gray-800 animate-[scaleIn_0.2s_ease-out] relative overflow-hidden",children:[u.jsxs("div",{className:"flex items-center justify-between px-6 py-5 border-b border-gray-800/50 bg-[#1a1a1a]",children:[u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx("div",{className:"p-2.5 bg-red-500/10 rounded-xl text-red-500",children:u.jsx(pn,{className:"w-5 h-5"})}),u.jsxs("div",{children:[u.jsx("h2",{className:"text-xl font-bold tracking-tight text-white flex items-center gap-2",children:"Papelera de Reciclaje"}),u.jsx("p",{className:"text-sm text-gray-400 mt-0.5",children:"Estos elementos están ocultos a los usuarios."})]})]}),u.jsx("button",{onClick:e,className:"p-2 hover:bg-white/10 rounded-xl transition-colors shrink-0 group right-4 absolute md:relative top-4 md:top-0",children:u.jsx(mt,{className:"w-5 h-5 text-gray-400 group-hover:text-white"})})]}),u.jsx("div",{className:"flex-1 overflow-y-auto p-4 sm:p-6 space-y-3 custom-scrollbar",children:n.length===0?u.jsxs("div",{className:"flex flex-col items-center justify-center h-48 text-gray-400 opacity-50",children:[u.jsx(pn,{className:"w-16 h-16 mb-4"}),u.jsx("p",{className:"text-lg font-medium",children:"La papelera está vacía"})]}):n.map(c=>u.jsxs("div",{className:"flex flex-col sm:flex-row items-center gap-4 bg-gray-900/50 p-3 sm:p-4 rounded-xl border border-gray-800 hover:border-gray-700 transition-colors",children:[u.jsx("div",{className:"w-16 h-16 shrink-0 bg-gray-800 rounded-lg overflow-hidden flex items-center justify-center",children:c.thumbnail_url||c.cover_url?u.jsx("img",{src:c.thumbnail_url||c.cover_url,alt:"",className:"w-full h-full object-cover opacity-70 grayscale hover:grayscale-0 transition-all"}):c.is_folder?u.jsx(hr,{className:"w-8 h-8 text-gray-500"}):u.jsx("div",{className:"w-6 h-6 bg-gray-700 rounded-sm"})}),u.jsxs("div",{className:"flex-1 min-w-0 w-full text-center sm:text-left",children:[u.jsxs("div",{className:"flex items-center gap-2 mb-1 justify-center sm:justify-start",children:[c.is_folder&&u.jsx(hr,{className:"w-3.5 h-3.5 text-blue-400"}),u.jsx("h3",{className:"font-bold text-white truncate text-sm sm:text-base",title:c.title,children:c.title})]}),u.jsxs("p",{className:"text-xs text-gray-400 truncate",children:[c.author||"Sin autor"," • Eliminado el ",new Date(c.updated_at).toLocaleDateString()]})]}),u.jsxs("div",{className:"flex items-center gap-2 w-full sm:w-auto",children:[u.jsxs("button",{onClick:()=>a(c.id),disabled:i.has(c.id),className:"flex-1 sm:flex-none flex items-center justify-center gap-1.5 px-3 py-2 bg-emerald-500/10 hover:bg-emerald-500/20 text-emerald-500 rounded-lg text-xs font-semibold transition-colors disabled:opacity-50",children:[u.jsx(CD,{className:"w-3.5 h-3.5"}),"Restaurar"]}),u.jsxs("button",{onClick:()=>l(c.id),disabled:i.has(c.id),className:"flex-1 sm:flex-none flex items-center justify-center gap-1.5 px-3 py-2 bg-red-500/10 hover:bg-red-500/20 text-red-500 rounded-lg text-xs font-semibold transition-colors disabled:opacity-50",children:[u.jsx(pn,{className:"w-3.5 h-3.5"}),"Purgar"]})]})]},c.id))})]})})}function TE({isOpen:t,onClose:e,onConfirm:n,title:r,message:s,confirmText:i="Confirmar",cancelText:o="Cancelar",variant:a="warning"}){if(!t)return null;const l={danger:"from-red-500 to-red-600 shadow-red-500/20",warning:"from-[#bb86fc] to-[#9966dd] shadow-[#bb86fc]/30",info:"from-blue-500 to-blue-600 shadow-blue-500/20"},c={danger:"bg-red-500/10 text-red-500",warning:"bg-[#bb86fc]/10 text-[#bb86fc]",info:"bg-blue-500/10 text-blue-500"};return u.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-[100] p-4 backdrop-blur-sm animate-[fadeIn_0.2s_ease-out]",children:u.jsxs("div",{className:"bg-gradient-to-b from-[#1f1f1f] to-[#121212] rounded-2xl border border-gray-700/40 w-full max-w-md shadow-2xl overflow-hidden scale-in-center",children:[u.jsxs("div",{className:"bg-gradient-to-b from-[#2a2a2a] to-[#1f1f1f] border-b border-gray-700/30 px-6 py-4 flex items-center justify-between",children:[u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx("div",{className:`p-2 rounded-lg ${c[a]}`,children:u.jsx(hD,{className:"w-5 h-5"})}),u.jsx("h2",{className:"text-xl font-bold text-white tracking-tight",children:r})]}),u.jsx("button",{onClick:e,className:"text-gray-500 hover:text-white hover:bg-white/10 transition-all p-1.5 rounded-lg",children:u.jsx(mt,{className:"w-5 h-5"})})]}),u.jsxs("div",{className:"p-8",children:[u.jsx("p",{className:"text-gray-300 leading-relaxed",children:s}),u.jsxs("div",{className:"flex gap-3 mt-8",children:[u.jsx("button",{onClick:e,className:"flex-1 bg-[#1a1a1a] border border-gray-600/40 hover:border-gray-500 hover:bg-[#242424] text-white px-5 py-3 rounded-xl font-semibold text-sm transition-all shadow-md active:scale-95",children:o}),u.jsx("button",{onClick:()=>{n(),e()},className:`flex-1 bg-gradient-to-r ${l[a]} text-white px-5 py-3 rounded-xl font-bold text-sm transition-all shadow-lg hover:brightness-110 active:scale-95`,children:i})]})]})]})})}function oK({isOpen:t,onClose:e,mangaIds:n,onSaveComplete:r}){const[s,i]=V.useState(null),[o,a]=V.useState(null),[l,c]=V.useState([]),[d,h]=V.useState([]),[m,p]=V.useState(new Set),[g,b]=V.useState(new Set),[E,y]=V.useState(!1),[v,_]=V.useState(!1),[P,D]=V.useState({active:!1,selecting:!0,source:null});V.useEffect(()=>{const z=()=>D({active:!1,selecting:!0,source:null});return window.addEventListener("mouseup",z),()=>window.removeEventListener("mouseup",z)},[]),V.useEffect(()=>{t&&n.length===2?k():(i(null),a(null),c([]),h([]),p(new Set),b(new Set))},[t,n]);const k=async()=>{var z,B;_(!0);try{const[q,X]=await Promise.all([zo(n[0]),zo(n[1])]);i(q),a(X);let O=[];(z=q==null?void 0:q.chapters)==null||z.forEach(R=>O.push(...R.pages||[])),c(O);let H=[];(B=X==null?void 0:X.chapters)==null||B.forEach(R=>H.push(...R.pages||[])),h(H),p(new Set),b(new Set)}catch{he.error("Error al cargar los mangas")}finally{_(!1)}},T=()=>{if(m.size===0)return;const B=Array.from(m).sort((X,O)=>X-O).map(X=>l[X]),q=l.filter((X,O)=>!m.has(O));c(q),h(X=>[...X,...B]),p(new Set)},w=()=>{if(g.size===0)return;const B=Array.from(g).sort((X,O)=>X-O).map(X=>d[X]),q=d.filter((X,O)=>!g.has(O));h(q),c(X=>[...X,...B]),b(new Set)},C=(z,B)=>{const q=z==="A"?m.has(B):g.has(B);D({active:!0,selecting:!q,source:z}),I(z,B,!q)},I=(z,B,q)=>{if(!P.active&&q===void 0||P.source!==null&&P.source!==z&&q===void 0)return;const X=q!==void 0?q:P.selecting;z==="A"?p(O=>{const H=new Set(O);return X?H.add(B):H.delete(B),H}):b(O=>{const H=new Set(O);return X?H.add(B):H.delete(B),H})},N=()=>{m.size===l.length?p(new Set):p(new Set(l.map((z,B)=>B)))},j=()=>{g.size===d.length?b(new Set):b(new Set(d.map((z,B)=>B)))},A=async()=>{if(!(!s||!o)){y(!0);try{await jB(s.id,o.id,l,d),he.success("Páginas transferidas correctamente."),r(),e()}catch(z){console.error(z),he.error("Ocurrió un error al guardar los cambios.")}finally{y(!1)}}};return t?u.jsx("div",{className:"fixed inset-0 bg-black/80 backdrop-blur-sm z-[70] flex items-center justify-center p-4 sm:p-6 animate-in fade-in duration-200",children:u.jsxs("div",{className:"bg-[#121212] border border-gray-700 w-full max-w-7xl h-[90vh] rounded-2xl shadow-2xl flex flex-col overflow-hidden animate-in zoom-in-95 duration-200",children:[u.jsxs("div",{className:"bg-[#1a1a1a] border-b border-gray-800 px-6 py-4 flex items-center justify-between shrink-0",children:[u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx("div",{className:"p-2 bg-amber-500/10 rounded-lg text-amber-500",children:u.jsx(SD,{className:"w-5 h-5"})}),u.jsxs("div",{children:[u.jsx("h2",{className:"text-xl font-bold text-white",children:"Transferencia de Páginas"}),u.jsx("p",{className:"text-sm text-gray-400",children:"Mueve páginas de un manga a otro"})]})]}),u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsxs("button",{onClick:A,disabled:E||v,className:"bg-emerald-600 hover:bg-emerald-700 disabled:opacity-50 disabled:cursor-not-allowed text-white px-4 py-2 rounded-lg font-semibold text-sm transition-all shadow-lg shadow-emerald-500/20 flex items-center gap-2",children:[E?u.jsx(_b,{className:"w-4 h-4 animate-spin"}):u.jsx(sl,{className:"w-4 h-4"}),"Guardar Cambios"]}),u.jsx("button",{onClick:e,className:"text-gray-400 hover:text-white transition-colors p-2 hover:bg-white/5 rounded-lg",children:u.jsx(mt,{className:"w-5 h-5"})})]})]}),v?u.jsx("div",{className:"flex-1 flex items-center justify-center",children:u.jsx(_b,{className:"w-12 h-12 text-amber-500 animate-spin"})}):u.jsxs("div",{className:"flex-1 flex flex-col md:flex-row min-h-0",children:[u.jsxs("div",{className:"flex-1 flex flex-col min-h-0 border-r border-gray-800 bg-[#151515]",children:[u.jsxs("div",{className:"p-4 border-b border-gray-800 bg-[#1a1a1a] shrink-0 sticky top-0 z-10 flex flex-col gap-2",children:[u.jsx("h3",{className:"font-bold text-lg text-amber-400 truncate",title:s==null?void 0:s.title,children:(s==null?void 0:s.title)||"Cargando..."}),u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsxs("span",{className:"text-sm text-gray-400",children:[l.length," páginas"]}),u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx("button",{onClick:N,className:"text-xs text-blue-400 hover:text-blue-300",children:m.size===l.length&&l.length>0?"Deseleccionar todo":"Seleccionar todo"}),m.size>0&&u.jsxs("span",{className:"text-xs bg-amber-500/20 text-amber-300 px-2 py-0.5 rounded-full font-bold",children:[m.size," sel."]})]})]})]}),u.jsx("div",{className:"flex-1 overflow-y-auto p-4 custom-scrollbar",children:u.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3",children:[l.map((z,B)=>u.jsxs("div",{onMouseDown:q=>{q.preventDefault(),C("A",B)},onMouseEnter:()=>I("A",B),className:`relative aspect-[2/3] rounded-lg overflow-hidden cursor-pointer border-2 transition-all group select-none ${m.has(B)?"border-amber-500 shadow-[0_0_15px_rgba(245,158,11,0.4)]":"border-transparent hover:border-gray-500 bg-gray-800"}`,children:[u.jsx("img",{src:z,alt:`A-${B}`,className:"w-full h-full object-cover",loading:"lazy"}),u.jsx("div",{className:`absolute top-2 right-2 w-6 h-6 rounded-full border-2 flex items-center justify-center transition-colors ${m.has(B)?"bg-amber-500 border-amber-500":"bg-black/50 border-gray-300 group-hover:border-amber-500/50"}`,children:m.has(B)&&u.jsx("div",{className:"w-2.5 h-2.5 bg-white rounded-full"})}),u.jsx("div",{className:"absolute bottom-2 left-2 px-2 py-1 bg-black/70 text-xs font-bold text-white rounded backdrop-blur-md",children:B+1})]},`a-${B}`)),l.length===0&&u.jsx("div",{className:"col-span-full h-32 flex items-center justify-center text-gray-500 text-sm italic",children:"Vacío"})]})})]}),u.jsxs("div",{className:"w-full md:w-24 shrink-0 bg-[#0f0f0f] flex flex-row md:flex-col items-center justify-center gap-4 py-4 md:py-0 border-y md:border-y-0 border-gray-800",children:[u.jsxs("button",{onClick:T,disabled:m.size===0,className:"w-14 h-14 rounded-full bg-[#1a1a1a] hover:bg-amber-600 disabled:opacity-50 disabled:hover:bg-[#1a1a1a] border border-gray-700 flex items-center justify-center transition-colors text-white disabled:text-gray-600 shadow-xl group",title:"Mover selección a la derecha",children:[u.jsx(mb,{className:"w-6 h-6 hidden md:block group-hover:scale-110 transition-transform"}),u.jsx(mb,{className:"w-6 h-6 block md:hidden rotate-90 group-hover:scale-110 transition-transform"})]}),u.jsxs("button",{onClick:w,disabled:g.size===0,className:"w-14 h-14 rounded-full bg-[#1a1a1a] hover:bg-amber-600 disabled:opacity-50 disabled:hover:bg-[#1a1a1a] border border-gray-700 flex items-center justify-center transition-colors text-white disabled:text-gray-600 shadow-xl group",title:"Mover selección a la izquierda",children:[u.jsx(Nr,{className:"w-6 h-6 hidden md:block group-hover:scale-110 transition-transform"}),u.jsx(Nr,{className:"w-6 h-6 block md:hidden rotate-90 group-hover:scale-110 transition-transform"})]})]}),u.jsxs("div",{className:"flex-1 flex flex-col min-h-0 bg-[#151515]",children:[u.jsxs("div",{className:"p-4 border-b border-gray-800 bg-[#1a1a1a] shrink-0 sticky top-0 z-10 flex flex-col gap-2",children:[u.jsx("h3",{className:"font-bold text-lg text-amber-400 truncate",title:o==null?void 0:o.title,children:(o==null?void 0:o.title)||"Cargando..."}),u.jsxs("div",{className:"flex items-center justify-between",children:[u.jsxs("span",{className:"text-sm text-gray-400",children:[d.length," páginas"]}),u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx("button",{onClick:j,className:"text-xs text-blue-400 hover:text-blue-300",children:g.size===d.length&&d.length>0?"Deseleccionar todo":"Seleccionar todo"}),g.size>0&&u.jsxs("span",{className:"text-xs bg-amber-500/20 text-amber-300 px-2 py-0.5 rounded-full font-bold",children:[g.size," sel."]})]})]})]}),u.jsx("div",{className:"flex-1 overflow-y-auto p-4 custom-scrollbar",children:u.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3",children:[d.map((z,B)=>u.jsxs("div",{onMouseDown:q=>{q.preventDefault(),C("B",B)},onMouseEnter:()=>I("B",B),className:`relative aspect-[2/3] rounded-lg overflow-hidden cursor-pointer border-2 transition-all group select-none ${g.has(B)?"border-amber-500 shadow-[0_0_15px_rgba(245,158,11,0.4)]":"border-transparent hover:border-gray-500 bg-gray-800"}`,children:[u.jsx("img",{src:z,alt:`B-${B}`,className:"w-full h-full object-cover",loading:"lazy"}),u.jsx("div",{className:`absolute top-2 right-2 w-6 h-6 rounded-full border-2 flex items-center justify-center transition-colors ${g.has(B)?"bg-amber-500 border-amber-500":"bg-black/50 border-gray-300 group-hover:border-amber-500/50"}`,children:g.has(B)&&u.jsx("div",{className:"w-2.5 h-2.5 bg-white rounded-full"})}),u.jsx("div",{className:"absolute bottom-2 left-2 px-2 py-1 bg-black/70 text-xs font-bold text-white rounded backdrop-blur-md",children:B+1})]},`b-${B}`)),d.length===0&&u.jsx("div",{className:"col-span-full h-32 flex items-center justify-center text-gray-500 text-sm italic",children:"Vacío"})]})})]})]})]})}):null}function aK({currentSection:t,onSectionChange:e}){const[n,r]=V.useState(!1);return u.jsxs(u.Fragment,{children:[u.jsx("button",{onClick:()=>r(!0),className:"p-2 sm:p-2.5 hover:bg-white/10 rounded-full text-white transition-colors flex-shrink-0",children:u.jsx(ED,{className:"w-5 h-5 sm:w-6 sm:h-6"})}),u.jsx("div",{className:`fixed inset-0 bg-black/70 z-[45] transition-opacity duration-300 ${n?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none"}`,onClick:()=>r(!1)}),u.jsxs("div",{className:`fixed inset-y-0 left-0 w-72 bg-[#1a1a1a] shadow-2xl border-r border-[#333] z-50 transform transition-transform duration-300 ease-out will-change-transform ${n?"translate-x-0":"-translate-x-full"}`,children:[u.jsxs("div",{className:"p-4 sm:p-6 border-b border-gray-800 flex items-center justify-between",children:[u.jsxs("div",{className:"flex items-center gap-3",children:[u.jsx("img",{src:"/icons/icones.png",alt:"Logo",className:"w-8 h-8 sm:w-10 sm:h-10 object-contain"}),u.jsx("span",{className:"font-bold text-white text-lg",children:"Twisted Streaming Brody"})]}),u.jsx("button",{onClick:()=>r(!1),className:"p-2 text-gray-400 hover:text-white rounded-full hover:bg-white/10 transition-colors",children:u.jsx(mt,{className:"w-5 h-5"})})]}),u.jsxs("div",{className:"p-4 flex flex-col gap-2",children:[u.jsx("div",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2 px-2",children:"Navegación principal"}),u.jsxs("button",{onClick:()=>{e("peliculas"),r(!1)},className:`flex items-center gap-3 w-full p-3 rounded-xl font-semibold transition-all active:scale-95 ${t==="peliculas"?"bg-[#f96854]/10 text-[#f96854] border border-[#f96854]/20 hover:bg-[#f96854]/20":"text-gray-300 hover:bg-white/5 border border-transparent"}`,children:[u.jsx(Dg,{className:"w-5 h-5"}),"Películas"]}),u.jsxs("button",{onClick:()=>{e("flow"),r(!1)},className:`flex items-center gap-3 w-full p-3 rounded-xl font-semibold transition-all active:scale-95 ${t==="flow"?"bg-[#bb86fc]/10 text-[#bb86fc] border border-[#bb86fc]/20 hover:bg-[#bb86fc]/20":"text-gray-300 hover:bg-white/5 border border-transparent"}`,children:[u.jsx(Ra,{className:"w-5 h-5"}),"Flow"]}),u.jsxs("button",{onClick:()=>{e("series"),r(!1)},className:`flex items-center gap-3 w-full p-3 rounded-xl font-semibold transition-all active:scale-95 ${t==="series"?"bg-[#00AFF0]/10 text-[#00AFF0] border border-[#00AFF0]/20 hover:bg-[#00AFF0]/20":"text-gray-300 hover:bg-white/5 border border-transparent"}`,children:[u.jsx(AD,{className:"w-5 h-5"}),"Series"]})]})]})]})}const kE={random:"Aleatorio",name:"Nombre",date:"Fecha de creación",modified:"Última modificación"};function lK({value:t,onChange:e,placeholder:n="Buscar manga...",sortType:r="random",onSortTypeChange:s,sortDirection:i="asc",onSortDirectionChange:o}){const[a,l]=V.useState(!1),c=()=>{e("")},d=()=>{const p=["modified","name","date","random"],b=(p.indexOf(r)+1)%p.length,E=p[b];s==null||s(E),window.innerWidth<640&&he.success(`Ordenado por: ${kE[E]}`,{position:"top-center",duration:1500,className:"bg-purple-900/90 text-white border-purple-500/50"})},h=()=>{const p=i==="asc"?"desc":"asc";if(o==null||o(p),window.innerWidth<640){let g=p==="asc"?"Ascendente (A-Z)":"Descendente (Z-A)";(r==="date"||r==="modified")&&(g=p==="asc"?"Más antiguos primero":"Más recientes primero"),he.success(`Orden: ${g}`,{position:"top-center",duration:1500,className:"bg-purple-900/90 text-white border-purple-500/50"})}},m=()=>i==="asc"?"ASC":"DESC";return u.jsxs("div",{className:"w-full flex gap-2 items-center",children:[u.jsxs("div",{className:"relative flex-1",children:[u.jsx(il,{className:`absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 pointer-events-none ${a?"text-purple-400":"text-gray-400"}`}),u.jsx("input",{type:"text",placeholder:n,value:t,onChange:p=>e(p.target.value),onFocus:()=>l(!0),onBlur:()=>l(!1),className:"w-full bg-[#1a1a1a] text-white rounded-lg pl-10 pr-10 py-2.5 text-sm placeholder-gray-400 border border-gray-700/50 focus:border-purple-500 focus:outline-none"}),t&&u.jsx("button",{onClick:c,className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-400 hover:text-purple-400 transition-all p-1 hover:scale-125 hover:rotate-90 duration-300",title:"Limpiar búsqueda",children:u.jsx(mt,{className:"w-4 h-4"})})]}),u.jsxs("button",{onClick:d,className:"bg-gradient-to-r from-gray-700/40 to-gray-600/40 hover:from-gray-700/60 hover:to-gray-600/60 border border-gray-600/50 hover:border-purple-500/50 text-white px-2.5 py-2.5 rounded-lg flex items-center justify-center gap-1.5 font-medium text-xs transition-all duration-300 active:scale-95 whitespace-nowrap hover:scale-110 hover:shadow-lg hover:shadow-purple-500/20 hover:border-purple-500",title:"Cambiar tipo de ordenamiento",children:[u.jsx(xD,{className:"w-3.5 h-3.5 transition-transform duration-300 hover:rotate-180"}),u.jsx("span",{className:"hidden sm:inline",children:kE[r]})]}),u.jsxs("button",{onClick:h,className:"bg-gradient-to-r from-gray-700/40 to-gray-600/40 hover:from-gray-700/60 hover:to-gray-600/60 border border-gray-600/50 hover:border-purple-500/50 text-white px-2.5 py-2.5 rounded-lg flex items-center justify-center gap-1.5 font-medium text-xs transition-all duration-300 active:scale-95 whitespace-nowrap hover:scale-110 hover:shadow-lg hover:shadow-purple-500/20 hover:border-purple-500",title:i==="asc"?"Cambiar a descendente":"Cambiar a ascendente",children:[u.jsx(fD,{className:`w-3.5 h-3.5 transition-all duration-500 ${i==="desc"?"rotate-180":""} hover:scale-125`}),u.jsx("span",{className:"hidden sm:inline text-[10px]",children:m()})]})]})}function cK(){const[t,e]=V.useState(!1),[n,r]=V.useState(!1),[s,i]=V.useState(!1),[o,a]=V.useState(!1),[l,c]=V.useState(null),[d,h]=V.useState(!1),[m,p]=V.useState(!1),[g,b]=V.useState(!1),[E,y]=V.useState([]),[v,_]=V.useState(!1),[P,D]=V.useState(!1),[k,T]=V.useState(!1),[w,C]=V.useState(!1),[I,N]=V.useState(!1),[j,A]=V.useState(!1),[z,B]=V.useState(!1),[q,X]=V.useState(!1),[O,H]=V.useState(!1),[R,Y]=V.useState({isOpen:!1,title:"",message:"",onConfirm:()=>{},variant:"info"}),[se,M]=V.useState(()=>localStorage.getItem("isFolderAnimationEnabled")==="true"),[$,ee]=V.useState(!1),[J,ae]=V.useState(!1),[ce,Ze]=V.useState(!1),[Ke,Ct]=V.useState(!1),[gt,zn]=V.useState(!1),[le,xe]=V.useState(!1),[Oe,qe]=V.useState(!1),[ke,Ce]=V.useState(null),[Ye,or]=V.useState(!1),[It,ar]=V.useState(!1),[Ji,Sr]=V.useState(!1),[W,te]=V.useState(null),[ve,Pe]=V.useState([]),[Me,yt]=V.useState(null),[je,Kt]=V.useState([]),[et,Bn]=V.useState(()=>{const ne=new URLSearchParams(window.location.search).get("section");return ne==="peliculas"||ne==="flow"||ne==="series"?ne:localStorage.getItem("currentSection")||"flow"}),[ot,Ft]=V.useState(!1),[zt,rn]=V.useState(!1),[Cs,Zi]=V.useState(!0),[rt,eo]=V.useState(""),[_e,ht]=V.useState("all"),[st,Bt]=V.useState([]),[Yt,bt]=V.useState([]),[Nt,Un]=V.useState(!1),[At,Qt]=V.useState(!1),[$n,sn]=V.useState(!1),[lr,Jr]=V.useState(()=>localStorage.getItem("sortType")||"modified"),[Js,Du]=V.useState(()=>localStorage.getItem("sortDirection")||"desc");V.useEffect(()=>{const ne=new URLSearchParams(window.location.search).get("admin")==="true";a(ne)},[]),V.useEffect(()=>{localStorage.setItem("sortType",lr)},[lr]),V.useEffect(()=>{localStorage.setItem("isFolderAnimationEnabled",String(se))},[se]),V.useEffect(()=>{localStorage.setItem("sortDirection",Js)},[Js]),V.useEffect(()=>{localStorage.setItem("currentSection",et);const F=new URL(window.location.href);et==="peliculas"||et==="series"?F.searchParams.set("section",et):F.searchParams.delete("section"),window.history.replaceState({},"",F.toString())},[et]),V.useEffect(()=>{var de;(de=window.Telegram)!=null&&de.WebApp&&window.Telegram.WebApp.ready(),_t();const F=window.location.hash.slice(1);if(F&&F.startsWith("video/"))if(F.endsWith("/hd")){const we=F.replace("video/","").replace("/hd","");te(we),Ft(!0)}else{const we=F.replace("video/","");te(we),Ft(!1)}else if(F&&F.startsWith("folder/")){const we=F.replace("folder/","");Ce(we)}else F==="info"&&rn(!0);const ne=()=>{const we=window.location.hash.slice(1);if(!we)te(null),yt(null),rn(!1),Ft(!1),Ce(null);else if(we.startsWith("video/")){if(we.endsWith("/hd")){const Fe=we.replace("video/","").replace("/hd","");te(Fe),Ft(!0)}else{const Fe=we.replace("video/","");te(Fe),Ft(!1)}yt(null),rn(!1),Ce(null)}else we.startsWith("folder/")?(Ce(we.replace("folder/","")),te(null),yt(null),rn(!1),Ft(!1)):we==="info"&&(rn(!0),te(null),yt(null),Ce(null))};return window.addEventListener("hashchange",ne),()=>window.removeEventListener("hashchange",ne)},[]),V.useEffect(()=>{},[]);async function _t(){try{Zi(!0);const F=await gl();Kt(F)}catch(F){console.error("Error loading mangas:",F)}finally{Zi(!1)}}const xt=V.useMemo(()=>et==="flow"?je.filter(F=>!F.is_deleted):je.filter(F=>!F.is_deleted&&F.section===et),[je,et]),Mu=V.useMemo(()=>je.filter(F=>F.is_deleted),[je]),dp=V.useMemo(()=>{const F=new Map;return xt.forEach(ne=>{var de;(de=ne.categories)==null||de.forEach(we=>{F.has(we.id)||F.set(we.id,we)})}),Array.from(F.values())},[xt]),Is=V.useMemo(()=>rt.trim()?UA(xt.filter(F=>!F.is_folder).map(F=>({id:F.id,title:F.title,author:F.author,categories:F.categories?F.categories.map(ne=>ne.name):[]})),rt,{fuzzyMatch:!0,minChars:1}):{items:xt,query:"",resultCount:xt.length},[xt,rt]),vl=V.useMemo(()=>{let F=Is.items.length>0?Is.items.map(Ie=>xt.find(He=>He.id===Ie.id)).filter(Boolean):[];st.length>0&&(F=F.filter(Ie=>st.some(He=>{var ge;return(ge=Ie.categories)==null?void 0:ge.some(An=>An.name===He)}))),Yt.length>0&&(F=F.filter(Ie=>Yt.includes(Ie.author))),Nt&&(F=F.filter(Ie=>Ie.is_decensored)),At&&(F=F.filter(Ie=>Ie.is_bn)),$n&&(F=F.filter(Ie=>Ie.is_color));const ne=[...F],de=st.length>0||Yt.length>0||Nt||At||$n,we=rt.trim().length>0;let Fe;if(de)Fe=ne;else if(we){const Ie=new Set(ne.map(ge=>ge.id)),He=new Set;for(const ge of ne){let An=ge.folder_id,Gn=0;for(;An&&Gn<20;){He.add(An);const qn=xt.find(Ns=>Ns.id===An);if(qn)An=qn.folder_id;else break;Gn++}}Fe=xt.filter(ge=>(ge.folder_id&&xt.some(Gn=>Gn.id===ge.folder_id&&Gn.is_folder)?ge.folder_id:null)!==(ke||null)?!1:ge.is_folder?Ie.has(ge.id)||He.has(ge.id):Ie.has(ge.id))}else Fe=ne.filter(Ie=>(Ie.folder_id&&xt.some(ge=>ge.id===Ie.folder_id&&ge.is_folder)?Ie.folder_id:null)===(ke||null));let tt=Fe;return _e==="mangas"?tt=tt.filter(Ie=>!Ie.is_folder):_e==="folders"&&(tt=tt.filter(Ie=>Ie.is_folder)),lr==="random"?tt.sort(()=>Math.random()-.5):(tt.sort((Ie,He)=>{var An,Gn;let ge=0;if(lr==="name")ge=Ie.title.localeCompare(He.title);else if(lr==="date"){const qn=new Date(Ie.created_at||0).getTime(),Ns=new Date(He.created_at||0).getTime();ge=qn-Ns}else if(lr==="modified"){const qn=new Date(Ie.updated_at||Ie.created_at||0).getTime(),Ns=new Date(He.updated_at||He.created_at||0).getTime();ge=qn-Ns}else if(lr==="pages"){const qn=((An=Ie.chapters)==null?void 0:An.reduce((Jo,Tl)=>{var no;return Jo+(((no=Tl.pages)==null?void 0:no.length)||0)},0))||0,Ns=((Gn=He.chapters)==null?void 0:Gn.reduce((Jo,Tl)=>{var no;return Jo+(((no=Tl.pages)==null?void 0:no.length)||0)},0))||0;ge=qn-Ns}else lr==="views"&&(ge=(Ie.views||0)-(He.views||0));return Js==="asc"?ge:-ge}),tt)},[xt,rt,Is.items,lr,Js,st,Yt,ke,_e,Nt,At,$n]),Qo=F=>{c(F),e(!0)},wl=async F=>{try{await af(F),await _t()}catch(ne){console.error("Error deleting manga:",ne),he.error("Error al eliminar el manga. Por favor intenta de nuevo.")}},bl=async()=>{const F=/\s*\[\d+\]\s*$/,ne=je.filter(de=>F.test(de.title)).map(de=>{let we=de.title.replace(F,"").trim();return we||(we=de.title),{id:de.id,title:we}}).filter(de=>{var we;return de.title!==((we=je.find(Fe=>Fe.id===de.id))==null?void 0:we.title)});if(ne.length===0){he.info("No hay nombres con formato [ID] que requieran limpieza.");return}try{await mv(ne),he.success(`Se limpiaron ${ne.length} nombres correctamente.`),_t()}catch(de){console.error(de),he.error("Ocurrió un error al intentar limpiar los nombres.")}},to=()=>{let F=[];const ne=Fe=>{let tt=[];const Ie=xt.filter(He=>He.folder_id===Fe);for(const He of Ie)tt.push(He.id),He.is_folder&&(tt=tt.concat(ne(He.id)));return tt};vl.forEach(Fe=>{F.push(Fe.id),Fe.is_folder&&(F=F.concat(ne(Fe.id)))});const de=Array.from(new Set(F)),we=de.length>0&&de.every(Fe=>E.includes(Fe));y(we?[]:de)},Zr=F=>{const ne=xt.find(de=>de.id===F);if(ne){if(ne.is_folder){const de=tt=>{let Ie=[];const He=xt.filter(ge=>ge.folder_id===tt);for(const ge of He)Ie.push(ge.id),ge.is_folder&&(Ie=Ie.concat(de(ge.id)));return Ie},we=de(F),Fe=[F,...we];y(tt=>{if(tt.includes(F))return tt.filter(He=>!Fe.includes(He));{const He=[...tt];return Fe.forEach(ge=>{He.includes(ge)||He.push(ge)}),He}});return}y(de=>de.includes(F)?de.filter(we=>we!==F):[...de,F])}},Xo=F=>{if(d||m||g||$||J||ce||Ke||gt||le||Oe){Zr(F);return}const ne=xt.find(de=>de.id===F);if(ne!=null&&ne.is_folder){window.location.hash=`folder/${F}`;return}window.location.hash=`video/${F}`,te(F),Ft(!1)},Hn=()=>{window.location.hash="",te(null),rn(!1)},Lu=F=>{W&&Pe([...ve,W]),window.location.hash=`video/${F}`,te(F)},_l=F=>{Bt(ne=>ne.includes(F)?ne.filter(de=>de!==F):[...ne,F]),Hn()},Vu=F=>{Bt(ne=>ne.filter(de=>de!==F))},Sl=F=>{bt(ne=>ne.includes(F)?ne.filter(de=>de!==F):[...ne,F]),Hn()},El=F=>{bt(ne=>ne.filter(de=>de!==F))},Ou=V.useMemo(()=>vl.map(F=>{var we,Fe;const ne=((we=F.chapters)==null?void 0:we.length)||0,de=((Fe=F.chapters)==null?void 0:Fe.reduce((tt,Ie)=>{var He;return tt+(((He=Ie.pages)==null?void 0:He.length)||0)},0))||0;return{id:F.id,title:F.title,author:F.author,chapterCount:ne,pageCount:de,thumbnail:F.cover_url||F.thumbnail_url||void 0,manga:F}}),[vl]);if(Me)return u.jsx(Z$,{manga:Me.manga,chapter:Me.chapter,onBack:()=>yt(null)});if(zt)return u.jsx(HW,{onBack:Hn,isAdmin:o});if(W!==null){let F=je.find(ne=>ne.id===W);return ot&&F?u.jsx(DD,{manga:F,onBack:()=>{F&&(window.location.hash=`video/${F.id}`),Ft(!1)}}):u.jsx(J$,{id:W,allMangas:je,onBack:()=>{if(ve.length>0){const ne=ve[ve.length-1];Pe(ve.slice(0,-1)),window.location.hash=`video/${ne}`,te(ne)}else if(F!=null&&F.folder_id){const ne=je.find(de=>de.id===F.folder_id);ne!=null&&ne.is_folder?(window.location.hash=`folder/${F.folder_id}`,Ce(F.folder_id),te(null)):Hn()}else Hn()},onReadChapter:ne=>{F&&yt({manga:F,chapter:ne})},onMangaLoaded:ne=>{F||(F=ne)},onNavigateToManga:Lu,onSelectCategory:_l,onSelectAuthor:Sl,isAdmin:o})}return u.jsxs("div",{className:"min-h-screen bg-[#121212] text-white flex flex-col",children:[u.jsx("header",{className:"px-3 sm:px-6 md:px-12 py-4 sm:py-6 flex-shrink-0 transition-all duration-300",children:u.jsxs("div",{className:"max-w-[1800px] mx-auto flex items-center justify-between gap-2 sm:gap-0",children:[u.jsxs("div",{className:"flex items-center gap-1 sm:gap-3",children:[u.jsx(aK,{currentSection:et,onSectionChange:Bn}),u.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 group cursor-pointer",children:[u.jsx("img",{src:"/icons/icones.png",alt:"Twisted Brody Logo",className:"w-10 h-10 sm:w-14 sm:h-14 object-contain transition-all duration-300 group-hover:rotate-12 group-hover:scale-110"}),u.jsx("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-1 sm:gap-3",children:u.jsx("h1",{className:"text-base sm:text-2xl font-bold text-white transition-colors duration-300 group-hover:text-[#bb86fc] leading-tight",children:"Twisted Streaming Brody"})})]})]}),u.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-3",children:[(d||m||g||$||J||ce||Ke||gt||Oe)&&u.jsxs("div",{className:"hidden sm:flex items-center gap-2 mr-2 px-3 py-1.5 bg-purple-500/10 rounded-lg border border-purple-500/20",children:[u.jsx(Ra,{className:"w-4 h-4 text-purple-400"}),u.jsx("span",{className:"text-xs font-semibold text-purple-300",children:ce?"Modo Etiquetar Activo":gt?"Portal Plus Activo":Ke?"Colecciones Plus Activo":J?"Modo Nombres Activo":m?"Modo Copiar Activo":g?"Modo Eliminar Activo":$?"Modo Minus Activo":Oe?"Transferencia Activa":"Modo Plus Activo"}),u.jsx("span",{className:"text-xs bg-purple-500/20 px-2 py-0.5 rounded text-purple-200",children:E.length})]}),o&&u.jsxs(u.Fragment,{children:[u.jsxs("button",{onClick:()=>r(!0),className:"bg-gray-800 hover:bg-gray-700 active:scale-95 text-white px-2 py-2 sm:px-4 sm:py-2.5 rounded-lg flex items-center gap-1.5 sm:gap-2 font-semibold transition-all duration-300 border border-gray-700/50 hover:border-gray-600 text-xs sm:text-sm hover:scale-110 hover:shadow-lg hover:shadow-700/50",title:"Ajustes y Admin",children:[u.jsx(Qk,{className:"w-4 h-4 sm:w-5 sm:h-5 transition-transform duration-300 hover:rotate-180"}),u.jsx("span",{className:"hidden sm:inline",children:"Ajustes"})]}),u.jsxs("button",{onClick:()=>e(!0),className:"bg-purple-600 hover:bg-purple-700 active:scale-95 text-white px-2 py-2 sm:px-4 sm:py-2.5 rounded-lg flex items-center gap-1.5 sm:gap-2 font-semibold transition-all duration-300 shadow-lg shadow-purple-600/30 hover:shadow-purple-600/50 text-xs sm:text-sm hover:scale-110",children:[u.jsx(as,{className:"w-4 h-4 sm:w-5 sm:h-5 transition-transform duration-300 hover:rotate-180"}),u.jsx("span",{className:"hidden sm:inline",children:et==="patreon"?"Subir Imágenes":et==="onlyfans"?"Subir Only":et==="grok"?"Subir Grok":"Nuevo Video"})]})]})]})]})}),u.jsxs("main",{className:"flex-1 px-4 sm:px-6 md:px-12 pt-4 pb-8",children:[u.jsx(uU,{isAdmin:o}),u.jsxs("div",{className:"max-w-[1800px] mx-auto mb-8 flex-shrink-0",children:[u.jsx(lK,{value:rt,onChange:eo,placeholder:"Buscar...",sortType:lr,onSortTypeChange:Jr,sortDirection:Js,onSortDirectionChange:Du}),rt&&u.jsxs("div",{className:"mt-2 text-sm text-gray-400",children:[Is.resultCount," resultado",Is.resultCount!==1?"s":""," encontrado",Is.resultCount!==1?"s":""]}),(st.length>0||Yt.length>0||Nt||At||$n)&&u.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-2 animate-in fade-in slide-in-from-top-2 duration-300",children:[u.jsx("span",{className:"text-sm text-gray-400",children:"Filtrado por:"}),st.map(F=>u.jsxs("button",{onClick:()=>Vu(F),className:"bg-purple-500/20 hover:bg-purple-500/30 text-purple-300 px-3 py-1 rounded-full text-sm font-medium flex items-center gap-2 border border-purple-500/30 hover:border-purple-500/50 transition-all group",children:[F,u.jsx("div",{className:"bg-purple-500/20 rounded-full p-0.5 group-hover:bg-purple-500/40 transition-colors",children:u.jsx(as,{className:"w-3 h-3 transform rotate-45"})})]},F)),Yt.map(F=>u.jsxs("button",{onClick:()=>El(F),className:"bg-[#bb86fc]/20 hover:bg-[#bb86fc]/30 text-[#bb86fc] px-3 py-1 rounded-full text-sm font-medium flex items-center gap-2 border border-[#bb86fc]/30 hover:border-[#bb86fc]/50 transition-all group",children:[u.jsx(Xk,{size:14}),F,u.jsx("div",{className:"bg-[#bb86fc]/20 rounded-full p-0.5 group-hover:bg-[#bb86fc]/40 transition-colors",children:u.jsx(as,{className:"w-3 h-3 transform rotate-45"})})]},F)),Nt&&u.jsxs("button",{onClick:()=>{Un(!1),Hn()},className:"bg-purple-500/20 hover:bg-purple-500/30 text-purple-300 px-3 py-1 rounded-full text-sm font-medium flex items-center gap-2 border border-purple-500/30 hover:border-purple-500/50 transition-all group",children:["Sin censura",u.jsx("div",{className:"bg-purple-500/20 rounded-full p-0.5 group-hover:bg-purple-500/40 transition-colors",children:u.jsx(as,{className:"w-3 h-3 transform rotate-45"})})]}),At&&u.jsxs("button",{onClick:()=>{Qt(!1),Hn()},className:"bg-purple-500/20 hover:bg-purple-500/30 text-purple-300 px-3 py-1 rounded-full text-sm font-medium flex items-center gap-2 border border-purple-500/30 hover:border-purple-500/50 transition-all group",children:["B/N",u.jsx("div",{className:"bg-purple-500/20 rounded-full p-0.5 group-hover:bg-purple-500/40 transition-colors",children:u.jsx(as,{className:"w-3 h-3 transform rotate-45"})})]}),$n&&u.jsxs("button",{onClick:()=>{sn(!1),Hn()},className:"bg-purple-500/20 hover:bg-purple-500/30 text-purple-300 px-3 py-1 rounded-full text-sm font-medium flex items-center gap-2 border border-purple-500/30 hover:border-purple-500/50 transition-all group",children:["A color",u.jsx("div",{className:"bg-purple-500/20 rounded-full p-0.5 group-hover:bg-purple-500/40 transition-colors",children:u.jsx(as,{className:"w-3 h-3 transform rotate-45"})})]}),(st.length>0||Yt.length>0||Nt||At||$n)&&u.jsx("button",{onClick:()=>{Bt([]),bt([]),Un(!1),Qt(!1),sn(!1)},className:"text-xs text-gray-400 hover:text-white underline decoration-gray-600 hover:decoration-white transition-colors ml-2",children:"Limpiar todo"})]})]}),u.jsxs("div",{className:"max-w-[1800px] mx-auto",children:[ke&&(()=>{const F=je.find(ne=>ne.id===ke);return!F||!F.is_folder?null:u.jsxs("div",{className:"mb-6 flex items-center gap-4 bg-[#1a1a1a] p-4 rounded-xl border border-gray-800 animate-in slide-in-from-top-2",children:[u.jsx("button",{onClick:()=>{F.folder_id?window.location.hash=`folder/${F.folder_id}`:window.location.hash=""},className:"p-2 hover:bg-gray-800 rounded-lg text-white transition-colors",children:u.jsx(Nr,{className:"w-5 h-5"})}),u.jsx("div",{className:"w-10 h-10 rounded-lg bg-gray-800 flex items-center justify-center",children:!F.folder_id&&F.title.toLowerCase().includes("patreon")?u.jsx(hf,{className:"w-6 h-6 text-white"}):u.jsx(hr,{className:"w-6 h-6 text-purple-400"})}),u.jsxs("div",{children:[u.jsx("h2",{className:"text-xl font-bold text-white uppercase tracking-wider",children:F.title}),u.jsxs("p",{className:"text-sm text-gray-400",children:["Colección • ",xt.filter(ne=>ne.folder_id===F.id).length," elementos"]})]})]})})(),u.jsx(BA,{items:Ou,searchTerm:rt,isSearching:!1,isLoading:Cs,onSelectComic:Xo,onEditManga:o?Qo:void 0,onDeleteManga:o?wl:void 0,isCategoryPlusEnabled:d||m||g||$||J||ce||Ke||gt||le||Oe,selectedMangaIds:E,onToggleSelectManga:Zr,allMangas:xt,isFolderAnimationEnabled:se,currentSection:et})]})]}),(E.length>0||Ke||ke)&&u.jsx("div",{className:"fixed bottom-6 left-1/2 transform -translate-x-1/2 z-40 animate-in slide-in-from-bottom-4 duration-200",children:u.jsxs("div",{className:"bg-[#1a1a1a] border border-gray-700/50 shadow-2xl rounded-xl px-6 py-3 flex items-center gap-4",children:[u.jsxs("div",{className:"flex flex-col",children:[u.jsx("span",{className:"text-sm font-bold text-white",children:(()=>{const F=E.filter(we=>{var Fe;return(Fe=je.find(tt=>tt.id===we))==null?void 0:Fe.is_folder}).length,ne=E.length-F,de=[];return ne>0&&de.push(`${ne} manga${ne!==1?"s":""}`),F>0&&de.push(`${F} ${F!==1?"colecciones":"colección"}`),de.length>0?de.join(" y ")+" seleccionad"+(F>0&&ne===0?"as":"os"):"0 seleccionados"})()}),u.jsx("button",{onClick:to,className:"text-xs text-[#bb86fc] hover:text-white transition-colors text-left mt-0.5 underline decoration-[#bb86fc]/30 underline-offset-2",children:"Seleccionar todo"})]}),u.jsx("div",{className:"h-8 w-px bg-gray-700"}),u.jsxs("div",{className:"flex gap-2",children:[Ke||ke?u.jsx("div",{className:"flex items-center gap-2",children:u.jsx("button",{onClick:async()=>{if(E.length<2){he.error("Selecciona al menos 2 elementos para crear una colección");return}Y({isOpen:!0,title:"Crear Colección",message:`¿Seguro que quieres agrupar estos ${E.length} videos como partes de una colección?`,variant:"warning",onConfirm:async()=>{try{await PB(E),he.success("Colección creada y ordenada alfabéticamente."),y([]),_t()}catch{he.error("Error al crear la colección.")}}})},className:"bg-indigo-600 hover:bg-indigo-700 text-white px-4 py-2 rounded-lg text-sm font-bold shadow-lg shadow-indigo-500/20 transition-all transform hover:scale-105 active:scale-95",children:"Crear Colección"})}):gt?u.jsxs("button",{onClick:()=>Sr(!0),className:"bg-indigo-600 hover:bg-indigo-700 text-white px-4 py-2 rounded-lg text-sm font-bold shadow-lg shadow-indigo-500/20 transition-all transform hover:scale-105 active:scale-95 flex items-center gap-2",children:[u.jsx($k,{className:"w-4 h-4"}),"Mover de Sección"]}):d?u.jsx("button",{onClick:()=>_(!0),className:"bg-[#bb86fc] hover:bg-[#9966dd] text-white px-4 py-2 rounded-lg text-sm font-bold shadow-lg shadow-purple-500/20 transition-all transform hover:scale-105 active:scale-95",children:"Aplicar Categorías"}):ce?u.jsxs("button",{onClick:()=>C(!0),className:"bg-[#bb86fc] hover:bg-[#9966dd] text-white px-4 py-2 rounded-lg text-sm font-bold shadow-lg shadow-[#bb86fc]/20 transition-all transform hover:scale-105 active:scale-95 flex items-center gap-2",children:[u.jsx(Mg,{className:"w-4 h-4"}),"Etiquetar"]}):$?u.jsx("button",{onClick:()=>D(!0),className:"bg-orange-500 hover:bg-orange-600 text-white px-4 py-2 rounded-lg text-sm font-bold shadow-lg shadow-orange-500/20 transition-all transform hover:scale-105 active:scale-95",children:"Remover Categorías"}):J?u.jsxs("button",{onClick:()=>T(!0),className:"bg-pink-500 hover:bg-pink-600 text-white px-4 py-2 rounded-lg text-sm font-bold shadow-lg shadow-pink-500/20 transition-all transform hover:scale-105 active:scale-95 flex items-center gap-2",children:[u.jsx(jf,{className:"w-4 h-4"}),"Editar Nombres"]}):m?u.jsxs("button",{onClick:()=>{const F=E.filter(ne=>{var de;return!((de=je.find(we=>we.id===ne))!=null&&de.is_folder)});navigator.clipboard.writeText(F.join(", ")),he.success(`Se copiaron ${F.length} IDs`),y([])},className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg text-sm font-bold shadow-lg shadow-blue-500/20 transition-all transform hover:scale-105 active:scale-95 flex items-center gap-2",children:[u.jsx(Uk,{className:"w-4 h-4"}),"Copiar IDs"]}):g?u.jsx("button",{onClick:async()=>{Y({isOpen:!0,title:"Eliminar Selección",message:`¿Seguro que quieres eliminar ${E.length} elementos?`,variant:"danger",onConfirm:async()=>{try{for(const F of E)await af(F);he.success(`Se eliminaron ${E.length} elementos.`),y([]),_t()}catch{he.error("Error al eliminar")}}})},className:"bg-red-600 hover:bg-red-700 text-white px-4 py-2 rounded-lg text-sm font-bold shadow-lg shadow-red-500/20 transition-all transform hover:scale-105 active:scale-95",children:"Eliminar Selección"}):le?u.jsxs("button",{onClick:async()=>{const F=E.filter(ne=>{var de;return!((de=je.find(we=>we.id===ne))!=null&&de.is_folder)});if(F.length<2){he.error("Debes seleccionar al menos 2 mangas para unirlos (las colecciones son ignoradas).");return}Y({isOpen:!0,title:"Unir Mangas",message:`¿Seguro que quieres unir ${F.length} mangas en uno solo? Los originales serán eliminados.`,variant:"warning",onConfirm:async()=>{try{await bS(F),he.success(`Se fusionaron ${F.length} mangas correctamente.`),y([]),_t()}catch{he.error("Error al unir mangas")}}})},className:"bg-emerald-600 hover:bg-emerald-700 text-white px-4 py-2 rounded-lg text-sm font-bold shadow-lg shadow-emerald-500/20 transition-all transform hover:scale-105 active:scale-95 flex items-center gap-2",children:[u.jsx(bb,{className:"w-4 h-4"}),"Unir Mangas"]}):Oe?u.jsxs("button",{onClick:()=>{if(E.filter(ne=>{var de;return!((de=je.find(we=>we.id===ne))!=null&&de.is_folder)}).length!==2){he.error("Debes seleccionar exactamente 2 mangas para transferir páginas.");return}X(!0)},className:`bg-amber-600 hover:bg-amber-700 text-white px-4 py-2 rounded-lg text-sm font-bold shadow-lg shadow-amber-500/20 transition-all transform flex items-center gap-2 ${E.filter(F=>{var ne;return!((ne=je.find(de=>de.id===F))!=null&&ne.is_folder)}).length!==2?"opacity-50 cursor-not-allowed":"hover:scale-105 active:scale-95"}`,children:[u.jsx(Ra,{className:"w-4 h-4"}),"Transferir Páginas"]}):u.jsxs(u.Fragment,{children:[E.filter(F=>{var ne;return!((ne=je.find(de=>de.id===F))!=null&&ne.is_folder)}).length===2&&u.jsxs("button",{onClick:()=>X(!0),className:"bg-amber-600 hover:bg-amber-700 text-white px-4 py-2 rounded-lg text-sm font-bold shadow-lg shadow-amber-500/20 transition-all transform hover:scale-105 active:scale-95 flex items-center gap-2",children:[u.jsx(Ra,{className:"w-4 h-4"}),"Transferir Páginas"]}),E.filter(F=>{var ne;return!((ne=je.find(de=>de.id===F))!=null&&ne.is_folder)}).length>1&&u.jsxs("button",{onClick:async()=>{const F=E.filter(ne=>{var de;return!((de=je.find(we=>we.id===ne))!=null&&de.is_folder)});Y({isOpen:!0,title:"Unir Mangas",message:`¿Seguro que quieres unir ${F.length} mangas en uno solo? Los originales serán eliminados.`,variant:"warning",onConfirm:async()=>{try{await bS(F),he.success(`Se fusionaron ${F.length} mangas correctamente.`),y([]),_t()}catch{he.error("Error al unir mangas")}}})},className:"bg-emerald-600 hover:bg-emerald-700 text-white px-4 py-2 rounded-lg text-sm font-bold shadow-lg shadow-emerald-500/20 transition-all transform hover:scale-105 active:scale-95 flex items-center gap-2",children:[u.jsx(bb,{className:"w-4 h-4"}),"Unir Mangas"]})]}),E.length>0&&u.jsx("button",{onClick:()=>y([]),className:"text-gray-400 hover:text-white text-sm font-semibold transition-colors px-2",children:"Cancelar"})]})]})}),u.jsx(Df,{isAdmin:o,onOpenTrash:()=>B(!0)}),u.jsx(aU,{currentSection:et,isOpen:t,availableVideos:je,onClose:()=>{e(!1),c(null)},editingManga:l,onMangaCreated:F=>{_t(),c(null),F&&!l&&setTimeout(()=>{Xo(F)},500)},onDelete:o?wl:void 0},(l==null?void 0:l.id)||"new"),u.jsx(qW,{isOpen:v,onClose:()=>_(!1),selectedMangaIds:E,onSaveComplete:()=>{_t(),y([])}}),u.jsx(WW,{isOpen:P,onClose:()=>D(!1),selectedMangaIds:E,onSaveComplete:()=>{_t(),y([])}}),u.jsx(XW,{isOpen:k,onClose:()=>T(!1),mangas:je,selectedMangaIds:E,onSaveComplete:()=>{_t(),y([])}}),u.jsx(JW,{isOpen:w,onClose:()=>C(!1),selectedMangaIds:E,onSaveComplete:()=>{_t(),y([])}}),u.jsx(ZW,{isOpen:Ye,onClose:()=>or(!1),selectedMangaIds:E,onSaveComplete:()=>{_t(),y([])},currentFolderId:ke,currentSection:et}),u.jsx(eK,{isOpen:It,onClose:()=>ar(!1),selectedMangaIds:E,mangas:xt,onSaveComplete:()=>{_t(),y([])}}),u.jsx(rK,{isOpen:Ji,onClose:()=>Sr(!1),selectedMangaIds:E,currentSection:et,onSaveComplete:()=>{_t(),y([])}}),u.jsx(cU,{isOpen:n,onClose:()=>r(!1),isAdmin:o,onAdminChange:a,isCategoryPlusEnabled:d,onCategoryPlusChange:h,isCopyIdsEnabled:m,onCopyIdsChange:p,isDeletePlusEnabled:g,onDeletePlusChange:b,isCategoryMinusEnabled:$,onCategoryMinusChange:ee,isEditTitlePlusEnabled:J,onEditTitlePlusChange:ae,isEtiquetadoraEnabled:ce,onEtiquetadoraChange:Ze,isFolderPlusEnabled:Ke,onFolderPlusChange:F=>{Ct(F),F||y([])},isPortalPlusEnabled:gt,onPortalPlusChange:F=>{zn(F),F||y([])},isMergePlusEnabled:le,onMergePlusChange:F=>{xe(F),F||y([])},isTransferPlusEnabled:Oe,onTransferPlusChange:F=>{qe(F),F||y([])},isFolderAnimationEnabled:se,onFolderAnimationChange:M,onOpenTitleManager:()=>N(!0),onOpenFolderMap:()=>A(!0),onCleanKemonoTitles:()=>H(!0)}),u.jsx(QW,{isOpen:I,onClose:()=>N(!1),mangas:je,onSaveComplete:()=>_t()}),u.jsx(YW,{isOpen:s,onClose:()=>i(!1),categories:dp,selectedCategories:st,onToggleCategory:_l,onClearFilters:()=>{Bt([]),Un(!1),Qt(!1),sn(!1),Hn()},filterDecensored:Nt,setFilterDecensored:F=>{Un(F),Hn()},filterBN:At,setFilterBN:F=>{Qt(F),Hn()},filterColor:$n,setFilterColor:F=>{sn(F),Hn()}}),u.jsx(sK,{isOpen:j,onClose:()=>A(!1),mangas:xt}),u.jsx(TE,{isOpen:O,onClose:()=>H(!1),onConfirm:bl,title:"Limpiar IDs de Kemono",message:"¿Seguro que quieres eliminar las etiquetas [Numeros] del final de todos los mangas y colecciones? Esta acción se aplicará automáticamente a toda la base de datos.",confirmText:"Sí, limpiar nombres",cancelText:"Cancelar",variant:"warning"}),u.jsx(iK,{isOpen:z,onClose:()=>B(!1),deletedMangas:Mu,onRestore:async F=>{await EB(F),await _t()},onPermanentDelete:async F=>{await TB(F),await _t()}}),u.jsx(oK,{isOpen:q,onClose:()=>{X(!1),y([])},mangaIds:E.filter(F=>{var ne;return!((ne=je.find(de=>de.id===F))!=null&&ne.is_folder)}).slice(0,2),onSaveComplete:()=>{_t(),y([])}}),u.jsx(TE,{isOpen:R.isOpen,onClose:()=>Y(F=>({...F,isOpen:!1})),onConfirm:R.onConfirm,title:R.title,message:R.message,variant:R.variant}),u.jsx(oU,{position:"top-center",richColors:!0,theme:"dark"})]})}zk(document.getElementById("root")).render(u.jsx(V.StrictMode,{children:u.jsx(cK,{})})); diff --git a/dist/assets/index-B_R5IU3M.css b/dist/assets/index-B_R5IU3M.css new file mode 100644 index 0000000000000000000000000000000000000000..8095cad83f04d804df0dad2dffb0e390c7db921d --- /dev/null +++ b/dist/assets/index-B_R5IU3M.css @@ -0,0 +1 @@ +*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.visible{visibility:visible}.invisible{visibility:hidden}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.bottom-0{bottom:0}.bottom-2{bottom:.5rem}.bottom-6{bottom:1.5rem}.left-0{left:0}.left-1\.5{left:.375rem}.left-1\/2{left:50%}.left-2{left:.5rem}.left-3{left:.75rem}.left-4{left:1rem}.left-6{left:1.5rem}.right-0{right:0}.right-2{right:.5rem}.right-3{right:.75rem}.right-4{right:1rem}.right-6{right:1.5rem}.right-8{right:2rem}.top-0{top:0}.top-1\.5{top:.375rem}.top-1\/2{top:50%}.top-2{top:.5rem}.top-6{top:1.5rem}.top-8{top:2rem}.top-full{top:100%}.z-10{z-index:10}.z-20{z-index:20}.z-40{z-index:40}.z-50{z-index:50}.mx-1{margin-left:.25rem;margin-right:.25rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-auto{margin-left:auto;margin-right:auto}.my-1{margin-top:.25rem;margin-bottom:.25rem}.my-6{margin-top:1.5rem;margin-bottom:1.5rem}.my-8{margin-top:2rem;margin-bottom:2rem}.mb-0\.5{margin-bottom:.125rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-5{margin-bottom:1.25rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-2{margin-left:.5rem}.ml-auto{margin-left:auto}.mr-2{margin-right:.5rem}.mr-auto{margin-right:auto}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-2{margin-top:.5rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-8{margin-top:2rem}.mt-auto{margin-top:auto}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.block{display:block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.grid{display:grid}.hidden{display:none}.aspect-\[2\/3\]{aspect-ratio:2/3}.aspect-\[3\/4\]{aspect-ratio:3/4}.h-1{height:.25rem}.h-1\/3{height:33.333333%}.h-10{height:2.5rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-16{height:4rem}.h-2{height:.5rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-\[500px\]{height:500px}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.max-h-60{max-height:15rem}.max-h-\[80vh\]{max-height:80vh}.max-h-\[85vh\]{max-height:85vh}.max-h-\[90vh\]{max-height:90vh}.max-h-screen{max-height:100vh}.min-h-\[100px\]{min-height:100px}.min-h-\[300px\]{min-height:300px}.min-h-screen{min-height:100vh}.w-1{width:.25rem}.w-1\/2{width:50%}.w-1\/3{width:33.333333%}.w-10{width:2.5rem}.w-11{width:2.75rem}.w-12{width:3rem}.w-14{width:3.5rem}.w-16{width:4rem}.w-2{width:.5rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-3\/4{width:75%}.w-4{width:1rem}.w-5{width:1.25rem}.w-56{width:14rem}.w-6{width:1.5rem}.w-64{width:16rem}.w-7{width:1.75rem}.w-8{width:2rem}.w-\[300\%\]{width:300%}.w-full{width:100%}.w-max{width:-moz-max-content;width:max-content}.w-px{width:1px}.min-w-0{min-width:0px}.min-w-\[200px\]{min-width:200px}.min-w-\[3ch\]{min-width:3ch}.max-w-2xl{max-width:42rem}.max-w-4xl{max-width:56rem}.max-w-5xl{max-width:64rem}.max-w-7xl{max-width:80rem}.max-w-\[150px\]{max-width:150px}.max-w-\[1800px\]{max-width:1800px}.max-w-\[1920px\]{max-width:1920px}.max-w-\[200px\]{max-width:200px}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-none{max-width:none}.max-w-sm{max-width:24rem}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.flex-shrink-0{flex-shrink:0}.origin-left{transform-origin:left}.origin-right{transform-origin:right}.-translate-x-1\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-45{--tw-rotate: 45deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-100{--tw-scale-x: 1;--tw-scale-y: 1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-95{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform-gpu{transform:translate3d(var(--tw-translate-x),var(--tw-translate-y),0) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.animate-\[fadeIn_0\.7s_ease-out_forwards\]{animation:fadeIn .7s ease-out forwards}@keyframes bounce{0%,to{transform:translateY(-25%);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;animation-timing-function:cubic-bezier(0,0,.2,1)}}.animate-bounce{animation:bounce 1s infinite}@keyframes ping{75%,to{transform:scale(2);opacity:0}}.animate-ping{animation:ping 1s cubic-bezier(0,0,.2,1) infinite}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.cursor-move{cursor:move}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-none{resize:none}.resize{resize:both}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-3\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.875rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.875rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-xl{border-radius:.75rem}.rounded-r-lg{border-top-right-radius:.5rem;border-bottom-right-radius:.5rem}.border{border-width:1px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-l{border-left-width:1px}.border-l-4{border-left-width:4px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-\[\#bb86fc\]{--tw-border-opacity: 1;border-color:rgb(187 134 252 / var(--tw-border-opacity, 1))}.border-\[\#bb86fc\]\/30{border-color:#bb86fc4d}.border-\[\#bb86fc\]\/40{border-color:#bb86fc66}.border-\[\#bb86fc\]\/50{border-color:#bb86fc80}.border-blue-500\/30{border-color:#3b82f64d}.border-gray-500\/30{border-color:#6b72804d}.border-gray-600{--tw-border-opacity: 1;border-color:rgb(75 85 99 / var(--tw-border-opacity, 1))}.border-gray-600\/50{border-color:#4b556380}.border-gray-700{--tw-border-opacity: 1;border-color:rgb(55 65 81 / var(--tw-border-opacity, 1))}.border-gray-700\/30{border-color:#3741514d}.border-gray-700\/40{border-color:#37415166}.border-gray-700\/50{border-color:#37415180}.border-gray-700\/60{border-color:#37415199}.border-gray-800{--tw-border-opacity: 1;border-color:rgb(31 41 55 / var(--tw-border-opacity, 1))}.border-gray-800\/50{border-color:#1f293780}.border-green-500{--tw-border-opacity: 1;border-color:rgb(34 197 94 / var(--tw-border-opacity, 1))}.border-green-500\/30{border-color:#22c55e4d}.border-pink-500\/30{border-color:#ec48994d}.border-purple-500\/20{border-color:#a855f733}.border-purple-500\/30{border-color:#a855f74d}.border-purple-500\/50{border-color:#a855f780}.border-red-500\/20{border-color:#ef444433}.border-red-500\/30{border-color:#ef44444d}.border-transparent{border-color:transparent}.border-white\/50{border-color:#ffffff80}.border-t-transparent{border-top-color:transparent}.bg-\[\#050505\]{--tw-bg-opacity: 1;background-color:rgb(5 5 5 / var(--tw-bg-opacity, 1))}.bg-\[\#0a0a0a\]{--tw-bg-opacity: 1;background-color:rgb(10 10 10 / var(--tw-bg-opacity, 1))}.bg-\[\#0f0f0f\]{--tw-bg-opacity: 1;background-color:rgb(15 15 15 / var(--tw-bg-opacity, 1))}.bg-\[\#121212\]{--tw-bg-opacity: 1;background-color:rgb(18 18 18 / var(--tw-bg-opacity, 1))}.bg-\[\#121212\]\/90{background-color:#121212e6}.bg-\[\#151515\]{--tw-bg-opacity: 1;background-color:rgb(21 21 21 / var(--tw-bg-opacity, 1))}.bg-\[\#1a1a1a\]{--tw-bg-opacity: 1;background-color:rgb(26 26 26 / var(--tw-bg-opacity, 1))}.bg-\[\#1a1a1a\]\/50{background-color:#1a1a1a80}.bg-\[\#1f1f1f\]{--tw-bg-opacity: 1;background-color:rgb(31 31 31 / var(--tw-bg-opacity, 1))}.bg-\[\#252525\]{--tw-bg-opacity: 1;background-color:rgb(37 37 37 / var(--tw-bg-opacity, 1))}.bg-\[\#bb86fc\]{--tw-bg-opacity: 1;background-color:rgb(187 134 252 / var(--tw-bg-opacity, 1))}.bg-\[\#bb86fc\]\/10{background-color:#bb86fc1a}.bg-\[\#bb86fc\]\/20{background-color:#bb86fc33}.bg-\[\#bb86fc\]\/90{background-color:#bb86fce6}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-black\/30{background-color:#0000004d}.bg-black\/40{background-color:#0006}.bg-black\/50{background-color:#00000080}.bg-black\/60{background-color:#0009}.bg-black\/70{background-color:#000000b3}.bg-black\/80{background-color:#000c}.bg-black\/95{background-color:#000000f2}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.bg-blue-500\/10{background-color:#3b82f61a}.bg-blue-500\/20{background-color:#3b82f633}.bg-blue-600{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.bg-gray-500\/20{background-color:#6b728033}.bg-gray-600{--tw-bg-opacity: 1;background-color:rgb(75 85 99 / var(--tw-bg-opacity, 1))}.bg-gray-700{--tw-bg-opacity: 1;background-color:rgb(55 65 81 / var(--tw-bg-opacity, 1))}.bg-gray-700\/40{background-color:#37415166}.bg-gray-800{--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.bg-green-500\/10{background-color:#22c55e1a}.bg-green-500\/20{background-color:#22c55e33}.bg-green-600\/90{background-color:#16a34ae6}.bg-pink-500\/20{background-color:#ec489933}.bg-purple-500{--tw-bg-opacity: 1;background-color:rgb(168 85 247 / var(--tw-bg-opacity, 1))}.bg-purple-500\/10{background-color:#a855f71a}.bg-purple-500\/20{background-color:#a855f733}.bg-purple-600{--tw-bg-opacity: 1;background-color:rgb(147 51 234 / var(--tw-bg-opacity, 1))}.bg-purple-900\/90{background-color:#581c87e6}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-500\/10{background-color:#ef44441a}.bg-red-600{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.bg-red-600\/80{background-color:#dc2626cc}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-white\/10{background-color:#ffffff1a}.bg-white\/20{background-color:#fff3}.bg-gradient-to-b{background-image:linear-gradient(to bottom,var(--tw-gradient-stops))}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.bg-gradient-to-t{background-image:linear-gradient(to top,var(--tw-gradient-stops))}.from-\[\#1a1a1a\]{--tw-gradient-from: #1a1a1a var(--tw-gradient-from-position);--tw-gradient-to: rgb(26 26 26 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-\[\#1f1f1f\]{--tw-gradient-from: #1f1f1f var(--tw-gradient-from-position);--tw-gradient-to: rgb(31 31 31 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-\[\#1f1f1f\]\/80{--tw-gradient-from: rgb(31 31 31 / .8) var(--tw-gradient-from-position);--tw-gradient-to: rgb(31 31 31 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-\[\#242424\]{--tw-gradient-from: #242424 var(--tw-gradient-from-position);--tw-gradient-to: rgb(36 36 36 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-\[\#2a2a2a\]{--tw-gradient-from: #2a2a2a var(--tw-gradient-from-position);--tw-gradient-to: rgb(42 42 42 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-\[\#2a2a2a\]\/80{--tw-gradient-from: rgb(42 42 42 / .8) var(--tw-gradient-from-position);--tw-gradient-to: rgb(42 42 42 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-\[\#9966dd\]{--tw-gradient-from: #9966dd var(--tw-gradient-from-position);--tw-gradient-to: rgb(153 102 221 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-\[\#bb86fc\]{--tw-gradient-from: #bb86fc var(--tw-gradient-from-position);--tw-gradient-to: rgb(187 134 252 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-\[\#bb86fc\]\/20{--tw-gradient-from: rgb(187 134 252 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(187 134 252 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-black\/60{--tw-gradient-from: rgb(0 0 0 / .6) var(--tw-gradient-from-position);--tw-gradient-to: rgb(0 0 0 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-gray-700\/40{--tw-gradient-from: rgb(55 65 81 / .4) var(--tw-gradient-from-position);--tw-gradient-to: rgb(55 65 81 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-gray-800{--tw-gradient-from: #1f2937 var(--tw-gradient-from-position);--tw-gradient-to: rgb(31 41 55 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-transparent{--tw-gradient-from: transparent var(--tw-gradient-from-position);--tw-gradient-to: rgb(0 0 0 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-white{--tw-gradient-from: #fff var(--tw-gradient-from-position);--tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.via-\[\#9966dd\]{--tw-gradient-to: rgb(153 102 221 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), #9966dd var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-white\/20{--tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), rgb(255 255 255 / .2) var(--tw-gradient-via-position), var(--tw-gradient-to)}.to-\[\#0f0f0f\]{--tw-gradient-to: #0f0f0f var(--tw-gradient-to-position)}.to-\[\#121212\]{--tw-gradient-to: #121212 var(--tw-gradient-to-position)}.to-\[\#1a1a1a\]{--tw-gradient-to: #1a1a1a var(--tw-gradient-to-position)}.to-\[\#1a1a1a\]\/80{--tw-gradient-to: rgb(26 26 26 / .8) var(--tw-gradient-to-position)}.to-\[\#1f1f1f\]{--tw-gradient-to: #1f1f1f var(--tw-gradient-to-position)}.to-\[\#1f1f1f\]\/80{--tw-gradient-to: rgb(31 31 31 / .8) var(--tw-gradient-to-position)}.to-\[\#252525\]{--tw-gradient-to: #252525 var(--tw-gradient-to-position)}.to-\[\#7744cc\]{--tw-gradient-to: #7744cc var(--tw-gradient-to-position)}.to-\[\#9966dd\]{--tw-gradient-to: #9966dd var(--tw-gradient-to-position)}.to-\[\#bb86fc\]{--tw-gradient-to: #bb86fc var(--tw-gradient-to-position)}.to-gray-400{--tw-gradient-to: #9ca3af var(--tw-gradient-to-position)}.to-gray-600\/40{--tw-gradient-to: rgb(75 85 99 / .4) var(--tw-gradient-to-position)}.to-gray-900{--tw-gradient-to: #111827 var(--tw-gradient-to-position)}.to-transparent{--tw-gradient-to: transparent var(--tw-gradient-to-position)}.bg-clip-text{-webkit-background-clip:text;background-clip:text}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.object-left{-o-object-position:left;object-position:left}.object-right{-o-object-position:right;object-position:right}.p-0\.5{padding:.125rem}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-2{padding:.5rem}.p-2\.5{padding:.625rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-0{padding-left:0;padding-right:0}.px-1{padding-left:.25rem;padding-right:.25rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-8{padding-left:2rem;padding-right:2rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-16{padding-top:4rem;padding-bottom:4rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-20{padding-top:5rem;padding-bottom:5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-2{padding-bottom:.5rem}.pb-8{padding-bottom:2rem}.pl-10{padding-left:2.5rem}.pl-2{padding-left:.5rem}.pl-3{padding-left:.75rem}.pl-4{padding-left:1rem}.pr-10{padding-right:2.5rem}.pr-3{padding-right:.75rem}.pr-4{padding-right:1rem}.pt-2{padding-top:.5rem}.pt-4{padding-top:1rem}.pt-6{padding-top:1.5rem}.pt-8{padding-top:2rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-\[10px\]{font-size:10px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.italic{font-style:italic}.leading-relaxed{line-height:1.625}.tracking-wide{letter-spacing:.025em}.tracking-wider{letter-spacing:.05em}.text-\[\#bb86fc\]{--tw-text-opacity: 1;color:rgb(187 134 252 / var(--tw-text-opacity, 1))}.text-blue-300{--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.text-gray-200{--tw-text-opacity: 1;color:rgb(229 231 235 / var(--tw-text-opacity, 1))}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-green-300{--tw-text-opacity: 1;color:rgb(134 239 172 / var(--tw-text-opacity, 1))}.text-green-400{--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.text-pink-300{--tw-text-opacity: 1;color:rgb(249 168 212 / var(--tw-text-opacity, 1))}.text-pink-400{--tw-text-opacity: 1;color:rgb(244 114 182 / var(--tw-text-opacity, 1))}.text-purple-100{--tw-text-opacity: 1;color:rgb(243 232 255 / var(--tw-text-opacity, 1))}.text-purple-200{--tw-text-opacity: 1;color:rgb(233 213 255 / var(--tw-text-opacity, 1))}.text-purple-300{--tw-text-opacity: 1;color:rgb(216 180 254 / var(--tw-text-opacity, 1))}.text-purple-400{--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-transparent{color:transparent}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-white\/40{color:#fff6}.text-white\/70{color:#ffffffb3}.underline{text-decoration-line:underline}.no-underline{text-decoration-line:none}.decoration-gray-600{text-decoration-color:#4b5563}.placeholder-gray-400::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(156 163 175 / var(--tw-placeholder-opacity, 1))}.placeholder-gray-400::placeholder{--tw-placeholder-opacity: 1;color:rgb(156 163 175 / var(--tw-placeholder-opacity, 1))}.placeholder-gray-500::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(107 114 128 / var(--tw-placeholder-opacity, 1))}.placeholder-gray-500::placeholder{--tw-placeholder-opacity: 1;color:rgb(107 114 128 / var(--tw-placeholder-opacity, 1))}.placeholder-gray-600::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(75 85 99 / var(--tw-placeholder-opacity, 1))}.placeholder-gray-600::placeholder{--tw-placeholder-opacity: 1;color:rgb(75 85 99 / var(--tw-placeholder-opacity, 1))}.accent-\[\#bb86fc\]{accent-color:#bb86fc}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\[0_0_15px_-3px_rgba\(168\,85\,247\,0\.3\)\]{--tw-shadow: 0 0 15px -3px rgba(168,85,247,.3);--tw-shadow-colored: 0 0 15px -3px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-inner{--tw-shadow: inset 0 2px 4px 0 rgb(0 0 0 / .05);--tw-shadow-colored: inset 0 2px 4px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\[\#bb86fc\]\/10{--tw-shadow-color: rgb(187 134 252 / .1);--tw-shadow: var(--tw-shadow-colored)}.shadow-\[\#bb86fc\]\/20{--tw-shadow-color: rgb(187 134 252 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-\[\#bb86fc\]\/30{--tw-shadow-color: rgb(187 134 252 / .3);--tw-shadow: var(--tw-shadow-colored)}.shadow-\[\#bb86fc\]\/40{--tw-shadow-color: rgb(187 134 252 / .4);--tw-shadow: var(--tw-shadow-colored)}.shadow-black\/50{--tw-shadow-color: rgb(0 0 0 / .5);--tw-shadow: var(--tw-shadow-colored)}.shadow-blue-500\/20{--tw-shadow-color: rgb(59 130 246 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-green-500\/40{--tw-shadow-color: rgb(34 197 94 / .4);--tw-shadow: var(--tw-shadow-colored)}.shadow-purple-500\/20{--tw-shadow-color: rgb(168 85 247 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-purple-600\/30{--tw-shadow-color: rgb(147 51 234 / .3);--tw-shadow: var(--tw-shadow-colored)}.shadow-purple-900\/20{--tw-shadow-color: rgb(88 28 135 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-red-500\/20{--tw-shadow-color: rgb(239 68 68 / .2);--tw-shadow: var(--tw-shadow-colored)}.ring-4{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-\[\#bb86fc\]{--tw-ring-opacity: 1;--tw-ring-color: rgb(187 134 252 / var(--tw-ring-opacity, 1))}.blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-md{--tw-backdrop-blur: blur(12px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-none{transition-property:none}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-1000{transition-duration:1s}.duration-150{transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}.duration-700{transition-duration:.7s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.ease-linear{transition-timing-function:linear}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}@keyframes fadeIn{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}@keyframes fadeOut{0%{opacity:1}to{opacity:0}}@keyframes fadeInUp{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}@keyframes quickFadeIn{0%{opacity:0;transform:scale(.98)}to{opacity:1;transform:scale(1)}}.animate-quick-fade-in{animation:quickFadeIn .15s ease-out forwards}@keyframes smoothFadeIn{0%{opacity:0;transform:scale(.98)}50%{opacity:.5}to{opacity:1;transform:scale(1)}}.animate-smooth-fade-in{animation:smoothFadeIn 1.2s ease-out forwards}.masonry-container{-moz-column-count:2;column-count:2;-moz-column-gap:4px;column-gap:4px}@media (min-width: 640px){.masonry-container{-moz-column-count:3;column-count:3}}@media (min-width: 768px){.masonry-container{-moz-column-count:4;column-count:4}}@media (min-width: 1024px){.masonry-container{-moz-column-count:5;column-count:5}}@media (min-width: 1280px){.masonry-container{-moz-column-count:6;column-count:6}}@keyframes shimmer{0%{background-position:-1000px 0}to{background-position:1000px 0}}.animate-shimmer{animation:shimmer 2.5s infinite}.masonry-item{-moz-column-break-inside:avoid;break-inside:avoid;margin-bottom:4px;display:inline-block;width:100%}@keyframes slideInUp{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}@keyframes slideInDown{0%{opacity:0;transform:translateY(-20px)}to{opacity:1;transform:translateY(0)}}@keyframes slideInLeft{0%{opacity:0;transform:translate(-20px)}to{opacity:1;transform:translate(0)}}@keyframes slideInRight{0%{opacity:0;transform:translate(20px)}to{opacity:1;transform:translate(0)}}@keyframes glow{0%,to{box-shadow:0 0 5px #8b5cf61a}50%{box-shadow:0 0 20px #8b5cf64d}}@keyframes pulse-color{0%,to{color:currentColor}50%{color:#8b5cf699}}.animate-slide-in-up{animation:slideInUp .5s ease-out forwards}.animate-slide-in-down{animation:slideInDown .5s ease-out forwards}.animate-slide-in-left{animation:slideInLeft .5s ease-out forwards}.animate-slide-in-right{animation:slideInRight .5s ease-out forwards}.animate-glow{animation:glow 2s ease-in-out infinite}.animate-pulse-color{animation:pulse-color 2s ease-in-out infinite}.after\:absolute:after{content:var(--tw-content);position:absolute}.after\:left-\[2px\]:after{content:var(--tw-content);left:2px}.after\:top-\[2px\]:after{content:var(--tw-content);top:2px}.after\:h-5:after{content:var(--tw-content);height:1.25rem}.after\:w-5:after{content:var(--tw-content);width:1.25rem}.after\:rounded-full:after{content:var(--tw-content);border-radius:9999px}.after\:border:after{content:var(--tw-content);border-width:1px}.after\:border-gray-300:after{content:var(--tw-content);--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.after\:bg-white:after{content:var(--tw-content);--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.after\:transition-all:after{content:var(--tw-content);transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.after\:content-\[\'\'\]:after{--tw-content: "";content:var(--tw-content)}.hover\:rotate-180:hover{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:rotate-90:hover{--tw-rotate: 90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:scale-105:hover{--tw-scale-x: 1.05;--tw-scale-y: 1.05;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:scale-110:hover{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:scale-125:hover{--tw-scale-x: 1.25;--tw-scale-y: 1.25;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:scale-\[1\.02\]:hover{--tw-scale-x: 1.02;--tw-scale-y: 1.02;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:border-\[\#24A1DE\]:hover{--tw-border-opacity: 1;border-color:rgb(36 161 222 / var(--tw-border-opacity, 1))}.hover\:border-\[\#FF424D\]:hover{--tw-border-opacity: 1;border-color:rgb(255 66 77 / var(--tw-border-opacity, 1))}.hover\:border-\[\#bb86fc\]:hover{--tw-border-opacity: 1;border-color:rgb(187 134 252 / var(--tw-border-opacity, 1))}.hover\:border-\[\#bb86fc\]\/50:hover{border-color:#bb86fc80}.hover\:border-gray-500:hover{--tw-border-opacity: 1;border-color:rgb(107 114 128 / var(--tw-border-opacity, 1))}.hover\:border-gray-600:hover{--tw-border-opacity: 1;border-color:rgb(75 85 99 / var(--tw-border-opacity, 1))}.hover\:border-gray-600\/70:hover{border-color:#4b5563b3}.hover\:border-gray-700:hover{--tw-border-opacity: 1;border-color:rgb(55 65 81 / var(--tw-border-opacity, 1))}.hover\:border-gray-700\/60:hover{border-color:#37415199}.hover\:border-purple-500:hover{--tw-border-opacity: 1;border-color:rgb(168 85 247 / var(--tw-border-opacity, 1))}.hover\:border-purple-500\/50:hover{border-color:#a855f780}.hover\:border-red-500\/40:hover{border-color:#ef444466}.hover\:border-white:hover{--tw-border-opacity: 1;border-color:rgb(255 255 255 / var(--tw-border-opacity, 1))}.hover\:bg-\[\#1f1f1f\]:hover{--tw-bg-opacity: 1;background-color:rgb(31 31 31 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#242424\]:hover{--tw-bg-opacity: 1;background-color:rgb(36 36 36 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#2a2a2a\]:hover{--tw-bg-opacity: 1;background-color:rgb(42 42 42 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#333\]:hover{--tw-bg-opacity: 1;background-color:rgb(51 51 51 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#9966dd\]:hover{--tw-bg-opacity: 1;background-color:rgb(153 102 221 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#bb86fc\]:hover{--tw-bg-opacity: 1;background-color:rgb(187 134 252 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#bb86fc\]\/10:hover{background-color:#bb86fc1a}.hover\:bg-\[\#bb86fc\]\/20:hover{background-color:#bb86fc33}.hover\:bg-\[\#bb86fc\]\/30:hover{background-color:#bb86fc4d}.hover\:bg-\[\#bb86fc\]\/5:hover{background-color:#bb86fc0d}.hover\:bg-blue-700:hover{--tw-bg-opacity: 1;background-color:rgb(29 78 216 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-700:hover{--tw-bg-opacity: 1;background-color:rgb(55 65 81 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-800:hover{--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.hover\:bg-purple-500\/30:hover{background-color:#a855f74d}.hover\:bg-purple-600:hover{--tw-bg-opacity: 1;background-color:rgb(147 51 234 / var(--tw-bg-opacity, 1))}.hover\:bg-purple-700:hover{--tw-bg-opacity: 1;background-color:rgb(126 34 206 / var(--tw-bg-opacity, 1))}.hover\:bg-red-500\/20:hover{background-color:#ef444433}.hover\:bg-red-600:hover{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.hover\:bg-red-700:hover{--tw-bg-opacity: 1;background-color:rgb(185 28 28 / var(--tw-bg-opacity, 1))}.hover\:bg-white\/10:hover{background-color:#ffffff1a}.hover\:bg-white\/20:hover{background-color:#fff3}.hover\:bg-white\/5:hover{background-color:#ffffff0d}.hover\:from-\[\#9966dd\]:hover{--tw-gradient-from: #9966dd var(--tw-gradient-from-position);--tw-gradient-to: rgb(153 102 221 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.hover\:from-gray-700\/60:hover{--tw-gradient-from: rgb(55 65 81 / .6) var(--tw-gradient-from-position);--tw-gradient-to: rgb(55 65 81 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.hover\:to-\[\#7744cc\]:hover{--tw-gradient-to: #7744cc var(--tw-gradient-to-position)}.hover\:to-gray-600\/60:hover{--tw-gradient-to: rgb(75 85 99 / .6) var(--tw-gradient-to-position)}.hover\:text-\[\#24A1DE\]:hover{--tw-text-opacity: 1;color:rgb(36 161 222 / var(--tw-text-opacity, 1))}.hover\:text-\[\#FF424D\]:hover{--tw-text-opacity: 1;color:rgb(255 66 77 / var(--tw-text-opacity, 1))}.hover\:text-\[\#bb86fc\]:hover{--tw-text-opacity: 1;color:rgb(187 134 252 / var(--tw-text-opacity, 1))}.hover\:text-purple-400:hover{--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.hover\:text-red-400:hover{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.hover\:text-white:hover{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:decoration-white:hover{text-decoration-color:#fff}.hover\:opacity-100:hover{opacity:1}.hover\:opacity-80:hover{opacity:.8}.hover\:shadow-lg:hover{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-\[\#bb86fc\]\/60:hover{--tw-shadow-color: rgb(187 134 252 / .6);--tw-shadow: var(--tw-shadow-colored)}.hover\:shadow-purple-500\/10:hover{--tw-shadow-color: rgb(168 85 247 / .1);--tw-shadow: var(--tw-shadow-colored)}.hover\:shadow-purple-500\/20:hover{--tw-shadow-color: rgb(168 85 247 / .2);--tw-shadow: var(--tw-shadow-colored)}.hover\:shadow-purple-600\/50:hover{--tw-shadow-color: rgb(147 51 234 / .5);--tw-shadow: var(--tw-shadow-colored)}.focus\:border-\[\#bb86fc\]:focus{--tw-border-opacity: 1;border-color:rgb(187 134 252 / var(--tw-border-opacity, 1))}.focus\:border-purple-500:focus{--tw-border-opacity: 1;border-color:rgb(168 85 247 / var(--tw-border-opacity, 1))}.focus\:border-purple-500\/50:focus{border-color:#a855f780}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-\[\#bb86fc\]:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(187 134 252 / var(--tw-ring-opacity, 1))}.focus\:ring-\[\#bb86fc\]\/30:focus{--tw-ring-color: rgb(187 134 252 / .3)}.focus\:ring-purple-500\/50:focus{--tw-ring-color: rgb(168 85 247 / .5)}.active\:scale-95:active{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.disabled\:hover\:bg-\[\#1a1a1a\]:hover:disabled{--tw-bg-opacity: 1;background-color:rgb(26 26 26 / var(--tw-bg-opacity, 1))}.group:hover .group-hover\:-translate-x-1{--tw-translate-x: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:rotate-12{--tw-rotate: 12deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:scale-110{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:scale-\[1\.08\]{--tw-scale-x: 1.08;--tw-scale-y: 1.08;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:scale-\[1\.10\]{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:bg-\[\#bb86fc\]\/40{background-color:#bb86fc66}.group:hover .group-hover\:bg-purple-500\/40{background-color:#a855f766}.group:hover .group-hover\:text-\[\#bb86fc\]{--tw-text-opacity: 1;color:rgb(187 134 252 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-purple-400{--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-white\/60{color:#fff9}.group:hover .group-hover\:opacity-100{opacity:1}.group:hover .group-hover\:shadow-\[\#bb86fc\]\/30{--tw-shadow-color: rgb(187 134 252 / .3);--tw-shadow: var(--tw-shadow-colored)}.group:hover .group-hover\:shadow-\[\#bb86fc\]\/60{--tw-shadow-color: rgb(187 134 252 / .6);--tw-shadow: var(--tw-shadow-colored)}.peer:checked~.peer-checked\:bg-\[\#bb86fc\]{--tw-bg-opacity: 1;background-color:rgb(187 134 252 / var(--tw-bg-opacity, 1))}.peer:checked~.peer-checked\:bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.peer:checked~.peer-checked\:bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.peer:checked~.peer-checked\:after\:translate-x-full:after{content:var(--tw-content);--tw-translate-x: 100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.peer:checked~.peer-checked\:after\:border-white:after{content:var(--tw-content);--tw-border-opacity: 1;border-color:rgb(255 255 255 / var(--tw-border-opacity, 1))}.peer:focus~.peer-focus\:outline-none{outline:2px solid transparent;outline-offset:2px}.peer:focus~.peer-focus\:ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.peer:focus~.peer-focus\:ring-blue-300{--tw-ring-opacity: 1;--tw-ring-color: rgb(147 197 253 / var(--tw-ring-opacity, 1))}.peer:focus~.peer-focus\:ring-purple-300{--tw-ring-opacity: 1;--tw-ring-color: rgb(216 180 254 / var(--tw-ring-opacity, 1))}.peer:focus~.peer-focus\:ring-red-300{--tw-ring-opacity: 1;--tw-ring-color: rgb(252 165 165 / var(--tw-ring-opacity, 1))}@media (min-width: 640px){.sm\:left-8{left:2rem}.sm\:right-8{right:2rem}.sm\:mx-0{margin-left:0;margin-right:0}.sm\:mb-4{margin-bottom:1rem}.sm\:mb-6{margin-bottom:1.5rem}.sm\:mt-12{margin-top:3rem}.sm\:mt-2{margin-top:.5rem}.sm\:mt-8{margin-top:2rem}.sm\:inline-block{display:inline-block}.sm\:inline{display:inline}.sm\:flex{display:flex}.sm\:hidden{display:none}.sm\:h-10{height:2.5rem}.sm\:h-14{height:3.5rem}.sm\:h-4{height:1rem}.sm\:h-5{height:1.25rem}.sm\:w-10{width:2.5rem}.sm\:w-14{width:3.5rem}.sm\:w-4{width:1rem}.sm\:w-5{width:1.25rem}.sm\:w-64{width:16rem}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:gap-0{gap:0px}.sm\:gap-1\.5{gap:.375rem}.sm\:gap-2{gap:.5rem}.sm\:gap-3{gap:.75rem}.sm\:gap-4{gap:1rem}.sm\:gap-6{gap:1.5rem}.sm\:p-12{padding:3rem}.sm\:p-2{padding:.5rem}.sm\:p-4{padding:1rem}.sm\:p-6{padding:1.5rem}.sm\:px-10{padding-left:2.5rem;padding-right:2.5rem}.sm\:px-3{padding-left:.75rem;padding-right:.75rem}.sm\:px-4{padding-left:1rem;padding-right:1rem}.sm\:px-6{padding-left:1.5rem;padding-right:1.5rem}.sm\:py-2{padding-top:.5rem;padding-bottom:.5rem}.sm\:py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.sm\:py-4{padding-top:1rem;padding-bottom:1rem}.sm\:py-6{padding-top:1.5rem;padding-bottom:1.5rem}.sm\:py-8{padding-top:2rem;padding-bottom:2rem}.sm\:pt-12{padding-top:3rem}.sm\:pt-8{padding-top:2rem}.sm\:text-2xl{font-size:1.5rem;line-height:2rem}.sm\:text-4xl{font-size:2.25rem;line-height:2.5rem}.sm\:text-lg{font-size:1.125rem;line-height:1.75rem}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}}@media (min-width: 768px){.md\:absolute{position:absolute}.md\:right-8{right:2rem}.md\:flex{display:flex}.md\:hidden{display:none}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:gap-3{gap:.75rem}.md\:p-12{padding:3rem}.md\:px-12{padding-left:3rem;padding-right:3rem}}@media (min-width: 1024px){.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.lg\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}}@media (min-width: 1280px){.xl\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.xl\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}}@media (min-width: 1536px){.\32xl\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}}@media (prefers-color-scheme: dark){.dark\:border-gray-600{--tw-border-opacity: 1;border-color:rgb(75 85 99 / var(--tw-border-opacity, 1))}.dark\:bg-gray-700{--tw-bg-opacity: 1;background-color:rgb(55 65 81 / var(--tw-bg-opacity, 1))}.peer:focus~.dark\:peer-focus\:ring-blue-800{--tw-ring-opacity: 1;--tw-ring-color: rgb(30 64 175 / var(--tw-ring-opacity, 1))}.peer:focus~.dark\:peer-focus\:ring-purple-800{--tw-ring-opacity: 1;--tw-ring-color: rgb(107 33 168 / var(--tw-ring-opacity, 1))}.peer:focus~.dark\:peer-focus\:ring-red-800{--tw-ring-opacity: 1;--tw-ring-color: rgb(153 27 27 / var(--tw-ring-opacity, 1))}} diff --git a/dist/assets/index-BmVodIQq.js b/dist/assets/index-BmVodIQq.js new file mode 100644 index 0000000000000000000000000000000000000000..6aeb0674720434a388204648171b1579bc6b262a --- /dev/null +++ b/dist/assets/index-BmVodIQq.js @@ -0,0 +1,3558 @@ +(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();var Hu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Fc(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ww={exports:{}},Uc={},_w={exports:{}},Le={};/** + * @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 ml=Symbol.for("react.element"),CT=Symbol.for("react.portal"),NT=Symbol.for("react.fragment"),AT=Symbol.for("react.strict_mode"),PT=Symbol.for("react.profiler"),RT=Symbol.for("react.provider"),DT=Symbol.for("react.context"),jT=Symbol.for("react.forward_ref"),LT=Symbol.for("react.suspense"),OT=Symbol.for("react.memo"),MT=Symbol.for("react.lazy"),Ay=Symbol.iterator;function VT(t){return t===null||typeof t!="object"?null:(t=Ay&&t[Ay]||t["@@iterator"],typeof t=="function"?t:null)}var bw={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Ew=Object.assign,Sw={};function jo(t,e,n){this.props=t,this.context=e,this.refs=Sw,this.updater=n||bw}jo.prototype.isReactComponent={};jo.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=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,t,e,"setState")};jo.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function Tw(){}Tw.prototype=jo.prototype;function Dp(t,e,n){this.props=t,this.context=e,this.refs=Sw,this.updater=n||bw}var jp=Dp.prototype=new Tw;jp.constructor=Dp;Ew(jp,jo.prototype);jp.isPureReactComponent=!0;var Py=Array.isArray,Iw=Object.prototype.hasOwnProperty,Lp={current:null},kw={key:!0,ref:!0,__self:!0,__source:!0};function Cw(t,e,n){var r,i={},s=null,o=null;if(e!=null)for(r in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(s=""+e.key),e)Iw.call(e,r)&&!kw.hasOwnProperty(r)&&(i[r]=e[r]);var a=arguments.length-2;if(a===1)i.children=n;else if(1>>1,_e=G[pe];if(0>>1;pei(Y,A))re<_e&&0>i(Ce,Y)?(G[pe]=Ce,G[re]=A,pe=re):(G[pe]=Y,G[$]=A,pe=$);else if(re<_e&&0>i(Ce,A))G[pe]=Ce,G[re]=A,pe=re;else break e}}return se}function i(G,se){var A=G.sortIndex-se.sortIndex;return A!==0?A:G.id-se.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();t.unstable_now=function(){return o.now()-a}}var u=[],c=[],h=1,f=null,p=3,g=!1,_=!1,T=!1,R=typeof setTimeout=="function"?setTimeout:null,y=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function k(G){for(var se=n(c);se!==null;){if(se.callback===null)r(c);else if(se.startTime<=G)r(c),se.sortIndex=se.expirationTime,e(u,se);else break;se=n(c)}}function L(G){if(T=!1,k(G),!_)if(n(u)!==null)_=!0,fe(U);else{var se=n(c);se!==null&&we(L,se.startTime-G)}}function U(G,se){_=!1,T&&(T=!1,y(x),x=-1),g=!0;var A=p;try{for(k(se),f=n(u);f!==null&&(!(f.expirationTime>se)||G&&!N());){var pe=f.callback;if(typeof pe=="function"){f.callback=null,p=f.priorityLevel;var _e=pe(f.expirationTime<=se);se=t.unstable_now(),typeof _e=="function"?f.callback=_e:f===n(u)&&r(u),k(se)}else r(u);f=n(u)}if(f!==null)var P=!0;else{var $=n(c);$!==null&&we(L,$.startTime-se),P=!1}return P}finally{f=null,p=A,g=!1}}var j=!1,b=null,x=-1,E=5,I=-1;function N(){return!(t.unstable_now()-IG||125pe?(G.sortIndex=A,e(c,G),n(u)===null&&G===n(c)&&(T?(y(x),x=-1):T=!0,we(L,A-pe))):(G.sortIndex=_e,e(u,G),_||g||(_=!0,fe(U))),G},t.unstable_shouldYield=N,t.unstable_wrapCallback=function(G){var se=p;return function(){var A=p;p=se;try{return G.apply(this,arguments)}finally{p=A}}}})(Dw);Rw.exports=Dw;var QT=Rw.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 YT=F,Fn=QT;function X(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Qh=Object.prototype.hasOwnProperty,XT=/^[: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]*$/,Dy={},jy={};function JT(t){return Qh.call(jy,t)?!0:Qh.call(Dy,t)?!1:XT.test(t)?jy[t]=!0:(Dy[t]=!0,!1)}function ZT(t,e,n,r){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function eI(t,e,n,r){if(e===null||typeof e>"u"||ZT(t,e,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function fn(t,e,n,r,i,s,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=s,this.removeEmptyString=o}var Qt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Qt[t]=new fn(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Qt[e]=new fn(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Qt[t]=new fn(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Qt[t]=new fn(t,2,!1,t,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(t){Qt[t]=new fn(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Qt[t]=new fn(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Qt[t]=new fn(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Qt[t]=new fn(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Qt[t]=new fn(t,5,!1,t.toLowerCase(),null,!1,!1)});var Mp=/[\-:]([a-z])/g;function Vp(t){return t[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(t){var e=t.replace(Mp,Vp);Qt[e]=new fn(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(Mp,Vp);Qt[e]=new fn(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(Mp,Vp);Qt[e]=new fn(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Qt[t]=new fn(t,1,!1,t.toLowerCase(),null,!1,!1)});Qt.xlinkHref=new fn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Qt[t]=new fn(t,1,!1,t.toLowerCase(),null,!0,!0)});function Fp(t,e,n,r){var i=Qt.hasOwnProperty(e)?Qt[e]:null;(i!==null?i.type!==0:r||!(2a||i[o]!==s[a]){var u=` +`+i[o].replace(" at new "," at ");return t.displayName&&u.includes("")&&(u=u.replace("",t.displayName)),u}while(1<=o&&0<=a);break}}}finally{Jd=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?fa(t):""}function tI(t){switch(t.tag){case 5:return fa(t.type);case 16:return fa("Lazy");case 13:return fa("Suspense");case 19:return fa("SuspenseList");case 0:case 2:case 15:return t=Zd(t.type,!1),t;case 11:return t=Zd(t.type.render,!1),t;case 1:return t=Zd(t.type,!0),t;default:return""}}function Zh(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case qs:return"Fragment";case Hs:return"Portal";case Yh:return"Profiler";case Up:return"StrictMode";case Xh:return"Suspense";case Jh:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case Ow:return(t.displayName||"Context")+".Consumer";case Lw:return(t._context.displayName||"Context")+".Provider";case zp:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Bp:return e=t.displayName||null,e!==null?e:Zh(t.type)||"Memo";case fi:e=t._payload,t=t._init;try{return Zh(t(e))}catch{}}return null}function nI(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Zh(e);case 8:return e===Up?"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 e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function Oi(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Vw(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function rI(t){var e=Vw(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,s=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,s.call(this,o)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function Wl(t){t._valueTracker||(t._valueTracker=rI(t))}function Fw(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=Vw(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function qu(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function ef(t,e){var n=e.checked;return pt({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function Oy(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=Oi(e.value!=null?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function Uw(t,e){e=e.checked,e!=null&&Fp(t,"checked",e,!1)}function tf(t,e){Uw(t,e);var n=Oi(e.value),r=e.type;if(n!=null)r==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?nf(t,e.type,n):e.hasOwnProperty("defaultValue")&&nf(t,e.type,Oi(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function My(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function nf(t,e,n){(e!=="number"||qu(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var pa=Array.isArray;function io(t,e,n,r){if(t=t.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=Gl.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Ua(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var _a={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},iI=["Webkit","ms","Moz","O"];Object.keys(_a).forEach(function(t){iI.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),_a[e]=_a[t]})});function Hw(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||_a.hasOwnProperty(t)&&_a[t]?(""+e).trim():e+"px"}function qw(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=Hw(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,i):t[n]=i}}var sI=pt({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 of(t,e){if(e){if(sI[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(X(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(X(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(X(61))}if(e.style!=null&&typeof e.style!="object")throw Error(X(62))}}function af(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){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 lf=null;function $p(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var uf=null,so=null,oo=null;function Uy(t){if(t=vl(t)){if(typeof uf!="function")throw Error(X(280));var e=t.stateNode;e&&(e=qc(e),uf(t.stateNode,t.type,e))}}function Ww(t){so?oo?oo.push(t):oo=[t]:so=t}function Gw(){if(so){var t=so,e=oo;if(oo=so=null,Uy(t),e)for(t=0;t>>=0,t===0?32:31-(gI(t)/yI|0)|0}var Kl=64,Ql=4194304;function ma(t){switch(t&-t){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 t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Qu(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,i=t.suspendedLanes,s=t.pingedLanes,o=n&268435455;if(o!==0){var a=o&~i;a!==0?r=ma(a):(s&=o,s!==0&&(r=ma(s)))}else o=n&~i,o!==0?r=ma(o):s!==0&&(r=ma(s));if(r===0)return 0;if(e!==0&&e!==r&&!(e&i)&&(i=r&-r,s=e&-e,i>=s||i===16&&(s&4194240)!==0))return e;if(r&4&&(r|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0n;n++)e.push(t);return e}function gl(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-or(e),t[e]=n}function _I(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var r=t.eventTimes;for(t=t.expirationTimes;0=Ea),Qy=" ",Yy=!1;function f_(t,e){switch(t){case"keyup":return QI.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function p_(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Ws=!1;function XI(t,e){switch(t){case"compositionend":return p_(e);case"keypress":return e.which!==32?null:(Yy=!0,Qy);case"textInput":return t=e.data,t===Qy&&Yy?null:t;default:return null}}function JI(t,e){if(Ws)return t==="compositionend"||!Xp&&f_(t,e)?(t=d_(),Eu=Kp=wi=null,Ws=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=e0(n)}}function v_(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?v_(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function x_(){for(var t=window,e=qu();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=qu(t.document)}return e}function Jp(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function ak(t){var e=x_(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&v_(n.ownerDocument.documentElement,n)){if(r!==null&&Jp(n)){if(e=r.start,t=r.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var i=n.textContent.length,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!t.extend&&s>r&&(i=r,r=s,s=i),i=t0(n,s);var o=t0(n,r);i&&o&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==o.node||t.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),s>r?(t.addRange(e),t.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Gs=null,mf=null,Ta=null,gf=!1;function n0(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;gf||Gs==null||Gs!==qu(r)||(r=Gs,"selectionStart"in r&&Jp(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Ta&&Wa(Ta,r)||(Ta=r,r=Ju(mf,"onSelect"),0Ys||(t.current=bf[Ys],bf[Ys]=null,Ys--)}function rt(t,e){Ys++,bf[Ys]=t.current,t.current=e}var Mi={},sn=Wi(Mi),En=Wi(!1),ys=Mi;function xo(t,e){var n=t.type.contextTypes;if(!n)return Mi;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in n)i[s]=e[s];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function Sn(t){return t=t.childContextTypes,t!=null}function ec(){lt(En),lt(sn)}function u0(t,e,n){if(sn.current!==Mi)throw Error(X(168));rt(sn,e),rt(En,n)}function C_(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in e))throw Error(X(108,nI(t)||"Unknown",i));return pt({},n,r)}function tc(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Mi,ys=sn.current,rt(sn,t),rt(En,En.current),!0}function c0(t,e,n){var r=t.stateNode;if(!r)throw Error(X(169));n?(t=C_(t,e,ys),r.__reactInternalMemoizedMergedChildContext=t,lt(En),lt(sn),rt(sn,t)):lt(En),rt(En,n)}var Or=null,Wc=!1,fh=!1;function N_(t){Or===null?Or=[t]:Or.push(t)}function xk(t){Wc=!0,N_(t)}function Gi(){if(!fh&&Or!==null){fh=!0;var t=0,e=Ke;try{var n=Or;for(Ke=1;t>=o,i-=o,Vr=1<<32-or(e)+i|n<x?(E=b,b=null):E=b.sibling;var I=p(y,b,k[x],L);if(I===null){b===null&&(b=E);break}t&&b&&I.alternate===null&&e(y,b),w=s(I,w,x),j===null?U=I:j.sibling=I,j=I,b=E}if(x===k.length)return n(y,b),ct&&rs(y,x),U;if(b===null){for(;xx?(E=b,b=null):E=b.sibling;var N=p(y,b,I.value,L);if(N===null){b===null&&(b=E);break}t&&b&&N.alternate===null&&e(y,b),w=s(N,w,x),j===null?U=N:j.sibling=N,j=N,b=E}if(I.done)return n(y,b),ct&&rs(y,x),U;if(b===null){for(;!I.done;x++,I=k.next())I=f(y,I.value,L),I!==null&&(w=s(I,w,x),j===null?U=I:j.sibling=I,j=I);return ct&&rs(y,x),U}for(b=r(y,b);!I.done;x++,I=k.next())I=g(b,y,x,I.value,L),I!==null&&(t&&I.alternate!==null&&b.delete(I.key===null?x:I.key),w=s(I,w,x),j===null?U=I:j.sibling=I,j=I);return t&&b.forEach(function(D){return e(y,D)}),ct&&rs(y,x),U}function R(y,w,k,L){if(typeof k=="object"&&k!==null&&k.type===qs&&k.key===null&&(k=k.props.children),typeof k=="object"&&k!==null){switch(k.$$typeof){case ql:e:{for(var U=k.key,j=w;j!==null;){if(j.key===U){if(U=k.type,U===qs){if(j.tag===7){n(y,j.sibling),w=i(j,k.props.children),w.return=y,y=w;break e}}else if(j.elementType===U||typeof U=="object"&&U!==null&&U.$$typeof===fi&&f0(U)===j.type){n(y,j.sibling),w=i(j,k.props),w.ref=oa(y,j,k),w.return=y,y=w;break e}n(y,j);break}else e(y,j);j=j.sibling}k.type===qs?(w=hs(k.props.children,y.mode,L,k.key),w.return=y,y=w):(L=Pu(k.type,k.key,k.props,null,y.mode,L),L.ref=oa(y,w,k),L.return=y,y=L)}return o(y);case Hs:e:{for(j=k.key;w!==null;){if(w.key===j)if(w.tag===4&&w.stateNode.containerInfo===k.containerInfo&&w.stateNode.implementation===k.implementation){n(y,w.sibling),w=i(w,k.children||[]),w.return=y,y=w;break e}else{n(y,w);break}else e(y,w);w=w.sibling}w=_h(k,y.mode,L),w.return=y,y=w}return o(y);case fi:return j=k._init,R(y,w,j(k._payload),L)}if(pa(k))return _(y,w,k,L);if(ta(k))return T(y,w,k,L);nu(y,k)}return typeof k=="string"&&k!==""||typeof k=="number"?(k=""+k,w!==null&&w.tag===6?(n(y,w.sibling),w=i(w,k),w.return=y,y=w):(n(y,w),w=wh(k,y.mode,L),w.return=y,y=w),o(y)):n(y,w)}return R}var _o=D_(!0),j_=D_(!1),ic=Wi(null),sc=null,Zs=null,nm=null;function rm(){nm=Zs=sc=null}function im(t){var e=ic.current;lt(ic),t._currentValue=e}function Tf(t,e,n){for(;t!==null;){var r=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),t===n)break;t=t.return}}function lo(t,e){sc=t,nm=Zs=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(bn=!0),t.firstContext=null)}function Yn(t){var e=t._currentValue;if(nm!==t)if(t={context:t,memoizedValue:e,next:null},Zs===null){if(sc===null)throw Error(X(308));Zs=t,sc.dependencies={lanes:0,firstContext:t}}else Zs=Zs.next=t;return e}var ls=null;function sm(t){ls===null?ls=[t]:ls.push(t)}function L_(t,e,n,r){var i=e.interleaved;return i===null?(n.next=n,sm(e)):(n.next=i.next,i.next=n),e.interleaved=n,Gr(t,r)}function Gr(t,e){t.lanes|=e;var n=t.alternate;for(n!==null&&(n.lanes|=e),n=t,t=t.return;t!==null;)t.childLanes|=e,n=t.alternate,n!==null&&(n.childLanes|=e),n=t,t=t.return;return n.tag===3?n.stateNode:null}var pi=!1;function om(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function O_(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function Br(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function Ci(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,ze&2){var i=r.pending;return i===null?e.next=e:(e.next=i.next,i.next=e),r.pending=e,Gr(t,n)}return i=r.interleaved,i===null?(e.next=e,sm(r)):(e.next=i.next,i.next=e),r.interleaved=e,Gr(t,n)}function Tu(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,qp(t,n)}}function p0(t,e){var n=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?i=s=o:s=s.next=o,n=n.next}while(n!==null);s===null?i=s=e:s=s.next=e}else i=s=e;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:r.shared,effects:r.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function oc(t,e,n,r){var i=t.updateQueue;pi=!1;var s=i.firstBaseUpdate,o=i.lastBaseUpdate,a=i.shared.pending;if(a!==null){i.shared.pending=null;var u=a,c=u.next;u.next=null,o===null?s=c:o.next=c,o=u;var h=t.alternate;h!==null&&(h=h.updateQueue,a=h.lastBaseUpdate,a!==o&&(a===null?h.firstBaseUpdate=c:a.next=c,h.lastBaseUpdate=u))}if(s!==null){var f=i.baseState;o=0,h=c=u=null,a=s;do{var p=a.lane,g=a.eventTime;if((r&p)===p){h!==null&&(h=h.next={eventTime:g,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var _=t,T=a;switch(p=e,g=n,T.tag){case 1:if(_=T.payload,typeof _=="function"){f=_.call(g,f,p);break e}f=_;break e;case 3:_.flags=_.flags&-65537|128;case 0:if(_=T.payload,p=typeof _=="function"?_.call(g,f,p):_,p==null)break e;f=pt({},f,p);break e;case 2:pi=!0}}a.callback!==null&&a.lane!==0&&(t.flags|=64,p=i.effects,p===null?i.effects=[a]:p.push(a))}else g={eventTime:g,lane:p,tag:a.tag,payload:a.payload,callback:a.callback,next:null},h===null?(c=h=g,u=f):h=h.next=g,o|=p;if(a=a.next,a===null){if(a=i.shared.pending,a===null)break;p=a,a=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(!0);if(h===null&&(u=f),i.baseState=u,i.firstBaseUpdate=c,i.lastBaseUpdate=h,e=i.shared.interleaved,e!==null){i=e;do o|=i.lane,i=i.next;while(i!==e)}else s===null&&(i.shared.lanes=0);ws|=o,t.lanes=o,t.memoizedState=f}}function m0(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;en?n:4,t(!0);var r=mh.transition;mh.transition={};try{t(!1),e()}finally{Ke=n,mh.transition=r}}function Z_(){return Xn().memoizedState}function Ek(t,e,n){var r=Ai(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},e1(t))t1(e,n);else if(n=L_(t,e,n,r),n!==null){var i=dn();ar(n,t,r,i),n1(n,e,r)}}function Sk(t,e,n){var r=Ai(t),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(e1(t))t1(e,i);else{var s=t.alternate;if(t.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var o=e.lastRenderedState,a=s(o,n);if(i.hasEagerState=!0,i.eagerState=a,ur(a,o)){var u=e.interleaved;u===null?(i.next=i,sm(e)):(i.next=u.next,u.next=i),e.interleaved=i;return}}catch{}finally{}n=L_(t,e,i,r),n!==null&&(i=dn(),ar(n,t,r,i),n1(n,e,r))}}function e1(t){var e=t.alternate;return t===ft||e!==null&&e===ft}function t1(t,e){Ia=lc=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function n1(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,qp(t,n)}}var uc={readContext:Yn,useCallback:Jt,useContext:Jt,useEffect:Jt,useImperativeHandle:Jt,useInsertionEffect:Jt,useLayoutEffect:Jt,useMemo:Jt,useReducer:Jt,useRef:Jt,useState:Jt,useDebugValue:Jt,useDeferredValue:Jt,useTransition:Jt,useMutableSource:Jt,useSyncExternalStore:Jt,useId:Jt,unstable_isNewReconciler:!1},Tk={readContext:Yn,useCallback:function(t,e){return mr().memoizedState=[t,e===void 0?null:e],t},useContext:Yn,useEffect:y0,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,ku(4194308,4,K_.bind(null,e,t),n)},useLayoutEffect:function(t,e){return ku(4194308,4,t,e)},useInsertionEffect:function(t,e){return ku(4,2,t,e)},useMemo:function(t,e){var n=mr();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=mr();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=Ek.bind(null,ft,t),[r.memoizedState,t]},useRef:function(t){var e=mr();return t={current:t},e.memoizedState=t},useState:g0,useDebugValue:pm,useDeferredValue:function(t){return mr().memoizedState=t},useTransition:function(){var t=g0(!1),e=t[0];return t=bk.bind(null,t[1]),mr().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=ft,i=mr();if(ct){if(n===void 0)throw Error(X(407));n=n()}else{if(n=e(),$t===null)throw Error(X(349));xs&30||U_(r,e,n)}i.memoizedState=n;var s={value:n,getSnapshot:e};return i.queue=s,y0(B_.bind(null,r,s,t),[t]),r.flags|=2048,el(9,z_.bind(null,r,s,n,e),void 0,null),n},useId:function(){var t=mr(),e=$t.identifierPrefix;if(ct){var n=Fr,r=Vr;n=(r&~(1<<32-or(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=Ja++,0<\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=o.createElement(n,{is:r.is}):(t=o.createElement(n),n==="select"&&(o=t,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):t=o.createElementNS(t,n),t[vr]=e,t[Qa]=r,h1(t,e,!1,!1),e.stateNode=t;e:{switch(o=af(n,r),n){case"dialog":at("cancel",t),at("close",t),i=r;break;case"iframe":case"object":case"embed":at("load",t),i=r;break;case"video":case"audio":for(i=0;iSo&&(e.flags|=128,r=!0,aa(s,!1),e.lanes=4194304)}else{if(!r)if(t=ac(o),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),aa(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!ct)return Zt(e),null}else 2*Et()-s.renderingStartTime>So&&n!==1073741824&&(e.flags|=128,r=!0,aa(s,!1),e.lanes=4194304);s.isBackwards?(o.sibling=e.child,e.child=o):(n=s.last,n!==null?n.sibling=o:e.child=o,s.last=o)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=Et(),e.sibling=null,n=ht.current,rt(ht,r?n&1|2:n&1),e):(Zt(e),null);case 22:case 23:return wm(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?jn&1073741824&&(Zt(e),e.subtreeFlags&6&&(e.flags|=8192)):Zt(e),null;case 24:return null;case 25:return null}throw Error(X(156,e.tag))}function Dk(t,e){switch(em(e),e.tag){case 1:return Sn(e.type)&&ec(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return bo(),lt(En),lt(sn),um(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return lm(e),null;case 13:if(lt(ht),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(X(340));wo()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return lt(ht),null;case 4:return bo(),null;case 10:return im(e.type._context),null;case 22:case 23:return wm(),null;case 24:return null;default:return null}}var iu=!1,nn=!1,jk=typeof WeakSet=="function"?WeakSet:Set,ce=null;function eo(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){yt(t,e,r)}else n.current=null}function jf(t,e,n){try{n()}catch(r){yt(t,e,r)}}var C0=!1;function Lk(t,e){if(yf=Yu,t=x_(),Jp(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var o=0,a=-1,u=-1,c=0,h=0,f=t,p=null;t:for(;;){for(var g;f!==n||i!==0&&f.nodeType!==3||(a=o+i),f!==s||r!==0&&f.nodeType!==3||(u=o+r),f.nodeType===3&&(o+=f.nodeValue.length),(g=f.firstChild)!==null;)p=f,f=g;for(;;){if(f===t)break t;if(p===n&&++c===i&&(a=o),p===s&&++h===r&&(u=o),(g=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=g}n=a===-1||u===-1?null:{start:a,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(vf={focusedElem:t,selectionRange:n},Yu=!1,ce=e;ce!==null;)if(e=ce,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,ce=t;else for(;ce!==null;){e=ce;try{var _=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(_!==null){var T=_.memoizedProps,R=_.memoizedState,y=e.stateNode,w=y.getSnapshotBeforeUpdate(e.elementType===e.type?T:er(e.type,T),R);y.__reactInternalSnapshotBeforeUpdate=w}break;case 3:var k=e.stateNode.containerInfo;k.nodeType===1?k.textContent="":k.nodeType===9&&k.documentElement&&k.removeChild(k.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(X(163))}}catch(L){yt(e,e.return,L)}if(t=e.sibling,t!==null){t.return=e.return,ce=t;break}ce=e.return}return _=C0,C0=!1,_}function ka(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&t)===t){var s=i.destroy;i.destroy=void 0,s!==void 0&&jf(e,n,s)}i=i.next}while(i!==r)}}function Qc(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function Lf(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function m1(t){var e=t.alternate;e!==null&&(t.alternate=null,m1(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[vr],delete e[Qa],delete e[_f],delete e[yk],delete e[vk])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function g1(t){return t.tag===5||t.tag===3||t.tag===4}function N0(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||g1(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Of(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=Zu));else if(r!==4&&(t=t.child,t!==null))for(Of(t,e,n),t=t.sibling;t!==null;)Of(t,e,n),t=t.sibling}function Mf(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(Mf(t,e,n),t=t.sibling;t!==null;)Mf(t,e,n),t=t.sibling}var qt=null,tr=!1;function ci(t,e,n){for(n=n.child;n!==null;)y1(t,e,n),n=n.sibling}function y1(t,e,n){if(wr&&typeof wr.onCommitFiberUnmount=="function")try{wr.onCommitFiberUnmount(zc,n)}catch{}switch(n.tag){case 5:nn||eo(n,e);case 6:var r=qt,i=tr;qt=null,ci(t,e,n),qt=r,tr=i,qt!==null&&(tr?(t=qt,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):qt.removeChild(n.stateNode));break;case 18:qt!==null&&(tr?(t=qt,n=n.stateNode,t.nodeType===8?hh(t.parentNode,n):t.nodeType===1&&hh(t,n),Ha(t)):hh(qt,n.stateNode));break;case 4:r=qt,i=tr,qt=n.stateNode.containerInfo,tr=!0,ci(t,e,n),qt=r,tr=i;break;case 0:case 11:case 14:case 15:if(!nn&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&jf(n,e,o),i=i.next}while(i!==r)}ci(t,e,n);break;case 1:if(!nn&&(eo(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){yt(n,e,a)}ci(t,e,n);break;case 21:ci(t,e,n);break;case 22:n.mode&1?(nn=(r=nn)||n.memoizedState!==null,ci(t,e,n),nn=r):ci(t,e,n);break;default:ci(t,e,n)}}function A0(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new jk),e.forEach(function(r){var i=Hk.bind(null,t,r);n.has(r)||(n.add(r),r.then(i,i))})}}function Zn(t,e){var n=e.deletions;if(n!==null)for(var r=0;ri&&(i=o),r&=~s}if(r=i,r=Et()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Mk(r/1960))-r,10t?16:t,_i===null)var r=!1;else{if(t=_i,_i=null,hc=0,ze&6)throw Error(X(331));var i=ze;for(ze|=4,ce=t.current;ce!==null;){var s=ce,o=s.child;if(ce.flags&16){var a=s.deletions;if(a!==null){for(var u=0;uEt()-vm?ds(t,0):ym|=n),Tn(t,e)}function T1(t,e){e===0&&(t.mode&1?(e=Ql,Ql<<=1,!(Ql&130023424)&&(Ql=4194304)):e=1);var n=dn();t=Gr(t,e),t!==null&&(gl(t,e,n),Tn(t,n))}function $k(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),T1(t,n)}function Hk(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,i=t.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(X(314))}r!==null&&r.delete(e),T1(t,n)}var I1;I1=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||En.current)bn=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return bn=!1,Pk(t,e,n);bn=!!(t.flags&131072)}else bn=!1,ct&&e.flags&1048576&&A_(e,rc,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;Cu(t,e),t=e.pendingProps;var i=xo(e,sn.current);lo(e,n),i=dm(null,e,r,t,i,n);var s=hm();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Sn(r)?(s=!0,tc(e)):s=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,om(e),i.updater=Kc,e.stateNode=i,i._reactInternals=e,kf(e,r,t,n),e=Af(null,e,r,!0,s,n)):(e.tag=0,ct&&s&&Zp(e),cn(null,e,i,n),e=e.child),e;case 16:r=e.elementType;e:{switch(Cu(t,e),t=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=Wk(r),t=er(r,t),i){case 0:e=Nf(null,e,r,t,n);break e;case 1:e=T0(null,e,r,t,n);break e;case 11:e=E0(null,e,r,t,n);break e;case 14:e=S0(null,e,r,er(r.type,t),n);break e}throw Error(X(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:er(r,i),Nf(t,e,r,i,n);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:er(r,i),T0(t,e,r,i,n);case 3:e:{if(u1(e),t===null)throw Error(X(387));r=e.pendingProps,s=e.memoizedState,i=s.element,O_(t,e),oc(e,r,null,n);var o=e.memoizedState;if(r=o.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){i=Eo(Error(X(423)),e),e=I0(t,e,r,n,i);break e}else if(r!==i){i=Eo(Error(X(424)),e),e=I0(t,e,r,n,i);break e}else for(Ln=ki(e.stateNode.containerInfo.firstChild),Vn=e,ct=!0,nr=null,n=j_(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(wo(),r===i){e=Kr(t,e,n);break e}cn(t,e,r,n)}e=e.child}return e;case 5:return M_(e),t===null&&Sf(e),r=e.type,i=e.pendingProps,s=t!==null?t.memoizedProps:null,o=i.children,xf(r,i)?o=null:s!==null&&xf(r,s)&&(e.flags|=32),l1(t,e),cn(t,e,o,n),e.child;case 6:return t===null&&Sf(e),null;case 13:return c1(t,e,n);case 4:return am(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=_o(e,null,r,n):cn(t,e,r,n),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:er(r,i),E0(t,e,r,i,n);case 7:return cn(t,e,e.pendingProps,n),e.child;case 8:return cn(t,e,e.pendingProps.children,n),e.child;case 12:return cn(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,i=e.pendingProps,s=e.memoizedProps,o=i.value,rt(ic,r._currentValue),r._currentValue=o,s!==null)if(ur(s.value,o)){if(s.children===i.children&&!En.current){e=Kr(t,e,n);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var u=a.firstContext;u!==null;){if(u.context===r){if(s.tag===1){u=Br(-1,n&-n),u.tag=2;var c=s.updateQueue;if(c!==null){c=c.shared;var h=c.pending;h===null?u.next=u:(u.next=h.next,h.next=u),c.pending=u}}s.lanes|=n,u=s.alternate,u!==null&&(u.lanes|=n),Tf(s.return,n,e),a.lanes|=n;break}u=u.next}}else if(s.tag===10)o=s.type===e.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(X(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),Tf(o,n,e),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===e){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}cn(t,e,i.children,n),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,lo(e,n),i=Yn(i),r=r(i),e.flags|=1,cn(t,e,r,n),e.child;case 14:return r=e.type,i=er(r,e.pendingProps),i=er(r.type,i),S0(t,e,r,i,n);case 15:return o1(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:er(r,i),Cu(t,e),e.tag=1,Sn(r)?(t=!0,tc(e)):t=!1,lo(e,n),r1(e,r,i),kf(e,r,i,n),Af(null,e,r,!0,t,n);case 19:return d1(t,e,n);case 22:return a1(t,e,n)}throw Error(X(156,e.tag))};function k1(t,e){return e_(t,e)}function qk(t,e,n,r){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Wn(t,e,n,r){return new qk(t,e,n,r)}function bm(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Wk(t){if(typeof t=="function")return bm(t)?1:0;if(t!=null){if(t=t.$$typeof,t===zp)return 11;if(t===Bp)return 14}return 2}function Pi(t,e){var n=t.alternate;return n===null?(n=Wn(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function Pu(t,e,n,r,i,s){var o=2;if(r=t,typeof t=="function")bm(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case qs:return hs(n.children,i,s,e);case Up:o=8,i|=8;break;case Yh:return t=Wn(12,n,e,i|2),t.elementType=Yh,t.lanes=s,t;case Xh:return t=Wn(13,n,e,i),t.elementType=Xh,t.lanes=s,t;case Jh:return t=Wn(19,n,e,i),t.elementType=Jh,t.lanes=s,t;case Mw:return Xc(n,i,s,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case Lw:o=10;break e;case Ow:o=9;break e;case zp:o=11;break e;case Bp:o=14;break e;case fi:o=16,r=null;break e}throw Error(X(130,t==null?t:typeof t,""))}return e=Wn(o,n,e,i),e.elementType=t,e.type=r,e.lanes=s,e}function hs(t,e,n,r){return t=Wn(7,t,r,e),t.lanes=n,t}function Xc(t,e,n,r){return t=Wn(22,t,r,e),t.elementType=Mw,t.lanes=n,t.stateNode={isHidden:!1},t}function wh(t,e,n){return t=Wn(6,t,null,e),t.lanes=n,t}function _h(t,e,n){return e=Wn(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function Gk(t,e,n,r,i){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=th(0),this.expirationTimes=th(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=th(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function Em(t,e,n,r,i,s,o,a,u){return t=new Gk(t,e,n,a,u),e===1?(e=1,s===!0&&(e|=8)):e=0,s=Wn(3,null,null,e),t.current=s,s.stateNode=t,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},om(s),t}function Kk(t,e,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(P1)}catch(t){console.error(t)}}P1(),Pw.exports=Un;var R1=Pw.exports;const Zk=Fc(R1);var D1,V0=R1;D1=V0.createRoot,V0.hydrateRoot;/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */var e2={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"};/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const t2=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),Re=(t,e)=>{const n=F.forwardRef(({color:r="currentColor",size:i=24,strokeWidth:s=2,absoluteStrokeWidth:o,className:a="",children:u,...c},h)=>F.createElement("svg",{ref:h,...e2,width:i,height:i,stroke:r,strokeWidth:o?Number(s)*24/Number(i):s,className:["lucide",`lucide-${t2(t)}`,a].join(" "),...c},[...e.map(([f,p])=>F.createElement(f,p)),...Array.isArray(u)?u:[u]]));return n.displayName=`${t}`,n};/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const n2=Re("AlertCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const To=Re("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const r2=Re("ArrowUpDown",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const F0=Re("BookMarked",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H20v20H6.5a2.5 2.5 0 0 1 0-5H20",key:"t4utmx"}],["polyline",{points:"10 2 10 10 13 7 16 10 16 2",key:"13o6vz"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const nl=Re("BookOpen",[["path",{d:"M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z",key:"vv98re"}],["path",{d:"M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z",key:"1cyq3y"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const i2=Re("Book",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H20v20H6.5a2.5 2.5 0 0 1 0-5H20",key:"t4utmx"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const wl=Re("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const nd=Re("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const rd=Re("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const j1=Re("ChevronsLeft",[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const L1=Re("ChevronsRight",[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const s2=Re("ChevronsUpDown",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const o2=Re("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const O1=Re("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ua=Re("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Bf=Re("Eye",[["path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z",key:"rwhkz3"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ca=Re("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const M1=Re("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const $f=Re("Grid2x2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M12 3v18",key:"108xh3"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Hf=Re("Grid3x3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const U0=Re("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const z0=Re("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const V1=Re("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const F1=Re("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const a2=Re("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const U1=Re("Megaphone",[["path",{d:"m3 11 18-5v12L3 14v-3z",key:"n962bs"}],["path",{d:"M11.6 16.8a3 3 0 1 1-5.8-1.6",key:"1yl0tm"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const z1=Re("Pen",[["path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z",key:"5qss01"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const co=Re("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const km=Re("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const qf=Re("Rows2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 12h18",key:"1i2n21"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const B1=Re("Save",[["path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z",key:"1owoqh"}],["polyline",{points:"17 21 17 13 7 13 7 21",key:"1md35c"}],["polyline",{points:"7 3 7 8 15 8",key:"8nz8an"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const mc=Re("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const l2=Re("Send",[["path",{d:"m22 2-7 20-4-9-9-4Z",key:"1q3vgg"}],["path",{d:"M22 2 11 13",key:"nzbqef"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const B0=Re("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const $1=Re("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const u2=Re("Timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const $r=Re("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Cm=Re("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const In=Re("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Nm=Re("ZoomIn",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Am=Re("ZoomOut",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]),bh=new Set;function Gn({src:t,alt:e,className:n="",imgClassName:r="",objectFit:i="contain",aspectRatio:s,loading:o,draggable:a}){const u=bh.has(t),[c,h]=F.useState(u),[f,p]=F.useState(!1),[g,_]=F.useState(0);F.useEffect(()=>{bh.has(t)?(h(!0),p(!1)):(h(!1),p(!1)),_(0)},[t]);const T=()=>{p(!1),h(!1),_(w=>w+1)},R=()=>{h(!0),p(!1),bh.add(t)},y=g>0?`${t}${t.includes("?")?"&":"?"}retry=${g}`:t;return d.jsxs("div",{className:`relative w-full h-full overflow-hidden ${f?"bg-[#1a1a1a]/50 rounded-lg min-h-[300px]":""} ${n}`,style:s&&s!=="auto"?{aspectRatio:s}:void 0,children:[d.jsx("div",{className:`absolute inset-0 flex items-center justify-center transition-opacity duration-500 ${c?"opacity-0 pointer-events-none":"opacity-100"}`,children:f?d.jsxs("div",{className:"flex flex-col items-center justify-center p-6 text-center max-w-sm w-full h-full",children:[d.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center mb-3",children:d.jsx(n2,{className:"w-6 h-6 text-red-500"})}),d.jsx("p",{className:"text-sm text-gray-400 mb-4",children:"La imagen no cargó. El servidor podría tener problemas."}),d.jsxs("button",{onClick:T,className:"flex items-center justify-center gap-2 px-4 py-2 bg-gray-800 hover:bg-gray-700 text-white rounded-lg transition-colors border border-gray-700 w-full max-w-[200px]",children:[d.jsx(km,{className:"w-4 h-4"}),d.jsxs("span",{children:["Reintentar (",g,")"]})]})]}):d.jsx("div",{className:"w-8 h-8 border-2 border-[#bb86fc] border-t-transparent rounded-full animate-spin"})}),!f&&d.jsx("img",{src:y,alt:e,loading:o,draggable:a,className:`w-full h-full object-${i} transition-all duration-1000 ease-linear ${r} ${c?"opacity-100":"opacity-0"}`,onLoad:R,onError:()=>{p(!0),h(!1)}})]})}function H1({images:t,initialIndex:e,onClose:n}){const[r,i]=F.useState(e),[s,o]=F.useState(!1),[a,u]=F.useState(0),[c,h]=F.useState(1),[f,p]=F.useState({x:0,y:0}),[g,_]=F.useState(!1),[T,R]=F.useState({x:0,y:0}),[y,w]=F.useState(null),[k,L]=F.useState(1),U=F.useRef(null);F.useEffect(()=>(document.body.style.overflow="hidden",()=>{document.body.style.overflow="unset"}),[]);const j=$=>{const Y=t.length;return($%Y+Y)%Y},b=$=>Math.hypot($[0].clientX-$[1].clientX,$[0].clientY-$[1].clientY),x=($,Y)=>{const re=window.innerWidth,Ce=window.innerHeight,de=(re*Y-re)/2,Qe=(Ce*Y-Ce)/2;return{x:Math.min(Math.max($.x,-de),de),y:Math.min(Math.max($.y,-Qe),Qe)}},E=s?2:1,I=()=>{i($=>j($-E)),u(0),h(1),p({x:0,y:0})},N=()=>{i($=>j($+E)),u(0),h(1),p({x:0,y:0})},D=($,Y)=>{_(!0),R({x:$,y:Y})},C=($,Y)=>{if(g)if(c>1){const re=$-T.x,Ce=Y-T.y;p(de=>({x:de.x+re,y:de.y+Ce})),R({x:$,y:Y})}else{const re=$-T.x;u(re)}},ge=()=>{var re;if(_(!1),w(null),c>1)return;const Y=(((re=U.current)==null?void 0:re.clientWidth)||window.innerWidth)*.25;Math.abs(a)>Y?a>0?I():N():u(0)},ie=$=>{$.preventDefault(),D($.clientX,$.clientY)},fe=$=>{$.preventDefault(),C($.clientX,$.clientY)},we=()=>ge(),G=$=>{if($.touches.length===2){const Y=b($.touches);w(Y),L(c),_(!1)}else $.touches.length===1&&D($.touches[0].clientX,$.touches[0].clientY)},se=$=>{if($.touches.length===2&&y!==null){const re=b($.touches)/y,Ce=Math.min(Math.max(k*re,1),4);h(Ce),p(de=>x(de,Ce))}else $.touches.length===1&&C($.touches[0].clientX,$.touches[0].clientY)},A=$=>{if(y!==null&&$.touches.length<2){w(null);return}ge()};F.useEffect(()=>{function $(Y){Y.key==="Escape"?n():Y.key==="ArrowLeft"?I():Y.key==="ArrowRight"?N():Y.key==="+"||Y.key==="="?h(re=>{const Ce=Math.min(re+.5,4);return p(de=>x(de,Ce)),Ce}):Y.key==="-"&&h(re=>{const Ce=Math.max(re-.5,1);return p(de=>x(de,Ce)),Ce})}return window.addEventListener("keydown",$),()=>window.removeEventListener("keydown",$)},[c,s]);let pe=`translateX(calc(-33.333333% + ${a}px))`,_e=g?"none":"transform 0.1s ease-out";a===0&&(_e="none");const P=$=>{const Y=j($);if(s){const re=j($+1);return d.jsxs("div",{className:"flex w-full h-full items-center justify-center px-2 sm:px-10",children:[d.jsx("div",{className:"flex-1 h-full flex items-center justify-end",children:d.jsx(Gn,{src:t[Y],alt:`Página ${Y+1}`,aspectRatio:"auto",objectFit:"contain",loading:"lazy",draggable:!1,imgClassName:"max-w-full max-h-screen object-contain select-none shadow-lg origin-right object-right transition-none"})}),d.jsx("div",{className:"flex-1 h-full flex items-center justify-start",children:d.jsx(Gn,{src:t[re],alt:`Página ${re+1}`,aspectRatio:"auto",objectFit:"contain",loading:"lazy",draggable:!1,imgClassName:"max-w-full max-h-screen object-contain select-none shadow-lg origin-left object-left transition-none"})})]})}else return d.jsx(Gn,{src:t[Y],alt:`Página ${Y+1}`,aspectRatio:"auto",objectFit:"contain",loading:"lazy",draggable:!1,imgClassName:"max-w-full max-h-screen object-contain select-none shadow-2xl transition-none"})};return d.jsxs("div",{className:"fixed inset-0 bg-black/95 flex items-center justify-center z-50 select-none touch-none overflow-hidden",style:{touchAction:"none"},ref:U,onWheel:$=>{$.stopPropagation();const Y=$.deltaY<0?.5:-.5;h(re=>{const Ce=Math.min(Math.max(re+Y,1),4);return p(de=>x(de,Ce)),Ce})},onMouseDown:ie,onMouseMove:fe,onMouseUp:we,onMouseLeave:()=>{_(!1),c===1&&u(0)},onTouchStart:G,onTouchMove:se,onTouchEnd:A,children:[d.jsxs("div",{className:"absolute top-6 right-6 flex items-center gap-4 z-50",children:[d.jsxs("div",{className:"flex items-center gap-2 bg-black/50 rounded-lg p-1",children:[d.jsx("button",{onClick:()=>o(!s),className:`p-2 transition-colors ${s?"text-[#bb86fc]":"text-white hover:text-[#bb86fc]"}`,title:s?"Vista Individual":"Vista de Libro",children:s?d.jsx(nl,{className:"w-5 h-5"}):d.jsx(i2,{className:"w-5 h-5"})}),d.jsx("div",{className:"w-px h-4 bg-white/20 mx-1"}),d.jsx("button",{onClick:()=>h($=>{const Y=Math.max($-.5,1);return p(re=>x(re,Y)),Y}),className:"p-2 text-white hover:text-[#bb86fc] transition-colors",children:d.jsx(Am,{className:"w-5 h-5"})}),d.jsxs("span",{className:"text-white text-sm min-w-[3ch] text-center",children:[Math.round(c*100),"%"]}),d.jsx("button",{onClick:()=>h($=>{const Y=Math.min($+.5,4);return p(re=>x(re,Y)),Y}),className:"p-2 text-white hover:text-[#bb86fc] transition-colors",children:d.jsx(Nm,{className:"w-5 h-5"})})]}),d.jsx("button",{onClick:n,className:"p-2 rounded-lg bg-white/10 hover:bg-white/20 text-white transition-all duration-200",children:d.jsx(In,{className:"w-6 h-6"})})]}),d.jsxs("div",{className:"flex h-full w-[300%] absolute top-0 left-0",style:{transform:pe,transition:_e},children:[d.jsx("div",{className:"w-1/3 h-full flex items-center justify-center relative",children:P(r-E)}),d.jsx("div",{className:"w-1/3 h-full flex items-center justify-center relative",children:d.jsx("div",{className:"relative flex items-center justify-center w-full h-full",style:{transform:`translate(${f.x}px, ${f.y}px) scale(${c})`,transition:g?"none":"transform 0.1s ease-out",cursor:c>1?g?"grabbing":"grab":"default"},onDoubleClick:$=>{$.stopPropagation(),h(Y=>Y>1?1:2.5),p({x:0,y:0})},children:P(r)})}),d.jsx("div",{className:"w-1/3 h-full flex items-center justify-center relative",children:P(r+E)})]}),c===1&&d.jsxs(d.Fragment,{children:[d.jsx("button",{onClick:$=>{$.stopPropagation(),I()},className:"absolute left-4 sm:left-8 top-1/2 -translate-y-1/2 p-3 sm:p-4 rounded-lg text-white opacity-40 hover:opacity-100 transition-opacity duration-200 z-40",children:d.jsx(nd,{className:"w-8 h-8 sm:w-10 sm:h-10"})}),d.jsx("button",{onClick:$=>{$.stopPropagation(),N()},className:"absolute right-4 sm:right-8 top-1/2 -translate-y-1/2 p-3 sm:p-4 rounded-lg text-white opacity-40 hover:opacity-100 transition-opacity duration-200 z-40",children:d.jsx(rd,{className:"w-8 h-8 sm:w-10 sm:h-10"})})]}),d.jsx("div",{className:"absolute bottom-6 left-1/2 -translate-x-1/2 bg-black/60 text-white px-4 py-2 rounded-lg text-sm font-medium z-40 pointer-events-none",children:s?`${r+1}-${Math.min(r+2,t.length)} / ${t.length}`:`${r+1} / ${t.length}`})]})}function id(){return d.jsxs("footer",{className:"py-6 border-t border-gray-800/50 flex flex-col md:flex-row items-center justify-between gap-4 text-gray-400 text-sm mt-auto w-full px-8 relative",children:[d.jsxs("div",{className:"flex flex-wrap justify-center gap-6 mx-auto",children:[d.jsxs("a",{href:"https://t.me/twistedbrody",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 hover:text-[#bb86fc] transition-colors",children:[d.jsx("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"currentColor",children:d.jsx("path",{d:"M12 0C5.373 0 0 5.373 0 12s5.373 12 12 12 12-5.373 12-12S18.627 0 12 0zm5.894 8.221l-1.97 9.28c-.145.658-.537.818-1.084.508l-3-2.21-1.446 1.394c-.16.16-.295.295-.605.295l.213-3.054 5.56-5.022c.242-.213-.054-.333-.373-.121l-6.869 4.326-2.96-.924c-.64-.203-.658-.64.135-.954l11.566-4.458c.538-.196 1.006.128.832.941z"})}),"Twisted Brody"]}),d.jsxs("a",{href:"https://t.me/+CmmZFHM9hpViYzMx",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 hover:text-[#bb86fc] transition-colors",children:[d.jsx("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"currentColor",children:d.jsx("path",{d:"M12 0C5.373 0 0 5.373 0 12s5.373 12 12 12 12-5.373 12-12S18.627 0 12 0zm5.894 8.221l-1.97 9.28c-.145.658-.537.818-1.084.508l-3-2.21-1.446 1.394c-.16.16-.295.295-.605.295l.213-3.054 5.56-5.022c.242-.213-.054-.333-.373-.121l-6.869 4.326-2.96-.924c-.64-.203-.658-.64.135-.954l11.566-4.458c.538-.196 1.006.128.832.941z"})}),"Canal Hub"]}),d.jsxs("a",{href:"https://x.com/TwistedBrody",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 hover:text-[#bb86fc] transition-colors",children:[d.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:d.jsx("path",{d:"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"})}),"X"]}),d.jsxs("a",{href:"https://www.patreon.com/cw/Twistedbrody",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 hover:text-[#bb86fc] transition-colors",children:[d.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:d.jsx("path",{d:"M0 .48v23.04h4.22V.48zm15.385 0c-4.764 0-8.641 3.88-8.641 8.65 0 4.755 3.877 8.623 8.641 8.623 4.75 0 8.615-3.868 8.615-8.623C24 4.36 20.136.48 15.385.48z"})}),"Patreon"]}),d.jsxs("button",{onClick:()=>{window.location.hash="info"},className:"flex items-center gap-2 hover:text-[#bb86fc] transition-colors",children:[d.jsx(V1,{className:"w-4 h-4"}),d.jsx("span",{children:"Info"})]})]}),d.jsxs("div",{className:"md:absolute md:right-8 text-xs opacity-50",children:["Twisted Brody MangaFlow © ",new Date().getFullYear()]})]})}function c2({manga:t,onBack:e}){const n=t.chapters&&t.chapters.length>0?t.chapters[0]:null,r=n?n.original_pages&&n.original_pages.length>0?n.original_pages:n.pages:[],[i,s]=F.useState("vertical"),[o,a]=F.useState(1),[u,c]=F.useState(!1),[h,f]=F.useState(0);if(!r||r.length===0)return d.jsxs("div",{className:"min-h-screen bg-[#121212] flex flex-col items-center justify-center",children:[d.jsx("button",{onClick:e,className:"absolute top-6 left-6 p-2 hover:bg-[#333] rounded-lg transition-colors text-white",children:d.jsx(To,{className:"w-6 h-6"})}),d.jsx("div",{className:"text-gray-400 text-lg",children:"No hay páginas disponibles"})]});const p=()=>a(T=>Math.min(T+.25,3)),g=()=>a(T=>Math.max(T-.25,.5)),_=()=>a(1);return d.jsxs("div",{className:"min-h-screen flex flex-col bg-[#121212]",children:[d.jsxs("header",{className:"sticky top-0 z-50 bg-[#121212]/90 backdrop-blur-md border-b border-gray-800 px-4 py-3 flex items-center justify-between gap-4",children:[d.jsx("div",{className:"flex items-center gap-2 flex-shrink-0",children:d.jsxs("button",{onClick:e,className:"p-2 hover:bg-[#333] rounded-lg transition-colors text-white flex items-center gap-2",children:[d.jsx(To,{className:"w-5 h-5"}),d.jsx("span",{className:"font-semibold text-sm hidden sm:inline",children:"Volver"})]})}),d.jsx("div",{className:"flex-1 flex justify-center min-w-0",children:d.jsxs("h1",{className:"text-white font-bold truncate text-center max-w-full",children:[t.title," ",d.jsx("span",{className:"text-[#bb86fc] text-xs ml-2 border border-[#bb86fc] px-1 rounded",children:"HD"})]})}),d.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[d.jsxs("div",{className:"flex items-center gap-1 bg-[#0a0a0a] border border-gray-800 rounded-lg p-1 hidden md:flex",children:[d.jsx("button",{onClick:()=>s("vertical"),className:`p-2 rounded-md transition-all duration-200 ${i==="vertical"?"bg-[#bb86fc] text-white":"text-gray-400 hover:text-white"}`,title:"Vertical",children:d.jsx(qf,{className:"w-4 h-4"})}),d.jsx("button",{onClick:()=>s("gallery"),className:`p-2 rounded-md transition-all duration-200 ${i==="gallery"?"bg-[#bb86fc] text-white":"text-gray-400 hover:text-white"}`,title:"Galería",children:d.jsx($f,{className:"w-4 h-4"})}),d.jsx("button",{onClick:()=>s("grid"),className:`p-2 rounded-md transition-all duration-200 ${i==="grid"?"bg-[#bb86fc] text-white":"text-gray-400 hover:text-white"}`,title:"Cuadrícula",children:d.jsx(Hf,{className:"w-4 h-4"})})]}),i==="vertical"&&d.jsxs("div",{className:"flex items-center gap-1 bg-[#0a0a0a] border border-gray-800 rounded-lg p-1",children:[d.jsx("button",{onClick:g,className:"p-2 text-gray-400 hover:text-white hover:bg-[#333] rounded",children:d.jsx(Am,{className:"w-4 h-4"})}),d.jsxs("span",{className:"text-xs text-gray-300 w-8 text-center",children:[Math.round(o*100),"%"]}),d.jsx("button",{onClick:p,className:"p-2 text-gray-400 hover:text-white hover:bg-[#333] rounded",children:d.jsx(Nm,{className:"w-4 h-4"})}),d.jsx("button",{onClick:_,className:"p-2 text-gray-400 hover:text-white hover:bg-[#333] rounded",title:"Reset",children:d.jsx(km,{className:"w-3 h-3"})})]})]})]}),d.jsx("div",{className:"md:hidden px-4 py-2 border-b border-gray-800 bg-[#121212] flex justify-center",children:d.jsxs("div",{className:"flex items-center gap-1 bg-[#0a0a0a] border border-gray-800 rounded-lg p-1",children:[d.jsxs("button",{onClick:()=>s("vertical"),className:`px-3 py-1.5 rounded-md flex items-center gap-2 text-xs font-medium ${i==="vertical"?"bg-[#bb86fc] text-white":"text-gray-400"}`,children:[d.jsx(qf,{className:"w-3 h-3"})," Vertical"]}),d.jsxs("button",{onClick:()=>s("gallery"),className:`px-3 py-1.5 rounded-md flex items-center gap-2 text-xs font-medium ${i==="gallery"?"bg-[#bb86fc] text-white":"text-gray-400"}`,children:[d.jsx($f,{className:"w-3 h-3"})," Galería"]}),d.jsxs("button",{onClick:()=>s("grid"),className:`px-3 py-1.5 rounded-md flex items-center gap-2 text-xs font-medium ${i==="grid"?"bg-[#bb86fc] text-white":"text-gray-400"}`,children:[d.jsx(Hf,{className:"w-3 h-3"})," Cuadrícula"]})]})}),d.jsx("main",{className:"flex-1 w-full max-w-[1920px] mx-auto px-0 sm:px-4 py-6",children:d.jsx("div",{className:` + bg-[#050505] min-h-screen transition-all duration-150 ease-out + ${i==="vertical"?"flex flex-col items-center gap-1":""} + ${i==="gallery"?"masonry-container p-2":""} + ${i==="grid"?"grid grid-cols-3 md:grid-cols-5 gap-2 p-2":""} + `,children:r.map((T,R)=>{const y=T;return i==="vertical"?d.jsx("div",{className:"relative transition-all duration-200",style:{width:o===1?"100%":`${100*o}%`,maxWidth:o>1?"none":"80rem"},children:d.jsx("div",{className:`mx-auto ${o<=1?"max-w-5xl":""}`,children:d.jsx(Gn,{src:y,alt:`Página ${R+1}`,aspectRatio:"auto",objectFit:"contain",loading:R<3?"eager":"lazy",className:"w-full h-auto",imgClassName:"w-full h-auto block"})})},R):d.jsx("div",{className:` + group cursor-pointer relative bg-black rounded-lg shadow-lg overflow-hidden transition-transform duration-300 hover:scale-[1.02] + ${i==="gallery"?"masonry-item":""} + `,onClick:()=>{f(R),c(!0)},children:d.jsx(Gn,{src:y,alt:`Página ${R+1}`,aspectRatio:i==="grid"?"1/1":"auto",objectFit:i==="grid"?"cover":"contain",loading:R<5?"eager":"lazy",className:"w-full h-auto rounded-lg",imgClassName:"group-hover:scale-110"})},R)})})}),d.jsx(id,{}),u&&d.jsx(H1,{images:r,initialIndex:h,onClose:()=>c(!1)})]})}async function d2(t,e,n){const r=await h2(t),i=f2(t);try{const s=await fetch("/api/process-image",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({image:r,name:t.name,index:e,total:n})});if(!s.ok)throw new Error(`Server processing failed: ${s.statusText}`);const o=await s.json();if(!o.success||!o.data)throw new Error("Invalid response from processing server");return{thumbnail:o.data.thumbnail,original:r,webpDisplay:o.data.webp,webpCover:o.data.webp,originalFormat:i,originalBase64:r,originalUnmodified:r}}catch(s){throw console.error("Error processing image on server, falling back to local:",s),s}}async function h2(t){return new Promise((e,n)=>{const r=new FileReader;r.onload=i=>{var s;return e((s=i.target)==null?void 0:s.result)},r.onerror=()=>n(new Error("Failed to read file")),r.readAsDataURL(t)})}function f2(t){var r;const e=t.type;if(e==="image/png")return"png";if(e==="image/jpeg")return"jpg";if(e==="image/gif")return"gif";if(e==="image/webp")return"webp";const n=(r=t.name.split(".").pop())==null?void 0:r.toLowerCase();return n&&["png","jpg","jpeg","gif","webp"].includes(n)?n==="jpeg"?"jpg":n:"jpg"}async function p2(t){return new Promise((e,n)=>{const r=new Image;r.crossOrigin="anonymous",r.onload=()=>{const i=r.width/r.height;i<.9?e("portrait"):i>1.1?e("landscape"):e("square")},r.onerror=()=>n(new Error("Failed to load image")),r.src=t})}const q1="imageBatchSize",$0=10;function au(t){if(t<0)throw new Error("El tamaño del lote no puede ser negativo");localStorage.setItem(q1,t.toString())}function W1(){const t=localStorage.getItem(q1);if(!t)return $0;const e=parseInt(t,10);return isNaN(e)||e<0?$0:e>=999999?0:e}const m2="https://codebydante-brodyfilestreambot.hf.space/upload";function g2(t,e){const n=t.split(","),r=n[0].match(/:(.*?);/),i=r?r[1]:"image/jpeg",s=atob(n[n.length-1]);let o=s.length;const a=new Uint8Array(o);for(;o--;)a[o]=s.charCodeAt(o);return new File([a],e,{type:i})}const Wf=t=>new Promise(e=>setTimeout(e,t));async function Gf(t,e,n=3){var a,u,c;const r=e?`${e}.jpg`:"image.jpg",i=g2(t,r),s=new FormData;s.append("file",i);let o=0;for(;oh.abort(),6e4);try{const p=await fetch(m2,{method:"POST",body:s,signal:h.signal});if(clearTimeout(f),!p.ok){const _=await p.text();if(p.status>=500&&o=n)throw p}}throw new Error("No se pudo subir la imagen tras varios intentos.")}async function lu(t,e,n){const r=W1()||5,i=[];for(let s=0;s{const f=s+h,p=e?`${e}_${f+1}`:void 0;return Gf(c,p)}),u=await Promise.all(a);i.push(...u),n&&n(Math.min(s+r,t.length),t.length),s+r{};var H0={};/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const G1=function(t){const e=[];let n=0;for(let r=0;r>6|192,e[n++]=i&63|128):(i&64512)===55296&&r+1>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=i&63|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=i&63|128)}return e},v2=function(t){const e=[];let n=0,r=0;for(;n191&&i<224){const s=t[n++];e[r++]=String.fromCharCode((i&31)<<6|s&63)}else if(i>239&&i<365){const s=t[n++],o=t[n++],a=t[n++],u=((i&7)<<18|(s&63)<<12|(o&63)<<6|a&63)-65536;e[r++]=String.fromCharCode(55296+(u>>10)),e[r++]=String.fromCharCode(56320+(u&1023))}else{const s=t[n++],o=t[n++];e[r++]=String.fromCharCode((i&15)<<12|(s&63)<<6|o&63)}}return e.join("")},K1={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let i=0;i>2,f=(s&3)<<4|a>>4;let p=(a&15)<<2|c>>6,g=c&63;u||(g=64,o||(p=64)),r.push(n[h],n[f],n[p],n[g])}return r.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(G1(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):v2(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();const n=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let i=0;i>4;if(r.push(p),c!==64){const g=a<<4&240|c>>2;if(r.push(g),f!==64){const _=c<<6&192|f;r.push(_)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let t=0;t=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}};class x2 extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const w2=function(t){const e=G1(t);return K1.encodeByteArray(e,!0)},gc=function(t){return w2(t).replace(/\./g,"")},Q1=function(t){try{return K1.decodeString(t,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};/** + * @license + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function _2(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}/** + * @license + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const b2=()=>_2().__FIREBASE_DEFAULTS__,E2=()=>{if(typeof process>"u"||typeof H0>"u")return;const t=H0.__FIREBASE_DEFAULTS__;if(t)return JSON.parse(t)},S2=()=>{if(typeof document>"u")return;let t;try{t=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const e=t&&Q1(t[1]);return e&&JSON.parse(e)},sd=()=>{try{return y2()||b2()||E2()||S2()}catch(t){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${t}`);return}},Y1=t=>{var e,n;return(n=(e=sd())==null?void 0:e.emulatorHosts)==null?void 0:n[t]},X1=t=>{const e=Y1(t);if(!e)return;const n=e.lastIndexOf(":");if(n<=0||n+1===e.length)throw new Error(`Invalid host ${e} with no separate hostname and port!`);const r=parseInt(e.substring(n+1),10);return e[0]==="["?[e.substring(1,n-1),r]:[e.substring(0,n),r]},J1=()=>{var t;return(t=sd())==null?void 0:t.config},Z1=t=>{var e;return(e=sd())==null?void 0:e[`_${t}`]};/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class T2{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}wrapCallback(e){return(n,r)=>{n?this.reject(n):this.resolve(r),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(n):e(n,r))}}}/** + * @license + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Ns(t){try{return(t.startsWith("http://")||t.startsWith("https://")?new URL(t).hostname:t).endsWith(".cloudworkstations.dev")}catch{return!1}}async function Pm(t){return(await fetch(t,{credentials:"include"})).ok}/** + * @license + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function eb(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const n={alg:"none",type:"JWT"},r=e||"demo-project",i=t.iat||0,s=t.sub||t.user_id;if(!s)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const o={iss:`https://securetoken.google.com/${r}`,aud:r,iat:i,exp:i+3600,auth_time:i,sub:s,user_id:s,firebase:{sign_in_provider:"custom",identities:{}},...t};return[gc(JSON.stringify(n)),gc(JSON.stringify(o)),""].join(".")}const Aa={};function I2(){const t={prod:[],emulator:[]};for(const e of Object.keys(Aa))Aa[e]?t.emulator.push(e):t.prod.push(e);return t}function k2(t){let e=document.getElementById(t),n=!1;return e||(e=document.createElement("div"),e.setAttribute("id",t),n=!0),{created:n,element:e}}let q0=!1;function Rm(t,e){if(typeof window>"u"||typeof document>"u"||!Ns(window.location.host)||Aa[t]===e||Aa[t]||q0)return;Aa[t]=e;function n(p){return`__firebase__banner__${p}`}const r="__firebase__banner",s=I2().prod.length>0;function o(){const p=document.getElementById(r);p&&p.remove()}function a(p){p.style.display="flex",p.style.background="#7faaf0",p.style.position="fixed",p.style.bottom="5px",p.style.left="5px",p.style.padding=".5em",p.style.borderRadius="5px",p.style.alignItems="center"}function u(p,g){p.setAttribute("width","24"),p.setAttribute("id",g),p.setAttribute("height","24"),p.setAttribute("viewBox","0 0 24 24"),p.setAttribute("fill","none"),p.style.marginLeft="-6px"}function c(){const p=document.createElement("span");return p.style.cursor="pointer",p.style.marginLeft="16px",p.style.fontSize="24px",p.innerHTML=" ×",p.onclick=()=>{q0=!0,o()},p}function h(p,g){p.setAttribute("id",g),p.innerText="Learn more",p.href="https://firebase.google.com/docs/studio/preview-apps#preview-backend",p.setAttribute("target","__blank"),p.style.paddingLeft="5px",p.style.textDecoration="underline"}function f(){const p=k2(r),g=n("text"),_=document.getElementById(g)||document.createElement("span"),T=n("learnmore"),R=document.getElementById(T)||document.createElement("a"),y=n("preprendIcon"),w=document.getElementById(y)||document.createElementNS("http://www.w3.org/2000/svg","svg");if(p.created){const k=p.element;a(k),h(R,T);const L=c();u(w,y),k.append(w,_,R,L),document.body.appendChild(k)}s?(_.innerText="Preview backend disconnected.",w.innerHTML=` + + + + + + +`):(w.innerHTML=` + + + + + + +`,_.innerText="Preview backend running in this workspace."),_.setAttribute("id",g)}document.readyState==="loading"?window.addEventListener("DOMContentLoaded",f):f()}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function on(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function C2(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(on())}function N2(){var e;const t=(e=sd())==null?void 0:e.forceEnvironment;if(t==="node")return!0;if(t==="browser")return!1;try{return Object.prototype.toString.call(global.process)==="[object process]"}catch{return!1}}function A2(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function P2(){const t=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof t=="object"&&t.id!==void 0}function R2(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function D2(){const t=on();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0}function j2(){return!N2()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}function L2(){try{return typeof indexedDB=="object"}catch{return!1}}function O2(){return new Promise((t,e)=>{try{let n=!0;const r="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(r);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(r),t(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{var s;e(((s=i.error)==null?void 0:s.message)||"")}}catch(n){e(n)}})}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const M2="FirebaseError";class Rr extends Error{constructor(e,n,r){super(n),this.code=e,this.customData=r,this.name=M2,Object.setPrototypeOf(this,Rr.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,_l.prototype.create)}}class _l{constructor(e,n,r){this.service=e,this.serviceName=n,this.errors=r}create(e,...n){const r=n[0]||{},i=`${this.service}/${e}`,s=this.errors[e],o=s?V2(s,r):"Error",a=`${this.serviceName}: ${o} (${i}).`;return new Rr(i,a,r)}}function V2(t,e){return t.replace(F2,(n,r)=>{const i=e[r];return i!=null?String(i):`<${r}?>`})}const F2=/\{\$([^}]+)}/g;function U2(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}function bs(t,e){if(t===e)return!0;const n=Object.keys(t),r=Object.keys(e);for(const i of n){if(!r.includes(i))return!1;const s=t[i],o=e[i];if(W0(s)&&W0(o)){if(!bs(s,o))return!1}else if(s!==o)return!1}for(const i of r)if(!n.includes(i))return!1;return!0}function W0(t){return t!==null&&typeof t=="object"}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function bl(t){const e=[];for(const[n,r]of Object.entries(t))Array.isArray(r)?r.forEach(i=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(i))}):e.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return e.length?"&"+e.join("&"):""}function z2(t,e){const n=new B2(t,e);return n.subscribe.bind(n)}class B2{constructor(e,n){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=n,this.task.then(()=>{e(this)}).catch(r=>{this.error(r)})}next(e){this.forEachObserver(n=>{n.next(e)})}error(e){this.forEachObserver(n=>{n.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,n,r){let i;if(e===void 0&&n===void 0&&r===void 0)throw new Error("Missing Observer.");$2(e,["next","error","complete"])?i=e:i={next:e,error:n,complete:r},i.next===void 0&&(i.next=Eh),i.error===void 0&&(i.error=Eh),i.complete===void 0&&(i.complete=Eh);const s=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?i.error(this.finalError):i.complete()}catch{}}),this.observers.push(i),s}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let n=0;n{if(this.observers!==void 0&&this.observers[e]!==void 0)try{n(this.observers[e])}catch(r){typeof console<"u"&&console.error&&console.error(r)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}}function $2(t,e){if(typeof t!="object"||t===null)return!1;for(const n of e)if(n in t&&typeof t[n]=="function")return!0;return!1}function Eh(){}/** + * @license + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Yt(t){return t&&t._delegate?t._delegate:t}class Vi{constructor(e,n,r){this.name=e,this.instanceFactory=n,this.type=r,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const ss="[DEFAULT]";/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class H2{constructor(e,n){this.name=e,this.container=n,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){const n=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(n)){const r=new T2;if(this.instancesDeferred.set(n,r),this.isInitialized(n)||this.shouldAutoInitialize())try{const i=this.getOrInitializeService({instanceIdentifier:n});i&&r.resolve(i)}catch{}}return this.instancesDeferred.get(n).promise}getImmediate(e){const n=this.normalizeInstanceIdentifier(e==null?void 0:e.identifier),r=(e==null?void 0:e.optional)??!1;if(this.isInitialized(n)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:n})}catch(i){if(r)return null;throw i}else{if(r)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,!!this.shouldAutoInitialize()){if(W2(e))try{this.getOrInitializeService({instanceIdentifier:ss})}catch{}for(const[n,r]of this.instancesDeferred.entries()){const i=this.normalizeInstanceIdentifier(n);try{const s=this.getOrInitializeService({instanceIdentifier:i});r.resolve(s)}catch{}}}}clearInstance(e=ss){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){const e=Array.from(this.instances.values());await Promise.all([...e.filter(n=>"INTERNAL"in n).map(n=>n.INTERNAL.delete()),...e.filter(n=>"_delete"in n).map(n=>n._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=ss){return this.instances.has(e)}getOptions(e=ss){return this.instancesOptions.get(e)||{}}initialize(e={}){const{options:n={}}=e,r=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(r))throw Error(`${this.name}(${r}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const i=this.getOrInitializeService({instanceIdentifier:r,options:n});for(const[s,o]of this.instancesDeferred.entries()){const a=this.normalizeInstanceIdentifier(s);r===a&&o.resolve(i)}return i}onInit(e,n){const r=this.normalizeInstanceIdentifier(n),i=this.onInitCallbacks.get(r)??new Set;i.add(e),this.onInitCallbacks.set(r,i);const s=this.instances.get(r);return s&&e(s,r),()=>{i.delete(e)}}invokeOnInitCallbacks(e,n){const r=this.onInitCallbacks.get(n);if(r)for(const i of r)try{i(e,n)}catch{}}getOrInitializeService({instanceIdentifier:e,options:n={}}){let r=this.instances.get(e);if(!r&&this.component&&(r=this.component.instanceFactory(this.container,{instanceIdentifier:q2(e),options:n}),this.instances.set(e,r),this.instancesOptions.set(e,n),this.invokeOnInitCallbacks(r,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,r)}catch{}return r||null}normalizeInstanceIdentifier(e=ss){return this.component?this.component.multipleInstances?e:ss:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function q2(t){return t===ss?void 0:t}function W2(t){return t.instantiationMode==="EAGER"}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class G2{constructor(e){this.name=e,this.providers=new Map}addComponent(e){const n=this.getProvider(e.name);if(n.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);n.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);const n=new H2(e,this);return this.providers.set(e,n),n}getProviders(){return Array.from(this.providers.values())}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */var Me;(function(t){t[t.DEBUG=0]="DEBUG",t[t.VERBOSE=1]="VERBOSE",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.SILENT=5]="SILENT"})(Me||(Me={}));const K2={debug:Me.DEBUG,verbose:Me.VERBOSE,info:Me.INFO,warn:Me.WARN,error:Me.ERROR,silent:Me.SILENT},Q2=Me.INFO,Y2={[Me.DEBUG]:"log",[Me.VERBOSE]:"log",[Me.INFO]:"info",[Me.WARN]:"warn",[Me.ERROR]:"error"},X2=(t,e,...n)=>{if(ee.some(n=>t instanceof n);let G0,K0;function Z2(){return G0||(G0=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function eC(){return K0||(K0=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const tb=new WeakMap,Kf=new WeakMap,nb=new WeakMap,Sh=new WeakMap,jm=new WeakMap;function tC(t){const e=new Promise((n,r)=>{const i=()=>{t.removeEventListener("success",s),t.removeEventListener("error",o)},s=()=>{n(Ri(t.result)),i()},o=()=>{r(t.error),i()};t.addEventListener("success",s),t.addEventListener("error",o)});return e.then(n=>{n instanceof IDBCursor&&tb.set(n,t)}).catch(()=>{}),jm.set(e,t),e}function nC(t){if(Kf.has(t))return;const e=new Promise((n,r)=>{const i=()=>{t.removeEventListener("complete",s),t.removeEventListener("error",o),t.removeEventListener("abort",o)},s=()=>{n(),i()},o=()=>{r(t.error||new DOMException("AbortError","AbortError")),i()};t.addEventListener("complete",s),t.addEventListener("error",o),t.addEventListener("abort",o)});Kf.set(t,e)}let Qf={get(t,e,n){if(t instanceof IDBTransaction){if(e==="done")return Kf.get(t);if(e==="objectStoreNames")return t.objectStoreNames||nb.get(t);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return Ri(t[e])},set(t,e,n){return t[e]=n,!0},has(t,e){return t instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in t}};function rC(t){Qf=t(Qf)}function iC(t){return t===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...n){const r=t.call(Th(this),e,...n);return nb.set(r,e.sort?e.sort():[e]),Ri(r)}:eC().includes(t)?function(...e){return t.apply(Th(this),e),Ri(tb.get(this))}:function(...e){return Ri(t.apply(Th(this),e))}}function sC(t){return typeof t=="function"?iC(t):(t instanceof IDBTransaction&&nC(t),J2(t,Z2())?new Proxy(t,Qf):t)}function Ri(t){if(t instanceof IDBRequest)return tC(t);if(Sh.has(t))return Sh.get(t);const e=sC(t);return e!==t&&(Sh.set(t,e),jm.set(e,t)),e}const Th=t=>jm.get(t);function oC(t,e,{blocked:n,upgrade:r,blocking:i,terminated:s}={}){const o=indexedDB.open(t,e),a=Ri(o);return r&&o.addEventListener("upgradeneeded",u=>{r(Ri(o.result),u.oldVersion,u.newVersion,Ri(o.transaction),u)}),n&&o.addEventListener("blocked",u=>n(u.oldVersion,u.newVersion,u)),a.then(u=>{s&&u.addEventListener("close",()=>s()),i&&u.addEventListener("versionchange",c=>i(c.oldVersion,c.newVersion,c))}).catch(()=>{}),a}const aC=["get","getKey","getAll","getAllKeys","count"],lC=["put","add","delete","clear"],Ih=new Map;function Q0(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(Ih.get(e))return Ih.get(e);const n=e.replace(/FromIndex$/,""),r=e!==n,i=lC.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(i||aC.includes(n)))return;const s=async function(o,...a){const u=this.transaction(o,i?"readwrite":"readonly");let c=u.store;return r&&(c=c.index(a.shift())),(await Promise.all([c[n](...a),i&&u.done]))[0]};return Ih.set(e,s),s}rC(t=>({...t,get:(e,n,r)=>Q0(e,n)||t.get(e,n,r),has:(e,n)=>!!Q0(e,n)||t.has(e,n)}));/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class uC{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(cC(n)){const r=n.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(n=>n).join(" ")}}function cC(t){const e=t.getComponent();return(e==null?void 0:e.type)==="VERSION"}const Yf="@firebase/app",Y0="0.14.6";/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Qr=new Dm("@firebase/app"),dC="@firebase/app-compat",hC="@firebase/analytics-compat",fC="@firebase/analytics",pC="@firebase/app-check-compat",mC="@firebase/app-check",gC="@firebase/auth",yC="@firebase/auth-compat",vC="@firebase/database",xC="@firebase/data-connect",wC="@firebase/database-compat",_C="@firebase/functions",bC="@firebase/functions-compat",EC="@firebase/installations",SC="@firebase/installations-compat",TC="@firebase/messaging",IC="@firebase/messaging-compat",kC="@firebase/performance",CC="@firebase/performance-compat",NC="@firebase/remote-config",AC="@firebase/remote-config-compat",PC="@firebase/storage",RC="@firebase/storage-compat",DC="@firebase/firestore",jC="@firebase/ai",LC="@firebase/firestore-compat",OC="firebase",MC="12.6.0";/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Xf="[DEFAULT]",VC={[Yf]:"fire-core",[dC]:"fire-core-compat",[fC]:"fire-analytics",[hC]:"fire-analytics-compat",[mC]:"fire-app-check",[pC]:"fire-app-check-compat",[gC]:"fire-auth",[yC]:"fire-auth-compat",[vC]:"fire-rtdb",[xC]:"fire-data-connect",[wC]:"fire-rtdb-compat",[_C]:"fire-fn",[bC]:"fire-fn-compat",[EC]:"fire-iid",[SC]:"fire-iid-compat",[TC]:"fire-fcm",[IC]:"fire-fcm-compat",[kC]:"fire-perf",[CC]:"fire-perf-compat",[NC]:"fire-rc",[AC]:"fire-rc-compat",[PC]:"fire-gcs",[RC]:"fire-gcs-compat",[DC]:"fire-fst",[LC]:"fire-fst-compat",[jC]:"fire-vertex","fire-js":"fire-js",[OC]:"fire-js-all"};/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const yc=new Map,FC=new Map,Jf=new Map;function X0(t,e){try{t.container.addComponent(e)}catch(n){Qr.debug(`Component ${e.name} failed to register with FirebaseApp ${t.name}`,n)}}function Es(t){const e=t.name;if(Jf.has(e))return Qr.debug(`There were multiple attempts to register component ${e}.`),!1;Jf.set(e,t);for(const n of yc.values())X0(n,t);for(const n of FC.values())X0(n,t);return!0}function od(t,e){const n=t.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),t.container.getProvider(e)}function rr(t){return t==null?!1:t.settings!==void 0}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const UC={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},Di=new _l("app","Firebase",UC);/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class zC{constructor(e,n,r){this._isDeleted=!1,this._options={...e},this._config={...n},this._name=n.name,this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new Vi("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw Di.create("app-deleted",{appName:this._name})}}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const As=MC;function rb(t,e={}){let n=t;typeof e!="object"&&(e={name:e});const r={name:Xf,automaticDataCollectionEnabled:!0,...e},i=r.name;if(typeof i!="string"||!i)throw Di.create("bad-app-name",{appName:String(i)});if(n||(n=J1()),!n)throw Di.create("no-options");const s=yc.get(i);if(s){if(bs(n,s.options)&&bs(r,s.config))return s;throw Di.create("duplicate-app",{appName:i})}const o=new G2(i);for(const u of Jf.values())o.addComponent(u);const a=new zC(n,r,o);return yc.set(i,a),a}function Lm(t=Xf){const e=yc.get(t);if(!e&&t===Xf&&J1())return rb();if(!e)throw Di.create("no-app",{appName:t});return e}function br(t,e,n){let r=VC[t]??t;n&&(r+=`-${n}`);const i=r.match(/\s|\//),s=e.match(/\s|\//);if(i||s){const o=[`Unable to register library "${r}" with version "${e}":`];i&&o.push(`library name "${r}" contains illegal characters (whitespace or "/")`),i&&s&&o.push("and"),s&&o.push(`version name "${e}" contains illegal characters (whitespace or "/")`),Qr.warn(o.join(" "));return}Es(new Vi(`${r}-version`,()=>({library:r,version:e}),"VERSION"))}/** + * @license + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const BC="firebase-heartbeat-database",$C=1,rl="firebase-heartbeat-store";let kh=null;function ib(){return kh||(kh=oC(BC,$C,{upgrade:(t,e)=>{switch(e){case 0:try{t.createObjectStore(rl)}catch(n){console.warn(n)}}}}).catch(t=>{throw Di.create("idb-open",{originalErrorMessage:t.message})})),kh}async function HC(t){try{const n=(await ib()).transaction(rl),r=await n.objectStore(rl).get(sb(t));return await n.done,r}catch(e){if(e instanceof Rr)Qr.warn(e.message);else{const n=Di.create("idb-get",{originalErrorMessage:e==null?void 0:e.message});Qr.warn(n.message)}}}async function J0(t,e){try{const r=(await ib()).transaction(rl,"readwrite");await r.objectStore(rl).put(e,sb(t)),await r.done}catch(n){if(n instanceof Rr)Qr.warn(n.message);else{const r=Di.create("idb-set",{originalErrorMessage:n==null?void 0:n.message});Qr.warn(r.message)}}}function sb(t){return`${t.name}!${t.options.appId}`}/** + * @license + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const qC=1024,WC=30;class GC{constructor(e){this.container=e,this._heartbeatsCache=null;const n=this.container.getProvider("app").getImmediate();this._storage=new QC(n),this._heartbeatsCachePromise=this._storage.read().then(r=>(this._heartbeatsCache=r,r))}async triggerHeartbeat(){var e,n;try{const i=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),s=Z0();if(((e=this._heartbeatsCache)==null?void 0:e.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((n=this._heartbeatsCache)==null?void 0:n.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===s||this._heartbeatsCache.heartbeats.some(o=>o.date===s))return;if(this._heartbeatsCache.heartbeats.push({date:s,agent:i}),this._heartbeatsCache.heartbeats.length>WC){const o=YC(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(o,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(r){Qr.warn(r)}}async getHeartbeatsHeader(){var e;try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((e=this._heartbeatsCache)==null?void 0:e.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";const n=Z0(),{heartbeatsToSend:r,unsentEntries:i}=KC(this._heartbeatsCache.heartbeats),s=gc(JSON.stringify({version:2,heartbeats:r}));return this._heartbeatsCache.lastSentHeartbeatDate=n,i.length>0?(this._heartbeatsCache.heartbeats=i,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),s}catch(n){return Qr.warn(n),""}}}function Z0(){return new Date().toISOString().substring(0,10)}function KC(t,e=qC){const n=[];let r=t.slice();for(const i of t){const s=n.find(o=>o.agent===i.agent);if(s){if(s.dates.push(i.date),ev(n)>e){s.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),ev(n)>e){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}class QC{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return L2()?O2().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const n=await HC(this.app);return n!=null&&n.heartbeats?n:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){if(await this._canUseIndexedDBPromise){const r=await this.read();return J0(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){if(await this._canUseIndexedDBPromise){const r=await this.read();return J0(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:[...r.heartbeats,...e.heartbeats]})}else return}}function ev(t){return gc(JSON.stringify({version:2,heartbeats:t})).length}function YC(t){if(t.length===0)return-1;let e=0,n=t[0].date;for(let r=1;rnew uC(e),"PRIVATE")),Es(new Vi("heartbeat",e=>new GC(e),"PRIVATE")),br(Yf,Y0,t),br(Yf,Y0,"esm2020"),br("fire-js","")}XC("");var JC="firebase",ZC="12.6.0";/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */br(JC,ZC,"app");var tv=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/** @license +Copyright The Closure Library Authors. +SPDX-License-Identifier: Apache-2.0 +*/var ji,ob;(function(){var t;/** @license + + Copyright The Closure Library Authors. + SPDX-License-Identifier: Apache-2.0 +*/function e(b,x){function E(){}E.prototype=x.prototype,b.F=x.prototype,b.prototype=new E,b.prototype.constructor=b,b.D=function(I,N,D){for(var C=Array(arguments.length-2),ge=2;ge>>25),C=D+(N^x&(E^N))+I[1]+3905402710&4294967295,D=x+(C<<12&4294967295|C>>>20),C=N+(E^D&(x^E))+I[2]+606105819&4294967295,N=D+(C<<17&4294967295|C>>>15),C=E+(x^N&(D^x))+I[3]+3250441966&4294967295,E=N+(C<<22&4294967295|C>>>10),C=x+(D^E&(N^D))+I[4]+4118548399&4294967295,x=E+(C<<7&4294967295|C>>>25),C=D+(N^x&(E^N))+I[5]+1200080426&4294967295,D=x+(C<<12&4294967295|C>>>20),C=N+(E^D&(x^E))+I[6]+2821735955&4294967295,N=D+(C<<17&4294967295|C>>>15),C=E+(x^N&(D^x))+I[7]+4249261313&4294967295,E=N+(C<<22&4294967295|C>>>10),C=x+(D^E&(N^D))+I[8]+1770035416&4294967295,x=E+(C<<7&4294967295|C>>>25),C=D+(N^x&(E^N))+I[9]+2336552879&4294967295,D=x+(C<<12&4294967295|C>>>20),C=N+(E^D&(x^E))+I[10]+4294925233&4294967295,N=D+(C<<17&4294967295|C>>>15),C=E+(x^N&(D^x))+I[11]+2304563134&4294967295,E=N+(C<<22&4294967295|C>>>10),C=x+(D^E&(N^D))+I[12]+1804603682&4294967295,x=E+(C<<7&4294967295|C>>>25),C=D+(N^x&(E^N))+I[13]+4254626195&4294967295,D=x+(C<<12&4294967295|C>>>20),C=N+(E^D&(x^E))+I[14]+2792965006&4294967295,N=D+(C<<17&4294967295|C>>>15),C=E+(x^N&(D^x))+I[15]+1236535329&4294967295,E=N+(C<<22&4294967295|C>>>10),C=x+(N^D&(E^N))+I[1]+4129170786&4294967295,x=E+(C<<5&4294967295|C>>>27),C=D+(E^N&(x^E))+I[6]+3225465664&4294967295,D=x+(C<<9&4294967295|C>>>23),C=N+(x^E&(D^x))+I[11]+643717713&4294967295,N=D+(C<<14&4294967295|C>>>18),C=E+(D^x&(N^D))+I[0]+3921069994&4294967295,E=N+(C<<20&4294967295|C>>>12),C=x+(N^D&(E^N))+I[5]+3593408605&4294967295,x=E+(C<<5&4294967295|C>>>27),C=D+(E^N&(x^E))+I[10]+38016083&4294967295,D=x+(C<<9&4294967295|C>>>23),C=N+(x^E&(D^x))+I[15]+3634488961&4294967295,N=D+(C<<14&4294967295|C>>>18),C=E+(D^x&(N^D))+I[4]+3889429448&4294967295,E=N+(C<<20&4294967295|C>>>12),C=x+(N^D&(E^N))+I[9]+568446438&4294967295,x=E+(C<<5&4294967295|C>>>27),C=D+(E^N&(x^E))+I[14]+3275163606&4294967295,D=x+(C<<9&4294967295|C>>>23),C=N+(x^E&(D^x))+I[3]+4107603335&4294967295,N=D+(C<<14&4294967295|C>>>18),C=E+(D^x&(N^D))+I[8]+1163531501&4294967295,E=N+(C<<20&4294967295|C>>>12),C=x+(N^D&(E^N))+I[13]+2850285829&4294967295,x=E+(C<<5&4294967295|C>>>27),C=D+(E^N&(x^E))+I[2]+4243563512&4294967295,D=x+(C<<9&4294967295|C>>>23),C=N+(x^E&(D^x))+I[7]+1735328473&4294967295,N=D+(C<<14&4294967295|C>>>18),C=E+(D^x&(N^D))+I[12]+2368359562&4294967295,E=N+(C<<20&4294967295|C>>>12),C=x+(E^N^D)+I[5]+4294588738&4294967295,x=E+(C<<4&4294967295|C>>>28),C=D+(x^E^N)+I[8]+2272392833&4294967295,D=x+(C<<11&4294967295|C>>>21),C=N+(D^x^E)+I[11]+1839030562&4294967295,N=D+(C<<16&4294967295|C>>>16),C=E+(N^D^x)+I[14]+4259657740&4294967295,E=N+(C<<23&4294967295|C>>>9),C=x+(E^N^D)+I[1]+2763975236&4294967295,x=E+(C<<4&4294967295|C>>>28),C=D+(x^E^N)+I[4]+1272893353&4294967295,D=x+(C<<11&4294967295|C>>>21),C=N+(D^x^E)+I[7]+4139469664&4294967295,N=D+(C<<16&4294967295|C>>>16),C=E+(N^D^x)+I[10]+3200236656&4294967295,E=N+(C<<23&4294967295|C>>>9),C=x+(E^N^D)+I[13]+681279174&4294967295,x=E+(C<<4&4294967295|C>>>28),C=D+(x^E^N)+I[0]+3936430074&4294967295,D=x+(C<<11&4294967295|C>>>21),C=N+(D^x^E)+I[3]+3572445317&4294967295,N=D+(C<<16&4294967295|C>>>16),C=E+(N^D^x)+I[6]+76029189&4294967295,E=N+(C<<23&4294967295|C>>>9),C=x+(E^N^D)+I[9]+3654602809&4294967295,x=E+(C<<4&4294967295|C>>>28),C=D+(x^E^N)+I[12]+3873151461&4294967295,D=x+(C<<11&4294967295|C>>>21),C=N+(D^x^E)+I[15]+530742520&4294967295,N=D+(C<<16&4294967295|C>>>16),C=E+(N^D^x)+I[2]+3299628645&4294967295,E=N+(C<<23&4294967295|C>>>9),C=x+(N^(E|~D))+I[0]+4096336452&4294967295,x=E+(C<<6&4294967295|C>>>26),C=D+(E^(x|~N))+I[7]+1126891415&4294967295,D=x+(C<<10&4294967295|C>>>22),C=N+(x^(D|~E))+I[14]+2878612391&4294967295,N=D+(C<<15&4294967295|C>>>17),C=E+(D^(N|~x))+I[5]+4237533241&4294967295,E=N+(C<<21&4294967295|C>>>11),C=x+(N^(E|~D))+I[12]+1700485571&4294967295,x=E+(C<<6&4294967295|C>>>26),C=D+(E^(x|~N))+I[3]+2399980690&4294967295,D=x+(C<<10&4294967295|C>>>22),C=N+(x^(D|~E))+I[10]+4293915773&4294967295,N=D+(C<<15&4294967295|C>>>17),C=E+(D^(N|~x))+I[1]+2240044497&4294967295,E=N+(C<<21&4294967295|C>>>11),C=x+(N^(E|~D))+I[8]+1873313359&4294967295,x=E+(C<<6&4294967295|C>>>26),C=D+(E^(x|~N))+I[15]+4264355552&4294967295,D=x+(C<<10&4294967295|C>>>22),C=N+(x^(D|~E))+I[6]+2734768916&4294967295,N=D+(C<<15&4294967295|C>>>17),C=E+(D^(N|~x))+I[13]+1309151649&4294967295,E=N+(C<<21&4294967295|C>>>11),C=x+(N^(E|~D))+I[4]+4149444226&4294967295,x=E+(C<<6&4294967295|C>>>26),C=D+(E^(x|~N))+I[11]+3174756917&4294967295,D=x+(C<<10&4294967295|C>>>22),C=N+(x^(D|~E))+I[2]+718787259&4294967295,N=D+(C<<15&4294967295|C>>>17),C=E+(D^(N|~x))+I[9]+3951481745&4294967295,b.g[0]=b.g[0]+x&4294967295,b.g[1]=b.g[1]+(N+(C<<21&4294967295|C>>>11))&4294967295,b.g[2]=b.g[2]+N&4294967295,b.g[3]=b.g[3]+D&4294967295}r.prototype.v=function(b,x){x===void 0&&(x=b.length);const E=x-this.blockSize,I=this.C;let N=this.h,D=0;for(;D>>I&255;return b};function s(b,x){var E=a;return Object.prototype.hasOwnProperty.call(E,b)?E[b]:E[b]=x(b)}function o(b,x){this.h=x;const E=[];let I=!0;for(let N=b.length-1;N>=0;N--){const D=b[N]|0;I&&D==x||(E[N]=D,I=!1)}this.g=E}var a={};function u(b){return-128<=b&&b<128?s(b,function(x){return new o([x|0],x<0?-1:0)}):new o([b|0],b<0?-1:0)}function c(b){if(isNaN(b)||!isFinite(b))return f;if(b<0)return R(c(-b));const x=[];let E=1;for(let I=0;b>=E;I++)x[I]=b/E|0,E*=4294967296;return new o(x,0)}function h(b,x){if(b.length==0)throw Error("number format error: empty string");if(x=x||10,x<2||36=0)throw Error('number format error: interior "-" character');const E=c(Math.pow(x,8));let I=f;for(let D=0;D=0?I:4294967296+I)*x,x*=4294967296}return b},t.toString=function(b){if(b=b||10,b<2||360?E.g[0]:E.h)>>>0).toString(b);if(E=N,_(E))return D+I;for(;D.length<6;)D="0"+D;I=D+I}},t.i=function(b){return b<0?0:b>>16)+(this.i(N)>>>16)+(b.i(N)>>>16);I=C>>>16,D&=65535,C&=65535,E[N]=C<<16|D}return new o(E,E[E.length-1]&-2147483648?-1:0)};function y(b,x){return b.add(R(x))}t.j=function(b){if(_(this)||_(b))return f;if(T(this))return T(b)?R(this).j(R(b)):R(R(this).j(b));if(T(b))return R(this.j(R(b)));if(this.l(g)<0&&b.l(g)<0)return c(this.m()*b.m());const x=this.g.length+b.g.length,E=[];for(var I=0;I<2*x;I++)E[I]=0;for(I=0;I>>16,C=this.i(I)&65535,ge=b.i(N)>>>16,ie=b.i(N)&65535;E[2*I+2*N]+=C*ie,w(E,2*I+2*N),E[2*I+2*N+1]+=D*ie,w(E,2*I+2*N+1),E[2*I+2*N+1]+=C*ge,w(E,2*I+2*N+1),E[2*I+2*N+2]+=D*ge,w(E,2*I+2*N+2)}for(b=0;b>>16,b[x]&=65535,x++}function k(b,x){this.g=b,this.h=x}function L(b,x){if(_(x))throw Error("division by zero");if(_(b))return new k(f,f);if(T(b))return x=L(R(b),x),new k(R(x.g),R(x.h));if(T(x))return x=L(b,R(x)),new k(R(x.g),x.h);if(b.g.length>30){if(T(b)||T(x))throw Error("slowDivide_ only works with positive integers.");for(var E=p,I=x;I.l(b)<=0;)E=U(E),I=U(I);var N=j(E,1),D=j(I,1);for(I=j(I,2),E=j(E,2);!_(I);){var C=D.add(I);C.l(b)<=0&&(N=N.add(E),D=C),I=j(I,1),E=j(E,1)}return x=y(b,N.j(x)),new k(N,x)}for(N=f;b.l(x)>=0;){for(E=Math.max(1,Math.floor(b.m()/x.m())),I=Math.ceil(Math.log(E)/Math.LN2),I=I<=48?1:Math.pow(2,I-48),D=c(E),C=D.j(x);T(C)||C.l(b)>0;)E-=I,D=c(E),C=D.j(x);_(D)&&(D=p),N=N.add(D),b=y(b,C)}return new k(N,b)}t.B=function(b){return L(this,b).h},t.and=function(b){const x=Math.max(this.g.length,b.g.length),E=[];for(let I=0;I>>31;return new o(E,b.h)}function j(b,x){const E=x>>5;x%=32;const I=b.g.length-E,N=[];for(let D=0;D0?b.i(D+E)>>>x|b.i(D+E+1)<<32-x:b.i(D+E);return new o(N,b.h)}r.prototype.digest=r.prototype.A,r.prototype.reset=r.prototype.u,r.prototype.update=r.prototype.v,ob=r,o.prototype.add=o.prototype.add,o.prototype.multiply=o.prototype.j,o.prototype.modulo=o.prototype.B,o.prototype.compare=o.prototype.l,o.prototype.toNumber=o.prototype.m,o.prototype.toString=o.prototype.toString,o.prototype.getBits=o.prototype.i,o.fromNumber=c,o.fromString=h,ji=o}).apply(typeof tv<"u"?tv:typeof self<"u"?self:typeof window<"u"?window:{});var uu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/** @license +Copyright The Closure Library Authors. +SPDX-License-Identifier: Apache-2.0 +*/var ab,ya,lb,Ru,Zf,ub,cb,db;(function(){var t,e=Object.defineProperty;function n(l){l=[typeof globalThis=="object"&&globalThis,l,typeof window=="object"&&window,typeof self=="object"&&self,typeof uu=="object"&&uu];for(var m=0;ml&&AsyncContext.Snapshot.wrap(l):l=>l;function g(l){const m=l.length;if(m>0){const v=Array(m);for(let S=0;S0?(this.h--,m=this.g,this.g=m.next,m.next=null):m=this.i(),m}}function R(l){o.setTimeout(()=>{throw l},0)}function y(){var l=b;let m=null;return l.g&&(m=l.g,l.g=l.g.next,l.g||(l.h=null),m.next=null),m}class w{constructor(){this.h=this.g=null}add(m,v){const S=k.get();S.set(m,v),this.h?this.h.next=S:this.g=S,this.h=S}}var k=new T(()=>new L,l=>l.reset());class L{constructor(){this.next=this.g=this.h=null}set(m,v){this.h=m,this.g=v,this.next=null}reset(){this.next=this.g=this.h=null}}let U,j=!1,b=new w,x=()=>{const l=Promise.resolve(void 0);U=()=>{l.then(E)}};function E(){for(var l;l=y();){try{l.h.call(l.g)}catch(v){R(v)}var m=k;m.j(l),m.h<100&&(m.h++,l.next=m.g,m.g=l)}j=!1}function I(){this.u=this.u,this.C=this.C}I.prototype.u=!1,I.prototype.dispose=function(){this.u||(this.u=!0,this.N())},I.prototype[Symbol.dispose]=function(){this.dispose()},I.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()};function N(l,m){this.type=l,this.g=this.target=m,this.defaultPrevented=!1}N.prototype.h=function(){this.defaultPrevented=!0};var D=function(){if(!o.addEventListener||!Object.defineProperty)return!1;var l=!1,m=Object.defineProperty({},"passive",{get:function(){l=!0}});try{const v=()=>{};o.addEventListener("test",v,m),o.removeEventListener("test",v,m)}catch{}return l}();function C(l){return/^[\s\xa0]*$/.test(l)}function ge(l,m){N.call(this,l?l.type:""),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType="",this.i=null,l&&this.init(l,m)}f(ge,N),ge.prototype.init=function(l,m){const v=this.type=l.type,S=l.changedTouches&&l.changedTouches.length?l.changedTouches[0]:null;this.target=l.target||l.srcElement,this.g=m,m=l.relatedTarget,m||(v=="mouseover"?m=l.fromElement:v=="mouseout"&&(m=l.toElement)),this.relatedTarget=m,S?(this.clientX=S.clientX!==void 0?S.clientX:S.pageX,this.clientY=S.clientY!==void 0?S.clientY:S.pageY,this.screenX=S.screenX||0,this.screenY=S.screenY||0):(this.clientX=l.clientX!==void 0?l.clientX:l.pageX,this.clientY=l.clientY!==void 0?l.clientY:l.pageY,this.screenX=l.screenX||0,this.screenY=l.screenY||0),this.button=l.button,this.key=l.key||"",this.ctrlKey=l.ctrlKey,this.altKey=l.altKey,this.shiftKey=l.shiftKey,this.metaKey=l.metaKey,this.pointerId=l.pointerId||0,this.pointerType=l.pointerType,this.state=l.state,this.i=l,l.defaultPrevented&&ge.Z.h.call(this)},ge.prototype.h=function(){ge.Z.h.call(this);const l=this.i;l.preventDefault?l.preventDefault():l.returnValue=!1};var ie="closure_listenable_"+(Math.random()*1e6|0),fe=0;function we(l,m,v,S,M){this.listener=l,this.proxy=null,this.src=m,this.type=v,this.capture=!!S,this.ha=M,this.key=++fe,this.da=this.fa=!1}function G(l){l.da=!0,l.listener=null,l.proxy=null,l.src=null,l.ha=null}function se(l,m,v){for(const S in l)m.call(v,l[S],S,l)}function A(l,m){for(const v in l)m.call(void 0,l[v],v,l)}function pe(l){const m={};for(const v in l)m[v]=l[v];return m}const _e="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function P(l,m){let v,S;for(let M=1;M-1?(m=l[te],v||(m.fa=!1)):(m=new we(m,this.src,z,!!S,M),m.fa=v,l.push(m)),m};function Y(l,m){const v=m.type;if(v in l.g){var S=l.g[v],M=Array.prototype.indexOf.call(S,m,void 0),z;(z=M>=0)&&Array.prototype.splice.call(S,M,1),z&&(G(m),l.g[v].length==0&&(delete l.g[v],l.h--))}}function re(l,m,v,S){for(let M=0;M-1&&(G(m[v]),Array.prototype.splice.call(m,v,1),m.length==0&&(delete l.g[z],l.h--)))):l&&(l=St(l))&&(m=l.g[m.toString()],l=-1,m&&(l=re(m,v,S,M)),(v=l>-1?m[l]:null)&&xt(v))}function xt(l){if(typeof l!="number"&&l&&!l.da){var m=l.src;if(m&&m[ie])Y(m.i,l);else{var v=l.type,S=l.proxy;m.removeEventListener?m.removeEventListener(v,S,l.capture):m.detachEvent?m.detachEvent(Rt(v),S):m.addListener&&m.removeListener&&m.removeListener(S),(v=St(m))?(Y(v,l),v.h==0&&(v.src=null,m[Ce]=null)):G(l)}}}function Rt(l){return l in de?de[l]:de[l]="on"+l}function ln(l,m){if(l.da)l=!0;else{m=new ge(m,this);const v=l.listener,S=l.ha||l.src;l.fa&&xt(l),l=v.call(S,m)}return l}function St(l){return l=l[Ce],l instanceof $?l:null}var st="__closure_events_fn_"+(Math.random()*1e9>>>0);function Ht(l){return typeof l=="function"?l:(l[st]||(l[st]=function(m){return l.handleEvent(m)}),l[st])}function Oe(){I.call(this),this.i=new $(this),this.M=this,this.G=null}f(Oe,I),Oe.prototype[ie]=!0,Oe.prototype.removeEventListener=function(l,m,v,S){Vt(this,l,m,v,S)};function Ye(l,m){var v,S=l.G;if(S)for(v=[];S;S=S.G)v.push(S);if(l=l.M,S=m.type||m,typeof m=="string")m=new N(m,l);else if(m instanceof N)m.target=m.target||l;else{var M=m;m=new N(S,l),P(m,M)}M=!0;let z,te;if(v)for(te=v.length-1;te>=0;te--)z=m.g=v[te],M=ee(z,S,!0,m)&&M;if(z=m.g=l,M=ee(z,S,!0,m)&&M,M=ee(z,S,!1,m)&&M,v)for(te=0;te2147483647?-1:o.setTimeout(l,m||0)}function V(l){l.g=Q(()=>{l.g=null,l.i&&(l.i=!1,V(l))},l.l);const m=l.h;l.h=null,l.m.apply(null,m)}class K extends I{constructor(m,v){super(),this.m=m,this.l=v,this.h=null,this.i=!1,this.g=null}j(m){this.h=arguments,this.g?this.i=!0:V(this)}N(){super.N(),this.g&&(o.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function me(l){I.call(this),this.h=l,this.g={}}f(me,I);var O=[];function B(l){se(l.g,function(m,v){this.g.hasOwnProperty(v)&&xt(m)},l),l.g={}}me.prototype.N=function(){me.Z.N.call(this),B(this)},me.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var oe=o.JSON.stringify,le=o.JSON.parse,he=class{stringify(l){return o.JSON.stringify(l,void 0)}parse(l){return o.JSON.parse(l,void 0)}};function $e(){}function je(){}var He={OPEN:"a",hb:"b",ERROR:"c",tb:"d"};function et(){N.call(this,"d")}f(et,N);function H(){N.call(this,"c")}f(H,N);var Z={},be=null;function ye(){return be=be||new Oe}Z.Ia="serverreachability";function ve(l){N.call(this,Z.Ia,l)}f(ve,N);function Xe(l){const m=ye();Ye(m,new ve(m))}Z.STAT_EVENT="statevent";function wt(l,m){N.call(this,Z.STAT_EVENT,l),this.stat=m}f(wt,N);function Ee(l){const m=ye();Ye(m,new wt(m,l))}Z.Ja="timingevent";function _t(l,m){N.call(this,Z.Ja,l),this.size=m}f(_t,N);function Se(l,m){if(typeof l!="function")throw Error("Fn must not be null and must be a function");return o.setTimeout(function(){l()},m)}function ut(){this.g=!0}ut.prototype.ua=function(){this.g=!1};function Ft(l,m,v,S,M,z){l.info(function(){if(l.g)if(z){var te="",De=z.split("&");for(let Je=0;Je1){const Ut=jt[0];jt=jt[1];const hr=Ut.split("_");te=hr.length>=2&&hr[1]=="type"?te+(Ut+"="+jt+"&"):te+(Ut+"=redacted&")}}}else te=null;else te=z;return"XMLHTTP REQ ("+S+") [attempt "+M+"]: "+m+` +`+v+` +`+te})}function un(l,m,v,S,M,z,te){l.info(function(){return"XMLHTTP RESP ("+S+") [ attempt "+M+"]: "+m+` +`+v+` +`+z+" "+te})}function Jn(l,m,v,S){l.info(function(){return"XMLHTTP TEXT ("+m+"): "+pn(l,v)+(S?" "+S:"")})}function Dt(l,m){l.info(function(){return"TIMEOUT: "+m})}ut.prototype.info=function(){};function pn(l,m){if(!l.g)return m;if(!m)return null;try{const z=JSON.parse(m);if(z){for(l=0;l0&&l.length;)v.push(l.shift()),m--;return l.length&&v.push(l.join(":")),v}function ii(l,m,v,S){this.j=l,this.i=m,this.l=v,this.S=S||1,this.V=new me(this),this.H=45e3,this.J=null,this.o=!1,this.u=this.B=this.A=this.M=this.F=this.T=this.D=null,this.G=[],this.g=null,this.C=0,this.m=this.v=null,this.X=-1,this.K=!1,this.P=0,this.O=null,this.W=this.L=this.U=this.R=!1,this.h=new Gg}function Gg(){this.i=null,this.g="",this.h=!1}var Kg={},Md={};function Vd(l,m,v){l.M=1,l.A=Ol(dr(m)),l.u=v,l.R=!0,Qg(l,null)}function Qg(l,m){l.F=Date.now(),Ll(l),l.B=dr(l.A);var v=l.B,S=l.S;Array.isArray(S)||(S=[String(S)]),ly(v.i,"t",S),l.C=0,v=l.j.L,l.h=new Gg,l.g=Iy(l.j,v?m:null,!l.u),l.P>0&&(l.O=new K(c(l.Y,l,l.g),l.P)),m=l.V,v=l.g,S=l.ba;var M="readystatechange";Array.isArray(M)||(M&&(O[0]=M.toString()),M=O);for(let z=0;z0&&!this.W){this.W=!0;var te=this.j;te.g==this&&te.aa&&!te.P&&(te.j.info("Great, no buffering proxy detected. Bytes received: "+v.length),Kd(te),te.P=!0,Ee(11))}}else Jn(this.i,this.l,v,null),Ud(this,v);De==4&&Zi(this),this.o&&!this.K&&(De==4?by(this.j,this):(this.o=!1,Ll(this)))}else IT(this.g),m==400&&v.indexOf("Unknown SID")>0?(this.m=3,Ee(12)):(this.m=0,Ee(13)),Zi(this),qo(this)}}}catch{}finally{}};function dT(l){if(!Yg(l))return l.g.la();const m=my(l.g);if(m==="")return"";let v="";const S=m.length,M=ai(l.g)==4;if(!l.h.i){if(typeof TextDecoder>"u")return Zi(l),qo(l),"";l.h.i=new o.TextDecoder}for(let z=0;zm.length?Md:(m=m.slice(S,S+v),l.C=S+v,m)))}ii.prototype.cancel=function(){this.K=!0,Zi(this)};function Ll(l){l.T=Date.now()+l.H,Xg(l,l.H)}function Xg(l,m){if(l.D!=null)throw Error("WatchDog timer not null");l.D=Se(c(l.aa,l),m)}function Fd(l){l.D&&(o.clearTimeout(l.D),l.D=null)}ii.prototype.aa=function(){this.D=null;const l=Date.now();l-this.T>=0?(Dt(this.i,this.B),this.M!=2&&(Xe(),Ee(17)),Zi(this),this.m=2,qo(this)):Xg(this,this.T-l)};function qo(l){l.j.I==0||l.K||by(l.j,l)}function Zi(l){Fd(l);var m=l.O;m&&typeof m.dispose=="function"&&m.dispose(),l.O=null,B(l.V),l.g&&(m=l.g,l.g=null,m.abort(),m.dispose())}function Ud(l,m){try{var v=l.j;if(v.I!=0&&(v.g==l||zd(v.h,l))){if(!l.L&&zd(v.h,l)&&v.I==3){try{var S=v.Ba.g.parse(m)}catch{S=null}if(Array.isArray(S)&&S.length==3){var M=S;if(M[0]==0){e:if(!v.v){if(v.g)if(v.g.F+3e30&&(S=1.5*li,v.O=S,v.j.info("backChannelRequestTimeoutMs_="+S)),S=v;const ui=l.g;if(ui){const $l=ui.g?ui.g.getResponseHeader("X-Client-Wire-Protocol"):null;if($l){var z=S.h;z.g||$l.indexOf("spdy")==-1&&$l.indexOf("quic")==-1&&$l.indexOf("h2")==-1||(z.j=z.l,z.g=new Set,z.h&&(Bd(z,z.h),z.h=null))}if(S.G){const Qd=ui.g?ui.g.getResponseHeader("X-HTTP-Session-Id"):null;Qd&&(S.wa=Qd,ot(S.J,S.G,Qd))}}v.I=3,v.l&&v.l.ra(),v.aa&&(v.T=Date.now()-l.F,v.j.info("Handshake RTT: "+v.T+"ms")),S=v;var te=l;if(S.na=Ty(S,S.L?S.ba:null,S.W),te.L){ty(S.h,te);var De=te,jt=S.O;jt&&(De.H=jt),De.D&&(Fd(De),Ll(De)),S.g=te}else wy(S);v.i.length>0&&Ul(v)}else Je[0]!="stop"&&Je[0]!="close"||ts(v,7);else v.I==3&&(Je[0]=="stop"||Je[0]=="close"?Je[0]=="stop"?ts(v,7):Wd(v):Je[0]!="noop"&&v.l&&v.l.qa(Je),v.A=0)}}Xe(4)}catch{}}var fT=class{constructor(l,m){this.g=l,this.map=m}};function Jg(l){this.l=l||10,o.PerformanceNavigationTiming?(l=o.performance.getEntriesByType("navigation"),l=l.length>0&&(l[0].nextHopProtocol=="hq"||l[0].nextHopProtocol=="h2")):l=!!(o.chrome&&o.chrome.loadTimes&&o.chrome.loadTimes()&&o.chrome.loadTimes().wasFetchedViaSpdy),this.j=l?this.l:1,this.g=null,this.j>1&&(this.g=new Set),this.h=null,this.i=[]}function Zg(l){return l.h?!0:l.g?l.g.size>=l.j:!1}function ey(l){return l.h?1:l.g?l.g.size:0}function zd(l,m){return l.h?l.h==m:l.g?l.g.has(m):!1}function Bd(l,m){l.g?l.g.add(m):l.h=m}function ty(l,m){l.h&&l.h==m?l.h=null:l.g&&l.g.has(m)&&l.g.delete(m)}Jg.prototype.cancel=function(){if(this.i=ny(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&this.g.size!==0){for(const l of this.g.values())l.cancel();this.g.clear()}};function ny(l){if(l.h!=null)return l.i.concat(l.h.G);if(l.g!=null&&l.g.size!==0){let m=l.i;for(const v of l.g.values())m=m.concat(v.G);return m}return g(l.i)}var ry=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function pT(l,m){if(l){l=l.split("&");for(let v=0;v=0?(M=l[v].substring(0,S),z=l[v].substring(S+1)):M=l[v],m(M,z?decodeURIComponent(z.replace(/\+/g," ")):"")}}}function si(l){this.g=this.o=this.j="",this.u=null,this.m=this.h="",this.l=!1;let m;l instanceof si?(this.l=l.l,Wo(this,l.j),this.o=l.o,this.g=l.g,Go(this,l.u),this.h=l.h,$d(this,uy(l.i)),this.m=l.m):l&&(m=String(l).match(ry))?(this.l=!1,Wo(this,m[1]||"",!0),this.o=Ko(m[2]||""),this.g=Ko(m[3]||"",!0),Go(this,m[4]),this.h=Ko(m[5]||"",!0),$d(this,m[6]||"",!0),this.m=Ko(m[7]||"")):(this.l=!1,this.i=new Yo(null,this.l))}si.prototype.toString=function(){const l=[];var m=this.j;m&&l.push(Qo(m,iy,!0),":");var v=this.g;return(v||m=="file")&&(l.push("//"),(m=this.o)&&l.push(Qo(m,iy,!0),"@"),l.push(Pn(v).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),v=this.u,v!=null&&l.push(":",String(v))),(v=this.h)&&(this.g&&v.charAt(0)!="/"&&l.push("/"),l.push(Qo(v,v.charAt(0)=="/"?yT:gT,!0))),(v=this.i.toString())&&l.push("?",v),(v=this.m)&&l.push("#",Qo(v,xT)),l.join("")},si.prototype.resolve=function(l){const m=dr(this);let v=!!l.j;v?Wo(m,l.j):v=!!l.o,v?m.o=l.o:v=!!l.g,v?m.g=l.g:v=l.u!=null;var S=l.h;if(v)Go(m,l.u);else if(v=!!l.h){if(S.charAt(0)!="/")if(this.g&&!this.h)S="/"+S;else{var M=m.h.lastIndexOf("/");M!=-1&&(S=m.h.slice(0,M+1)+S)}if(M=S,M==".."||M==".")S="";else if(M.indexOf("./")!=-1||M.indexOf("/.")!=-1){S=M.lastIndexOf("/",0)==0,M=M.split("/");const z=[];for(let te=0;te1||z.length==1&&z[0]!="")&&z.pop(),S&&te==M.length&&z.push("")):(z.push(De),S=!0)}S=z.join("/")}else S=M}return v?m.h=S:v=l.i.toString()!=="",v?$d(m,uy(l.i)):v=!!l.m,v&&(m.m=l.m),m};function dr(l){return new si(l)}function Wo(l,m,v){l.j=v?Ko(m,!0):m,l.j&&(l.j=l.j.replace(/:$/,""))}function Go(l,m){if(m){if(m=Number(m),isNaN(m)||m<0)throw Error("Bad port number "+m);l.u=m}else l.u=null}function $d(l,m,v){m instanceof Yo?(l.i=m,wT(l.i,l.l)):(v||(m=Qo(m,vT)),l.i=new Yo(m,l.l))}function ot(l,m,v){l.i.set(m,v)}function Ol(l){return ot(l,"zx",Math.floor(Math.random()*2147483648).toString(36)+Math.abs(Math.floor(Math.random()*2147483648)^Date.now()).toString(36)),l}function Ko(l,m){return l?m?decodeURI(l.replace(/%25/g,"%2525")):decodeURIComponent(l):""}function Qo(l,m,v){return typeof l=="string"?(l=encodeURI(l).replace(m,mT),v&&(l=l.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),l):null}function mT(l){return l=l.charCodeAt(0),"%"+(l>>4&15).toString(16)+(l&15).toString(16)}var iy=/[#\/\?@]/g,gT=/[#\?:]/g,yT=/[#\?]/g,vT=/[#\?@]/g,xT=/#/g;function Yo(l,m){this.h=this.g=null,this.i=l||null,this.j=!!m}function es(l){l.g||(l.g=new Map,l.h=0,l.i&&pT(l.i,function(m,v){l.add(decodeURIComponent(m.replace(/\+/g," ")),v)}))}t=Yo.prototype,t.add=function(l,m){es(this),this.i=null,l=Os(this,l);let v=this.g.get(l);return v||this.g.set(l,v=[]),v.push(m),this.h+=1,this};function sy(l,m){es(l),m=Os(l,m),l.g.has(m)&&(l.i=null,l.h-=l.g.get(m).length,l.g.delete(m))}function oy(l,m){return es(l),m=Os(l,m),l.g.has(m)}t.forEach=function(l,m){es(this),this.g.forEach(function(v,S){v.forEach(function(M){l.call(m,M,S,this)},this)},this)};function ay(l,m){es(l);let v=[];if(typeof m=="string")oy(l,m)&&(v=v.concat(l.g.get(Os(l,m))));else for(l=Array.from(l.g.values()),m=0;m0?String(l[0]):m):m};function ly(l,m,v){sy(l,m),v.length>0&&(l.i=null,l.g.set(Os(l,m),g(v)),l.h+=v.length)}t.toString=function(){if(this.i)return this.i;if(!this.g)return"";const l=[],m=Array.from(this.g.keys());for(let S=0;S{S.abort(),oi(v,"TestPingServer: timeout",!1,m)},1e4);fetch(l,{signal:S.signal}).then(z=>{clearTimeout(M),z.ok?oi(v,"TestPingServer: ok",!0,m):oi(v,"TestPingServer: server error",!1,m)}).catch(()=>{clearTimeout(M),oi(v,"TestPingServer: error",!1,m)})}function oi(l,m,v,S,M){try{M&&(M.onload=null,M.onerror=null,M.onabort=null,M.ontimeout=null),S(v)}catch{}}function ET(){this.g=new he}function Hd(l){this.i=l.Sb||null,this.h=l.ab||!1}f(Hd,$e),Hd.prototype.g=function(){return new Ml(this.i,this.h)};function Ml(l,m){Oe.call(this),this.H=l,this.o=m,this.m=void 0,this.status=this.readyState=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.A=new Headers,this.h=null,this.F="GET",this.D="",this.g=!1,this.B=this.j=this.l=null,this.v=new AbortController}f(Ml,Oe),t=Ml.prototype,t.open=function(l,m){if(this.readyState!=0)throw this.abort(),Error("Error reopening a connection");this.F=l,this.D=m,this.readyState=1,Jo(this)},t.send=function(l){if(this.readyState!=1)throw this.abort(),Error("need to call open() first. ");if(this.v.signal.aborted)throw this.abort(),Error("Request was aborted.");this.g=!0;const m={headers:this.A,method:this.F,credentials:this.m,cache:void 0,signal:this.v.signal};l&&(m.body=l),(this.H||o).fetch(new Request(this.D,m)).then(this.Pa.bind(this),this.ga.bind(this))},t.abort=function(){this.response=this.responseText="",this.A=new Headers,this.status=0,this.v.abort(),this.j&&this.j.cancel("Request was aborted.").catch(()=>{}),this.readyState>=1&&this.g&&this.readyState!=4&&(this.g=!1,Xo(this)),this.readyState=0},t.Pa=function(l){if(this.g&&(this.l=l,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=l.headers,this.readyState=2,Jo(this)),this.g&&(this.readyState=3,Jo(this),this.g)))if(this.responseType==="arraybuffer")l.arrayBuffer().then(this.Na.bind(this),this.ga.bind(this));else if(typeof o.ReadableStream<"u"&&"body"in l){if(this.j=l.body.getReader(),this.o){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.B=new TextDecoder;cy(this)}else l.text().then(this.Oa.bind(this),this.ga.bind(this))};function cy(l){l.j.read().then(l.Ma.bind(l)).catch(l.ga.bind(l))}t.Ma=function(l){if(this.g){if(this.o&&l.value)this.response.push(l.value);else if(!this.o){var m=l.value?l.value:new Uint8Array(0);(m=this.B.decode(m,{stream:!l.done}))&&(this.response=this.responseText+=m)}l.done?Xo(this):Jo(this),this.readyState==3&&cy(this)}},t.Oa=function(l){this.g&&(this.response=this.responseText=l,Xo(this))},t.Na=function(l){this.g&&(this.response=l,Xo(this))},t.ga=function(){this.g&&Xo(this)};function Xo(l){l.readyState=4,l.l=null,l.j=null,l.B=null,Jo(l)}t.setRequestHeader=function(l,m){this.A.append(l,m)},t.getResponseHeader=function(l){return this.h&&this.h.get(l.toLowerCase())||""},t.getAllResponseHeaders=function(){if(!this.h)return"";const l=[],m=this.h.entries();for(var v=m.next();!v.done;)v=v.value,l.push(v[0]+": "+v[1]),v=m.next();return l.join(`\r +`)};function Jo(l){l.onreadystatechange&&l.onreadystatechange.call(l)}Object.defineProperty(Ml.prototype,"withCredentials",{get:function(){return this.m==="include"},set:function(l){this.m=l?"include":"same-origin"}});function dy(l){let m="";return se(l,function(v,S){m+=S,m+=":",m+=v,m+=`\r +`}),m}function qd(l,m,v){e:{for(S in v){var S=!1;break e}S=!0}S||(v=dy(v),typeof l=="string"?v!=null&&Pn(v):ot(l,m,v))}function gt(l){Oe.call(this),this.headers=new Map,this.L=l||null,this.h=!1,this.g=null,this.D="",this.o=0,this.l="",this.j=this.B=this.v=this.A=!1,this.m=null,this.F="",this.H=!1}f(gt,Oe);var ST=/^https?$/i,TT=["POST","PUT"];t=gt.prototype,t.Fa=function(l){this.H=l},t.ea=function(l,m,v,S){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+l);m=m?m.toUpperCase():"GET",this.D=l,this.l="",this.o=0,this.A=!1,this.h=!0,this.g=this.L?this.L.g():gn.g(),this.g.onreadystatechange=p(c(this.Ca,this));try{this.B=!0,this.g.open(m,String(l),!0),this.B=!1}catch(z){hy(this,z);return}if(l=v||"",v=new Map(this.headers),S)if(Object.getPrototypeOf(S)===Object.prototype)for(var M in S)v.set(M,S[M]);else if(typeof S.keys=="function"&&typeof S.get=="function")for(const z of S.keys())v.set(z,S.get(z));else throw Error("Unknown input type for opt_headers: "+String(S));S=Array.from(v.keys()).find(z=>z.toLowerCase()=="content-type"),M=o.FormData&&l instanceof o.FormData,!(Array.prototype.indexOf.call(TT,m,void 0)>=0)||S||M||v.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(const[z,te]of v)this.g.setRequestHeader(z,te);this.F&&(this.g.responseType=this.F),"withCredentials"in this.g&&this.g.withCredentials!==this.H&&(this.g.withCredentials=this.H);try{this.m&&(clearTimeout(this.m),this.m=null),this.v=!0,this.g.send(l),this.v=!1}catch(z){hy(this,z)}};function hy(l,m){l.h=!1,l.g&&(l.j=!0,l.g.abort(),l.j=!1),l.l=m,l.o=5,fy(l),Vl(l)}function fy(l){l.A||(l.A=!0,Ye(l,"complete"),Ye(l,"error"))}t.abort=function(l){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.o=l||7,Ye(this,"complete"),Ye(this,"abort"),Vl(this))},t.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),Vl(this,!0)),gt.Z.N.call(this)},t.Ca=function(){this.u||(this.B||this.v||this.j?py(this):this.Xa())},t.Xa=function(){py(this)};function py(l){if(l.h&&typeof s<"u"){if(l.v&&ai(l)==4)setTimeout(l.Ca.bind(l),0);else if(Ye(l,"readystatechange"),ai(l)==4){l.h=!1;try{const z=l.ca();e:switch(z){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var m=!0;break e;default:m=!1}var v;if(!(v=m)){var S;if(S=z===0){let te=String(l.D).match(ry)[1]||null;!te&&o.self&&o.self.location&&(te=o.self.location.protocol.slice(0,-1)),S=!ST.test(te?te.toLowerCase():"")}v=S}if(v)Ye(l,"complete"),Ye(l,"success");else{l.o=6;try{var M=ai(l)>2?l.g.statusText:""}catch{M=""}l.l=M+" ["+l.ca()+"]",fy(l)}}finally{Vl(l)}}}}function Vl(l,m){if(l.g){l.m&&(clearTimeout(l.m),l.m=null);const v=l.g;l.g=null,m||Ye(l,"ready");try{v.onreadystatechange=null}catch{}}}t.isActive=function(){return!!this.g};function ai(l){return l.g?l.g.readyState:0}t.ca=function(){try{return ai(this)>2?this.g.status:-1}catch{return-1}},t.la=function(){try{return this.g?this.g.responseText:""}catch{return""}},t.La=function(l){if(this.g){var m=this.g.responseText;return l&&m.indexOf(l)==0&&(m=m.substring(l.length)),le(m)}};function my(l){try{if(!l.g)return null;if("response"in l.g)return l.g.response;switch(l.F){case"":case"text":return l.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in l.g)return l.g.mozResponseArrayBuffer}return null}catch{return null}}function IT(l){const m={};l=(l.g&&ai(l)>=2&&l.g.getAllResponseHeaders()||"").split(`\r +`);for(let S=0;S0&&(this.ia=l.longPollingTimeout),this.ta=void 0,this.T=0,this.P=!1,this.ja=this.B=null}t=gy.prototype,t.ka=8,t.I=1,t.connect=function(l,m,v,S){Ee(0),this.W=l,this.H=m||{},v&&S!==void 0&&(this.H.OSID=v,this.H.OAID=S),this.F=this.X,this.J=Ty(this,null,this.W),Ul(this)};function Wd(l){if(yy(l),l.I==3){var m=l.V++,v=dr(l.J);if(ot(v,"SID",l.M),ot(v,"RID",m),ot(v,"TYPE","terminate"),ea(l,v),m=new ii(l,l.j,m),m.M=2,m.A=Ol(dr(v)),v=!1,o.navigator&&o.navigator.sendBeacon)try{v=o.navigator.sendBeacon(m.A.toString(),"")}catch{}!v&&o.Image&&(new Image().src=m.A,v=!0),v||(m.g=Iy(m.j,null),m.g.ea(m.A)),m.F=Date.now(),Ll(m)}Sy(l)}function Fl(l){l.g&&(Kd(l),l.g.cancel(),l.g=null)}function yy(l){Fl(l),l.v&&(o.clearTimeout(l.v),l.v=null),zl(l),l.h.cancel(),l.m&&(typeof l.m=="number"&&o.clearTimeout(l.m),l.m=null)}function Ul(l){if(!Zg(l.h)&&!l.m){l.m=!0;var m=l.Ea;U||x(),j||(U(),j=!0),b.add(m,l),l.D=0}}function kT(l,m){return ey(l.h)>=l.h.j-(l.m?1:0)?!1:l.m?(l.i=m.G.concat(l.i),!0):l.I==1||l.I==2||l.D>=(l.Sa?0:l.Ta)?!1:(l.m=Se(c(l.Ea,l,m),Ey(l,l.D)),l.D++,!0)}t.Ea=function(l){if(this.m)if(this.m=null,this.I==1){if(!l){this.V=Math.floor(Math.random()*1e5),l=this.V++;const M=new ii(this,this.j,l);let z=this.o;if(this.U&&(z?(z=pe(z),P(z,this.U)):z=this.U),this.u!==null||this.R||(M.J=z,z=null),this.S)e:{for(var m=0,v=0;v4096){m=v;break e}if(m===4096||v===this.i.length-1){m=v+1;break e}}m=1e3}else m=1e3;m=xy(this,M,m),v=dr(this.J),ot(v,"RID",l),ot(v,"CVER",22),this.G&&ot(v,"X-HTTP-Session-Id",this.G),ea(this,v),z&&(this.R?m="headers="+Pn(dy(z))+"&"+m:this.u&&qd(v,this.u,z)),Bd(this.h,M),this.Ra&&ot(v,"TYPE","init"),this.S?(ot(v,"$req",m),ot(v,"SID","null"),M.U=!0,Vd(M,v,null)):Vd(M,v,m),this.I=2}}else this.I==3&&(l?vy(this,l):this.i.length==0||Zg(this.h)||vy(this))};function vy(l,m){var v;m?v=m.l:v=l.V++;const S=dr(l.J);ot(S,"SID",l.M),ot(S,"RID",v),ot(S,"AID",l.K),ea(l,S),l.u&&l.o&&qd(S,l.u,l.o),v=new ii(l,l.j,v,l.D+1),l.u===null&&(v.J=l.o),m&&(l.i=m.G.concat(l.i)),m=xy(l,v,1e3),v.H=Math.round(l.va*.5)+Math.round(l.va*.5*Math.random()),Bd(l.h,v),Vd(v,S,m)}function ea(l,m){l.H&&se(l.H,function(v,S){ot(m,S,v)}),l.l&&se({},function(v,S){ot(m,S,v)})}function xy(l,m,v){v=Math.min(l.i.length,v);const S=l.l?c(l.l.Ka,l.l,l):null;e:{var M=l.i;let De=-1;for(;;){const jt=["count="+v];De==-1?v>0?(De=M[0].g,jt.push("ofs="+De)):De=0:jt.push("ofs="+De);let Je=!0;for(let Ut=0;Ut=3?!1:(l.Y++,l.v=Se(c(l.Da,l),Ey(l,l.A)),l.A++,!0)}t.Da=function(){if(this.v=null,_y(this),this.aa&&!(this.P||this.g==null||this.T<=0)){var l=4*this.T;this.j.info("BP detection timer enabled: "+l),this.B=Se(c(this.Wa,this),l)}},t.Wa=function(){this.B&&(this.B=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.F=!1,this.P=!0,Ee(10),Fl(this),_y(this))};function Kd(l){l.B!=null&&(o.clearTimeout(l.B),l.B=null)}function _y(l){l.g=new ii(l,l.j,"rpc",l.Y),l.u===null&&(l.g.J=l.o),l.g.P=0;var m=dr(l.na);ot(m,"RID","rpc"),ot(m,"SID",l.M),ot(m,"AID",l.K),ot(m,"CI",l.F?"0":"1"),!l.F&&l.ia&&ot(m,"TO",l.ia),ot(m,"TYPE","xmlhttp"),ea(l,m),l.u&&l.o&&qd(m,l.u,l.o),l.O&&(l.g.H=l.O);var v=l.g;l=l.ba,v.M=1,v.A=Ol(dr(m)),v.u=null,v.R=!0,Qg(v,l)}t.Va=function(){this.C!=null&&(this.C=null,Fl(this),Gd(this),Ee(19))};function zl(l){l.C!=null&&(o.clearTimeout(l.C),l.C=null)}function by(l,m){var v=null;if(l.g==m){zl(l),Kd(l),l.g=null;var S=2}else if(zd(l.h,m))v=m.G,ty(l.h,m),S=1;else return;if(l.I!=0){if(m.o)if(S==1){v=m.u?m.u.length:0,m=Date.now()-m.F;var M=l.D;S=ye(),Ye(S,new _t(S,v)),Ul(l)}else wy(l);else if(M=m.m,M==3||M==0&&m.X>0||!(S==1&&kT(l,m)||S==2&&Gd(l)))switch(v&&v.length>0&&(m=l.h,m.i=m.i.concat(v)),M){case 1:ts(l,5);break;case 4:ts(l,10);break;case 3:ts(l,6);break;default:ts(l,2)}}}function Ey(l,m){let v=l.Qa+Math.floor(Math.random()*l.Za);return l.isActive()||(v*=2),v*m}function ts(l,m){if(l.j.info("Error code "+m),m==2){var v=c(l.bb,l),S=l.Ua;const M=!S;S=new si(S||"//www.google.com/images/cleardot.gif"),o.location&&o.location.protocol=="http"||Wo(S,"https"),Ol(S),M?_T(S.toString(),v):bT(S.toString(),v)}else Ee(2);l.I=0,l.l&&l.l.pa(m),Sy(l),yy(l)}t.bb=function(l){l?(this.j.info("Successfully pinged google.com"),Ee(2)):(this.j.info("Failed to ping google.com"),Ee(1))};function Sy(l){if(l.I=0,l.ja=[],l.l){const m=ny(l.h);(m.length!=0||l.i.length!=0)&&(_(l.ja,m),_(l.ja,l.i),l.h.i.length=0,g(l.i),l.i.length=0),l.l.oa()}}function Ty(l,m,v){var S=v instanceof si?dr(v):new si(v);if(S.g!="")m&&(S.g=m+"."+S.g),Go(S,S.u);else{var M=o.location;S=M.protocol,m=m?m+"."+M.hostname:M.hostname,M=+M.port;const z=new si(null);S&&Wo(z,S),m&&(z.g=m),M&&Go(z,M),v&&(z.h=v),S=z}return v=l.G,m=l.wa,v&&m&&ot(S,v,m),ot(S,"VER",l.ka),ea(l,S),S}function Iy(l,m,v){if(m&&!l.L)throw Error("Can't create secondary domain capable XhrIo object.");return m=l.Aa&&!l.ma?new gt(new Hd({ab:v})):new gt(l.ma),m.Fa(l.L),m}t.isActive=function(){return!!this.l&&this.l.isActive(this)};function ky(){}t=ky.prototype,t.ra=function(){},t.qa=function(){},t.pa=function(){},t.oa=function(){},t.isActive=function(){return!0},t.Ka=function(){};function Bl(){}Bl.prototype.g=function(l,m){return new Rn(l,m)};function Rn(l,m){Oe.call(this),this.g=new gy(m),this.l=l,this.h=m&&m.messageUrlParams||null,l=m&&m.messageHeaders||null,m&&m.clientProtocolHeaderRequired&&(l?l["X-Client-Protocol"]="webchannel":l={"X-Client-Protocol":"webchannel"}),this.g.o=l,l=m&&m.initMessageHeaders||null,m&&m.messageContentType&&(l?l["X-WebChannel-Content-Type"]=m.messageContentType:l={"X-WebChannel-Content-Type":m.messageContentType}),m&&m.sa&&(l?l["X-WebChannel-Client-Profile"]=m.sa:l={"X-WebChannel-Client-Profile":m.sa}),this.g.U=l,(l=m&&m.Qb)&&!C(l)&&(this.g.u=l),this.A=m&&m.supportsCrossDomainXhr||!1,this.v=m&&m.sendRawJson||!1,(m=m&&m.httpSessionIdParam)&&!C(m)&&(this.g.G=m,l=this.h,l!==null&&m in l&&(l=this.h,m in l&&delete l[m])),this.j=new Ms(this)}f(Rn,Oe),Rn.prototype.m=function(){this.g.l=this.j,this.A&&(this.g.L=!0),this.g.connect(this.l,this.h||void 0)},Rn.prototype.close=function(){Wd(this.g)},Rn.prototype.o=function(l){var m=this.g;if(typeof l=="string"){var v={};v.__data__=l,l=v}else this.v&&(v={},v.__data__=oe(l),l=v);m.i.push(new fT(m.Ya++,l)),m.I==3&&Ul(m)},Rn.prototype.N=function(){this.g.l=null,delete this.j,Wd(this.g),delete this.g,Rn.Z.N.call(this)};function Cy(l){et.call(this),l.__headers__&&(this.headers=l.__headers__,this.statusCode=l.__status__,delete l.__headers__,delete l.__status__);var m=l.__sm__;if(m){e:{for(const v in m){l=v;break e}l=void 0}(this.i=l)&&(l=this.i,m=m!==null&&l in m?m[l]:void 0),this.data=m}else this.data=l}f(Cy,et);function Ny(){H.call(this),this.status=1}f(Ny,H);function Ms(l){this.g=l}f(Ms,ky),Ms.prototype.ra=function(){Ye(this.g,"a")},Ms.prototype.qa=function(l){Ye(this.g,new Cy(l))},Ms.prototype.pa=function(l){Ye(this.g,new Ny)},Ms.prototype.oa=function(){Ye(this.g,"b")},Bl.prototype.createWebChannel=Bl.prototype.g,Rn.prototype.send=Rn.prototype.o,Rn.prototype.open=Rn.prototype.m,Rn.prototype.close=Rn.prototype.close,db=function(){return new Bl},cb=function(){return ye()},ub=Z,Zf={jb:0,mb:1,nb:2,Hb:3,Mb:4,Jb:5,Kb:6,Ib:7,Gb:8,Lb:9,PROXY:10,NOPROXY:11,Eb:12,Ab:13,Bb:14,zb:15,Cb:16,Db:17,fb:18,eb:19,gb:20},jr.NO_ERROR=0,jr.TIMEOUT=8,jr.HTTP_ERROR=6,Ru=jr,mn.COMPLETE="complete",lb=mn,je.EventType=He,He.OPEN="a",He.CLOSE="b",He.ERROR="c",He.MESSAGE="d",Oe.prototype.listen=Oe.prototype.J,ya=je,gt.prototype.listenOnce=gt.prototype.K,gt.prototype.getLastError=gt.prototype.Ha,gt.prototype.getLastErrorCode=gt.prototype.ya,gt.prototype.getStatus=gt.prototype.ca,gt.prototype.getResponseJson=gt.prototype.La,gt.prototype.getResponseText=gt.prototype.la,gt.prototype.send=gt.prototype.ea,gt.prototype.setWithCredentials=gt.prototype.Fa,ab=gt}).apply(typeof uu<"u"?uu:typeof self<"u"?self:typeof window<"u"?window:{});const nv="@firebase/firestore",rv="4.9.2";/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class tn{constructor(e){this.uid=e}isAuthenticated(){return this.uid!=null}toKey(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}isEqual(e){return e.uid===this.uid}}tn.UNAUTHENTICATED=new tn(null),tn.GOOGLE_CREDENTIALS=new tn("google-credentials-uid"),tn.FIRST_PARTY=new tn("first-party-uid"),tn.MOCK_USER=new tn("mock-user");/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */let Mo="12.3.0";/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Ss=new Dm("@firebase/firestore");function Us(){return Ss.logLevel}function ue(t,...e){if(Ss.logLevel<=Me.DEBUG){const n=e.map(Om);Ss.debug(`Firestore (${Mo}): ${t}`,...n)}}function Yr(t,...e){if(Ss.logLevel<=Me.ERROR){const n=e.map(Om);Ss.error(`Firestore (${Mo}): ${t}`,...n)}}function Io(t,...e){if(Ss.logLevel<=Me.WARN){const n=e.map(Om);Ss.warn(`Firestore (${Mo}): ${t}`,...n)}}function Om(t){if(typeof t=="string")return t;try{/** +* @license +* Copyright 2020 Google LLC +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/return function(n){return JSON.stringify(n)}(t)}catch{return t}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Te(t,e,n){let r="Unexpected state";typeof e=="string"?r=e:n=e,hb(t,r,n)}function hb(t,e,n){let r=`FIRESTORE (${Mo}) INTERNAL ASSERTION FAILED: ${e} (ID: ${t.toString(16)})`;if(n!==void 0)try{r+=" CONTEXT: "+JSON.stringify(n)}catch{r+=" CONTEXT: "+n}throw Yr(r),new Error(r)}function Ge(t,e,n,r){let i="Unexpected state";typeof n=="string"?i=n:r=n,t||hb(e,i,r)}function Ae(t,e){return t}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const q={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENTED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"};class ae extends Rr{constructor(e,n){super(e,n),this.code=e,this.message=n,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Hr{constructor(){this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class fb{constructor(e,n){this.user=n,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}}class eN{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,n){e.enqueueRetryable(()=>n(tn.UNAUTHENTICATED))}shutdown(){}}class tN{constructor(e){this.token=e,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(e,n){this.changeListener=n,e.enqueueRetryable(()=>n(this.token.user))}shutdown(){this.changeListener=null}}class nN{constructor(e){this.t=e,this.currentUser=tn.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,n){Ge(this.o===void 0,42304);let r=this.i;const i=u=>this.i!==r?(r=this.i,n(u)):Promise.resolve();let s=new Hr;this.o=()=>{this.i++,this.currentUser=this.u(),s.resolve(),s=new Hr,e.enqueueRetryable(()=>i(this.currentUser))};const o=()=>{const u=s;e.enqueueRetryable(async()=>{await u.promise,await i(this.currentUser)})},a=u=>{ue("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=u,this.o&&(this.auth.addAuthTokenListener(this.o),o())};this.t.onInit(u=>a(u)),setTimeout(()=>{if(!this.auth){const u=this.t.getImmediate({optional:!0});u?a(u):(ue("FirebaseAuthCredentialsProvider","Auth not yet detected"),s.resolve(),s=new Hr)}},0),o()}getToken(){const e=this.i,n=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(n).then(r=>this.i!==e?(ue("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):r?(Ge(typeof r.accessToken=="string",31837,{l:r}),new fb(r.accessToken,this.currentUser)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.o&&this.auth.removeAuthTokenListener(this.o),this.o=void 0}u(){const e=this.auth&&this.auth.getUid();return Ge(e===null||typeof e=="string",2055,{h:e}),new tn(e)}}class rN{constructor(e,n,r){this.P=e,this.T=n,this.I=r,this.type="FirstParty",this.user=tn.FIRST_PARTY,this.A=new Map}R(){return this.I?this.I():null}get headers(){this.A.set("X-Goog-AuthUser",this.P);const e=this.R();return e&&this.A.set("Authorization",e),this.T&&this.A.set("X-Goog-Iam-Authorization-Token",this.T),this.A}}class iN{constructor(e,n,r){this.P=e,this.T=n,this.I=r}getToken(){return Promise.resolve(new rN(this.P,this.T,this.I))}start(e,n){e.enqueueRetryable(()=>n(tn.FIRST_PARTY))}shutdown(){}invalidateToken(){}}class iv{constructor(e){this.value=e,this.type="AppCheck",this.headers=new Map,e&&e.length>0&&this.headers.set("x-firebase-appcheck",this.value)}}class sN{constructor(e,n){this.V=n,this.forceRefresh=!1,this.appCheck=null,this.m=null,this.p=null,rr(e)&&e.settings.appCheckToken&&(this.p=e.settings.appCheckToken)}start(e,n){Ge(this.o===void 0,3512);const r=s=>{s.error!=null&&ue("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${s.error.message}`);const o=s.token!==this.m;return this.m=s.token,ue("FirebaseAppCheckTokenProvider",`Received ${o?"new":"existing"} token.`),o?n(s.token):Promise.resolve()};this.o=s=>{e.enqueueRetryable(()=>r(s))};const i=s=>{ue("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=s,this.o&&this.appCheck.addTokenListener(this.o)};this.V.onInit(s=>i(s)),setTimeout(()=>{if(!this.appCheck){const s=this.V.getImmediate({optional:!0});s?i(s):ue("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}},0)}getToken(){if(this.p)return Promise.resolve(new iv(this.p));const e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then(n=>n?(Ge(typeof n.token=="string",44558,{tokenResult:n}),this.m=n.token,new iv(n.token)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.o&&this.appCheck.removeTokenListener(this.o),this.o=void 0}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function oN(t){const e=typeof self<"u"&&(self.crypto||self.msCrypto),n=new Uint8Array(t);if(e&&typeof e.getRandomValues=="function")e.getRandomValues(n);else for(let r=0;re?1:0}function ep(t,e){const n=Math.min(t.length,e.length);for(let r=0;r=aN&&e<=lN}function ko(t,e,n){return t.length===e.length&&t.every((r,i)=>n(r,e[i]))}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const sv="__name__";class yr{constructor(e,n,r){n===void 0?n=0:n>e.length&&Te(637,{offset:n,range:e.length}),r===void 0?r=e.length-n:r>e.length-n&&Te(1746,{length:r,range:e.length-n}),this.segments=e,this.offset=n,this.len=r}get length(){return this.len}isEqual(e){return yr.comparator(this,e)===0}child(e){const n=this.segments.slice(this.offset,this.limit());return e instanceof yr?e.forEach(r=>{n.push(r)}):n.push(e),this.construct(n)}limit(){return this.offset+this.length}popFirst(e){return e=e===void 0?1:e,this.construct(this.segments,this.offset+e,this.length-e)}popLast(){return this.construct(this.segments,this.offset,this.length-1)}firstSegment(){return this.segments[this.offset]}lastSegment(){return this.get(this.length-1)}get(e){return this.segments[this.offset+e]}isEmpty(){return this.length===0}isPrefixOf(e){if(e.length=0)throw new ae(q.INVALID_ARGUMENT,`Invalid segment (${r}). Paths must not contain // in them.`);n.push(...r.split("/").filter(i=>i.length>0))}return new nt(n)}static emptyPath(){return new nt([])}}const uN=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class Gt extends yr{construct(e,n,r){return new Gt(e,n,r)}static isValidIdentifier(e){return uN.test(e)}canonicalString(){return this.toArray().map(e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),Gt.isValidIdentifier(e)||(e="`"+e+"`"),e)).join(".")}toString(){return this.canonicalString()}isKeyField(){return this.length===1&&this.get(0)===sv}static keyField(){return new Gt([sv])}static fromServerFormat(e){const n=[];let r="",i=0;const s=()=>{if(r.length===0)throw new ae(q.INVALID_ARGUMENT,`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);n.push(r),r=""};let o=!1;for(;i=2&&this.path.get(this.path.length-2)===e}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(e){return e!==null&&nt.comparator(this.path,e.path)===0}toString(){return this.path.toString()}static comparator(e,n){return nt.comparator(e.path,n.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new xe(new nt(e.slice()))}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function pb(t,e,n){if(!n)throw new ae(q.INVALID_ARGUMENT,`Function ${t}() cannot be called with an empty ${e}.`)}function cN(t,e,n,r){if(e===!0&&r===!0)throw new ae(q.INVALID_ARGUMENT,`${t} and ${n} cannot be used together.`)}function ov(t){if(!xe.isDocumentKey(t))throw new ae(q.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`)}function av(t){if(xe.isDocumentKey(t))throw new ae(q.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`)}function mb(t){return typeof t=="object"&&t!==null&&(Object.getPrototypeOf(t)===Object.prototype||Object.getPrototypeOf(t)===null)}function ad(t){if(t===void 0)return"undefined";if(t===null)return"null";if(typeof t=="string")return t.length>20&&(t=`${t.substring(0,20)}...`),JSON.stringify(t);if(typeof t=="number"||typeof t=="boolean")return""+t;if(typeof t=="object"){if(t instanceof Array)return"an array";{const e=function(r){return r.constructor?r.constructor.name:null}(t);return e?`a custom ${e} object`:"an object"}}return typeof t=="function"?"a function":Te(12329,{type:typeof t})}function kn(t,e){if("_delegate"in t&&(t=t._delegate),!(t instanceof e)){if(e.name===t.constructor.name)throw new ae(q.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const n=ad(t);throw new ae(q.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${n}`)}}return t}/** + * @license + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function At(t,e){const n={typeString:t};return e&&(n.value=e),n}function El(t,e){if(!mb(t))throw new ae(q.INVALID_ARGUMENT,"JSON must be an object");let n;for(const r in e)if(e[r]){const i=e[r].typeString,s="value"in e[r]?{value:e[r].value}:void 0;if(!(r in t)){n=`JSON missing required field: '${r}'`;break}const o=t[r];if(i&&typeof o!==i){n=`JSON field '${r}' must be a ${i}.`;break}if(s!==void 0&&o!==s.value){n=`Expected '${r}' field to equal '${s.value}'`;break}}if(n)throw new ae(q.INVALID_ARGUMENT,n);return!0}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const lv=-62135596800,uv=1e6;class We{static now(){return We.fromMillis(Date.now())}static fromDate(e){return We.fromMillis(e.getTime())}static fromMillis(e){const n=Math.floor(e/1e3),r=Math.floor((e-1e3*n)*uv);return new We(n,r)}constructor(e,n){if(this.seconds=e,this.nanoseconds=n,n<0)throw new ae(q.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+n);if(n>=1e9)throw new ae(q.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+n);if(e=253402300800)throw new ae(q.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/uv}_compareTo(e){return this.seconds===e.seconds?Ve(this.nanoseconds,e.nanoseconds):Ve(this.seconds,e.seconds)}isEqual(e){return e.seconds===this.seconds&&e.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{type:We._jsonSchemaVersion,seconds:this.seconds,nanoseconds:this.nanoseconds}}static fromJSON(e){if(El(e,We._jsonSchema))return new We(e.seconds,e.nanoseconds)}valueOf(){const e=this.seconds-lv;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}We._jsonSchemaVersion="firestore/timestamp/1.0",We._jsonSchema={type:At("string",We._jsonSchemaVersion),seconds:At("number"),nanoseconds:At("number")};/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Ne{static fromTimestamp(e){return new Ne(e)}static min(){return new Ne(new We(0,0))}static max(){return new Ne(new We(253402300799,999999999))}constructor(e){this.timestamp=e}compareTo(e){return this.timestamp._compareTo(e.timestamp)}isEqual(e){return this.timestamp.isEqual(e.timestamp)}toMicroseconds(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}toString(){return"SnapshotVersion("+this.timestamp.toString()+")"}toTimestamp(){return this.timestamp}}/** + * @license + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const il=-1;function dN(t,e){const n=t.toTimestamp().seconds,r=t.toTimestamp().nanoseconds+1,i=Ne.fromTimestamp(r===1e9?new We(n+1,0):new We(n,r));return new Fi(i,xe.empty(),e)}function hN(t){return new Fi(t.readTime,t.key,il)}class Fi{constructor(e,n,r){this.readTime=e,this.documentKey=n,this.largestBatchId=r}static min(){return new Fi(Ne.min(),xe.empty(),il)}static max(){return new Fi(Ne.max(),xe.empty(),il)}}function fN(t,e){let n=t.readTime.compareTo(e.readTime);return n!==0?n:(n=xe.comparator(t.documentKey,e.documentKey),n!==0?n:Ve(t.largestBatchId,e.largestBatchId))}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const pN="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.";class mN{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach(e=>e())}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function Vo(t){if(t.code!==q.FAILED_PRECONDITION||t.message!==pN)throw t;ue("LocalStore","Unexpectedly lost primary lease")}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class W{constructor(e){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,e(n=>{this.isDone=!0,this.result=n,this.nextCallback&&this.nextCallback(n)},n=>{this.isDone=!0,this.error=n,this.catchCallback&&this.catchCallback(n)})}catch(e){return this.next(void 0,e)}next(e,n){return this.callbackAttached&&Te(59440),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(n,this.error):this.wrapSuccess(e,this.result):new W((r,i)=>{this.nextCallback=s=>{this.wrapSuccess(e,s).next(r,i)},this.catchCallback=s=>{this.wrapFailure(n,s).next(r,i)}})}toPromise(){return new Promise((e,n)=>{this.next(e,n)})}wrapUserFunction(e){try{const n=e();return n instanceof W?n:W.resolve(n)}catch(n){return W.reject(n)}}wrapSuccess(e,n){return e?this.wrapUserFunction(()=>e(n)):W.resolve(n)}wrapFailure(e,n){return e?this.wrapUserFunction(()=>e(n)):W.reject(n)}static resolve(e){return new W((n,r)=>{n(e)})}static reject(e){return new W((n,r)=>{r(e)})}static waitFor(e){return new W((n,r)=>{let i=0,s=0,o=!1;e.forEach(a=>{++i,a.next(()=>{++s,o&&s===i&&n()},u=>r(u))}),o=!0,s===i&&n()})}static or(e){let n=W.resolve(!1);for(const r of e)n=n.next(i=>i?W.resolve(i):r());return n}static forEach(e,n){const r=[];return e.forEach((i,s)=>{r.push(n.call(this,i,s))}),this.waitFor(r)}static mapArray(e,n){return new W((r,i)=>{const s=e.length,o=new Array(s);let a=0;for(let u=0;u{o[c]=h,++a,a===s&&r(o)},h=>i(h))}})}static doWhile(e,n){return new W((r,i)=>{const s=()=>{e()===!0?n().next(()=>{s()},i):r()};s()})}}function gN(t){const e=t.match(/Android ([\d.]+)/i),n=e?e[1].split(".").slice(0,2).join("."):"-1";return Number(n)}function Fo(t){return t.name==="IndexedDbTransactionError"}/** + * @license + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class ld{constructor(e,n){this.previousValue=e,n&&(n.sequenceNumberHandler=r=>this.ae(r),this.ue=r=>n.writeSequenceNumber(r))}ae(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){const e=++this.previousValue;return this.ue&&this.ue(e),e}}ld.ce=-1;/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Vm=-1;function ud(t){return t==null}function vc(t){return t===0&&1/t==-1/0}function yN(t){return typeof t=="number"&&Number.isInteger(t)&&!vc(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const gb="";function vN(t){let e="";for(let n=0;n0&&(e=cv(e)),e=xN(t.get(n),e);return cv(e)}function xN(t,e){let n=e;const r=t.length;for(let i=0;i0&&(n=n.right)}return null}indexOf(e){let n=0,r=this.root;for(;!r.isEmpty();){const i=this.comparator(e,r.key);if(i===0)return n+r.left.size;i<0?r=r.left:(n+=r.left.size+1,r=r.right)}return-1}isEmpty(){return this.root.isEmpty()}get size(){return this.root.size}minKey(){return this.root.minKey()}maxKey(){return this.root.maxKey()}inorderTraversal(e){return this.root.inorderTraversal(e)}forEach(e){this.inorderTraversal((n,r)=>(e(n,r),!1))}toString(){const e=[];return this.inorderTraversal((n,r)=>(e.push(`${n}:${r}`),!1)),`{${e.join(", ")}}`}reverseTraversal(e){return this.root.reverseTraversal(e)}getIterator(){return new cu(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new cu(this.root,e,this.comparator,!1)}getReverseIterator(){return new cu(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new cu(this.root,e,this.comparator,!0)}}class cu{constructor(e,n,r,i){this.isReverse=i,this.nodeStack=[];let s=1;for(;!e.isEmpty();)if(s=n?r(e.key,n):1,n&&i&&(s*=-1),s<0)e=this.isReverse?e.left:e.right;else{if(s===0){this.nodeStack.push(e);break}this.nodeStack.push(e),e=this.isReverse?e.right:e.left}}getNext(){let e=this.nodeStack.pop();const n={key:e.key,value:e.value};if(this.isReverse)for(e=e.left;!e.isEmpty();)this.nodeStack.push(e),e=e.right;else for(e=e.right;!e.isEmpty();)this.nodeStack.push(e),e=e.left;return n}hasNext(){return this.nodeStack.length>0}peek(){if(this.nodeStack.length===0)return null;const e=this.nodeStack[this.nodeStack.length-1];return{key:e.key,value:e.value}}}class Wt{constructor(e,n,r,i,s){this.key=e,this.value=n,this.color=r??Wt.RED,this.left=i??Wt.EMPTY,this.right=s??Wt.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,n,r,i,s){return new Wt(e??this.key,n??this.value,r??this.color,i??this.left,s??this.right)}isEmpty(){return!1}inorderTraversal(e){return this.left.inorderTraversal(e)||e(this.key,this.value)||this.right.inorderTraversal(e)}reverseTraversal(e){return this.right.reverseTraversal(e)||e(this.key,this.value)||this.left.reverseTraversal(e)}min(){return this.left.isEmpty()?this:this.left.min()}minKey(){return this.min().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(e,n,r){let i=this;const s=r(e,i.key);return i=s<0?i.copy(null,null,null,i.left.insert(e,n,r),null):s===0?i.copy(null,n,null,null,null):i.copy(null,null,null,null,i.right.insert(e,n,r)),i.fixUp()}removeMin(){if(this.left.isEmpty())return Wt.EMPTY;let e=this;return e.left.isRed()||e.left.left.isRed()||(e=e.moveRedLeft()),e=e.copy(null,null,null,e.left.removeMin(),null),e.fixUp()}remove(e,n){let r,i=this;if(n(e,i.key)<0)i.left.isEmpty()||i.left.isRed()||i.left.left.isRed()||(i=i.moveRedLeft()),i=i.copy(null,null,null,i.left.remove(e,n),null);else{if(i.left.isRed()&&(i=i.rotateRight()),i.right.isEmpty()||i.right.isRed()||i.right.left.isRed()||(i=i.moveRedRight()),n(e,i.key)===0){if(i.right.isEmpty())return Wt.EMPTY;r=i.right.min(),i=i.copy(r.key,r.value,null,null,i.right.removeMin())}i=i.copy(null,null,null,null,i.right.remove(e,n))}return i.fixUp()}isRed(){return this.color}fixUp(){let e=this;return e.right.isRed()&&!e.left.isRed()&&(e=e.rotateLeft()),e.left.isRed()&&e.left.left.isRed()&&(e=e.rotateRight()),e.left.isRed()&&e.right.isRed()&&(e=e.colorFlip()),e}moveRedLeft(){let e=this.colorFlip();return e.right.left.isRed()&&(e=e.copy(null,null,null,null,e.right.rotateRight()),e=e.rotateLeft(),e=e.colorFlip()),e}moveRedRight(){let e=this.colorFlip();return e.left.left.isRed()&&(e=e.rotateRight(),e=e.colorFlip()),e}rotateLeft(){const e=this.copy(null,null,Wt.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){const e=this.copy(null,null,Wt.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)}colorFlip(){const e=this.left.copy(null,null,!this.left.color,null,null),n=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,n)}checkMaxDepth(){const e=this.check();return Math.pow(2,e)<=this.size+1}check(){if(this.isRed()&&this.left.isRed())throw Te(43730,{key:this.key,value:this.value});if(this.right.isRed())throw Te(14113,{key:this.key,value:this.value});const e=this.left.check();if(e!==this.right.check())throw Te(27949);return e+(this.isRed()?0:1)}}Wt.EMPTY=null,Wt.RED=!0,Wt.BLACK=!1;Wt.EMPTY=new class{constructor(){this.size=0}get key(){throw Te(57766)}get value(){throw Te(16141)}get color(){throw Te(16727)}get left(){throw Te(29726)}get right(){throw Te(36894)}copy(e,n,r,i,s){return this}insert(e,n,r){return new Wt(e,n)}remove(e,n){return this}isEmpty(){return!0}inorderTraversal(e){return!1}reverseTraversal(e){return!1}minKey(){return null}maxKey(){return null}isRed(){return!1}checkMaxDepth(){return!0}check(){return 0}};/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Mt{constructor(e){this.comparator=e,this.data=new mt(this.comparator)}has(e){return this.data.get(e)!==null}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(e){return this.data.indexOf(e)}forEach(e){this.data.inorderTraversal((n,r)=>(e(n),!1))}forEachInRange(e,n){const r=this.data.getIteratorFrom(e[0]);for(;r.hasNext();){const i=r.getNext();if(this.comparator(i.key,e[1])>=0)return;n(i.key)}}forEachWhile(e,n){let r;for(r=n!==void 0?this.data.getIteratorFrom(n):this.data.getIterator();r.hasNext();)if(!e(r.getNext().key))return}firstAfterOrEqual(e){const n=this.data.getIteratorFrom(e);return n.hasNext()?n.getNext().key:null}getIterator(){return new hv(this.data.getIterator())}getIteratorFrom(e){return new hv(this.data.getIteratorFrom(e))}add(e){return this.copy(this.data.remove(e).insert(e,!0))}delete(e){return this.has(e)?this.copy(this.data.remove(e)):this}isEmpty(){return this.data.isEmpty()}unionWith(e){let n=this;return n.size{n=n.add(r)}),n}isEqual(e){if(!(e instanceof Mt)||this.size!==e.size)return!1;const n=this.data.getIterator(),r=e.data.getIterator();for(;n.hasNext();){const i=n.getNext().key,s=r.getNext().key;if(this.comparator(i,s)!==0)return!1}return!0}toArray(){const e=[];return this.forEach(n=>{e.push(n)}),e}toString(){const e=[];return this.forEach(n=>e.push(n)),"SortedSet("+e.toString()+")"}copy(e){const n=new Mt(this.comparator);return n.data=e,n}}class hv{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class On{constructor(e){this.fields=e,e.sort(Gt.comparator)}static empty(){return new On([])}unionWith(e){let n=new Mt(Gt.comparator);for(const r of this.fields)n=n.add(r);for(const r of e)n=n.add(r);return new On(n.toArray())}covers(e){for(const n of this.fields)if(n.isPrefixOf(e))return!0;return!1}isEqual(e){return ko(this.fields,e.fields,(n,r)=>n.isEqual(r))}}/** + * @license + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class vb extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Xt{constructor(e){this.binaryString=e}static fromBase64String(e){const n=function(i){try{return atob(i)}catch(s){throw typeof DOMException<"u"&&s instanceof DOMException?new vb("Invalid base64 string: "+s):s}}(e);return new Xt(n)}static fromUint8Array(e){const n=function(i){let s="";for(let o=0;oeNr(n,e))!==void 0}function Co(t,e){if(t===e)return 0;const n=Bi(t),r=Bi(e);if(n!==r)return Ve(n,r);switch(n){case 0:case 9007199254740991:return 0;case 1:return Ve(t.booleanValue,e.booleanValue);case 2:return function(s,o){const a=bt(s.integerValue||s.doubleValue),u=bt(o.integerValue||o.doubleValue);return au?1:a===u?0:isNaN(a)?isNaN(u)?0:-1:1}(t,e);case 3:return fv(t.timestampValue,e.timestampValue);case 4:return fv(sl(t),sl(e));case 5:return ep(t.stringValue,e.stringValue);case 6:return function(s,o){const a=zi(s),u=zi(o);return a.compareTo(u)}(t.bytesValue,e.bytesValue);case 7:return function(s,o){const a=s.split("/"),u=o.split("/");for(let c=0;ci+Du(s),0)}(t.arrayValue);case 10:case 11:return function(r){let i=0;return Ki(r.fields,(s,o)=>{i+=s.length+Du(o)}),i}(t.mapValue);default:throw Te(13486,{value:t})}}function mv(t,e){return{referenceValue:`projects/${t.projectId}/databases/${t.database}/documents/${e.path.canonicalString()}`}}function np(t){return!!t&&"integerValue"in t}function Um(t){return!!t&&"arrayValue"in t}function gv(t){return!!t&&"nullValue"in t}function yv(t){return!!t&&"doubleValue"in t&&isNaN(Number(t.doubleValue))}function ju(t){return!!t&&"mapValue"in t}function EN(t){var n,r;return((r=(((n=t==null?void 0:t.mapValue)==null?void 0:n.fields)||{})[Eb])==null?void 0:r.stringValue)===Sb}function Pa(t){if(t.geoPointValue)return{geoPointValue:{...t.geoPointValue}};if(t.timestampValue&&typeof t.timestampValue=="object")return{timestampValue:{...t.timestampValue}};if(t.mapValue){const e={mapValue:{fields:{}}};return Ki(t.mapValue.fields,(n,r)=>e.mapValue.fields[n]=Pa(r)),e}if(t.arrayValue){const e={arrayValue:{values:[]}};for(let n=0;n<(t.arrayValue.values||[]).length;++n)e.arrayValue.values[n]=Pa(t.arrayValue.values[n]);return e}return{...t}}function SN(t){return(((t.mapValue||{}).fields||{}).__type__||{}).stringValue===bN}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class _n{constructor(e){this.value=e}static empty(){return new _n({mapValue:{}})}field(e){if(e.isEmpty())return this.value;{let n=this.value;for(let r=0;r{if(!n.isImmediateParentOf(a)){const u=this.getFieldsMap(n);this.applyChanges(u,r,i),r={},i=[],n=a.popLast()}o?r[a.lastSegment()]=Pa(o):i.push(a.lastSegment())});const s=this.getFieldsMap(n);this.applyChanges(s,r,i)}delete(e){const n=this.field(e.popLast());ju(n)&&n.mapValue.fields&&delete n.mapValue.fields[e.lastSegment()]}isEqual(e){return Nr(this.value,e.value)}getFieldsMap(e){let n=this.value;n.mapValue.fields||(n.mapValue={fields:{}});for(let r=0;re[i]=s);for(const i of r)delete e[i]}clone(){return new _n(Pa(this.value))}}function Tb(t){const e=[];return Ki(t.fields,(n,r)=>{const i=new Gt([n]);if(ju(r)){const s=Tb(r.mapValue).fields;if(s.length===0)e.push(i);else for(const o of s)e.push(i.child(o))}else e.push(i)}),new On(e)}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class rn{constructor(e,n,r,i,s,o,a){this.key=e,this.documentType=n,this.version=r,this.readTime=i,this.createTime=s,this.data=o,this.documentState=a}static newInvalidDocument(e){return new rn(e,0,Ne.min(),Ne.min(),Ne.min(),_n.empty(),0)}static newFoundDocument(e,n,r,i){return new rn(e,1,n,Ne.min(),r,i,0)}static newNoDocument(e,n){return new rn(e,2,n,Ne.min(),Ne.min(),_n.empty(),0)}static newUnknownDocument(e,n){return new rn(e,3,n,Ne.min(),Ne.min(),_n.empty(),2)}convertToFoundDocument(e,n){return!this.createTime.isEqual(Ne.min())||this.documentType!==2&&this.documentType!==0||(this.createTime=e),this.version=e,this.documentType=1,this.data=n,this.documentState=0,this}convertToNoDocument(e){return this.version=e,this.documentType=2,this.data=_n.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=_n.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=Ne.min(),this}setReadTime(e){return this.readTime=e,this}get hasLocalMutations(){return this.documentState===1}get hasCommittedMutations(){return this.documentState===2}get hasPendingWrites(){return this.hasLocalMutations||this.hasCommittedMutations}isValidDocument(){return this.documentType!==0}isFoundDocument(){return this.documentType===1}isNoDocument(){return this.documentType===2}isUnknownDocument(){return this.documentType===3}isEqual(e){return e instanceof rn&&this.key.isEqual(e.key)&&this.version.isEqual(e.version)&&this.documentType===e.documentType&&this.documentState===e.documentState&&this.data.isEqual(e.data)}mutableCopy(){return new rn(this.key,this.documentType,this.version,this.readTime,this.createTime,this.data.clone(),this.documentState)}toString(){return`Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {createTime: ${this.createTime}}), {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`}}/** + * @license + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class _c{constructor(e,n){this.position=e,this.inclusive=n}}function vv(t,e,n){let r=0;for(let i=0;i":return e>0;case">=":return e>=0;default:return Te(47266,{operator:this.op})}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}}class cr extends Ib{constructor(e,n){super(),this.filters=e,this.op=n,this.Pe=null}static create(e,n){return new cr(e,n)}matches(e){return kb(this)?this.filters.find(n=>!n.matches(e))===void 0:this.filters.find(n=>n.matches(e))!==void 0}getFlattenedFilters(){return this.Pe!==null||(this.Pe=this.filters.reduce((e,n)=>e.concat(n.getFlattenedFilters()),[])),this.Pe}getFilters(){return Object.assign([],this.filters)}}function kb(t){return t.op==="and"}function Cb(t){return IN(t)&&kb(t)}function IN(t){for(const e of t.filters)if(e instanceof cr)return!1;return!0}function rp(t){if(t instanceof Nt)return t.field.canonicalString()+t.op.toString()+No(t.value);if(Cb(t))return t.filters.map(e=>rp(e)).join(",");{const e=t.filters.map(n=>rp(n)).join(",");return`${t.op}(${e})`}}function Nb(t,e){return t instanceof Nt?function(r,i){return i instanceof Nt&&r.op===i.op&&r.field.isEqual(i.field)&&Nr(r.value,i.value)}(t,e):t instanceof cr?function(r,i){return i instanceof cr&&r.op===i.op&&r.filters.length===i.filters.length?r.filters.reduce((s,o,a)=>s&&Nb(o,i.filters[a]),!0):!1}(t,e):void Te(19439)}function Ab(t){return t instanceof Nt?function(n){return`${n.field.canonicalString()} ${n.op} ${No(n.value)}`}(t):t instanceof cr?function(n){return n.op.toString()+" {"+n.getFilters().map(Ab).join(" ,")+"}"}(t):"Filter"}class kN extends Nt{constructor(e,n,r){super(e,n,r),this.key=xe.fromName(r.referenceValue)}matches(e){const n=xe.comparator(e.key,this.key);return this.matchesComparison(n)}}class CN extends Nt{constructor(e,n){super(e,"in",n),this.keys=Pb("in",n)}matches(e){return this.keys.some(n=>n.isEqual(e.key))}}class NN extends Nt{constructor(e,n){super(e,"not-in",n),this.keys=Pb("not-in",n)}matches(e){return!this.keys.some(n=>n.isEqual(e.key))}}function Pb(t,e){var n;return(((n=e.arrayValue)==null?void 0:n.values)||[]).map(r=>xe.fromName(r.referenceValue))}class AN extends Nt{constructor(e,n){super(e,"array-contains",n)}matches(e){const n=e.data.field(this.field);return Um(n)&&al(n.arrayValue,this.value)}}class PN extends Nt{constructor(e,n){super(e,"in",n)}matches(e){const n=e.data.field(this.field);return n!==null&&al(this.value.arrayValue,n)}}class RN extends Nt{constructor(e,n){super(e,"not-in",n)}matches(e){if(al(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const n=e.data.field(this.field);return n!==null&&n.nullValue===void 0&&!al(this.value.arrayValue,n)}}class DN extends Nt{constructor(e,n){super(e,"array-contains-any",n)}matches(e){const n=e.data.field(this.field);return!(!Um(n)||!n.arrayValue.values)&&n.arrayValue.values.some(r=>al(this.value.arrayValue,r))}}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class jN{constructor(e,n=null,r=[],i=[],s=null,o=null,a=null){this.path=e,this.collectionGroup=n,this.orderBy=r,this.filters=i,this.limit=s,this.startAt=o,this.endAt=a,this.Te=null}}function wv(t,e=null,n=[],r=[],i=null,s=null,o=null){return new jN(t,e,n,r,i,s,o)}function zm(t){const e=Ae(t);if(e.Te===null){let n=e.path.canonicalString();e.collectionGroup!==null&&(n+="|cg:"+e.collectionGroup),n+="|f:",n+=e.filters.map(r=>rp(r)).join(","),n+="|ob:",n+=e.orderBy.map(r=>function(s){return s.field.canonicalString()+s.dir}(r)).join(","),ud(e.limit)||(n+="|l:",n+=e.limit),e.startAt&&(n+="|lb:",n+=e.startAt.inclusive?"b:":"a:",n+=e.startAt.position.map(r=>No(r)).join(",")),e.endAt&&(n+="|ub:",n+=e.endAt.inclusive?"a:":"b:",n+=e.endAt.position.map(r=>No(r)).join(",")),e.Te=n}return e.Te}function Bm(t,e){if(t.limit!==e.limit||t.orderBy.length!==e.orderBy.length)return!1;for(let n=0;n0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc";(function(o){let a=new Mt(Gt.comparator);return o.filters.forEach(u=>{u.getFlattenedFilters().forEach(c=>{c.isInequality()&&(a=a.add(c.field))})}),a})(e).forEach(s=>{n.has(s.canonicalString())||s.isKeyField()||e.Ie.push(new ll(s,r))}),n.has(Gt.keyField().canonicalString())||e.Ie.push(new ll(Gt.keyField(),r))}return e.Ie}function Er(t){const e=Ae(t);return e.Ee||(e.Ee=ON(e,Ra(t))),e.Ee}function ON(t,e){if(t.limitType==="F")return wv(t.path,t.collectionGroup,e,t.filters,t.limit,t.startAt,t.endAt);{e=e.map(i=>{const s=i.dir==="desc"?"asc":"desc";return new ll(i.field,s)});const n=t.endAt?new _c(t.endAt.position,t.endAt.inclusive):null,r=t.startAt?new _c(t.startAt.position,t.startAt.inclusive):null;return wv(t.path,t.collectionGroup,e,t.filters,t.limit,n,r)}}function sp(t,e){const n=t.filters.concat([e]);return new Uo(t.path,t.collectionGroup,t.explicitOrderBy.slice(),n,t.limit,t.limitType,t.startAt,t.endAt)}function op(t,e,n){return new Uo(t.path,t.collectionGroup,t.explicitOrderBy.slice(),t.filters.slice(),e,n,t.startAt,t.endAt)}function hd(t,e){return Bm(Er(t),Er(e))&&t.limitType===e.limitType}function Db(t){return`${zm(Er(t))}|lt:${t.limitType}`}function zs(t){return`Query(target=${function(n){let r=n.path.canonicalString();return n.collectionGroup!==null&&(r+=" collectionGroup="+n.collectionGroup),n.filters.length>0&&(r+=`, filters: [${n.filters.map(i=>Ab(i)).join(", ")}]`),ud(n.limit)||(r+=", limit: "+n.limit),n.orderBy.length>0&&(r+=`, orderBy: [${n.orderBy.map(i=>function(o){return`${o.field.canonicalString()} (${o.dir})`}(i)).join(", ")}]`),n.startAt&&(r+=", startAt: ",r+=n.startAt.inclusive?"b:":"a:",r+=n.startAt.position.map(i=>No(i)).join(",")),n.endAt&&(r+=", endAt: ",r+=n.endAt.inclusive?"a:":"b:",r+=n.endAt.position.map(i=>No(i)).join(",")),`Target(${r})`}(Er(t))}; limitType=${t.limitType})`}function fd(t,e){return e.isFoundDocument()&&function(r,i){const s=i.key.path;return r.collectionGroup!==null?i.key.hasCollectionId(r.collectionGroup)&&r.path.isPrefixOf(s):xe.isDocumentKey(r.path)?r.path.isEqual(s):r.path.isImmediateParentOf(s)}(t,e)&&function(r,i){for(const s of Ra(r))if(!s.field.isKeyField()&&i.data.field(s.field)===null)return!1;return!0}(t,e)&&function(r,i){for(const s of r.filters)if(!s.matches(i))return!1;return!0}(t,e)&&function(r,i){return!(r.startAt&&!function(o,a,u){const c=vv(o,a,u);return o.inclusive?c<=0:c<0}(r.startAt,Ra(r),i)||r.endAt&&!function(o,a,u){const c=vv(o,a,u);return o.inclusive?c>=0:c>0}(r.endAt,Ra(r),i))}(t,e)}function MN(t){return t.collectionGroup||(t.path.length%2==1?t.path.lastSegment():t.path.get(t.path.length-2))}function jb(t){return(e,n)=>{let r=!1;for(const i of Ra(t)){const s=VN(i,e,n);if(s!==0)return s;r=r||i.field.isKeyField()}return 0}}function VN(t,e,n){const r=t.field.isKeyField()?xe.comparator(e.key,n.key):function(s,o,a){const u=o.data.field(s),c=a.data.field(s);return u!==null&&c!==null?Co(u,c):Te(42886)}(t.field,e,n);switch(t.dir){case"asc":return r;case"desc":return-1*r;default:return Te(19790,{direction:t.dir})}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Ps{constructor(e,n){this.mapKeyFn=e,this.equalsFn=n,this.inner={},this.innerSize=0}get(e){const n=this.mapKeyFn(e),r=this.inner[n];if(r!==void 0){for(const[i,s]of r)if(this.equalsFn(i,e))return s}}has(e){return this.get(e)!==void 0}set(e,n){const r=this.mapKeyFn(e),i=this.inner[r];if(i===void 0)return this.inner[r]=[[e,n]],void this.innerSize++;for(let s=0;s{for(const[i,s]of r)e(i,s)})}isEmpty(){return yb(this.inner)}size(){return this.innerSize}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const FN=new mt(xe.comparator);function Xr(){return FN}const Lb=new mt(xe.comparator);function va(...t){let e=Lb;for(const n of t)e=e.insert(n.key,n);return e}function Ob(t){let e=Lb;return t.forEach((n,r)=>e=e.insert(n,r.overlayedDocument)),e}function cs(){return Da()}function Mb(){return Da()}function Da(){return new Ps(t=>t.toString(),(t,e)=>t.isEqual(e))}const UN=new mt(xe.comparator),zN=new Mt(xe.comparator);function Fe(...t){let e=zN;for(const n of t)e=e.add(n);return e}const BN=new Mt(Ve);function $N(){return BN}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function $m(t,e){if(t.useProto3Json){if(isNaN(e))return{doubleValue:"NaN"};if(e===1/0)return{doubleValue:"Infinity"};if(e===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:vc(e)?"-0":e}}function Vb(t){return{integerValue:""+t}}function Fb(t,e){return yN(e)?Vb(e):$m(t,e)}/** + * @license + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class pd{constructor(){this._=void 0}}function HN(t,e,n){return t instanceof bc?function(i,s){const o={fields:{[wb]:{stringValue:xb},[bb]:{timestampValue:{seconds:i.seconds,nanos:i.nanoseconds}}}};return s&&Fm(s)&&(s=cd(s)),s&&(o.fields[_b]=s),{mapValue:o}}(n,e):t instanceof ul?zb(t,e):t instanceof cl?Bb(t,e):function(i,s){const o=Ub(i,s),a=bv(o)+bv(i.Ae);return np(o)&&np(i.Ae)?Vb(a):$m(i.serializer,a)}(t,e)}function qN(t,e,n){return t instanceof ul?zb(t,e):t instanceof cl?Bb(t,e):n}function Ub(t,e){return t instanceof dl?function(r){return np(r)||function(s){return!!s&&"doubleValue"in s}(r)}(e)?e:{integerValue:0}:null}class bc extends pd{}class ul extends pd{constructor(e){super(),this.elements=e}}function zb(t,e){const n=$b(e);for(const r of t.elements)n.some(i=>Nr(i,r))||n.push(r);return{arrayValue:{values:n}}}class cl extends pd{constructor(e){super(),this.elements=e}}function Bb(t,e){let n=$b(e);for(const r of t.elements)n=n.filter(i=>!Nr(i,r));return{arrayValue:{values:n}}}class dl extends pd{constructor(e,n){super(),this.serializer=e,this.Ae=n}}function bv(t){return bt(t.integerValue||t.doubleValue)}function $b(t){return Um(t)&&t.arrayValue.values?t.arrayValue.values.slice():[]}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class WN{constructor(e,n){this.field=e,this.transform=n}}function GN(t,e){return t.field.isEqual(e.field)&&function(r,i){return r instanceof ul&&i instanceof ul||r instanceof cl&&i instanceof cl?ko(r.elements,i.elements,Nr):r instanceof dl&&i instanceof dl?Nr(r.Ae,i.Ae):r instanceof bc&&i instanceof bc}(t.transform,e.transform)}class KN{constructor(e,n){this.version=e,this.transformResults=n}}class Qn{constructor(e,n){this.updateTime=e,this.exists=n}static none(){return new Qn}static exists(e){return new Qn(void 0,e)}static updateTime(e){return new Qn(e)}get isNone(){return this.updateTime===void 0&&this.exists===void 0}isEqual(e){return this.exists===e.exists&&(this.updateTime?!!e.updateTime&&this.updateTime.isEqual(e.updateTime):!e.updateTime)}}function Lu(t,e){return t.updateTime!==void 0?e.isFoundDocument()&&e.version.isEqual(t.updateTime):t.exists===void 0||t.exists===e.isFoundDocument()}class md{}function Hb(t,e){if(!t.hasLocalMutations||e&&e.fields.length===0)return null;if(e===null)return t.isNoDocument()?new Hm(t.key,Qn.none()):new Sl(t.key,t.data,Qn.none());{const n=t.data,r=_n.empty();let i=new Mt(Gt.comparator);for(let s of e.fields)if(!i.has(s)){let o=n.field(s);o===null&&s.length>1&&(s=s.popLast(),o=n.field(s)),o===null?r.delete(s):r.set(s,o),i=i.add(s)}return new Qi(t.key,r,new On(i.toArray()),Qn.none())}}function QN(t,e,n){t instanceof Sl?function(i,s,o){const a=i.value.clone(),u=Sv(i.fieldTransforms,s,o.transformResults);a.setAll(u),s.convertToFoundDocument(o.version,a).setHasCommittedMutations()}(t,e,n):t instanceof Qi?function(i,s,o){if(!Lu(i.precondition,s))return void s.convertToUnknownDocument(o.version);const a=Sv(i.fieldTransforms,s,o.transformResults),u=s.data;u.setAll(qb(i)),u.setAll(a),s.convertToFoundDocument(o.version,u).setHasCommittedMutations()}(t,e,n):function(i,s,o){s.convertToNoDocument(o.version).setHasCommittedMutations()}(0,e,n)}function ja(t,e,n,r){return t instanceof Sl?function(s,o,a,u){if(!Lu(s.precondition,o))return a;const c=s.value.clone(),h=Tv(s.fieldTransforms,u,o);return c.setAll(h),o.convertToFoundDocument(o.version,c).setHasLocalMutations(),null}(t,e,n,r):t instanceof Qi?function(s,o,a,u){if(!Lu(s.precondition,o))return a;const c=Tv(s.fieldTransforms,u,o),h=o.data;return h.setAll(qb(s)),h.setAll(c),o.convertToFoundDocument(o.version,h).setHasLocalMutations(),a===null?null:a.unionWith(s.fieldMask.fields).unionWith(s.fieldTransforms.map(f=>f.field))}(t,e,n,r):function(s,o,a){return Lu(s.precondition,o)?(o.convertToNoDocument(o.version).setHasLocalMutations(),null):a}(t,e,n)}function YN(t,e){let n=null;for(const r of t.fieldTransforms){const i=e.data.field(r.field),s=Ub(r.transform,i||null);s!=null&&(n===null&&(n=_n.empty()),n.set(r.field,s))}return n||null}function Ev(t,e){return t.type===e.type&&!!t.key.isEqual(e.key)&&!!t.precondition.isEqual(e.precondition)&&!!function(r,i){return r===void 0&&i===void 0||!(!r||!i)&&ko(r,i,(s,o)=>GN(s,o))}(t.fieldTransforms,e.fieldTransforms)&&(t.type===0?t.value.isEqual(e.value):t.type!==1||t.data.isEqual(e.data)&&t.fieldMask.isEqual(e.fieldMask))}class Sl extends md{constructor(e,n,r,i=[]){super(),this.key=e,this.value=n,this.precondition=r,this.fieldTransforms=i,this.type=0}getFieldMask(){return null}}class Qi extends md{constructor(e,n,r,i,s=[]){super(),this.key=e,this.data=n,this.fieldMask=r,this.precondition=i,this.fieldTransforms=s,this.type=1}getFieldMask(){return this.fieldMask}}function qb(t){const e=new Map;return t.fieldMask.fields.forEach(n=>{if(!n.isEmpty()){const r=t.data.field(n);e.set(n,r)}}),e}function Sv(t,e,n){const r=new Map;Ge(t.length===n.length,32656,{Re:n.length,Ve:t.length});for(let i=0;i{const s=e.get(i.key),o=s.overlayedDocument;let a=this.applyToLocalView(o,s.mutatedFields);a=n.has(i.key)?null:a;const u=Hb(o,a);u!==null&&r.set(i.key,u),o.isValidDocument()||o.convertToNoDocument(Ne.min())}),r}keys(){return this.mutations.reduce((e,n)=>e.add(n.key),Fe())}isEqual(e){return this.batchId===e.batchId&&ko(this.mutations,e.mutations,(n,r)=>Ev(n,r))&&ko(this.baseMutations,e.baseMutations,(n,r)=>Ev(n,r))}}class qm{constructor(e,n,r,i){this.batch=e,this.commitVersion=n,this.mutationResults=r,this.docVersions=i}static from(e,n,r){Ge(e.mutations.length===r.length,58842,{me:e.mutations.length,fe:r.length});let i=function(){return UN}();const s=e.mutations;for(let o=0;o=8)throw new xa(`Invalid padding: ${n}`);if(r<0)throw new xa(`Invalid hash count: ${r}`);if(e.length>0&&this.hashCount===0)throw new xa(`Invalid hash count: ${r}`);if(e.length===0&&n!==0)throw new xa(`Invalid padding when bitmap length is 0: ${n}`);this.ge=8*e.length-n,this.pe=ji.fromNumber(this.ge)}ye(e,n,r){let i=e.add(n.multiply(ji.fromNumber(r)));return i.compare(rA)===1&&(i=new ji([i.getBits(0),i.getBits(1)],0)),i.modulo(this.pe).toNumber()}we(e){return!!(this.bitmap[Math.floor(e/8)]&1<o.insert(a)),o}insert(e){if(this.ge===0)return;const n=Iv(e),[r,i]=kv(n);for(let s=0;s0&&(this.Oe=!0,this.Me=e)}ke(){let e=Fe(),n=Fe(),r=Fe();return this.Fe.forEach((i,s)=>{switch(s){case 0:e=e.add(i);break;case 2:n=n.add(i);break;case 1:r=r.add(i);break;default:Te(38017,{changeType:s})}}),new Tl(this.Me,this.xe,e,n,r)}qe(){this.Oe=!1,this.Fe=Nv()}Qe(e,n){this.Oe=!0,this.Fe=this.Fe.insert(e,n)}$e(e){this.Oe=!0,this.Fe=this.Fe.remove(e)}Ue(){this.ve+=1}Ke(){this.ve-=1,Ge(this.ve>=0,3241,{ve:this.ve})}We(){this.Oe=!0,this.xe=!0}}class iA{constructor(e){this.Ge=e,this.ze=new Map,this.je=Xr(),this.Je=hu(),this.He=hu(),this.Ye=new mt(Ve)}Ze(e){for(const n of e.be)e.De&&e.De.isFoundDocument()?this.Xe(n,e.De):this.et(n,e.key,e.De);for(const n of e.removedTargetIds)this.et(n,e.key,e.De)}tt(e){this.forEachTarget(e,n=>{const r=this.nt(n);switch(e.state){case 0:this.rt(n)&&r.Le(e.resumeToken);break;case 1:r.Ke(),r.Ne||r.qe(),r.Le(e.resumeToken);break;case 2:r.Ke(),r.Ne||this.removeTarget(n);break;case 3:this.rt(n)&&(r.We(),r.Le(e.resumeToken));break;case 4:this.rt(n)&&(this.it(n),r.Le(e.resumeToken));break;default:Te(56790,{state:e.state})}})}forEachTarget(e,n){e.targetIds.length>0?e.targetIds.forEach(n):this.ze.forEach((r,i)=>{this.rt(i)&&n(i)})}st(e){const n=e.targetId,r=e.Ce.count,i=this.ot(n);if(i){const s=i.target;if(ip(s))if(r===0){const o=new xe(s.path);this.et(n,o,rn.newNoDocument(o,Ne.min()))}else Ge(r===1,20013,{expectedCount:r});else{const o=this._t(n);if(o!==r){const a=this.ut(e),u=a?this.ct(a,e,o):1;if(u!==0){this.it(n);const c=u===2?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.Ye=this.Ye.insert(n,c)}}}}}ut(e){const n=e.Ce.unchangedNames;if(!n||!n.bits)return null;const{bits:{bitmap:r="",padding:i=0},hashCount:s=0}=n;let o,a;try{o=zi(r).toUint8Array()}catch(u){if(u instanceof vb)return Io("Decoding the base64 bloom filter in existence filter failed ("+u.message+"); ignoring the bloom filter and falling back to full re-query."),null;throw u}try{a=new Wm(o,i,s)}catch(u){return Io(u instanceof xa?"BloomFilter error: ":"Applying bloom filter failed: ",u),null}return a.ge===0?null:a}ct(e,n,r){return n.Ce.count===r-this.Pt(e,n.targetId)?0:2}Pt(e,n){const r=this.Ge.getRemoteKeysForTarget(n);let i=0;return r.forEach(s=>{const o=this.Ge.ht(),a=`projects/${o.projectId}/databases/${o.database}/documents/${s.path.canonicalString()}`;e.mightContain(a)||(this.et(n,s,null),i++)}),i}Tt(e){const n=new Map;this.ze.forEach((s,o)=>{const a=this.ot(o);if(a){if(s.current&&ip(a.target)){const u=new xe(a.target.path);this.It(u).has(o)||this.Et(o,u)||this.et(o,u,rn.newNoDocument(u,e))}s.Be&&(n.set(o,s.ke()),s.qe())}});let r=Fe();this.He.forEach((s,o)=>{let a=!0;o.forEachWhile(u=>{const c=this.ot(u);return!c||c.purpose==="TargetPurposeLimboResolution"||(a=!1,!1)}),a&&(r=r.add(s))}),this.je.forEach((s,o)=>o.setReadTime(e));const i=new gd(e,n,this.Ye,this.je,r);return this.je=Xr(),this.Je=hu(),this.He=hu(),this.Ye=new mt(Ve),i}Xe(e,n){if(!this.rt(e))return;const r=this.Et(e,n.key)?2:0;this.nt(e).Qe(n.key,r),this.je=this.je.insert(n.key,n),this.Je=this.Je.insert(n.key,this.It(n.key).add(e)),this.He=this.He.insert(n.key,this.dt(n.key).add(e))}et(e,n,r){if(!this.rt(e))return;const i=this.nt(e);this.Et(e,n)?i.Qe(n,1):i.$e(n),this.He=this.He.insert(n,this.dt(n).delete(e)),this.He=this.He.insert(n,this.dt(n).add(e)),r&&(this.je=this.je.insert(n,r))}removeTarget(e){this.ze.delete(e)}_t(e){const n=this.nt(e).ke();return this.Ge.getRemoteKeysForTarget(e).size+n.addedDocuments.size-n.removedDocuments.size}Ue(e){this.nt(e).Ue()}nt(e){let n=this.ze.get(e);return n||(n=new Cv,this.ze.set(e,n)),n}dt(e){let n=this.He.get(e);return n||(n=new Mt(Ve),this.He=this.He.insert(e,n)),n}It(e){let n=this.Je.get(e);return n||(n=new Mt(Ve),this.Je=this.Je.insert(e,n)),n}rt(e){const n=this.ot(e)!==null;return n||ue("WatchChangeAggregator","Detected inactive target",e),n}ot(e){const n=this.ze.get(e);return n&&n.Ne?null:this.Ge.At(e)}it(e){this.ze.set(e,new Cv),this.Ge.getRemoteKeysForTarget(e).forEach(n=>{this.et(e,n,null)})}Et(e,n){return this.Ge.getRemoteKeysForTarget(e).has(n)}}function hu(){return new mt(xe.comparator)}function Nv(){return new mt(xe.comparator)}const sA={asc:"ASCENDING",desc:"DESCENDING"},oA={"<":"LESS_THAN","<=":"LESS_THAN_OR_EQUAL",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","!=":"NOT_EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","not-in":"NOT_IN","array-contains-any":"ARRAY_CONTAINS_ANY"},aA={and:"AND",or:"OR"};class lA{constructor(e,n){this.databaseId=e,this.useProto3Json=n}}function ap(t,e){return t.useProto3Json||ud(e)?e:{value:e}}function Ec(t,e){return t.useProto3Json?`${new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+e.nanoseconds).slice(-9)}Z`:{seconds:""+e.seconds,nanos:e.nanoseconds}}function Qb(t,e){return t.useProto3Json?e.toBase64():e.toUint8Array()}function uA(t,e){return Ec(t,e.toTimestamp())}function Sr(t){return Ge(!!t,49232),Ne.fromTimestamp(function(n){const r=Ui(n);return new We(r.seconds,r.nanos)}(t))}function Gm(t,e){return lp(t,e).canonicalString()}function lp(t,e){const n=function(i){return new nt(["projects",i.projectId,"databases",i.database])}(t).child("documents");return e===void 0?n:n.child(e)}function Yb(t){const e=nt.fromString(t);return Ge(tE(e),10190,{key:e.toString()}),e}function up(t,e){return Gm(t.databaseId,e.path)}function Nh(t,e){const n=Yb(e);if(n.get(1)!==t.databaseId.projectId)throw new ae(q.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+n.get(1)+" vs "+t.databaseId.projectId);if(n.get(3)!==t.databaseId.database)throw new ae(q.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+t.databaseId.database);return new xe(Jb(n))}function Xb(t,e){return Gm(t.databaseId,e)}function cA(t){const e=Yb(t);return e.length===4?nt.emptyPath():Jb(e)}function cp(t){return new nt(["projects",t.databaseId.projectId,"databases",t.databaseId.database]).canonicalString()}function Jb(t){return Ge(t.length>4&&t.get(4)==="documents",29091,{key:t.toString()}),t.popFirst(5)}function Av(t,e,n){return{name:up(t,e),fields:n.value.mapValue.fields}}function dA(t,e){let n;if("targetChange"in e){e.targetChange;const r=function(c){return c==="NO_CHANGE"?0:c==="ADD"?1:c==="REMOVE"?2:c==="CURRENT"?3:c==="RESET"?4:Te(39313,{state:c})}(e.targetChange.targetChangeType||"NO_CHANGE"),i=e.targetChange.targetIds||[],s=function(c,h){return c.useProto3Json?(Ge(h===void 0||typeof h=="string",58123),Xt.fromBase64String(h||"")):(Ge(h===void 0||h instanceof Buffer||h instanceof Uint8Array,16193),Xt.fromUint8Array(h||new Uint8Array))}(t,e.targetChange.resumeToken),o=e.targetChange.cause,a=o&&function(c){const h=c.code===void 0?q.UNKNOWN:Wb(c.code);return new ae(h,c.message||"")}(o);n=new Kb(r,i,s,a||null)}else if("documentChange"in e){e.documentChange;const r=e.documentChange;r.document,r.document.name,r.document.updateTime;const i=Nh(t,r.document.name),s=Sr(r.document.updateTime),o=r.document.createTime?Sr(r.document.createTime):Ne.min(),a=new _n({mapValue:{fields:r.document.fields}}),u=rn.newFoundDocument(i,s,o,a),c=r.targetIds||[],h=r.removedTargetIds||[];n=new Ou(c,h,u.key,u)}else if("documentDelete"in e){e.documentDelete;const r=e.documentDelete;r.document;const i=Nh(t,r.document),s=r.readTime?Sr(r.readTime):Ne.min(),o=rn.newNoDocument(i,s),a=r.removedTargetIds||[];n=new Ou([],a,o.key,o)}else if("documentRemove"in e){e.documentRemove;const r=e.documentRemove;r.document;const i=Nh(t,r.document),s=r.removedTargetIds||[];n=new Ou([],s,i,null)}else{if(!("filter"in e))return Te(11601,{Rt:e});{e.filter;const r=e.filter;r.targetId;const{count:i=0,unchangedNames:s}=r,o=new eA(i,s),a=r.targetId;n=new Gb(a,o)}}return n}function hA(t,e){let n;if(e instanceof Sl)n={update:Av(t,e.key,e.value)};else if(e instanceof Hm)n={delete:up(t,e.key)};else if(e instanceof Qi)n={update:Av(t,e.key,e.data),updateMask:_A(e.fieldMask)};else{if(!(e instanceof XN))return Te(16599,{Vt:e.type});n={verify:up(t,e.key)}}return e.fieldTransforms.length>0&&(n.updateTransforms=e.fieldTransforms.map(r=>function(s,o){const a=o.transform;if(a instanceof bc)return{fieldPath:o.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(a instanceof ul)return{fieldPath:o.field.canonicalString(),appendMissingElements:{values:a.elements}};if(a instanceof cl)return{fieldPath:o.field.canonicalString(),removeAllFromArray:{values:a.elements}};if(a instanceof dl)return{fieldPath:o.field.canonicalString(),increment:a.Ae};throw Te(20930,{transform:o.transform})}(0,r))),e.precondition.isNone||(n.currentDocument=function(i,s){return s.updateTime!==void 0?{updateTime:uA(i,s.updateTime)}:s.exists!==void 0?{exists:s.exists}:Te(27497)}(t,e.precondition)),n}function fA(t,e){return t&&t.length>0?(Ge(e!==void 0,14353),t.map(n=>function(i,s){let o=i.updateTime?Sr(i.updateTime):Sr(s);return o.isEqual(Ne.min())&&(o=Sr(s)),new KN(o,i.transformResults||[])}(n,e))):[]}function pA(t,e){return{documents:[Xb(t,e.path)]}}function mA(t,e){const n={structuredQuery:{}},r=e.path;let i;e.collectionGroup!==null?(i=r,n.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(i=r.popLast(),n.structuredQuery.from=[{collectionId:r.lastSegment()}]),n.parent=Xb(t,i);const s=function(c){if(c.length!==0)return eE(cr.create(c,"and"))}(e.filters);s&&(n.structuredQuery.where=s);const o=function(c){if(c.length!==0)return c.map(h=>function(p){return{field:Bs(p.field),direction:vA(p.dir)}}(h))}(e.orderBy);o&&(n.structuredQuery.orderBy=o);const a=ap(t,e.limit);return a!==null&&(n.structuredQuery.limit=a),e.startAt&&(n.structuredQuery.startAt=function(c){return{before:c.inclusive,values:c.position}}(e.startAt)),e.endAt&&(n.structuredQuery.endAt=function(c){return{before:!c.inclusive,values:c.position}}(e.endAt)),{ft:n,parent:i}}function gA(t){let e=cA(t.parent);const n=t.structuredQuery,r=n.from?n.from.length:0;let i=null;if(r>0){Ge(r===1,65062);const h=n.from[0];h.allDescendants?i=h.collectionId:e=e.child(h.collectionId)}let s=[];n.where&&(s=function(f){const p=Zb(f);return p instanceof cr&&Cb(p)?p.getFilters():[p]}(n.where));let o=[];n.orderBy&&(o=function(f){return f.map(p=>function(_){return new ll($s(_.field),function(R){switch(R){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(_.direction))}(p))}(n.orderBy));let a=null;n.limit&&(a=function(f){let p;return p=typeof f=="object"?f.value:f,ud(p)?null:p}(n.limit));let u=null;n.startAt&&(u=function(f){const p=!!f.before,g=f.values||[];return new _c(g,p)}(n.startAt));let c=null;return n.endAt&&(c=function(f){const p=!f.before,g=f.values||[];return new _c(g,p)}(n.endAt)),LN(e,i,o,s,a,"F",u,c)}function yA(t,e){const n=function(i){switch(i){case"TargetPurposeListen":return null;case"TargetPurposeExistenceFilterMismatch":return"existence-filter-mismatch";case"TargetPurposeExistenceFilterMismatchBloom":return"existence-filter-mismatch-bloom";case"TargetPurposeLimboResolution":return"limbo-document";default:return Te(28987,{purpose:i})}}(e.purpose);return n==null?null:{"goog-listen-tags":n}}function Zb(t){return t.unaryFilter!==void 0?function(n){switch(n.unaryFilter.op){case"IS_NAN":const r=$s(n.unaryFilter.field);return Nt.create(r,"==",{doubleValue:NaN});case"IS_NULL":const i=$s(n.unaryFilter.field);return Nt.create(i,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const s=$s(n.unaryFilter.field);return Nt.create(s,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const o=$s(n.unaryFilter.field);return Nt.create(o,"!=",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":return Te(61313);default:return Te(60726)}}(t):t.fieldFilter!==void 0?function(n){return Nt.create($s(n.fieldFilter.field),function(i){switch(i){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";case"OPERATOR_UNSPECIFIED":return Te(58110);default:return Te(50506)}}(n.fieldFilter.op),n.fieldFilter.value)}(t):t.compositeFilter!==void 0?function(n){return cr.create(n.compositeFilter.filters.map(r=>Zb(r)),function(i){switch(i){case"AND":return"and";case"OR":return"or";default:return Te(1026)}}(n.compositeFilter.op))}(t):Te(30097,{filter:t})}function vA(t){return sA[t]}function xA(t){return oA[t]}function wA(t){return aA[t]}function Bs(t){return{fieldPath:t.canonicalString()}}function $s(t){return Gt.fromServerFormat(t.fieldPath)}function eE(t){return t instanceof Nt?function(n){if(n.op==="=="){if(yv(n.value))return{unaryFilter:{field:Bs(n.field),op:"IS_NAN"}};if(gv(n.value))return{unaryFilter:{field:Bs(n.field),op:"IS_NULL"}}}else if(n.op==="!="){if(yv(n.value))return{unaryFilter:{field:Bs(n.field),op:"IS_NOT_NAN"}};if(gv(n.value))return{unaryFilter:{field:Bs(n.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:Bs(n.field),op:xA(n.op),value:n.value}}}(t):t instanceof cr?function(n){const r=n.getFilters().map(i=>eE(i));return r.length===1?r[0]:{compositeFilter:{op:wA(n.op),filters:r}}}(t):Te(54877,{filter:t})}function _A(t){const e=[];return t.fields.forEach(n=>e.push(n.canonicalString())),{fieldPaths:e}}function tE(t){return t.length>=4&&t.get(0)==="projects"&&t.get(2)==="databases"}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class bi{constructor(e,n,r,i,s=Ne.min(),o=Ne.min(),a=Xt.EMPTY_BYTE_STRING,u=null){this.target=e,this.targetId=n,this.purpose=r,this.sequenceNumber=i,this.snapshotVersion=s,this.lastLimboFreeSnapshotVersion=o,this.resumeToken=a,this.expectedCount=u}withSequenceNumber(e){return new bi(this.target,this.targetId,this.purpose,e,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(e,n){return new bi(this.target,this.targetId,this.purpose,this.sequenceNumber,n,this.lastLimboFreeSnapshotVersion,e,null)}withExpectedCount(e){return new bi(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,e)}withLastLimboFreeSnapshotVersion(e){return new bi(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,e,this.resumeToken,this.expectedCount)}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class bA{constructor(e){this.yt=e}}function EA(t){const e=gA({parent:t.parent,structuredQuery:t.structuredQuery});return t.limitType==="LAST"?op(e,e.limit,"L"):e}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class SA{constructor(){this.Cn=new TA}addToCollectionParentIndex(e,n){return this.Cn.add(n),W.resolve()}getCollectionParents(e,n){return W.resolve(this.Cn.getEntries(n))}addFieldIndex(e,n){return W.resolve()}deleteFieldIndex(e,n){return W.resolve()}deleteAllFieldIndexes(e){return W.resolve()}createTargetIndexes(e,n){return W.resolve()}getDocumentsMatchingTarget(e,n){return W.resolve(null)}getIndexType(e,n){return W.resolve(0)}getFieldIndexes(e,n){return W.resolve([])}getNextCollectionGroupToUpdate(e){return W.resolve(null)}getMinOffset(e,n){return W.resolve(Fi.min())}getMinOffsetFromCollectionGroup(e,n){return W.resolve(Fi.min())}updateCollectionGroup(e,n,r){return W.resolve()}updateIndexEntries(e,n){return W.resolve()}}class TA{constructor(){this.index={}}add(e){const n=e.lastSegment(),r=e.popLast(),i=this.index[n]||new Mt(nt.comparator),s=!i.has(r);return this.index[n]=i.add(r),s}has(e){const n=e.lastSegment(),r=e.popLast(),i=this.index[n];return i&&i.has(r)}getEntries(e){return(this.index[e]||new Mt(nt.comparator)).toArray()}}/** + * @license + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Pv={didRun:!1,sequenceNumbersCollected:0,targetsRemoved:0,documentsRemoved:0},nE=41943040;class xn{static withCacheSize(e){return new xn(e,xn.DEFAULT_COLLECTION_PERCENTILE,xn.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}constructor(e,n,r){this.cacheSizeCollectionThreshold=e,this.percentileToCollect=n,this.maximumSequenceNumbersToCollect=r}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */xn.DEFAULT_COLLECTION_PERCENTILE=10,xn.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,xn.DEFAULT=new xn(nE,xn.DEFAULT_COLLECTION_PERCENTILE,xn.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),xn.DISABLED=new xn(-1,0,0);/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Ao{constructor(e){this.ar=e}next(){return this.ar+=2,this.ar}static ur(){return new Ao(0)}static cr(){return new Ao(-1)}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Rv="LruGarbageCollector",IA=1048576;function Dv([t,e],[n,r]){const i=Ve(t,n);return i===0?Ve(e,r):i}class kA{constructor(e){this.Ir=e,this.buffer=new Mt(Dv),this.Er=0}dr(){return++this.Er}Ar(e){const n=[e,this.dr()];if(this.buffer.size{this.Rr=null;try{await this.localStore.collectGarbage(this.garbageCollector)}catch(n){Fo(n)?ue(Rv,"Ignoring IndexedDB error during garbage collection: ",n):await Vo(n)}await this.Vr(3e5)})}}class NA{constructor(e,n){this.mr=e,this.params=n}calculateTargetCount(e,n){return this.mr.gr(e).next(r=>Math.floor(n/100*r))}nthSequenceNumber(e,n){if(n===0)return W.resolve(ld.ce);const r=new kA(n);return this.mr.forEachTarget(e,i=>r.Ar(i.sequenceNumber)).next(()=>this.mr.pr(e,i=>r.Ar(i))).next(()=>r.maxValue)}removeTargets(e,n,r){return this.mr.removeTargets(e,n,r)}removeOrphanedDocuments(e,n){return this.mr.removeOrphanedDocuments(e,n)}collect(e,n){return this.params.cacheSizeCollectionThreshold===-1?(ue("LruGarbageCollector","Garbage collection skipped; disabled"),W.resolve(Pv)):this.getCacheSize(e).next(r=>r(f>this.params.maximumSequenceNumbersToCollect?(ue("LruGarbageCollector",`Capping sequence numbers to collect down to the maximum of ${this.params.maximumSequenceNumbersToCollect} from ${f}`),i=this.params.maximumSequenceNumbersToCollect):i=f,o=Date.now(),this.nthSequenceNumber(e,i))).next(f=>(r=f,a=Date.now(),this.removeTargets(e,r,n))).next(f=>(s=f,u=Date.now(),this.removeOrphanedDocuments(e,r))).next(f=>(c=Date.now(),Us()<=Me.DEBUG&&ue("LruGarbageCollector",`LRU Garbage Collection + Counted targets in ${o-h}ms + Determined least recently used ${i} in `+(a-o)+`ms + Removed ${s} targets in `+(u-a)+`ms + Removed ${f} documents in `+(c-u)+`ms +Total Duration: ${c-h}ms`),W.resolve({didRun:!0,sequenceNumbersCollected:i,targetsRemoved:s,documentsRemoved:f})))}}function AA(t,e){return new NA(t,e)}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class PA{constructor(){this.changes=new Ps(e=>e.toString(),(e,n)=>e.isEqual(n)),this.changesApplied=!1}addEntry(e){this.assertNotApplied(),this.changes.set(e.key,e)}removeEntry(e,n){this.assertNotApplied(),this.changes.set(e,rn.newInvalidDocument(e).setReadTime(n))}getEntry(e,n){this.assertNotApplied();const r=this.changes.get(n);return r!==void 0?W.resolve(r):this.getFromCache(e,n)}getEntries(e,n){return this.getAllFromCache(e,n)}apply(e){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(e)}assertNotApplied(){}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *//** + * @license + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class RA{constructor(e,n){this.overlayedDocument=e,this.mutatedFields=n}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class DA{constructor(e,n,r,i){this.remoteDocumentCache=e,this.mutationQueue=n,this.documentOverlayCache=r,this.indexManager=i}getDocument(e,n){let r=null;return this.documentOverlayCache.getOverlay(e,n).next(i=>(r=i,this.remoteDocumentCache.getEntry(e,n))).next(i=>(r!==null&&ja(r.mutation,i,On.empty(),We.now()),i))}getDocuments(e,n){return this.remoteDocumentCache.getEntries(e,n).next(r=>this.getLocalViewOfDocuments(e,r,Fe()).next(()=>r))}getLocalViewOfDocuments(e,n,r=Fe()){const i=cs();return this.populateOverlays(e,i,n).next(()=>this.computeViews(e,n,i,r).next(s=>{let o=va();return s.forEach((a,u)=>{o=o.insert(a,u.overlayedDocument)}),o}))}getOverlayedDocuments(e,n){const r=cs();return this.populateOverlays(e,r,n).next(()=>this.computeViews(e,n,r,Fe()))}populateOverlays(e,n,r){const i=[];return r.forEach(s=>{n.has(s)||i.push(s)}),this.documentOverlayCache.getOverlays(e,i).next(s=>{s.forEach((o,a)=>{n.set(o,a)})})}computeViews(e,n,r,i){let s=Xr();const o=Da(),a=function(){return Da()}();return n.forEach((u,c)=>{const h=r.get(c.key);i.has(c.key)&&(h===void 0||h.mutation instanceof Qi)?s=s.insert(c.key,c):h!==void 0?(o.set(c.key,h.mutation.getFieldMask()),ja(h.mutation,c,h.mutation.getFieldMask(),We.now())):o.set(c.key,On.empty())}),this.recalculateAndSaveOverlays(e,s).next(u=>(u.forEach((c,h)=>o.set(c,h)),n.forEach((c,h)=>a.set(c,new RA(h,o.get(c)??null))),a))}recalculateAndSaveOverlays(e,n){const r=Da();let i=new mt((o,a)=>o-a),s=Fe();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,n).next(o=>{for(const a of o)a.keys().forEach(u=>{const c=n.get(u);if(c===null)return;let h=r.get(u)||On.empty();h=a.applyToLocalView(c,h),r.set(u,h);const f=(i.get(a.batchId)||Fe()).add(u);i=i.insert(a.batchId,f)})}).next(()=>{const o=[],a=i.getReverseIterator();for(;a.hasNext();){const u=a.getNext(),c=u.key,h=u.value,f=Mb();h.forEach(p=>{if(!s.has(p)){const g=Hb(n.get(p),r.get(p));g!==null&&f.set(p,g),s=s.add(p)}}),o.push(this.documentOverlayCache.saveOverlays(e,c,f))}return W.waitFor(o)}).next(()=>r)}recalculateAndSaveOverlaysForDocumentKeys(e,n){return this.remoteDocumentCache.getEntries(e,n).next(r=>this.recalculateAndSaveOverlays(e,r))}getDocumentsMatchingQuery(e,n,r,i){return function(o){return xe.isDocumentKey(o.path)&&o.collectionGroup===null&&o.filters.length===0}(n)?this.getDocumentsMatchingDocumentQuery(e,n.path):Rb(n)?this.getDocumentsMatchingCollectionGroupQuery(e,n,r,i):this.getDocumentsMatchingCollectionQuery(e,n,r,i)}getNextDocuments(e,n,r,i){return this.remoteDocumentCache.getAllFromCollectionGroup(e,n,r,i).next(s=>{const o=i-s.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,n,r.largestBatchId,i-s.size):W.resolve(cs());let a=il,u=s;return o.next(c=>W.forEach(c,(h,f)=>(a{u=u.insert(h,p)}))).next(()=>this.populateOverlays(e,c,s)).next(()=>this.computeViews(e,u,c,Fe())).next(h=>({batchId:a,changes:Ob(h)})))})}getDocumentsMatchingDocumentQuery(e,n){return this.getDocument(e,new xe(n)).next(r=>{let i=va();return r.isFoundDocument()&&(i=i.insert(r.key,r)),i})}getDocumentsMatchingCollectionGroupQuery(e,n,r,i){const s=n.collectionGroup;let o=va();return this.indexManager.getCollectionParents(e,s).next(a=>W.forEach(a,u=>{const c=function(f,p){return new Uo(p,null,f.explicitOrderBy.slice(),f.filters.slice(),f.limit,f.limitType,f.startAt,f.endAt)}(n,u.child(s));return this.getDocumentsMatchingCollectionQuery(e,c,r,i).next(h=>{h.forEach((f,p)=>{o=o.insert(f,p)})})}).next(()=>o))}getDocumentsMatchingCollectionQuery(e,n,r,i){let s;return this.documentOverlayCache.getOverlaysForCollection(e,n.path,r.largestBatchId).next(o=>(s=o,this.remoteDocumentCache.getDocumentsMatchingQuery(e,n,r,s,i))).next(o=>{s.forEach((u,c)=>{const h=c.getKey();o.get(h)===null&&(o=o.insert(h,rn.newInvalidDocument(h)))});let a=va();return o.forEach((u,c)=>{const h=s.get(u);h!==void 0&&ja(h.mutation,c,On.empty(),We.now()),fd(n,c)&&(a=a.insert(u,c))}),a})}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class jA{constructor(e){this.serializer=e,this.Lr=new Map,this.kr=new Map}getBundleMetadata(e,n){return W.resolve(this.Lr.get(n))}saveBundleMetadata(e,n){return this.Lr.set(n.id,function(i){return{id:i.id,version:i.version,createTime:Sr(i.createTime)}}(n)),W.resolve()}getNamedQuery(e,n){return W.resolve(this.kr.get(n))}saveNamedQuery(e,n){return this.kr.set(n.name,function(i){return{name:i.name,query:EA(i.bundledQuery),readTime:Sr(i.readTime)}}(n)),W.resolve()}}/** + * @license + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class LA{constructor(){this.overlays=new mt(xe.comparator),this.qr=new Map}getOverlay(e,n){return W.resolve(this.overlays.get(n))}getOverlays(e,n){const r=cs();return W.forEach(n,i=>this.getOverlay(e,i).next(s=>{s!==null&&r.set(i,s)})).next(()=>r)}saveOverlays(e,n,r){return r.forEach((i,s)=>{this.St(e,n,s)}),W.resolve()}removeOverlaysForBatchId(e,n,r){const i=this.qr.get(r);return i!==void 0&&(i.forEach(s=>this.overlays=this.overlays.remove(s)),this.qr.delete(r)),W.resolve()}getOverlaysForCollection(e,n,r){const i=cs(),s=n.length+1,o=new xe(n.child("")),a=this.overlays.getIteratorFrom(o);for(;a.hasNext();){const u=a.getNext().value,c=u.getKey();if(!n.isPrefixOf(c.path))break;c.path.length===s&&u.largestBatchId>r&&i.set(u.getKey(),u)}return W.resolve(i)}getOverlaysForCollectionGroup(e,n,r,i){let s=new mt((c,h)=>c-h);const o=this.overlays.getIterator();for(;o.hasNext();){const c=o.getNext().value;if(c.getKey().getCollectionGroup()===n&&c.largestBatchId>r){let h=s.get(c.largestBatchId);h===null&&(h=cs(),s=s.insert(c.largestBatchId,h)),h.set(c.getKey(),c)}}const a=cs(),u=s.getIterator();for(;u.hasNext()&&(u.getNext().value.forEach((c,h)=>a.set(c,h)),!(a.size()>=i)););return W.resolve(a)}St(e,n,r){const i=this.overlays.get(r.key);if(i!==null){const o=this.qr.get(i.largestBatchId).delete(r.key);this.qr.set(i.largestBatchId,o)}this.overlays=this.overlays.insert(r.key,new ZN(n,r));let s=this.qr.get(n);s===void 0&&(s=Fe(),this.qr.set(n,s)),this.qr.set(n,s.add(r.key))}}/** + * @license + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class OA{constructor(){this.sessionToken=Xt.EMPTY_BYTE_STRING}getSessionToken(e){return W.resolve(this.sessionToken)}setSessionToken(e,n){return this.sessionToken=n,W.resolve()}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Km{constructor(){this.Qr=new Mt(zt.$r),this.Ur=new Mt(zt.Kr)}isEmpty(){return this.Qr.isEmpty()}addReference(e,n){const r=new zt(e,n);this.Qr=this.Qr.add(r),this.Ur=this.Ur.add(r)}Wr(e,n){e.forEach(r=>this.addReference(r,n))}removeReference(e,n){this.Gr(new zt(e,n))}zr(e,n){e.forEach(r=>this.removeReference(r,n))}jr(e){const n=new xe(new nt([])),r=new zt(n,e),i=new zt(n,e+1),s=[];return this.Ur.forEachInRange([r,i],o=>{this.Gr(o),s.push(o.key)}),s}Jr(){this.Qr.forEach(e=>this.Gr(e))}Gr(e){this.Qr=this.Qr.delete(e),this.Ur=this.Ur.delete(e)}Hr(e){const n=new xe(new nt([])),r=new zt(n,e),i=new zt(n,e+1);let s=Fe();return this.Ur.forEachInRange([r,i],o=>{s=s.add(o.key)}),s}containsKey(e){const n=new zt(e,0),r=this.Qr.firstAfterOrEqual(n);return r!==null&&e.isEqual(r.key)}}class zt{constructor(e,n){this.key=e,this.Yr=n}static $r(e,n){return xe.comparator(e.key,n.key)||Ve(e.Yr,n.Yr)}static Kr(e,n){return Ve(e.Yr,n.Yr)||xe.comparator(e.key,n.key)}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class MA{constructor(e,n){this.indexManager=e,this.referenceDelegate=n,this.mutationQueue=[],this.tr=1,this.Zr=new Mt(zt.$r)}checkEmpty(e){return W.resolve(this.mutationQueue.length===0)}addMutationBatch(e,n,r,i){const s=this.tr;this.tr++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const o=new JN(s,n,r,i);this.mutationQueue.push(o);for(const a of i)this.Zr=this.Zr.add(new zt(a.key,s)),this.indexManager.addToCollectionParentIndex(e,a.key.path.popLast());return W.resolve(o)}lookupMutationBatch(e,n){return W.resolve(this.Xr(n))}getNextMutationBatchAfterBatchId(e,n){const r=n+1,i=this.ei(r),s=i<0?0:i;return W.resolve(this.mutationQueue.length>s?this.mutationQueue[s]:null)}getHighestUnacknowledgedBatchId(){return W.resolve(this.mutationQueue.length===0?Vm:this.tr-1)}getAllMutationBatches(e){return W.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,n){const r=new zt(n,0),i=new zt(n,Number.POSITIVE_INFINITY),s=[];return this.Zr.forEachInRange([r,i],o=>{const a=this.Xr(o.Yr);s.push(a)}),W.resolve(s)}getAllMutationBatchesAffectingDocumentKeys(e,n){let r=new Mt(Ve);return n.forEach(i=>{const s=new zt(i,0),o=new zt(i,Number.POSITIVE_INFINITY);this.Zr.forEachInRange([s,o],a=>{r=r.add(a.Yr)})}),W.resolve(this.ti(r))}getAllMutationBatchesAffectingQuery(e,n){const r=n.path,i=r.length+1;let s=r;xe.isDocumentKey(s)||(s=s.child(""));const o=new zt(new xe(s),0);let a=new Mt(Ve);return this.Zr.forEachWhile(u=>{const c=u.key.path;return!!r.isPrefixOf(c)&&(c.length===i&&(a=a.add(u.Yr)),!0)},o),W.resolve(this.ti(a))}ti(e){const n=[];return e.forEach(r=>{const i=this.Xr(r);i!==null&&n.push(i)}),n}removeMutationBatch(e,n){Ge(this.ni(n.batchId,"removed")===0,55003),this.mutationQueue.shift();let r=this.Zr;return W.forEach(n.mutations,i=>{const s=new zt(i.key,n.batchId);return r=r.delete(s),this.referenceDelegate.markPotentiallyOrphaned(e,i.key)}).next(()=>{this.Zr=r})}ir(e){}containsKey(e,n){const r=new zt(n,0),i=this.Zr.firstAfterOrEqual(r);return W.resolve(n.isEqual(i&&i.key))}performConsistencyCheck(e){return this.mutationQueue.length,W.resolve()}ni(e,n){return this.ei(e)}ei(e){return this.mutationQueue.length===0?0:e-this.mutationQueue[0].batchId}Xr(e){const n=this.ei(e);return n<0||n>=this.mutationQueue.length?null:this.mutationQueue[n]}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class VA{constructor(e){this.ri=e,this.docs=function(){return new mt(xe.comparator)}(),this.size=0}setIndexManager(e){this.indexManager=e}addEntry(e,n){const r=n.key,i=this.docs.get(r),s=i?i.size:0,o=this.ri(n);return this.docs=this.docs.insert(r,{document:n.mutableCopy(),size:o}),this.size+=o-s,this.indexManager.addToCollectionParentIndex(e,r.path.popLast())}removeEntry(e){const n=this.docs.get(e);n&&(this.docs=this.docs.remove(e),this.size-=n.size)}getEntry(e,n){const r=this.docs.get(n);return W.resolve(r?r.document.mutableCopy():rn.newInvalidDocument(n))}getEntries(e,n){let r=Xr();return n.forEach(i=>{const s=this.docs.get(i);r=r.insert(i,s?s.document.mutableCopy():rn.newInvalidDocument(i))}),W.resolve(r)}getDocumentsMatchingQuery(e,n,r,i){let s=Xr();const o=n.path,a=new xe(o.child("__id-9223372036854775808__")),u=this.docs.getIteratorFrom(a);for(;u.hasNext();){const{key:c,value:{document:h}}=u.getNext();if(!o.isPrefixOf(c.path))break;c.path.length>o.length+1||fN(hN(h),r)<=0||(i.has(h.key)||fd(n,h))&&(s=s.insert(h.key,h.mutableCopy()))}return W.resolve(s)}getAllFromCollectionGroup(e,n,r,i){Te(9500)}ii(e,n){return W.forEach(this.docs,r=>n(r))}newChangeBuffer(e){return new FA(this)}getSize(e){return W.resolve(this.size)}}class FA extends PA{constructor(e){super(),this.Nr=e}applyChanges(e){const n=[];return this.changes.forEach((r,i)=>{i.isValidDocument()?n.push(this.Nr.addEntry(e,i)):this.Nr.removeEntry(r)}),W.waitFor(n)}getFromCache(e,n){return this.Nr.getEntry(e,n)}getAllFromCache(e,n){return this.Nr.getEntries(e,n)}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class UA{constructor(e){this.persistence=e,this.si=new Ps(n=>zm(n),Bm),this.lastRemoteSnapshotVersion=Ne.min(),this.highestTargetId=0,this.oi=0,this._i=new Km,this.targetCount=0,this.ai=Ao.ur()}forEachTarget(e,n){return this.si.forEach((r,i)=>n(i)),W.resolve()}getLastRemoteSnapshotVersion(e){return W.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return W.resolve(this.oi)}allocateTargetId(e){return this.highestTargetId=this.ai.next(),W.resolve(this.highestTargetId)}setTargetsMetadata(e,n,r){return r&&(this.lastRemoteSnapshotVersion=r),n>this.oi&&(this.oi=n),W.resolve()}Pr(e){this.si.set(e.target,e);const n=e.targetId;n>this.highestTargetId&&(this.ai=new Ao(n),this.highestTargetId=n),e.sequenceNumber>this.oi&&(this.oi=e.sequenceNumber)}addTargetData(e,n){return this.Pr(n),this.targetCount+=1,W.resolve()}updateTargetData(e,n){return this.Pr(n),W.resolve()}removeTargetData(e,n){return this.si.delete(n.target),this._i.jr(n.targetId),this.targetCount-=1,W.resolve()}removeTargets(e,n,r){let i=0;const s=[];return this.si.forEach((o,a)=>{a.sequenceNumber<=n&&r.get(a.targetId)===null&&(this.si.delete(o),s.push(this.removeMatchingKeysForTargetId(e,a.targetId)),i++)}),W.waitFor(s).next(()=>i)}getTargetCount(e){return W.resolve(this.targetCount)}getTargetData(e,n){const r=this.si.get(n)||null;return W.resolve(r)}addMatchingKeys(e,n,r){return this._i.Wr(n,r),W.resolve()}removeMatchingKeys(e,n,r){this._i.zr(n,r);const i=this.persistence.referenceDelegate,s=[];return i&&n.forEach(o=>{s.push(i.markPotentiallyOrphaned(e,o))}),W.waitFor(s)}removeMatchingKeysForTargetId(e,n){return this._i.jr(n),W.resolve()}getMatchingKeysForTargetId(e,n){const r=this._i.Hr(n);return W.resolve(r)}containsKey(e,n){return W.resolve(this._i.containsKey(n))}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class rE{constructor(e,n){this.ui={},this.overlays={},this.ci=new ld(0),this.li=!1,this.li=!0,this.hi=new OA,this.referenceDelegate=e(this),this.Pi=new UA(this),this.indexManager=new SA,this.remoteDocumentCache=function(i){return new VA(i)}(r=>this.referenceDelegate.Ti(r)),this.serializer=new bA(n),this.Ii=new jA(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.li=!1,Promise.resolve()}get started(){return this.li}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let n=this.overlays[e.toKey()];return n||(n=new LA,this.overlays[e.toKey()]=n),n}getMutationQueue(e,n){let r=this.ui[e.toKey()];return r||(r=new MA(n,this.referenceDelegate),this.ui[e.toKey()]=r),r}getGlobalsCache(){return this.hi}getTargetCache(){return this.Pi}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.Ii}runTransaction(e,n,r){ue("MemoryPersistence","Starting transaction:",e);const i=new zA(this.ci.next());return this.referenceDelegate.Ei(),r(i).next(s=>this.referenceDelegate.di(i).next(()=>s)).toPromise().then(s=>(i.raiseOnCommittedEvent(),s))}Ai(e,n){return W.or(Object.values(this.ui).map(r=>()=>r.containsKey(e,n)))}}class zA extends mN{constructor(e){super(),this.currentSequenceNumber=e}}class Qm{constructor(e){this.persistence=e,this.Ri=new Km,this.Vi=null}static mi(e){return new Qm(e)}get fi(){if(this.Vi)return this.Vi;throw Te(60996)}addReference(e,n,r){return this.Ri.addReference(r,n),this.fi.delete(r.toString()),W.resolve()}removeReference(e,n,r){return this.Ri.removeReference(r,n),this.fi.add(r.toString()),W.resolve()}markPotentiallyOrphaned(e,n){return this.fi.add(n.toString()),W.resolve()}removeTarget(e,n){this.Ri.jr(n.targetId).forEach(i=>this.fi.add(i.toString()));const r=this.persistence.getTargetCache();return r.getMatchingKeysForTargetId(e,n.targetId).next(i=>{i.forEach(s=>this.fi.add(s.toString()))}).next(()=>r.removeTargetData(e,n))}Ei(){this.Vi=new Set}di(e){const n=this.persistence.getRemoteDocumentCache().newChangeBuffer();return W.forEach(this.fi,r=>{const i=xe.fromPath(r);return this.gi(e,i).next(s=>{s||n.removeEntry(i,Ne.min())})}).next(()=>(this.Vi=null,n.apply(e)))}updateLimboDocument(e,n){return this.gi(e,n).next(r=>{r?this.fi.delete(n.toString()):this.fi.add(n.toString())})}Ti(e){return 0}gi(e,n){return W.or([()=>W.resolve(this.Ri.containsKey(n)),()=>this.persistence.getTargetCache().containsKey(e,n),()=>this.persistence.Ai(e,n)])}}class Sc{constructor(e,n){this.persistence=e,this.pi=new Ps(r=>vN(r.path),(r,i)=>r.isEqual(i)),this.garbageCollector=AA(this,n)}static mi(e,n){return new Sc(e,n)}Ei(){}di(e){return W.resolve()}forEachTarget(e,n){return this.persistence.getTargetCache().forEachTarget(e,n)}gr(e){const n=this.wr(e);return this.persistence.getTargetCache().getTargetCount(e).next(r=>n.next(i=>r+i))}wr(e){let n=0;return this.pr(e,r=>{n++}).next(()=>n)}pr(e,n){return W.forEach(this.pi,(r,i)=>this.br(e,r,i).next(s=>s?W.resolve():n(i)))}removeTargets(e,n,r){return this.persistence.getTargetCache().removeTargets(e,n,r)}removeOrphanedDocuments(e,n){let r=0;const i=this.persistence.getRemoteDocumentCache(),s=i.newChangeBuffer();return i.ii(e,o=>this.br(e,o,n).next(a=>{a||(r++,s.removeEntry(o,Ne.min()))})).next(()=>s.apply(e)).next(()=>r)}markPotentiallyOrphaned(e,n){return this.pi.set(n,e.currentSequenceNumber),W.resolve()}removeTarget(e,n){const r=n.withSequenceNumber(e.currentSequenceNumber);return this.persistence.getTargetCache().updateTargetData(e,r)}addReference(e,n,r){return this.pi.set(r,e.currentSequenceNumber),W.resolve()}removeReference(e,n,r){return this.pi.set(r,e.currentSequenceNumber),W.resolve()}updateLimboDocument(e,n){return this.pi.set(n,e.currentSequenceNumber),W.resolve()}Ti(e){let n=e.key.toString().length;return e.isFoundDocument()&&(n+=Du(e.data.value)),n}br(e,n,r){return W.or([()=>this.persistence.Ai(e,n),()=>this.persistence.getTargetCache().containsKey(e,n),()=>{const i=this.pi.get(n);return W.resolve(i!==void 0&&i>r)}])}getCacheSize(e){return this.persistence.getRemoteDocumentCache().getSize(e)}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Ym{constructor(e,n,r,i){this.targetId=e,this.fromCache=n,this.Es=r,this.ds=i}static As(e,n){let r=Fe(),i=Fe();for(const s of n.docChanges)switch(s.type){case 0:r=r.add(s.doc.key);break;case 1:i=i.add(s.doc.key)}return new Ym(e,n.fromCache,r,i)}}/** + * @license + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class BA{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class $A{constructor(){this.Rs=!1,this.Vs=!1,this.fs=100,this.gs=function(){return j2()?8:gN(on())>0?6:4}()}initialize(e,n){this.ps=e,this.indexManager=n,this.Rs=!0}getDocumentsMatchingQuery(e,n,r,i){const s={result:null};return this.ys(e,n).next(o=>{s.result=o}).next(()=>{if(!s.result)return this.ws(e,n,i,r).next(o=>{s.result=o})}).next(()=>{if(s.result)return;const o=new BA;return this.Ss(e,n,o).next(a=>{if(s.result=a,this.Vs)return this.bs(e,n,o,a.size)})}).next(()=>s.result)}bs(e,n,r,i){return r.documentReadCountthis.gs*i?(Us()<=Me.DEBUG&&ue("QueryEngine","The SDK decides to create cache indexes for query:",zs(n),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(e,Er(n))):W.resolve())}ys(e,n){if(_v(n))return W.resolve(null);let r=Er(n);return this.indexManager.getIndexType(e,r).next(i=>i===0?null:(n.limit!==null&&i===1&&(n=op(n,null,"F"),r=Er(n)),this.indexManager.getDocumentsMatchingTarget(e,r).next(s=>{const o=Fe(...s);return this.ps.getDocuments(e,o).next(a=>this.indexManager.getMinOffset(e,r).next(u=>{const c=this.Ds(n,a);return this.Cs(n,c,o,u.readTime)?this.ys(e,op(n,null,"F")):this.vs(e,c,n,u)}))})))}ws(e,n,r,i){return _v(n)||i.isEqual(Ne.min())?W.resolve(null):this.ps.getDocuments(e,r).next(s=>{const o=this.Ds(n,s);return this.Cs(n,o,r,i)?W.resolve(null):(Us()<=Me.DEBUG&&ue("QueryEngine","Re-using previous result from %s to execute query: %s",i.toString(),zs(n)),this.vs(e,o,n,dN(i,il)).next(a=>a))})}Ds(e,n){let r=new Mt(jb(e));return n.forEach((i,s)=>{fd(e,s)&&(r=r.add(s))}),r}Cs(e,n,r,i){if(e.limit===null)return!1;if(r.size!==n.size)return!0;const s=e.limitType==="F"?n.last():n.first();return!!s&&(s.hasPendingWrites||s.version.compareTo(i)>0)}Ss(e,n,r){return Us()<=Me.DEBUG&&ue("QueryEngine","Using full collection scan to execute query:",zs(n)),this.ps.getDocumentsMatchingQuery(e,n,Fi.min(),r)}vs(e,n,r,i){return this.ps.getDocumentsMatchingQuery(e,r,i).next(s=>(n.forEach(o=>{s=s.insert(o.key,o)}),s))}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Xm="LocalStore",HA=3e8;class qA{constructor(e,n,r,i){this.persistence=e,this.Fs=n,this.serializer=i,this.Ms=new mt(Ve),this.xs=new Ps(s=>zm(s),Bm),this.Os=new Map,this.Ns=e.getRemoteDocumentCache(),this.Pi=e.getTargetCache(),this.Ii=e.getBundleCache(),this.Bs(r)}Bs(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new DA(this.Ns,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.Ns.setIndexManager(this.indexManager),this.Fs.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction("Collect garbage","readwrite-primary",n=>e.collect(n,this.Ms))}}function WA(t,e,n,r){return new qA(t,e,n,r)}async function iE(t,e){const n=Ae(t);return await n.persistence.runTransaction("Handle user change","readonly",r=>{let i;return n.mutationQueue.getAllMutationBatches(r).next(s=>(i=s,n.Bs(e),n.mutationQueue.getAllMutationBatches(r))).next(s=>{const o=[],a=[];let u=Fe();for(const c of i){o.push(c.batchId);for(const h of c.mutations)u=u.add(h.key)}for(const c of s){a.push(c.batchId);for(const h of c.mutations)u=u.add(h.key)}return n.localDocuments.getDocuments(r,u).next(c=>({Ls:c,removedBatchIds:o,addedBatchIds:a}))})})}function GA(t,e){const n=Ae(t);return n.persistence.runTransaction("Acknowledge batch","readwrite-primary",r=>{const i=e.batch.keys(),s=n.Ns.newChangeBuffer({trackRemovals:!0});return function(a,u,c,h){const f=c.batch,p=f.keys();let g=W.resolve();return p.forEach(_=>{g=g.next(()=>h.getEntry(u,_)).next(T=>{const R=c.docVersions.get(_);Ge(R!==null,48541),T.version.compareTo(R)<0&&(f.applyToRemoteDocument(T,c),T.isValidDocument()&&(T.setReadTime(c.commitVersion),h.addEntry(T)))})}),g.next(()=>a.mutationQueue.removeMutationBatch(u,f))}(n,r,e,s).next(()=>s.apply(r)).next(()=>n.mutationQueue.performConsistencyCheck(r)).next(()=>n.documentOverlayCache.removeOverlaysForBatchId(r,i,e.batch.batchId)).next(()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(r,function(a){let u=Fe();for(let c=0;c0&&(u=u.add(a.batch.mutations[c].key));return u}(e))).next(()=>n.localDocuments.getDocuments(r,i))})}function sE(t){const e=Ae(t);return e.persistence.runTransaction("Get last remote snapshot version","readonly",n=>e.Pi.getLastRemoteSnapshotVersion(n))}function KA(t,e){const n=Ae(t),r=e.snapshotVersion;let i=n.Ms;return n.persistence.runTransaction("Apply remote event","readwrite-primary",s=>{const o=n.Ns.newChangeBuffer({trackRemovals:!0});i=n.Ms;const a=[];e.targetChanges.forEach((h,f)=>{const p=i.get(f);if(!p)return;a.push(n.Pi.removeMatchingKeys(s,h.removedDocuments,f).next(()=>n.Pi.addMatchingKeys(s,h.addedDocuments,f)));let g=p.withSequenceNumber(s.currentSequenceNumber);e.targetMismatches.get(f)!==null?g=g.withResumeToken(Xt.EMPTY_BYTE_STRING,Ne.min()).withLastLimboFreeSnapshotVersion(Ne.min()):h.resumeToken.approximateByteSize()>0&&(g=g.withResumeToken(h.resumeToken,r)),i=i.insert(f,g),function(T,R,y){return T.resumeToken.approximateByteSize()===0||R.snapshotVersion.toMicroseconds()-T.snapshotVersion.toMicroseconds()>=HA?!0:y.addedDocuments.size+y.modifiedDocuments.size+y.removedDocuments.size>0}(p,g,h)&&a.push(n.Pi.updateTargetData(s,g))});let u=Xr(),c=Fe();if(e.documentUpdates.forEach(h=>{e.resolvedLimboDocuments.has(h)&&a.push(n.persistence.referenceDelegate.updateLimboDocument(s,h))}),a.push(QA(s,o,e.documentUpdates).next(h=>{u=h.ks,c=h.qs})),!r.isEqual(Ne.min())){const h=n.Pi.getLastRemoteSnapshotVersion(s).next(f=>n.Pi.setTargetsMetadata(s,s.currentSequenceNumber,r));a.push(h)}return W.waitFor(a).next(()=>o.apply(s)).next(()=>n.localDocuments.getLocalViewOfDocuments(s,u,c)).next(()=>u)}).then(s=>(n.Ms=i,s))}function QA(t,e,n){let r=Fe(),i=Fe();return n.forEach(s=>r=r.add(s)),e.getEntries(t,r).next(s=>{let o=Xr();return n.forEach((a,u)=>{const c=s.get(a);u.isFoundDocument()!==c.isFoundDocument()&&(i=i.add(a)),u.isNoDocument()&&u.version.isEqual(Ne.min())?(e.removeEntry(a,u.readTime),o=o.insert(a,u)):!c.isValidDocument()||u.version.compareTo(c.version)>0||u.version.compareTo(c.version)===0&&c.hasPendingWrites?(e.addEntry(u),o=o.insert(a,u)):ue(Xm,"Ignoring outdated watch update for ",a,". Current version:",c.version," Watch version:",u.version)}),{ks:o,qs:i}})}function YA(t,e){const n=Ae(t);return n.persistence.runTransaction("Get next mutation batch","readonly",r=>(e===void 0&&(e=Vm),n.mutationQueue.getNextMutationBatchAfterBatchId(r,e)))}function XA(t,e){const n=Ae(t);return n.persistence.runTransaction("Allocate target","readwrite",r=>{let i;return n.Pi.getTargetData(r,e).next(s=>s?(i=s,W.resolve(i)):n.Pi.allocateTargetId(r).next(o=>(i=new bi(e,o,"TargetPurposeListen",r.currentSequenceNumber),n.Pi.addTargetData(r,i).next(()=>i))))}).then(r=>{const i=n.Ms.get(r.targetId);return(i===null||r.snapshotVersion.compareTo(i.snapshotVersion)>0)&&(n.Ms=n.Ms.insert(r.targetId,r),n.xs.set(e,r.targetId)),r})}async function dp(t,e,n){const r=Ae(t),i=r.Ms.get(e),s=n?"readwrite":"readwrite-primary";try{n||await r.persistence.runTransaction("Release target",s,o=>r.persistence.referenceDelegate.removeTarget(o,i))}catch(o){if(!Fo(o))throw o;ue(Xm,`Failed to update sequence numbers for target ${e}: ${o}`)}r.Ms=r.Ms.remove(e),r.xs.delete(i.target)}function jv(t,e,n){const r=Ae(t);let i=Ne.min(),s=Fe();return r.persistence.runTransaction("Execute query","readwrite",o=>function(u,c,h){const f=Ae(u),p=f.xs.get(h);return p!==void 0?W.resolve(f.Ms.get(p)):f.Pi.getTargetData(c,h)}(r,o,Er(e)).next(a=>{if(a)return i=a.lastLimboFreeSnapshotVersion,r.Pi.getMatchingKeysForTargetId(o,a.targetId).next(u=>{s=u})}).next(()=>r.Fs.getDocumentsMatchingQuery(o,e,n?i:Ne.min(),n?s:Fe())).next(a=>(JA(r,MN(e),a),{documents:a,Qs:s})))}function JA(t,e,n){let r=t.Os.get(e)||Ne.min();n.forEach((i,s)=>{s.readTime.compareTo(r)>0&&(r=s.readTime)}),t.Os.set(e,r)}class Lv{constructor(){this.activeTargetIds=$N()}zs(e){this.activeTargetIds=this.activeTargetIds.add(e)}js(e){this.activeTargetIds=this.activeTargetIds.delete(e)}Gs(){const e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)}}class ZA{constructor(){this.Mo=new Lv,this.xo={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,n,r){}addLocalQueryTarget(e,n=!0){return n&&this.Mo.zs(e),this.xo[e]||"not-current"}updateQueryState(e,n,r){this.xo[e]=n}removeLocalQueryTarget(e){this.Mo.js(e)}isLocalQueryTarget(e){return this.Mo.activeTargetIds.has(e)}clearQueryState(e){delete this.xo[e]}getAllActiveQueryTargets(){return this.Mo.activeTargetIds}isActiveQueryTarget(e){return this.Mo.activeTargetIds.has(e)}start(){return this.Mo=new Lv,Promise.resolve()}handleUserChange(e,n,r){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class eP{Oo(e){}shutdown(){}}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Ov="ConnectivityMonitor";class Mv{constructor(){this.No=()=>this.Bo(),this.Lo=()=>this.ko(),this.qo=[],this.Qo()}Oo(e){this.qo.push(e)}shutdown(){window.removeEventListener("online",this.No),window.removeEventListener("offline",this.Lo)}Qo(){window.addEventListener("online",this.No),window.addEventListener("offline",this.Lo)}Bo(){ue(Ov,"Network connectivity changed: AVAILABLE");for(const e of this.qo)e(0)}ko(){ue(Ov,"Network connectivity changed: UNAVAILABLE");for(const e of this.qo)e(1)}static v(){return typeof window<"u"&&window.addEventListener!==void 0&&window.removeEventListener!==void 0}}/** + * @license + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */let fu=null;function hp(){return fu===null?fu=function(){return 268435456+Math.round(2147483648*Math.random())}():fu++,"0x"+fu.toString(16)}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Ah="RestConnection",tP={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery"};class nP{get $o(){return!1}constructor(e){this.databaseInfo=e,this.databaseId=e.databaseId;const n=e.ssl?"https":"http",r=encodeURIComponent(this.databaseId.projectId),i=encodeURIComponent(this.databaseId.database);this.Uo=n+"://"+e.host,this.Ko=`projects/${r}/databases/${i}`,this.Wo=this.databaseId.database===xc?`project_id=${r}`:`project_id=${r}&database_id=${i}`}Go(e,n,r,i,s){const o=hp(),a=this.zo(e,n.toUriEncodedString());ue(Ah,`Sending RPC '${e}' ${o}:`,a,r);const u={"google-cloud-resource-prefix":this.Ko,"x-goog-request-params":this.Wo};this.jo(u,i,s);const{host:c}=new URL(a),h=Ns(c);return this.Jo(e,a,u,r,h).then(f=>(ue(Ah,`Received RPC '${e}' ${o}: `,f),f),f=>{throw Io(Ah,`RPC '${e}' ${o} failed with error: `,f,"url: ",a,"request:",r),f})}Ho(e,n,r,i,s,o){return this.Go(e,n,r,i,s)}jo(e,n,r){e["X-Goog-Api-Client"]=function(){return"gl-js/ fire/"+Mo}(),e["Content-Type"]="text/plain",this.databaseInfo.appId&&(e["X-Firebase-GMPID"]=this.databaseInfo.appId),n&&n.headers.forEach((i,s)=>e[s]=i),r&&r.headers.forEach((i,s)=>e[s]=i)}zo(e,n){const r=tP[e];return`${this.Uo}/v1/${n}:${r}`}terminate(){}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class rP{constructor(e){this.Yo=e.Yo,this.Zo=e.Zo}Xo(e){this.e_=e}t_(e){this.n_=e}r_(e){this.i_=e}onMessage(e){this.s_=e}close(){this.Zo()}send(e){this.Yo(e)}o_(){this.e_()}__(){this.n_()}a_(e){this.i_(e)}u_(e){this.s_(e)}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const en="WebChannelConnection";class iP extends nP{constructor(e){super(e),this.c_=[],this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}Jo(e,n,r,i,s){const o=hp();return new Promise((a,u)=>{const c=new ab;c.setWithCredentials(!0),c.listenOnce(lb.COMPLETE,()=>{try{switch(c.getLastErrorCode()){case Ru.NO_ERROR:const f=c.getResponseJson();ue(en,`XHR for RPC '${e}' ${o} received:`,JSON.stringify(f)),a(f);break;case Ru.TIMEOUT:ue(en,`RPC '${e}' ${o} timed out`),u(new ae(q.DEADLINE_EXCEEDED,"Request time out"));break;case Ru.HTTP_ERROR:const p=c.getStatus();if(ue(en,`RPC '${e}' ${o} failed with status:`,p,"response text:",c.getResponseText()),p>0){let g=c.getResponseJson();Array.isArray(g)&&(g=g[0]);const _=g==null?void 0:g.error;if(_&&_.status&&_.message){const T=function(y){const w=y.toLowerCase().replace(/_/g,"-");return Object.values(q).indexOf(w)>=0?w:q.UNKNOWN}(_.status);u(new ae(T,_.message))}else u(new ae(q.UNKNOWN,"Server responded with status "+c.getStatus()))}else u(new ae(q.UNAVAILABLE,"Connection failed."));break;default:Te(9055,{l_:e,streamId:o,h_:c.getLastErrorCode(),P_:c.getLastError()})}}finally{ue(en,`RPC '${e}' ${o} completed.`)}});const h=JSON.stringify(i);ue(en,`RPC '${e}' ${o} sending request:`,i),c.send(n,"POST",h,r,15)})}T_(e,n,r){const i=hp(),s=[this.Uo,"/","google.firestore.v1.Firestore","/",e,"/channel"],o=db(),a=cb(),u={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:`projects/${this.databaseId.projectId}/databases/${this.databaseId.database}`},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling},c=this.longPollingOptions.timeoutSeconds;c!==void 0&&(u.longPollingTimeout=Math.round(1e3*c)),this.useFetchStreams&&(u.useFetchStreams=!0),this.jo(u.initMessageHeaders,n,r),u.encodeInitMessageHeaders=!0;const h=s.join("");ue(en,`Creating RPC '${e}' stream ${i}: ${h}`,u);const f=o.createWebChannel(h,u);this.I_(f);let p=!1,g=!1;const _=new rP({Yo:R=>{g?ue(en,`Not sending because RPC '${e}' stream ${i} is closed:`,R):(p||(ue(en,`Opening RPC '${e}' stream ${i} transport.`),f.open(),p=!0),ue(en,`RPC '${e}' stream ${i} sending:`,R),f.send(R))},Zo:()=>f.close()}),T=(R,y,w)=>{R.listen(y,k=>{try{w(k)}catch(L){setTimeout(()=>{throw L},0)}})};return T(f,ya.EventType.OPEN,()=>{g||(ue(en,`RPC '${e}' stream ${i} transport opened.`),_.o_())}),T(f,ya.EventType.CLOSE,()=>{g||(g=!0,ue(en,`RPC '${e}' stream ${i} transport closed`),_.a_(),this.E_(f))}),T(f,ya.EventType.ERROR,R=>{g||(g=!0,Io(en,`RPC '${e}' stream ${i} transport errored. Name:`,R.name,"Message:",R.message),_.a_(new ae(q.UNAVAILABLE,"The operation could not be completed")))}),T(f,ya.EventType.MESSAGE,R=>{var y;if(!g){const w=R.data[0];Ge(!!w,16349);const k=w,L=(k==null?void 0:k.error)||((y=k[0])==null?void 0:y.error);if(L){ue(en,`RPC '${e}' stream ${i} received error:`,L);const U=L.status;let j=function(E){const I=Tt[E];if(I!==void 0)return Wb(I)}(U),b=L.message;j===void 0&&(j=q.INTERNAL,b="Unknown error status: "+U+" with message "+L.message),g=!0,_.a_(new ae(j,b)),f.close()}else ue(en,`RPC '${e}' stream ${i} received:`,w),_.u_(w)}}),T(a,ub.STAT_EVENT,R=>{R.stat===Zf.PROXY?ue(en,`RPC '${e}' stream ${i} detected buffering proxy`):R.stat===Zf.NOPROXY&&ue(en,`RPC '${e}' stream ${i} detected no buffering proxy`)}),setTimeout(()=>{_.__()},0),_}terminate(){this.c_.forEach(e=>e.close()),this.c_=[]}I_(e){this.c_.push(e)}E_(e){this.c_=this.c_.filter(n=>n===e)}}function Ph(){return typeof document<"u"?document:null}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function yd(t){return new lA(t,!0)}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class oE{constructor(e,n,r=1e3,i=1.5,s=6e4){this.Mi=e,this.timerId=n,this.d_=r,this.A_=i,this.R_=s,this.V_=0,this.m_=null,this.f_=Date.now(),this.reset()}reset(){this.V_=0}g_(){this.V_=this.R_}p_(e){this.cancel();const n=Math.floor(this.V_+this.y_()),r=Math.max(0,Date.now()-this.f_),i=Math.max(0,n-r);i>0&&ue("ExponentialBackoff",`Backing off for ${i} ms (base delay: ${this.V_} ms, delay with jitter: ${n} ms, last attempt: ${r} ms ago)`),this.m_=this.Mi.enqueueAfterDelay(this.timerId,i,()=>(this.f_=Date.now(),e())),this.V_*=this.A_,this.V_this.R_&&(this.V_=this.R_)}w_(){this.m_!==null&&(this.m_.skipDelay(),this.m_=null)}cancel(){this.m_!==null&&(this.m_.cancel(),this.m_=null)}y_(){return(Math.random()-.5)*this.V_}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Vv="PersistentStream";class aE{constructor(e,n,r,i,s,o,a,u){this.Mi=e,this.S_=r,this.b_=i,this.connection=s,this.authCredentialsProvider=o,this.appCheckCredentialsProvider=a,this.listener=u,this.state=0,this.D_=0,this.C_=null,this.v_=null,this.stream=null,this.F_=0,this.M_=new oE(e,n)}x_(){return this.state===1||this.state===5||this.O_()}O_(){return this.state===2||this.state===3}start(){this.F_=0,this.state!==4?this.auth():this.N_()}async stop(){this.x_()&&await this.close(0)}B_(){this.state=0,this.M_.reset()}L_(){this.O_()&&this.C_===null&&(this.C_=this.Mi.enqueueAfterDelay(this.S_,6e4,()=>this.k_()))}q_(e){this.Q_(),this.stream.send(e)}async k_(){if(this.O_())return this.close(0)}Q_(){this.C_&&(this.C_.cancel(),this.C_=null)}U_(){this.v_&&(this.v_.cancel(),this.v_=null)}async close(e,n){this.Q_(),this.U_(),this.M_.cancel(),this.D_++,e!==4?this.M_.reset():n&&n.code===q.RESOURCE_EXHAUSTED?(Yr(n.toString()),Yr("Using maximum backoff delay to prevent overloading the backend."),this.M_.g_()):n&&n.code===q.UNAUTHENTICATED&&this.state!==3&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),this.stream!==null&&(this.K_(),this.stream.close(),this.stream=null),this.state=e,await this.listener.r_(n)}K_(){}auth(){this.state=1;const e=this.W_(this.D_),n=this.D_;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then(([r,i])=>{this.D_===n&&this.G_(r,i)},r=>{e(()=>{const i=new ae(q.UNKNOWN,"Fetching auth token failed: "+r.message);return this.z_(i)})})}G_(e,n){const r=this.W_(this.D_);this.stream=this.j_(e,n),this.stream.Xo(()=>{r(()=>this.listener.Xo())}),this.stream.t_(()=>{r(()=>(this.state=2,this.v_=this.Mi.enqueueAfterDelay(this.b_,1e4,()=>(this.O_()&&(this.state=3),Promise.resolve())),this.listener.t_()))}),this.stream.r_(i=>{r(()=>this.z_(i))}),this.stream.onMessage(i=>{r(()=>++this.F_==1?this.J_(i):this.onNext(i))})}N_(){this.state=5,this.M_.p_(async()=>{this.state=0,this.start()})}z_(e){return ue(Vv,`close with error: ${e}`),this.stream=null,this.close(4,e)}W_(e){return n=>{this.Mi.enqueueAndForget(()=>this.D_===e?n():(ue(Vv,"stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve()))}}}class sP extends aE{constructor(e,n,r,i,s,o){super(e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",n,r,i,o),this.serializer=s}j_(e,n){return this.connection.T_("Listen",e,n)}J_(e){return this.onNext(e)}onNext(e){this.M_.reset();const n=dA(this.serializer,e),r=function(s){if(!("targetChange"in s))return Ne.min();const o=s.targetChange;return o.targetIds&&o.targetIds.length?Ne.min():o.readTime?Sr(o.readTime):Ne.min()}(e);return this.listener.H_(n,r)}Y_(e){const n={};n.database=cp(this.serializer),n.addTarget=function(s,o){let a;const u=o.target;if(a=ip(u)?{documents:pA(s,u)}:{query:mA(s,u).ft},a.targetId=o.targetId,o.resumeToken.approximateByteSize()>0){a.resumeToken=Qb(s,o.resumeToken);const c=ap(s,o.expectedCount);c!==null&&(a.expectedCount=c)}else if(o.snapshotVersion.compareTo(Ne.min())>0){a.readTime=Ec(s,o.snapshotVersion.toTimestamp());const c=ap(s,o.expectedCount);c!==null&&(a.expectedCount=c)}return a}(this.serializer,e);const r=yA(this.serializer,e);r&&(n.labels=r),this.q_(n)}Z_(e){const n={};n.database=cp(this.serializer),n.removeTarget=e,this.q_(n)}}class oP extends aE{constructor(e,n,r,i,s,o){super(e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",n,r,i,o),this.serializer=s}get X_(){return this.F_>0}start(){this.lastStreamToken=void 0,super.start()}K_(){this.X_&&this.ea([])}j_(e,n){return this.connection.T_("Write",e,n)}J_(e){return Ge(!!e.streamToken,31322),this.lastStreamToken=e.streamToken,Ge(!e.writeResults||e.writeResults.length===0,55816),this.listener.ta()}onNext(e){Ge(!!e.streamToken,12678),this.lastStreamToken=e.streamToken,this.M_.reset();const n=fA(e.writeResults,e.commitTime),r=Sr(e.commitTime);return this.listener.na(r,n)}ra(){const e={};e.database=cp(this.serializer),this.q_(e)}ea(e){const n={streamToken:this.lastStreamToken,writes:e.map(r=>hA(this.serializer,r))};this.q_(n)}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class aP{}class lP extends aP{constructor(e,n,r,i){super(),this.authCredentials=e,this.appCheckCredentials=n,this.connection=r,this.serializer=i,this.ia=!1}sa(){if(this.ia)throw new ae(q.FAILED_PRECONDITION,"The client has already been terminated.")}Go(e,n,r,i){return this.sa(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([s,o])=>this.connection.Go(e,lp(n,r),i,s,o)).catch(s=>{throw s.name==="FirebaseError"?(s.code===q.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),s):new ae(q.UNKNOWN,s.toString())})}Ho(e,n,r,i,s){return this.sa(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([o,a])=>this.connection.Ho(e,lp(n,r),i,o,a,s)).catch(o=>{throw o.name==="FirebaseError"?(o.code===q.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),o):new ae(q.UNKNOWN,o.toString())})}terminate(){this.ia=!0,this.connection.terminate()}}class uP{constructor(e,n){this.asyncQueue=e,this.onlineStateHandler=n,this.state="Unknown",this.oa=0,this._a=null,this.aa=!0}ua(){this.oa===0&&(this.ca("Unknown"),this._a=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,()=>(this._a=null,this.la("Backend didn't respond within 10 seconds."),this.ca("Offline"),Promise.resolve())))}ha(e){this.state==="Online"?this.ca("Unknown"):(this.oa++,this.oa>=1&&(this.Pa(),this.la(`Connection failed 1 times. Most recent error: ${e.toString()}`),this.ca("Offline")))}set(e){this.Pa(),this.oa=0,e==="Online"&&(this.aa=!1),this.ca(e)}ca(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}la(e){const n=`Could not reach Cloud Firestore backend. ${e} +This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.`;this.aa?(Yr(n),this.aa=!1):ue("OnlineStateTracker",n)}Pa(){this._a!==null&&(this._a.cancel(),this._a=null)}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Ts="RemoteStore";class cP{constructor(e,n,r,i,s){this.localStore=e,this.datastore=n,this.asyncQueue=r,this.remoteSyncer={},this.Ta=[],this.Ia=new Map,this.Ea=new Set,this.da=[],this.Aa=s,this.Aa.Oo(o=>{r.enqueueAndForget(async()=>{Rs(this)&&(ue(Ts,"Restarting streams for network reachability change."),await async function(u){const c=Ae(u);c.Ea.add(4),await Il(c),c.Ra.set("Unknown"),c.Ea.delete(4),await vd(c)}(this))})}),this.Ra=new uP(r,i)}}async function vd(t){if(Rs(t))for(const e of t.da)await e(!0)}async function Il(t){for(const e of t.da)await e(!1)}function lE(t,e){const n=Ae(t);n.Ia.has(e.targetId)||(n.Ia.set(e.targetId,e),tg(n)?eg(n):zo(n).O_()&&Zm(n,e))}function Jm(t,e){const n=Ae(t),r=zo(n);n.Ia.delete(e),r.O_()&&uE(n,e),n.Ia.size===0&&(r.O_()?r.L_():Rs(n)&&n.Ra.set("Unknown"))}function Zm(t,e){if(t.Va.Ue(e.targetId),e.resumeToken.approximateByteSize()>0||e.snapshotVersion.compareTo(Ne.min())>0){const n=t.remoteSyncer.getRemoteKeysForTarget(e.targetId).size;e=e.withExpectedCount(n)}zo(t).Y_(e)}function uE(t,e){t.Va.Ue(e),zo(t).Z_(e)}function eg(t){t.Va=new iA({getRemoteKeysForTarget:e=>t.remoteSyncer.getRemoteKeysForTarget(e),At:e=>t.Ia.get(e)||null,ht:()=>t.datastore.serializer.databaseId}),zo(t).start(),t.Ra.ua()}function tg(t){return Rs(t)&&!zo(t).x_()&&t.Ia.size>0}function Rs(t){return Ae(t).Ea.size===0}function cE(t){t.Va=void 0}async function dP(t){t.Ra.set("Online")}async function hP(t){t.Ia.forEach((e,n)=>{Zm(t,e)})}async function fP(t,e){cE(t),tg(t)?(t.Ra.ha(e),eg(t)):t.Ra.set("Unknown")}async function pP(t,e,n){if(t.Ra.set("Online"),e instanceof Kb&&e.state===2&&e.cause)try{await async function(i,s){const o=s.cause;for(const a of s.targetIds)i.Ia.has(a)&&(await i.remoteSyncer.rejectListen(a,o),i.Ia.delete(a),i.Va.removeTarget(a))}(t,e)}catch(r){ue(Ts,"Failed to remove targets %s: %s ",e.targetIds.join(","),r),await Tc(t,r)}else if(e instanceof Ou?t.Va.Ze(e):e instanceof Gb?t.Va.st(e):t.Va.tt(e),!n.isEqual(Ne.min()))try{const r=await sE(t.localStore);n.compareTo(r)>=0&&await function(s,o){const a=s.Va.Tt(o);return a.targetChanges.forEach((u,c)=>{if(u.resumeToken.approximateByteSize()>0){const h=s.Ia.get(c);h&&s.Ia.set(c,h.withResumeToken(u.resumeToken,o))}}),a.targetMismatches.forEach((u,c)=>{const h=s.Ia.get(u);if(!h)return;s.Ia.set(u,h.withResumeToken(Xt.EMPTY_BYTE_STRING,h.snapshotVersion)),uE(s,u);const f=new bi(h.target,u,c,h.sequenceNumber);Zm(s,f)}),s.remoteSyncer.applyRemoteEvent(a)}(t,n)}catch(r){ue(Ts,"Failed to raise snapshot:",r),await Tc(t,r)}}async function Tc(t,e,n){if(!Fo(e))throw e;t.Ea.add(1),await Il(t),t.Ra.set("Offline"),n||(n=()=>sE(t.localStore)),t.asyncQueue.enqueueRetryable(async()=>{ue(Ts,"Retrying IndexedDB access"),await n(),t.Ea.delete(1),await vd(t)})}function dE(t,e){return e().catch(n=>Tc(t,n,e))}async function xd(t){const e=Ae(t),n=$i(e);let r=e.Ta.length>0?e.Ta[e.Ta.length-1].batchId:Vm;for(;mP(e);)try{const i=await YA(e.localStore,r);if(i===null){e.Ta.length===0&&n.L_();break}r=i.batchId,gP(e,i)}catch(i){await Tc(e,i)}hE(e)&&fE(e)}function mP(t){return Rs(t)&&t.Ta.length<10}function gP(t,e){t.Ta.push(e);const n=$i(t);n.O_()&&n.X_&&n.ea(e.mutations)}function hE(t){return Rs(t)&&!$i(t).x_()&&t.Ta.length>0}function fE(t){$i(t).start()}async function yP(t){$i(t).ra()}async function vP(t){const e=$i(t);for(const n of t.Ta)e.ea(n.mutations)}async function xP(t,e,n){const r=t.Ta.shift(),i=qm.from(r,e,n);await dE(t,()=>t.remoteSyncer.applySuccessfulWrite(i)),await xd(t)}async function wP(t,e){e&&$i(t).X_&&await async function(r,i){if(function(o){return tA(o)&&o!==q.ABORTED}(i.code)){const s=r.Ta.shift();$i(r).B_(),await dE(r,()=>r.remoteSyncer.rejectFailedWrite(s.batchId,i)),await xd(r)}}(t,e),hE(t)&&fE(t)}async function Fv(t,e){const n=Ae(t);n.asyncQueue.verifyOperationInProgress(),ue(Ts,"RemoteStore received new credentials");const r=Rs(n);n.Ea.add(3),await Il(n),r&&n.Ra.set("Unknown"),await n.remoteSyncer.handleCredentialChange(e),n.Ea.delete(3),await vd(n)}async function _P(t,e){const n=Ae(t);e?(n.Ea.delete(2),await vd(n)):e||(n.Ea.add(2),await Il(n),n.Ra.set("Unknown"))}function zo(t){return t.ma||(t.ma=function(n,r,i){const s=Ae(n);return s.sa(),new sP(r,s.connection,s.authCredentials,s.appCheckCredentials,s.serializer,i)}(t.datastore,t.asyncQueue,{Xo:dP.bind(null,t),t_:hP.bind(null,t),r_:fP.bind(null,t),H_:pP.bind(null,t)}),t.da.push(async e=>{e?(t.ma.B_(),tg(t)?eg(t):t.Ra.set("Unknown")):(await t.ma.stop(),cE(t))})),t.ma}function $i(t){return t.fa||(t.fa=function(n,r,i){const s=Ae(n);return s.sa(),new oP(r,s.connection,s.authCredentials,s.appCheckCredentials,s.serializer,i)}(t.datastore,t.asyncQueue,{Xo:()=>Promise.resolve(),t_:yP.bind(null,t),r_:wP.bind(null,t),ta:vP.bind(null,t),na:xP.bind(null,t)}),t.da.push(async e=>{e?(t.fa.B_(),await xd(t)):(await t.fa.stop(),t.Ta.length>0&&(ue(Ts,`Stopping write stream with ${t.Ta.length} pending writes`),t.Ta=[]))})),t.fa}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class ng{constructor(e,n,r,i,s){this.asyncQueue=e,this.timerId=n,this.targetTimeMs=r,this.op=i,this.removalCallback=s,this.deferred=new Hr,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch(o=>{})}get promise(){return this.deferred.promise}static createAndSchedule(e,n,r,i,s){const o=Date.now()+r,a=new ng(e,n,o,i,s);return a.start(r),a}start(e){this.timerHandle=setTimeout(()=>this.handleDelayElapsed(),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){this.timerHandle!==null&&(this.clearTimeout(),this.deferred.reject(new ae(q.CANCELLED,"Operation cancelled"+(e?": "+e:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget(()=>this.timerHandle!==null?(this.clearTimeout(),this.op().then(e=>this.deferred.resolve(e))):Promise.resolve())}clearTimeout(){this.timerHandle!==null&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}}function rg(t,e){if(Yr("AsyncQueue",`${e}: ${t}`),Fo(t))return new ae(q.UNAVAILABLE,`${e}: ${t}`);throw t}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class ho{static emptySet(e){return new ho(e.comparator)}constructor(e){this.comparator=e?(n,r)=>e(n,r)||xe.comparator(n.key,r.key):(n,r)=>xe.comparator(n.key,r.key),this.keyedMap=va(),this.sortedSet=new mt(this.comparator)}has(e){return this.keyedMap.get(e)!=null}get(e){return this.keyedMap.get(e)}first(){return this.sortedSet.minKey()}last(){return this.sortedSet.maxKey()}isEmpty(){return this.sortedSet.isEmpty()}indexOf(e){const n=this.keyedMap.get(e);return n?this.sortedSet.indexOf(n):-1}get size(){return this.sortedSet.size}forEach(e){this.sortedSet.inorderTraversal((n,r)=>(e(n),!1))}add(e){const n=this.delete(e.key);return n.copy(n.keyedMap.insert(e.key,e),n.sortedSet.insert(e,null))}delete(e){const n=this.get(e);return n?this.copy(this.keyedMap.remove(e),this.sortedSet.remove(n)):this}isEqual(e){if(!(e instanceof ho)||this.size!==e.size)return!1;const n=this.sortedSet.getIterator(),r=e.sortedSet.getIterator();for(;n.hasNext();){const i=n.getNext().key,s=r.getNext().key;if(!i.isEqual(s))return!1}return!0}toString(){const e=[];return this.forEach(n=>{e.push(n.toString())}),e.length===0?"DocumentSet ()":`DocumentSet ( + `+e.join(` +`)+` +)`}copy(e,n){const r=new ho;return r.comparator=this.comparator,r.keyedMap=e,r.sortedSet=n,r}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Uv{constructor(){this.ga=new mt(xe.comparator)}track(e){const n=e.doc.key,r=this.ga.get(n);r?e.type!==0&&r.type===3?this.ga=this.ga.insert(n,e):e.type===3&&r.type!==1?this.ga=this.ga.insert(n,{type:r.type,doc:e.doc}):e.type===2&&r.type===2?this.ga=this.ga.insert(n,{type:2,doc:e.doc}):e.type===2&&r.type===0?this.ga=this.ga.insert(n,{type:0,doc:e.doc}):e.type===1&&r.type===0?this.ga=this.ga.remove(n):e.type===1&&r.type===2?this.ga=this.ga.insert(n,{type:1,doc:r.doc}):e.type===0&&r.type===1?this.ga=this.ga.insert(n,{type:2,doc:e.doc}):Te(63341,{Rt:e,pa:r}):this.ga=this.ga.insert(n,e)}ya(){const e=[];return this.ga.inorderTraversal((n,r)=>{e.push(r)}),e}}class Po{constructor(e,n,r,i,s,o,a,u,c){this.query=e,this.docs=n,this.oldDocs=r,this.docChanges=i,this.mutatedKeys=s,this.fromCache=o,this.syncStateChanged=a,this.excludesMetadataChanges=u,this.hasCachedResults=c}static fromInitialDocuments(e,n,r,i,s){const o=[];return n.forEach(a=>{o.push({type:0,doc:a})}),new Po(e,n,ho.emptySet(n),o,r,i,!0,!1,s)}get hasPendingWrites(){return!this.mutatedKeys.isEmpty()}isEqual(e){if(!(this.fromCache===e.fromCache&&this.hasCachedResults===e.hasCachedResults&&this.syncStateChanged===e.syncStateChanged&&this.mutatedKeys.isEqual(e.mutatedKeys)&&hd(this.query,e.query)&&this.docs.isEqual(e.docs)&&this.oldDocs.isEqual(e.oldDocs)))return!1;const n=this.docChanges,r=e.docChanges;if(n.length!==r.length)return!1;for(let i=0;ie.Da())}}class EP{constructor(){this.queries=zv(),this.onlineState="Unknown",this.Ca=new Set}terminate(){(function(n,r){const i=Ae(n),s=i.queries;i.queries=zv(),s.forEach((o,a)=>{for(const u of a.Sa)u.onError(r)})})(this,new ae(q.ABORTED,"Firestore shutting down"))}}function zv(){return new Ps(t=>Db(t),hd)}async function ig(t,e){const n=Ae(t);let r=3;const i=e.query;let s=n.queries.get(i);s?!s.ba()&&e.Da()&&(r=2):(s=new bP,r=e.Da()?0:1);try{switch(r){case 0:s.wa=await n.onListen(i,!0);break;case 1:s.wa=await n.onListen(i,!1);break;case 2:await n.onFirstRemoteStoreListen(i)}}catch(o){const a=rg(o,`Initialization of query '${zs(e.query)}' failed`);return void e.onError(a)}n.queries.set(i,s),s.Sa.push(e),e.va(n.onlineState),s.wa&&e.Fa(s.wa)&&og(n)}async function sg(t,e){const n=Ae(t),r=e.query;let i=3;const s=n.queries.get(r);if(s){const o=s.Sa.indexOf(e);o>=0&&(s.Sa.splice(o,1),s.Sa.length===0?i=e.Da()?0:1:!s.ba()&&e.Da()&&(i=2))}switch(i){case 0:return n.queries.delete(r),n.onUnlisten(r,!0);case 1:return n.queries.delete(r),n.onUnlisten(r,!1);case 2:return n.onLastRemoteStoreUnlisten(r);default:return}}function SP(t,e){const n=Ae(t);let r=!1;for(const i of e){const s=i.query,o=n.queries.get(s);if(o){for(const a of o.Sa)a.Fa(i)&&(r=!0);o.wa=i}}r&&og(n)}function TP(t,e,n){const r=Ae(t),i=r.queries.get(e);if(i)for(const s of i.Sa)s.onError(n);r.queries.delete(e)}function og(t){t.Ca.forEach(e=>{e.next()})}var fp,Bv;(Bv=fp||(fp={})).Ma="default",Bv.Cache="cache";class ag{constructor(e,n,r){this.query=e,this.xa=n,this.Oa=!1,this.Na=null,this.onlineState="Unknown",this.options=r||{}}Fa(e){if(!this.options.includeMetadataChanges){const r=[];for(const i of e.docChanges)i.type!==3&&r.push(i);e=new Po(e.query,e.docs,e.oldDocs,r,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let n=!1;return this.Oa?this.Ba(e)&&(this.xa.next(e),n=!0):this.La(e,this.onlineState)&&(this.ka(e),n=!0),this.Na=e,n}onError(e){this.xa.error(e)}va(e){this.onlineState=e;let n=!1;return this.Na&&!this.Oa&&this.La(this.Na,e)&&(this.ka(this.Na),n=!0),n}La(e,n){if(!e.fromCache||!this.Da())return!0;const r=n!=="Offline";return(!this.options.qa||!r)&&(!e.docs.isEmpty()||e.hasCachedResults||n==="Offline")}Ba(e){if(e.docChanges.length>0)return!0;const n=this.Na&&this.Na.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!n)&&this.options.includeMetadataChanges===!0}ka(e){e=Po.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.Oa=!0,this.xa.next(e)}Da(){return this.options.source!==fp.Cache}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class pE{constructor(e){this.key=e}}class mE{constructor(e){this.key=e}}class IP{constructor(e,n){this.query=e,this.Ya=n,this.Za=null,this.hasCachedResults=!1,this.current=!1,this.Xa=Fe(),this.mutatedKeys=Fe(),this.eu=jb(e),this.tu=new ho(this.eu)}get nu(){return this.Ya}ru(e,n){const r=n?n.iu:new Uv,i=n?n.tu:this.tu;let s=n?n.mutatedKeys:this.mutatedKeys,o=i,a=!1;const u=this.query.limitType==="F"&&i.size===this.query.limit?i.last():null,c=this.query.limitType==="L"&&i.size===this.query.limit?i.first():null;if(e.inorderTraversal((h,f)=>{const p=i.get(h),g=fd(this.query,f)?f:null,_=!!p&&this.mutatedKeys.has(p.key),T=!!g&&(g.hasLocalMutations||this.mutatedKeys.has(g.key)&&g.hasCommittedMutations);let R=!1;p&&g?p.data.isEqual(g.data)?_!==T&&(r.track({type:3,doc:g}),R=!0):this.su(p,g)||(r.track({type:2,doc:g}),R=!0,(u&&this.eu(g,u)>0||c&&this.eu(g,c)<0)&&(a=!0)):!p&&g?(r.track({type:0,doc:g}),R=!0):p&&!g&&(r.track({type:1,doc:p}),R=!0,(u||c)&&(a=!0)),R&&(g?(o=o.add(g),s=T?s.add(h):s.delete(h)):(o=o.delete(h),s=s.delete(h)))}),this.query.limit!==null)for(;o.size>this.query.limit;){const h=this.query.limitType==="F"?o.last():o.first();o=o.delete(h.key),s=s.delete(h.key),r.track({type:1,doc:h})}return{tu:o,iu:r,Cs:a,mutatedKeys:s}}su(e,n){return e.hasLocalMutations&&n.hasCommittedMutations&&!n.hasLocalMutations}applyChanges(e,n,r,i){const s=this.tu;this.tu=e.tu,this.mutatedKeys=e.mutatedKeys;const o=e.iu.ya();o.sort((h,f)=>function(g,_){const T=R=>{switch(R){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return Te(20277,{Rt:R})}};return T(g)-T(_)}(h.type,f.type)||this.eu(h.doc,f.doc)),this.ou(r),i=i??!1;const a=n&&!i?this._u():[],u=this.Xa.size===0&&this.current&&!i?1:0,c=u!==this.Za;return this.Za=u,o.length!==0||c?{snapshot:new Po(this.query,e.tu,s,o,e.mutatedKeys,u===0,c,!1,!!r&&r.resumeToken.approximateByteSize()>0),au:a}:{au:a}}va(e){return this.current&&e==="Offline"?(this.current=!1,this.applyChanges({tu:this.tu,iu:new Uv,mutatedKeys:this.mutatedKeys,Cs:!1},!1)):{au:[]}}uu(e){return!this.Ya.has(e)&&!!this.tu.has(e)&&!this.tu.get(e).hasLocalMutations}ou(e){e&&(e.addedDocuments.forEach(n=>this.Ya=this.Ya.add(n)),e.modifiedDocuments.forEach(n=>{}),e.removedDocuments.forEach(n=>this.Ya=this.Ya.delete(n)),this.current=e.current)}_u(){if(!this.current)return[];const e=this.Xa;this.Xa=Fe(),this.tu.forEach(r=>{this.uu(r.key)&&(this.Xa=this.Xa.add(r.key))});const n=[];return e.forEach(r=>{this.Xa.has(r)||n.push(new mE(r))}),this.Xa.forEach(r=>{e.has(r)||n.push(new pE(r))}),n}cu(e){this.Ya=e.Qs,this.Xa=Fe();const n=this.ru(e.documents);return this.applyChanges(n,!0)}lu(){return Po.fromInitialDocuments(this.query,this.tu,this.mutatedKeys,this.Za===0,this.hasCachedResults)}}const lg="SyncEngine";class kP{constructor(e,n,r){this.query=e,this.targetId=n,this.view=r}}class CP{constructor(e){this.key=e,this.hu=!1}}class NP{constructor(e,n,r,i,s,o){this.localStore=e,this.remoteStore=n,this.eventManager=r,this.sharedClientState=i,this.currentUser=s,this.maxConcurrentLimboResolutions=o,this.Pu={},this.Tu=new Ps(a=>Db(a),hd),this.Iu=new Map,this.Eu=new Set,this.du=new mt(xe.comparator),this.Au=new Map,this.Ru=new Km,this.Vu={},this.mu=new Map,this.fu=Ao.cr(),this.onlineState="Unknown",this.gu=void 0}get isPrimaryClient(){return this.gu===!0}}async function AP(t,e,n=!0){const r=_E(t);let i;const s=r.Tu.get(e);return s?(r.sharedClientState.addLocalQueryTarget(s.targetId),i=s.view.lu()):i=await gE(r,e,n,!0),i}async function PP(t,e){const n=_E(t);await gE(n,e,!0,!1)}async function gE(t,e,n,r){const i=await XA(t.localStore,Er(e)),s=i.targetId,o=t.sharedClientState.addLocalQueryTarget(s,n);let a;return r&&(a=await RP(t,e,s,o==="current",i.resumeToken)),t.isPrimaryClient&&n&&lE(t.remoteStore,i),a}async function RP(t,e,n,r,i){t.pu=(f,p,g)=>async function(T,R,y,w){let k=R.view.ru(y);k.Cs&&(k=await jv(T.localStore,R.query,!1).then(({documents:b})=>R.view.ru(b,k)));const L=w&&w.targetChanges.get(R.targetId),U=w&&w.targetMismatches.get(R.targetId)!=null,j=R.view.applyChanges(k,T.isPrimaryClient,L,U);return Hv(T,R.targetId,j.au),j.snapshot}(t,f,p,g);const s=await jv(t.localStore,e,!0),o=new IP(e,s.Qs),a=o.ru(s.documents),u=Tl.createSynthesizedTargetChangeForCurrentChange(n,r&&t.onlineState!=="Offline",i),c=o.applyChanges(a,t.isPrimaryClient,u);Hv(t,n,c.au);const h=new kP(e,n,o);return t.Tu.set(e,h),t.Iu.has(n)?t.Iu.get(n).push(e):t.Iu.set(n,[e]),c.snapshot}async function DP(t,e,n){const r=Ae(t),i=r.Tu.get(e),s=r.Iu.get(i.targetId);if(s.length>1)return r.Iu.set(i.targetId,s.filter(o=>!hd(o,e))),void r.Tu.delete(e);r.isPrimaryClient?(r.sharedClientState.removeLocalQueryTarget(i.targetId),r.sharedClientState.isActiveQueryTarget(i.targetId)||await dp(r.localStore,i.targetId,!1).then(()=>{r.sharedClientState.clearQueryState(i.targetId),n&&Jm(r.remoteStore,i.targetId),pp(r,i.targetId)}).catch(Vo)):(pp(r,i.targetId),await dp(r.localStore,i.targetId,!0))}async function jP(t,e){const n=Ae(t),r=n.Tu.get(e),i=n.Iu.get(r.targetId);n.isPrimaryClient&&i.length===1&&(n.sharedClientState.removeLocalQueryTarget(r.targetId),Jm(n.remoteStore,r.targetId))}async function LP(t,e,n){const r=BP(t);try{const i=await function(o,a){const u=Ae(o),c=We.now(),h=a.reduce((g,_)=>g.add(_.key),Fe());let f,p;return u.persistence.runTransaction("Locally write mutations","readwrite",g=>{let _=Xr(),T=Fe();return u.Ns.getEntries(g,h).next(R=>{_=R,_.forEach((y,w)=>{w.isValidDocument()||(T=T.add(y))})}).next(()=>u.localDocuments.getOverlayedDocuments(g,_)).next(R=>{f=R;const y=[];for(const w of a){const k=YN(w,f.get(w.key).overlayedDocument);k!=null&&y.push(new Qi(w.key,k,Tb(k.value.mapValue),Qn.exists(!0)))}return u.mutationQueue.addMutationBatch(g,c,y,a)}).next(R=>{p=R;const y=R.applyToLocalDocumentSet(f,T);return u.documentOverlayCache.saveOverlays(g,R.batchId,y)})}).then(()=>({batchId:p.batchId,changes:Ob(f)}))}(r.localStore,e);r.sharedClientState.addPendingMutation(i.batchId),function(o,a,u){let c=o.Vu[o.currentUser.toKey()];c||(c=new mt(Ve)),c=c.insert(a,u),o.Vu[o.currentUser.toKey()]=c}(r,i.batchId,n),await kl(r,i.changes),await xd(r.remoteStore)}catch(i){const s=rg(i,"Failed to persist write");n.reject(s)}}async function yE(t,e){const n=Ae(t);try{const r=await KA(n.localStore,e);e.targetChanges.forEach((i,s)=>{const o=n.Au.get(s);o&&(Ge(i.addedDocuments.size+i.modifiedDocuments.size+i.removedDocuments.size<=1,22616),i.addedDocuments.size>0?o.hu=!0:i.modifiedDocuments.size>0?Ge(o.hu,14607):i.removedDocuments.size>0&&(Ge(o.hu,42227),o.hu=!1))}),await kl(n,r,e)}catch(r){await Vo(r)}}function $v(t,e,n){const r=Ae(t);if(r.isPrimaryClient&&n===0||!r.isPrimaryClient&&n===1){const i=[];r.Tu.forEach((s,o)=>{const a=o.view.va(e);a.snapshot&&i.push(a.snapshot)}),function(o,a){const u=Ae(o);u.onlineState=a;let c=!1;u.queries.forEach((h,f)=>{for(const p of f.Sa)p.va(a)&&(c=!0)}),c&&og(u)}(r.eventManager,e),i.length&&r.Pu.H_(i),r.onlineState=e,r.isPrimaryClient&&r.sharedClientState.setOnlineState(e)}}async function OP(t,e,n){const r=Ae(t);r.sharedClientState.updateQueryState(e,"rejected",n);const i=r.Au.get(e),s=i&&i.key;if(s){let o=new mt(xe.comparator);o=o.insert(s,rn.newNoDocument(s,Ne.min()));const a=Fe().add(s),u=new gd(Ne.min(),new Map,new mt(Ve),o,a);await yE(r,u),r.du=r.du.remove(s),r.Au.delete(e),ug(r)}else await dp(r.localStore,e,!1).then(()=>pp(r,e,n)).catch(Vo)}async function MP(t,e){const n=Ae(t),r=e.batch.batchId;try{const i=await GA(n.localStore,e);xE(n,r,null),vE(n,r),n.sharedClientState.updateMutationState(r,"acknowledged"),await kl(n,i)}catch(i){await Vo(i)}}async function VP(t,e,n){const r=Ae(t);try{const i=await function(o,a){const u=Ae(o);return u.persistence.runTransaction("Reject batch","readwrite-primary",c=>{let h;return u.mutationQueue.lookupMutationBatch(c,a).next(f=>(Ge(f!==null,37113),h=f.keys(),u.mutationQueue.removeMutationBatch(c,f))).next(()=>u.mutationQueue.performConsistencyCheck(c)).next(()=>u.documentOverlayCache.removeOverlaysForBatchId(c,h,a)).next(()=>u.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(c,h)).next(()=>u.localDocuments.getDocuments(c,h))})}(r.localStore,e);xE(r,e,n),vE(r,e),r.sharedClientState.updateMutationState(e,"rejected",n),await kl(r,i)}catch(i){await Vo(i)}}function vE(t,e){(t.mu.get(e)||[]).forEach(n=>{n.resolve()}),t.mu.delete(e)}function xE(t,e,n){const r=Ae(t);let i=r.Vu[r.currentUser.toKey()];if(i){const s=i.get(e);s&&(n?s.reject(n):s.resolve(),i=i.remove(e)),r.Vu[r.currentUser.toKey()]=i}}function pp(t,e,n=null){t.sharedClientState.removeLocalQueryTarget(e);for(const r of t.Iu.get(e))t.Tu.delete(r),n&&t.Pu.yu(r,n);t.Iu.delete(e),t.isPrimaryClient&&t.Ru.jr(e).forEach(r=>{t.Ru.containsKey(r)||wE(t,r)})}function wE(t,e){t.Eu.delete(e.path.canonicalString());const n=t.du.get(e);n!==null&&(Jm(t.remoteStore,n),t.du=t.du.remove(e),t.Au.delete(n),ug(t))}function Hv(t,e,n){for(const r of n)r instanceof pE?(t.Ru.addReference(r.key,e),FP(t,r)):r instanceof mE?(ue(lg,"Document no longer in limbo: "+r.key),t.Ru.removeReference(r.key,e),t.Ru.containsKey(r.key)||wE(t,r.key)):Te(19791,{wu:r})}function FP(t,e){const n=e.key,r=n.path.canonicalString();t.du.get(n)||t.Eu.has(r)||(ue(lg,"New document in limbo: "+n),t.Eu.add(r),ug(t))}function ug(t){for(;t.Eu.size>0&&t.du.size{o.push(r.pu(u,e,n).then(c=>{var h;if((c||n)&&r.isPrimaryClient){const f=c?!c.fromCache:(h=n==null?void 0:n.targetChanges.get(u.targetId))==null?void 0:h.current;r.sharedClientState.updateQueryState(u.targetId,f?"current":"not-current")}if(c){i.push(c);const f=Ym.As(u.targetId,c);s.push(f)}}))}),await Promise.all(o),r.Pu.H_(i),await async function(u,c){const h=Ae(u);try{await h.persistence.runTransaction("notifyLocalViewChanges","readwrite",f=>W.forEach(c,p=>W.forEach(p.Es,g=>h.persistence.referenceDelegate.addReference(f,p.targetId,g)).next(()=>W.forEach(p.ds,g=>h.persistence.referenceDelegate.removeReference(f,p.targetId,g)))))}catch(f){if(!Fo(f))throw f;ue(Xm,"Failed to update sequence numbers: "+f)}for(const f of c){const p=f.targetId;if(!f.fromCache){const g=h.Ms.get(p),_=g.snapshotVersion,T=g.withLastLimboFreeSnapshotVersion(_);h.Ms=h.Ms.insert(p,T)}}}(r.localStore,s))}async function UP(t,e){const n=Ae(t);if(!n.currentUser.isEqual(e)){ue(lg,"User change. New user:",e.toKey());const r=await iE(n.localStore,e);n.currentUser=e,function(s,o){s.mu.forEach(a=>{a.forEach(u=>{u.reject(new ae(q.CANCELLED,o))})}),s.mu.clear()}(n,"'waitForPendingWrites' promise is rejected due to a user change."),n.sharedClientState.handleUserChange(e,r.removedBatchIds,r.addedBatchIds),await kl(n,r.Ls)}}function zP(t,e){const n=Ae(t),r=n.Au.get(e);if(r&&r.hu)return Fe().add(r.key);{let i=Fe();const s=n.Iu.get(e);if(!s)return i;for(const o of s){const a=n.Tu.get(o);i=i.unionWith(a.view.nu)}return i}}function _E(t){const e=Ae(t);return e.remoteStore.remoteSyncer.applyRemoteEvent=yE.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=zP.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=OP.bind(null,e),e.Pu.H_=SP.bind(null,e.eventManager),e.Pu.yu=TP.bind(null,e.eventManager),e}function BP(t){const e=Ae(t);return e.remoteStore.remoteSyncer.applySuccessfulWrite=MP.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=VP.bind(null,e),e}class Ic{constructor(){this.kind="memory",this.synchronizeTabs=!1}async initialize(e){this.serializer=yd(e.databaseInfo.databaseId),this.sharedClientState=this.Du(e),this.persistence=this.Cu(e),await this.persistence.start(),this.localStore=this.vu(e),this.gcScheduler=this.Fu(e,this.localStore),this.indexBackfillerScheduler=this.Mu(e,this.localStore)}Fu(e,n){return null}Mu(e,n){return null}vu(e){return WA(this.persistence,new $A,e.initialUser,this.serializer)}Cu(e){return new rE(Qm.mi,this.serializer)}Du(e){return new ZA}async terminate(){var e,n;(e=this.gcScheduler)==null||e.stop(),(n=this.indexBackfillerScheduler)==null||n.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}}Ic.provider={build:()=>new Ic};class $P extends Ic{constructor(e){super(),this.cacheSizeBytes=e}Fu(e,n){Ge(this.persistence.referenceDelegate instanceof Sc,46915);const r=this.persistence.referenceDelegate.garbageCollector;return new CA(r,e.asyncQueue,n)}Cu(e){const n=this.cacheSizeBytes!==void 0?xn.withCacheSize(this.cacheSizeBytes):xn.DEFAULT;return new rE(r=>Sc.mi(r,n),this.serializer)}}class mp{async initialize(e,n){this.localStore||(this.localStore=e.localStore,this.sharedClientState=e.sharedClientState,this.datastore=this.createDatastore(n),this.remoteStore=this.createRemoteStore(n),this.eventManager=this.createEventManager(n),this.syncEngine=this.createSyncEngine(n,!e.synchronizeTabs),this.sharedClientState.onlineStateHandler=r=>$v(this.syncEngine,r,1),this.remoteStore.remoteSyncer.handleCredentialChange=UP.bind(null,this.syncEngine),await _P(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return function(){return new EP}()}createDatastore(e){const n=yd(e.databaseInfo.databaseId),r=function(s){return new iP(s)}(e.databaseInfo);return function(s,o,a,u){return new lP(s,o,a,u)}(e.authCredentials,e.appCheckCredentials,r,n)}createRemoteStore(e){return function(r,i,s,o,a){return new cP(r,i,s,o,a)}(this.localStore,this.datastore,e.asyncQueue,n=>$v(this.syncEngine,n,0),function(){return Mv.v()?new Mv:new eP}())}createSyncEngine(e,n){return function(i,s,o,a,u,c,h){const f=new NP(i,s,o,a,u,c);return h&&(f.gu=!0),f}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,n)}async terminate(){var e,n;await async function(i){const s=Ae(i);ue(Ts,"RemoteStore shutting down."),s.Ea.add(5),await Il(s),s.Aa.shutdown(),s.Ra.set("Unknown")}(this.remoteStore),(e=this.datastore)==null||e.terminate(),(n=this.eventManager)==null||n.terminate()}}mp.provider={build:()=>new mp};/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *//** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class cg{constructor(e){this.observer=e,this.muted=!1}next(e){this.muted||this.observer.next&&this.Ou(this.observer.next,e)}error(e){this.muted||(this.observer.error?this.Ou(this.observer.error,e):Yr("Uncaught Error in snapshot listener:",e.toString()))}Nu(){this.muted=!0}Ou(e,n){setTimeout(()=>{this.muted||e(n)},0)}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Hi="FirestoreClient";class HP{constructor(e,n,r,i,s){this.authCredentials=e,this.appCheckCredentials=n,this.asyncQueue=r,this.databaseInfo=i,this.user=tn.UNAUTHENTICATED,this.clientId=Mm.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=s,this.authCredentials.start(r,async o=>{ue(Hi,"Received user=",o.uid),await this.authCredentialListener(o),this.user=o}),this.appCheckCredentials.start(r,o=>(ue(Hi,"Received new app check token=",o),this.appCheckCredentialListener(o,this.user)))}get configuration(){return{asyncQueue:this.asyncQueue,databaseInfo:this.databaseInfo,clientId:this.clientId,authCredentials:this.authCredentials,appCheckCredentials:this.appCheckCredentials,initialUser:this.user,maxConcurrentLimboResolutions:100}}setCredentialChangeListener(e){this.authCredentialListener=e}setAppCheckTokenChangeListener(e){this.appCheckCredentialListener=e}terminate(){this.asyncQueue.enterRestrictedMode();const e=new Hr;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted(async()=>{try{this._onlineComponents&&await this._onlineComponents.terminate(),this._offlineComponents&&await this._offlineComponents.terminate(),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),e.resolve()}catch(n){const r=rg(n,"Failed to shutdown persistence");e.reject(r)}}),e.promise}}async function Rh(t,e){t.asyncQueue.verifyOperationInProgress(),ue(Hi,"Initializing OfflineComponentProvider");const n=t.configuration;await e.initialize(n);let r=n.initialUser;t.setCredentialChangeListener(async i=>{r.isEqual(i)||(await iE(e.localStore,i),r=i)}),e.persistence.setDatabaseDeletedListener(()=>t.terminate()),t._offlineComponents=e}async function qv(t,e){t.asyncQueue.verifyOperationInProgress();const n=await qP(t);ue(Hi,"Initializing OnlineComponentProvider"),await e.initialize(n,t.configuration),t.setCredentialChangeListener(r=>Fv(e.remoteStore,r)),t.setAppCheckTokenChangeListener((r,i)=>Fv(e.remoteStore,i)),t._onlineComponents=e}async function qP(t){if(!t._offlineComponents)if(t._uninitializedComponentsProvider){ue(Hi,"Using user provided OfflineComponentProvider");try{await Rh(t,t._uninitializedComponentsProvider._offline)}catch(e){const n=e;if(!function(i){return i.name==="FirebaseError"?i.code===q.FAILED_PRECONDITION||i.code===q.UNIMPLEMENTED:!(typeof DOMException<"u"&&i instanceof DOMException)||i.code===22||i.code===20||i.code===11}(n))throw n;Io("Error using user provided cache. Falling back to memory cache: "+n),await Rh(t,new Ic)}}else ue(Hi,"Using default OfflineComponentProvider"),await Rh(t,new $P(void 0));return t._offlineComponents}async function bE(t){return t._onlineComponents||(t._uninitializedComponentsProvider?(ue(Hi,"Using user provided OnlineComponentProvider"),await qv(t,t._uninitializedComponentsProvider._online)):(ue(Hi,"Using default OnlineComponentProvider"),await qv(t,new mp))),t._onlineComponents}function WP(t){return bE(t).then(e=>e.syncEngine)}async function kc(t){const e=await bE(t),n=e.eventManager;return n.onListen=AP.bind(null,e.syncEngine),n.onUnlisten=DP.bind(null,e.syncEngine),n.onFirstRemoteStoreListen=PP.bind(null,e.syncEngine),n.onLastRemoteStoreUnlisten=jP.bind(null,e.syncEngine),n}function GP(t,e,n={}){const r=new Hr;return t.asyncQueue.enqueueAndForget(async()=>function(s,o,a,u,c){const h=new cg({next:p=>{h.Nu(),o.enqueueAndForget(()=>sg(s,f));const g=p.docs.has(a);!g&&p.fromCache?c.reject(new ae(q.UNAVAILABLE,"Failed to get document because the client is offline.")):g&&p.fromCache&&u&&u.source==="server"?c.reject(new ae(q.UNAVAILABLE,'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')):c.resolve(p)},error:p=>c.reject(p)}),f=new ag(dd(a.path),h,{includeMetadataChanges:!0,qa:!0});return ig(s,f)}(await kc(t),t.asyncQueue,e,n,r)),r.promise}function KP(t,e,n={}){const r=new Hr;return t.asyncQueue.enqueueAndForget(async()=>function(s,o,a,u,c){const h=new cg({next:p=>{h.Nu(),o.enqueueAndForget(()=>sg(s,f)),p.fromCache&&u.source==="server"?c.reject(new ae(q.UNAVAILABLE,'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')):c.resolve(p)},error:p=>c.reject(p)}),f=new ag(a,h,{includeMetadataChanges:!0,qa:!0});return ig(s,f)}(await kc(t),t.asyncQueue,e,n,r)),r.promise}/** + * @license + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function EE(t){const e={};return t.timeoutSeconds!==void 0&&(e.timeoutSeconds=t.timeoutSeconds),e}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Wv=new Map;/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const SE="firestore.googleapis.com",Gv=!0;class Kv{constructor(e){if(e.host===void 0){if(e.ssl!==void 0)throw new ae(q.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host=SE,this.ssl=Gv}else this.host=e.host,this.ssl=e.ssl??Gv;if(this.isUsingEmulator=e.emulatorOptions!==void 0,this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,this.localCache=e.localCache,e.cacheSizeBytes===void 0)this.cacheSizeBytes=nE;else{if(e.cacheSizeBytes!==-1&&e.cacheSizeBytes30)throw new ae(q.INVALID_ARGUMENT,`invalid long polling timeout: ${r.timeoutSeconds} (maximum allowed value is 30)`)}}(this.experimentalLongPollingOptions),this.useFetchStreams=!!e.useFetchStreams}isEqual(e){return this.host===e.host&&this.ssl===e.ssl&&this.credentials===e.credentials&&this.cacheSizeBytes===e.cacheSizeBytes&&this.experimentalForceLongPolling===e.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===e.experimentalAutoDetectLongPolling&&function(r,i){return r.timeoutSeconds===i.timeoutSeconds}(this.experimentalLongPollingOptions,e.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}}class wd{constructor(e,n,r,i){this._authCredentials=e,this._appCheckCredentials=n,this._databaseId=r,this._app=i,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new Kv({}),this._settingsFrozen=!1,this._emulatorOptions={},this._terminateTask="notTerminated"}get app(){if(!this._app)throw new ae(q.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}get _initialized(){return this._settingsFrozen}get _terminated(){return this._terminateTask!=="notTerminated"}_setSettings(e){if(this._settingsFrozen)throw new ae(q.FAILED_PRECONDITION,"Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");this._settings=new Kv(e),this._emulatorOptions=e.emulatorOptions||{},e.credentials!==void 0&&(this._authCredentials=function(r){if(!r)return new eN;switch(r.type){case"firstParty":return new iN(r.sessionIndex||"0",r.iamToken||null,r.authTokenFactory||null);case"provider":return r.client;default:throw new ae(q.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}}(e.credentials))}_getSettings(){return this._settings}_getEmulatorOptions(){return this._emulatorOptions}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return this._terminateTask==="notTerminated"&&(this._terminateTask=this._terminate()),this._terminateTask}async _restart(){this._terminateTask==="notTerminated"?await this._terminate():this._terminateTask="notTerminated"}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(n){const r=Wv.get(n);r&&(ue("ComponentProvider","Removing Datastore"),Wv.delete(n),r.terminate())}(this),Promise.resolve()}}function QP(t,e,n,r={}){var c;t=kn(t,wd);const i=Ns(e),s=t._getSettings(),o={...s,emulatorOptions:t._getEmulatorOptions()},a=`${e}:${n}`;i&&(Pm(`https://${a}`),Rm("Firestore",!0)),s.host!==SE&&s.host!==a&&Io("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used.");const u={...s,host:a,ssl:i,emulatorOptions:r};if(!bs(u,o)&&(t._setSettings(u),r.mockUserToken)){let h,f;if(typeof r.mockUserToken=="string")h=r.mockUserToken,f=tn.MOCK_USER;else{h=eb(r.mockUserToken,(c=t._app)==null?void 0:c.options.projectId);const p=r.mockUserToken.sub||r.mockUserToken.user_id;if(!p)throw new ae(q.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");f=new tn(p)}t._authCredentials=new tN(new fb(h,f))}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Yi{constructor(e,n,r){this.converter=n,this._query=r,this.type="query",this.firestore=e}withConverter(e){return new Yi(this.firestore,e,this._query)}}class vt{constructor(e,n,r){this.converter=n,this._key=r,this.type="document",this.firestore=e}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new Li(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new vt(this.firestore,e,this._key)}toJSON(){return{type:vt._jsonSchemaVersion,referencePath:this._key.toString()}}static fromJSON(e,n,r){if(El(n,vt._jsonSchema))return new vt(e,r||null,new xe(nt.fromString(n.referencePath)))}}vt._jsonSchemaVersion="firestore/documentReference/1.0",vt._jsonSchema={type:At("string",vt._jsonSchemaVersion),referencePath:At("string")};class Li extends Yi{constructor(e,n,r){super(e,n,dd(r)),this._path=r,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const e=this._path.popLast();return e.isEmpty()?null:new vt(this.firestore,null,new xe(e))}withConverter(e){return new Li(this.firestore,e,this._path)}}function Cn(t,e,...n){if(t=Yt(t),pb("collection","path",e),t instanceof wd){const r=nt.fromString(e,...n);return av(r),new Li(t,null,r)}{if(!(t instanceof vt||t instanceof Li))throw new ae(q.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(nt.fromString(e,...n));return av(r),new Li(t.firestore,null,r)}}function Pt(t,e,...n){if(t=Yt(t),arguments.length===1&&(e=Mm.newId()),pb("doc","path",e),t instanceof wd){const r=nt.fromString(e,...n);return ov(r),new vt(t,null,new xe(r))}{if(!(t instanceof vt||t instanceof Li))throw new ae(q.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(nt.fromString(e,...n));return ov(r),new vt(t.firestore,t instanceof Li?t.converter:null,new xe(r))}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Qv="AsyncQueue";class Yv{constructor(e=Promise.resolve()){this.Xu=[],this.ec=!1,this.tc=[],this.nc=null,this.rc=!1,this.sc=!1,this.oc=[],this.M_=new oE(this,"async_queue_retry"),this._c=()=>{const r=Ph();r&&ue(Qv,"Visibility state changed to "+r.visibilityState),this.M_.w_()},this.ac=e;const n=Ph();n&&typeof n.addEventListener=="function"&&n.addEventListener("visibilitychange",this._c)}get isShuttingDown(){return this.ec}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.uc(),this.cc(e)}enterRestrictedMode(e){if(!this.ec){this.ec=!0,this.sc=e||!1;const n=Ph();n&&typeof n.removeEventListener=="function"&&n.removeEventListener("visibilitychange",this._c)}}enqueue(e){if(this.uc(),this.ec)return new Promise(()=>{});const n=new Hr;return this.cc(()=>this.ec&&this.sc?Promise.resolve():(e().then(n.resolve,n.reject),n.promise)).then(()=>n.promise)}enqueueRetryable(e){this.enqueueAndForget(()=>(this.Xu.push(e),this.lc()))}async lc(){if(this.Xu.length!==0){try{await this.Xu[0](),this.Xu.shift(),this.M_.reset()}catch(e){if(!Fo(e))throw e;ue(Qv,"Operation failed with retryable error: "+e)}this.Xu.length>0&&this.M_.p_(()=>this.lc())}}cc(e){const n=this.ac.then(()=>(this.rc=!0,e().catch(r=>{throw this.nc=r,this.rc=!1,Yr("INTERNAL UNHANDLED ERROR: ",Xv(r)),r}).then(r=>(this.rc=!1,r))));return this.ac=n,n}enqueueAfterDelay(e,n,r){this.uc(),this.oc.indexOf(e)>-1&&(n=0);const i=ng.createAndSchedule(this,e,n,r,s=>this.hc(s));return this.tc.push(i),i}uc(){this.nc&&Te(47125,{Pc:Xv(this.nc)})}verifyOperationInProgress(){}async Tc(){let e;do e=this.ac,await e;while(e!==this.ac)}Ic(e){for(const n of this.tc)if(n.timerId===e)return!0;return!1}Ec(e){return this.Tc().then(()=>{this.tc.sort((n,r)=>n.targetTimeMs-r.targetTimeMs);for(const n of this.tc)if(n.skipDelay(),e!=="all"&&n.timerId===e)break;return this.Tc()})}dc(e){this.oc.push(e)}hc(e){const n=this.tc.indexOf(e);this.tc.splice(n,1)}}function Xv(t){let e=t.message||"";return t.stack&&(e=t.stack.includes(t.message)?t.stack:t.message+` +`+t.stack),e}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Jv(t){return function(n,r){if(typeof n!="object"||n===null)return!1;const i=n;for(const s of r)if(s in i&&typeof i[s]=="function")return!0;return!1}(t,["next","error","complete"])}class Jr extends wd{constructor(e,n,r,i){super(e,n,r,i),this.type="firestore",this._queue=new Yv,this._persistenceKey=(i==null?void 0:i.name)||"[DEFAULT]"}async _terminate(){if(this._firestoreClient){const e=this._firestoreClient.terminate();this._queue=new Yv(e),this._firestoreClient=void 0,await e}}}function YP(t,e){const n=typeof t=="object"?t:Lm(),r=typeof t=="string"?t:xc,i=od(n,"firestore").getImmediate({identifier:r});if(!i._initialized){const s=X1("firestore");s&&QP(i,...s)}return i}function _d(t){if(t._terminated)throw new ae(q.FAILED_PRECONDITION,"The client has already been terminated.");return t._firestoreClient||XP(t),t._firestoreClient}function XP(t){var r,i,s;const e=t._freezeSettings(),n=function(a,u,c,h){return new _N(a,u,c,h.host,h.ssl,h.experimentalForceLongPolling,h.experimentalAutoDetectLongPolling,EE(h.experimentalLongPollingOptions),h.useFetchStreams,h.isUsingEmulator)}(t._databaseId,((r=t._app)==null?void 0:r.options.appId)||"",t._persistenceKey,e);t._componentsProvider||(i=e.localCache)!=null&&i._offlineComponentProvider&&((s=e.localCache)!=null&&s._onlineComponentProvider)&&(t._componentsProvider={_offline:e.localCache._offlineComponentProvider,_online:e.localCache._onlineComponentProvider}),t._firestoreClient=new HP(t._authCredentials,t._appCheckCredentials,t._queue,n,t._componentsProvider&&function(a){const u=a==null?void 0:a._online.build();return{_offline:a==null?void 0:a._offline.build(u),_online:u}}(t._componentsProvider))}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class qn{constructor(e){this._byteString=e}static fromBase64String(e){try{return new qn(Xt.fromBase64String(e))}catch(n){throw new ae(q.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+n)}}static fromUint8Array(e){return new qn(Xt.fromUint8Array(e))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return"Bytes(base64: "+this.toBase64()+")"}isEqual(e){return this._byteString.isEqual(e._byteString)}toJSON(){return{type:qn._jsonSchemaVersion,bytes:this.toBase64()}}static fromJSON(e){if(El(e,qn._jsonSchema))return qn.fromBase64String(e.bytes)}}qn._jsonSchemaVersion="firestore/bytes/1.0",qn._jsonSchema={type:At("string",qn._jsonSchemaVersion),bytes:At("string")};/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class bd{constructor(...e){for(let n=0;n90)throw new ae(q.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(n)||n<-180||n>180)throw new ae(q.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+n);this._lat=e,this._long=n}get latitude(){return this._lat}get longitude(){return this._long}isEqual(e){return this._lat===e._lat&&this._long===e._long}_compareTo(e){return Ve(this._lat,e._lat)||Ve(this._long,e._long)}toJSON(){return{latitude:this._lat,longitude:this._long,type:Tr._jsonSchemaVersion}}static fromJSON(e){if(El(e,Tr._jsonSchema))return new Tr(e.latitude,e.longitude)}}Tr._jsonSchemaVersion="firestore/geoPoint/1.0",Tr._jsonSchema={type:At("string",Tr._jsonSchemaVersion),latitude:At("number"),longitude:At("number")};/** + * @license + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Ir{constructor(e){this._values=(e||[]).map(n=>n)}toArray(){return this._values.map(e=>e)}isEqual(e){return function(r,i){if(r.length!==i.length)return!1;for(let s=0;stypeof n=="number"))return new Ir(e.vectorValues);throw new ae(q.INVALID_ARGUMENT,"Expected 'vectorValues' field to be a number array")}}}Ir._jsonSchemaVersion="firestore/vectorValue/1.0",Ir._jsonSchema={type:At("string",Ir._jsonSchemaVersion),vectorValues:At("object")};/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const JP=/^__.*__$/;class ZP{constructor(e,n,r){this.data=e,this.fieldMask=n,this.fieldTransforms=r}toMutation(e,n){return this.fieldMask!==null?new Qi(e,this.data,this.fieldMask,n,this.fieldTransforms):new Sl(e,this.data,n,this.fieldTransforms)}}class TE{constructor(e,n,r){this.data=e,this.fieldMask=n,this.fieldTransforms=r}toMutation(e,n){return new Qi(e,this.data,this.fieldMask,n,this.fieldTransforms)}}function IE(t){switch(t){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw Te(40011,{Ac:t})}}class dg{constructor(e,n,r,i,s,o){this.settings=e,this.databaseId=n,this.serializer=r,this.ignoreUndefinedProperties=i,s===void 0&&this.Rc(),this.fieldTransforms=s||[],this.fieldMask=o||[]}get path(){return this.settings.path}get Ac(){return this.settings.Ac}Vc(e){return new dg({...this.settings,...e},this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}mc(e){var i;const n=(i=this.path)==null?void 0:i.child(e),r=this.Vc({path:n,fc:!1});return r.gc(e),r}yc(e){var i;const n=(i=this.path)==null?void 0:i.child(e),r=this.Vc({path:n,fc:!1});return r.Rc(),r}wc(e){return this.Vc({path:void 0,fc:!0})}Sc(e){return Cc(e,this.settings.methodName,this.settings.bc||!1,this.path,this.settings.Dc)}contains(e){return this.fieldMask.find(n=>e.isPrefixOf(n))!==void 0||this.fieldTransforms.find(n=>e.isPrefixOf(n.field))!==void 0}Rc(){if(this.path)for(let e=0;eu.covers(f.field))}else u=null,c=o.fieldTransforms;return new ZP(new _n(a),u,c)}class Td extends Ed{_toFieldTransform(e){if(e.Ac!==2)throw e.Ac===1?e.Sc(`${this._methodName}() can only appear at the top level of your update data`):e.Sc(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);return e.fieldMask.push(e.path),null}isEqual(e){return e instanceof Td}}class hg extends Ed{constructor(e,n){super(e),this.Fc=n}_toFieldTransform(e){const n=new dl(e.serializer,Fb(e.serializer,this.Fc));return new WN(e.path,n)}isEqual(e){return e instanceof hg&&this.Fc===e.Fc}}function tR(t,e,n,r){const i=t.Cc(1,e,n);fg("Data must be an object, but it was:",i,r);const s=[],o=_n.empty();Ki(r,(u,c)=>{const h=pg(e,u,n);c=Yt(c);const f=i.yc(h);if(c instanceof Td)s.push(h);else{const p=Cl(c,f);p!=null&&(s.push(h),o.set(h,p))}});const a=new On(s);return new TE(o,a,i.fieldTransforms)}function nR(t,e,n,r,i,s){const o=t.Cc(1,e,n),a=[gp(e,r,n)],u=[i];if(s.length%2!=0)throw new ae(q.INVALID_ARGUMENT,`Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);for(let p=0;p=0;--p)if(!AE(c,a[p])){const g=a[p];let _=u[p];_=Yt(_);const T=o.yc(g);if(_ instanceof Td)c.push(g);else{const R=Cl(_,T);R!=null&&(c.push(g),h.set(g,R))}}const f=new On(c);return new TE(h,f,o.fieldTransforms)}function rR(t,e,n,r=!1){return Cl(n,t.Cc(r?4:3,e))}function Cl(t,e){if(NE(t=Yt(t)))return fg("Unsupported field value:",e,t),CE(t,e);if(t instanceof Ed)return function(r,i){if(!IE(i.Ac))throw i.Sc(`${r._methodName}() can only be used with update() and set()`);if(!i.path)throw i.Sc(`${r._methodName}() is not currently supported inside arrays`);const s=r._toFieldTransform(i);s&&i.fieldTransforms.push(s)}(t,e),null;if(t===void 0&&e.ignoreUndefinedProperties)return null;if(e.path&&e.fieldMask.push(e.path),t instanceof Array){if(e.settings.fc&&e.Ac!==4)throw e.Sc("Nested arrays are not supported");return function(r,i){const s=[];let o=0;for(const a of r){let u=Cl(a,i.wc(o));u==null&&(u={nullValue:"NULL_VALUE"}),s.push(u),o++}return{arrayValue:{values:s}}}(t,e)}return function(r,i){if((r=Yt(r))===null)return{nullValue:"NULL_VALUE"};if(typeof r=="number")return Fb(i.serializer,r);if(typeof r=="boolean")return{booleanValue:r};if(typeof r=="string")return{stringValue:r};if(r instanceof Date){const s=We.fromDate(r);return{timestampValue:Ec(i.serializer,s)}}if(r instanceof We){const s=new We(r.seconds,1e3*Math.floor(r.nanoseconds/1e3));return{timestampValue:Ec(i.serializer,s)}}if(r instanceof Tr)return{geoPointValue:{latitude:r.latitude,longitude:r.longitude}};if(r instanceof qn)return{bytesValue:Qb(i.serializer,r._byteString)};if(r instanceof vt){const s=i.databaseId,o=r.firestore._databaseId;if(!o.isEqual(s))throw i.Sc(`Document reference is for database ${o.projectId}/${o.database} but should be for database ${s.projectId}/${s.database}`);return{referenceValue:Gm(r.firestore._databaseId||i.databaseId,r._key.path)}}if(r instanceof Ir)return function(o,a){return{mapValue:{fields:{[Eb]:{stringValue:Sb},[wc]:{arrayValue:{values:o.toArray().map(c=>{if(typeof c!="number")throw a.Sc("VectorValues must only contain numeric values.");return $m(a.serializer,c)})}}}}}}(r,i);throw i.Sc(`Unsupported field value: ${ad(r)}`)}(t,e)}function CE(t,e){const n={};return yb(t)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):Ki(t,(r,i)=>{const s=Cl(i,e.mc(r));s!=null&&(n[r]=s)}),{mapValue:{fields:n}}}function NE(t){return!(typeof t!="object"||t===null||t instanceof Array||t instanceof Date||t instanceof We||t instanceof Tr||t instanceof qn||t instanceof vt||t instanceof Ed||t instanceof Ir)}function fg(t,e,n){if(!NE(n)||!mb(n)){const r=ad(n);throw r==="an object"?e.Sc(t+" a custom object"):e.Sc(t+" "+r)}}function gp(t,e,n){if((e=Yt(e))instanceof bd)return e._internalPath;if(typeof e=="string")return pg(t,e);throw Cc("Field path arguments must be of type string or ",t,!1,void 0,n)}const iR=new RegExp("[~\\*/\\[\\]]");function pg(t,e,n){if(e.search(iR)>=0)throw Cc(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,t,!1,void 0,n);try{return new bd(...e.split("."))._internalPath}catch{throw Cc(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,t,!1,void 0,n)}}function Cc(t,e,n,r,i){const s=r&&!r.isEmpty(),o=i!==void 0;let a=`Function ${e}() called with invalid data`;n&&(a+=" (via `toFirestore()`)"),a+=". ";let u="";return(s||o)&&(u+=" (found",s&&(u+=` in field ${r}`),o&&(u+=` in document ${i}`),u+=")"),new ae(q.INVALID_ARGUMENT,a+t+u)}function AE(t,e){return t.some(n=>n.isEqual(e))}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class PE{constructor(e,n,r,i,s){this._firestore=e,this._userDataWriter=n,this._key=r,this._document=i,this._converter=s}get id(){return this._key.path.lastSegment()}get ref(){return new vt(this._firestore,this._converter,this._key)}exists(){return this._document!==null}data(){if(this._document){if(this._converter){const e=new sR(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(e)}return this._userDataWriter.convertValue(this._document.data.value)}}get(e){if(this._document){const n=this._document.data.field(Id("DocumentSnapshot.get",e));if(n!==null)return this._userDataWriter.convertValue(n)}}}class sR extends PE{data(){return super.data()}}function Id(t,e){return typeof e=="string"?pg(t,e):e instanceof bd?e._internalPath:e._delegate._internalPath}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function RE(t){if(t.limitType==="L"&&t.explicitOrderBy.length===0)throw new ae(q.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class mg{}class DE extends mg{}function Zr(t,e,...n){let r=[];e instanceof mg&&r.push(e),r=r.concat(n),function(s){const o=s.filter(u=>u instanceof gg).length,a=s.filter(u=>u instanceof kd).length;if(o>1||o>0&&a>0)throw new ae(q.INVALID_ARGUMENT,"InvalidQuery. When using composite filters, you cannot use more than one filter at the top level. Consider nesting the multiple filters within an `and(...)` statement. For example: change `query(query, where(...), or(...))` to `query(query, and(where(...), or(...)))`.")}(r);for(const i of r)t=i._apply(t);return t}class kd extends DE{constructor(e,n,r){super(),this._field=e,this._op=n,this._value=r,this.type="where"}static _create(e,n,r){return new kd(e,n,r)}_apply(e){const n=this._parse(e);return jE(e._query,n),new Yi(e.firestore,e.converter,sp(e._query,n))}_parse(e){const n=Sd(e.firestore);return function(s,o,a,u,c,h,f){let p;if(c.isKeyField()){if(h==="array-contains"||h==="array-contains-any")throw new ae(q.INVALID_ARGUMENT,`Invalid Query. You can't perform '${h}' queries on documentId().`);if(h==="in"||h==="not-in"){ex(f,h);const _=[];for(const T of f)_.push(Zv(u,s,T));p={arrayValue:{values:_}}}else p=Zv(u,s,f)}else h!=="in"&&h!=="not-in"&&h!=="array-contains-any"||ex(f,h),p=rR(a,o,f,h==="in"||h==="not-in");return Nt.create(c,h,p)}(e._query,"where",n,e.firestore._databaseId,this._field,this._op,this._value)}}function Ds(t,e,n){const r=e,i=Id("where",t);return kd._create(i,r,n)}class gg extends mg{constructor(e,n){super(),this.type=e,this._queryConstraints=n}static _create(e,n){return new gg(e,n)}_parse(e){const n=this._queryConstraints.map(r=>r._parse(e)).filter(r=>r.getFilters().length>0);return n.length===1?n[0]:cr.create(n,this._getOperator())}_apply(e){const n=this._parse(e);return n.getFilters().length===0?e:(function(i,s){let o=i;const a=s.getFlattenedFilters();for(const u of a)jE(o,u),o=sp(o,u)}(e._query,n),new Yi(e.firestore,e.converter,sp(e._query,n)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return this.type==="and"?"and":"or"}}class yg extends DE{constructor(e,n){super(),this._field=e,this._direction=n,this.type="orderBy"}static _create(e,n){return new yg(e,n)}_apply(e){const n=function(i,s,o){if(i.startAt!==null)throw new ae(q.INVALID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(i.endAt!==null)throw new ae(q.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");return new ll(s,o)}(e._query,this._field,this._direction);return new Yi(e.firestore,e.converter,function(i,s){const o=i.explicitOrderBy.concat([s]);return new Uo(i.path,i.collectionGroup,o,i.filters.slice(),i.limit,i.limitType,i.startAt,i.endAt)}(e._query,n))}}function oR(t,e="asc"){const n=e,r=Id("orderBy",t);return yg._create(r,n)}function Zv(t,e,n){if(typeof(n=Yt(n))=="string"){if(n==="")throw new ae(q.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!Rb(e)&&n.indexOf("/")!==-1)throw new ae(q.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);const r=e.path.child(nt.fromString(n));if(!xe.isDocumentKey(r))throw new ae(q.INVALID_ARGUMENT,`Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${r}' is not because it has an odd number of segments (${r.length}).`);return mv(t,new xe(r))}if(n instanceof vt)return mv(t,n._key);throw new ae(q.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${ad(n)}.`)}function ex(t,e){if(!Array.isArray(t)||t.length===0)throw new ae(q.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`)}function jE(t,e){const n=function(i,s){for(const o of i)for(const a of o.getFlattenedFilters())if(s.indexOf(a.op)>=0)return a.op;return null}(t.filters,function(i){switch(i){case"!=":return["!=","not-in"];case"array-contains-any":case"in":return["not-in"];case"not-in":return["array-contains-any","in","not-in","!="];default:return[]}}(e.op));if(n!==null)throw n===e.op?new ae(q.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}' filter.`):new ae(q.INVALID_ARGUMENT,`Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`)}class aR{convertValue(e,n="none"){switch(Bi(e)){case 0:return null;case 1:return e.booleanValue;case 2:return bt(e.integerValue||e.doubleValue);case 3:return this.convertTimestamp(e.timestampValue);case 4:return this.convertServerTimestamp(e,n);case 5:return e.stringValue;case 6:return this.convertBytes(zi(e.bytesValue));case 7:return this.convertReference(e.referenceValue);case 8:return this.convertGeoPoint(e.geoPointValue);case 9:return this.convertArray(e.arrayValue,n);case 11:return this.convertObject(e.mapValue,n);case 10:return this.convertVectorValue(e.mapValue);default:throw Te(62114,{value:e})}}convertObject(e,n){return this.convertObjectMap(e.fields,n)}convertObjectMap(e,n="none"){const r={};return Ki(e,(i,s)=>{r[i]=this.convertValue(s,n)}),r}convertVectorValue(e){var r,i,s;const n=(s=(i=(r=e.fields)==null?void 0:r[wc].arrayValue)==null?void 0:i.values)==null?void 0:s.map(o=>bt(o.doubleValue));return new Ir(n)}convertGeoPoint(e){return new Tr(bt(e.latitude),bt(e.longitude))}convertArray(e,n){return(e.values||[]).map(r=>this.convertValue(r,n))}convertServerTimestamp(e,n){switch(n){case"previous":const r=cd(e);return r==null?null:this.convertValue(r,n);case"estimate":return this.convertTimestamp(sl(e));default:return null}}convertTimestamp(e){const n=Ui(e);return new We(n.seconds,n.nanos)}convertDocumentKey(e,n){const r=nt.fromString(e);Ge(tE(r),9688,{name:e});const i=new ol(r.get(1),r.get(3)),s=new xe(r.popFirst(5));return i.isEqual(n)||Yr(`Document ${s} contains a document reference within a different database (${i.projectId}/${i.database}) which is not supported. It will be treated as a reference in the current database (${n.projectId}/${n.database}) instead.`),s}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function LE(t,e,n){let r;return r=t?t.toFirestore(e):e,r}class wa{constructor(e,n){this.hasPendingWrites=e,this.fromCache=n}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}class fs extends PE{constructor(e,n,r,i,s,o){super(e,n,r,i,o),this._firestore=e,this._firestoreImpl=e,this.metadata=s}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){const n=new Mu(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(n,e)}return this._userDataWriter.convertValue(this._document.data.value,e.serverTimestamps)}}get(e,n={}){if(this._document){const r=this._document.data.field(Id("DocumentSnapshot.get",e));if(r!==null)return this._userDataWriter.convertValue(r,n.serverTimestamps)}}toJSON(){if(this.metadata.hasPendingWrites)throw new ae(q.FAILED_PRECONDITION,"DocumentSnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const e=this._document,n={};return n.type=fs._jsonSchemaVersion,n.bundle="",n.bundleSource="DocumentSnapshot",n.bundleName=this._key.toString(),!e||!e.isValidDocument()||!e.isFoundDocument()?n:(this._userDataWriter.convertObjectMap(e.data.value.mapValue.fields,"previous"),n.bundle=(this._firestore,this.ref.path,"NOT SUPPORTED"),n)}}fs._jsonSchemaVersion="firestore/documentSnapshot/1.0",fs._jsonSchema={type:At("string",fs._jsonSchemaVersion),bundleSource:At("string","DocumentSnapshot"),bundleName:At("string"),bundle:At("string")};class Mu extends fs{data(e={}){return super.data(e)}}class ps{constructor(e,n,r,i){this._firestore=e,this._userDataWriter=n,this._snapshot=i,this.metadata=new wa(i.hasPendingWrites,i.fromCache),this.query=r}get docs(){const e=[];return this.forEach(n=>e.push(n)),e}get size(){return this._snapshot.docs.size}get empty(){return this.size===0}forEach(e,n){this._snapshot.docs.forEach(r=>{e.call(n,new Mu(this._firestore,this._userDataWriter,r.key,r,new wa(this._snapshot.mutatedKeys.has(r.key),this._snapshot.fromCache),this.query.converter))})}docChanges(e={}){const n=!!e.includeMetadataChanges;if(n&&this._snapshot.excludesMetadataChanges)throw new ae(q.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===n||(this._cachedChanges=function(i,s){if(i._snapshot.oldDocs.isEmpty()){let o=0;return i._snapshot.docChanges.map(a=>{const u=new Mu(i._firestore,i._userDataWriter,a.doc.key,a.doc,new wa(i._snapshot.mutatedKeys.has(a.doc.key),i._snapshot.fromCache),i.query.converter);return a.doc,{type:"added",doc:u,oldIndex:-1,newIndex:o++}})}{let o=i._snapshot.oldDocs;return i._snapshot.docChanges.filter(a=>s||a.type!==3).map(a=>{const u=new Mu(i._firestore,i._userDataWriter,a.doc.key,a.doc,new wa(i._snapshot.mutatedKeys.has(a.doc.key),i._snapshot.fromCache),i.query.converter);let c=-1,h=-1;return a.type!==0&&(c=o.indexOf(a.doc.key),o=o.delete(a.doc.key)),a.type!==1&&(o=o.add(a.doc),h=o.indexOf(a.doc.key)),{type:lR(a.type),doc:u,oldIndex:c,newIndex:h}})}}(this,n),this._cachedChangesIncludeMetadataChanges=n),this._cachedChanges}toJSON(){if(this.metadata.hasPendingWrites)throw new ae(q.FAILED_PRECONDITION,"QuerySnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const e={};e.type=ps._jsonSchemaVersion,e.bundleSource="QuerySnapshot",e.bundleName=Mm.newId(),this._firestore._databaseId.database,this._firestore._databaseId.projectId;const n=[],r=[],i=[];return this.docs.forEach(s=>{s._document!==null&&(n.push(s._document),r.push(this._userDataWriter.convertObjectMap(s._document.data.value.mapValue.fields,"previous")),i.push(s.ref.path))}),e.bundle=(this._firestore,this.query._query,e.bundleName,"NOT SUPPORTED"),e}}function lR(t){switch(t){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return Te(61501,{type:t})}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function ei(t){t=kn(t,vt);const e=kn(t.firestore,Jr);return GP(_d(e),t._key).then(n=>ME(e,t,n))}ps._jsonSchemaVersion="firestore/querySnapshot/1.0",ps._jsonSchema={type:At("string",ps._jsonSchemaVersion),bundleSource:At("string","QuerySnapshot"),bundleName:At("string"),bundle:At("string")};class vg extends aR{constructor(e){super(),this.firestore=e}convertBytes(e){return new qn(e)}convertReference(e){const n=this.convertDocumentKey(e,this.firestore._databaseId);return new vt(this.firestore,null,n)}}function lr(t){t=kn(t,Yi);const e=kn(t.firestore,Jr),n=_d(e),r=new vg(e);return RE(t._query),KP(n,t._query).then(i=>new ps(e,r,t,i))}function OE(t,e,n){t=kn(t,vt);const r=kn(t.firestore,Jr),i=LE(t.converter,e);return Cd(r,[kE(Sd(r),"setDoc",t._key,i,t.converter!==null,n).toMutation(t._key,Qn.none())])}function Xi(t,e,n,...r){t=kn(t,vt);const i=kn(t.firestore,Jr),s=Sd(i);let o;return o=typeof(e=Yt(e))=="string"||e instanceof bd?nR(s,"updateDoc",t._key,e,n,r):tR(s,"updateDoc",t._key,e),Cd(i,[o.toMutation(t._key,Qn.exists(!0))])}function yp(t){return Cd(kn(t.firestore,Jr),[new Hm(t._key,Qn.none())])}function xg(t,e){const n=kn(t.firestore,Jr),r=Pt(t),i=LE(t.converter,e);return Cd(n,[kE(Sd(t.firestore),"addDoc",r._key,i,t.converter!==null,{}).toMutation(r._key,Qn.exists(!1))]).then(()=>r)}function wg(t,...e){var u,c,h;t=Yt(t);let n={includeMetadataChanges:!1,source:"default"},r=0;typeof e[r]!="object"||Jv(e[r])||(n=e[r++]);const i={includeMetadataChanges:n.includeMetadataChanges,source:n.source};if(Jv(e[r])){const f=e[r];e[r]=(u=f.next)==null?void 0:u.bind(f),e[r+1]=(c=f.error)==null?void 0:c.bind(f),e[r+2]=(h=f.complete)==null?void 0:h.bind(f)}let s,o,a;if(t instanceof vt)o=kn(t.firestore,Jr),a=dd(t._key.path),s={next:f=>{e[r]&&e[r](ME(o,t,f))},error:e[r+1],complete:e[r+2]};else{const f=kn(t,Yi);o=kn(f.firestore,Jr),a=f._query;const p=new vg(o);s={next:g=>{e[r]&&e[r](new ps(o,p,f,g))},error:e[r+1],complete:e[r+2]},RE(t._query)}return function(p,g,_,T){const R=new cg(T),y=new ag(g,R,_);return p.asyncQueue.enqueueAndForget(async()=>ig(await kc(p),y)),()=>{R.Nu(),p.asyncQueue.enqueueAndForget(async()=>sg(await kc(p),y))}}(_d(o),a,i,s)}function Cd(t,e){return function(r,i){const s=new Hr;return r.asyncQueue.enqueueAndForget(async()=>LP(await WP(r),i,s)),s.promise}(_d(t),e)}function ME(t,e,n){const r=n.docs.get(e._key),i=new vg(t);return new fs(t,i,e._key,r,new wa(n.hasPendingWrites,n.fromCache),e.converter)}function uR(t){return new hg("increment",t)}(function(e,n=!0){(function(i){Mo=i})(As),Es(new Vi("firestore",(r,{instanceIdentifier:i,options:s})=>{const o=r.getProvider("app").getImmediate(),a=new Jr(new nN(r.getProvider("auth-internal")),new sN(o,r.getProvider("app-check-internal")),function(c,h){if(!Object.prototype.hasOwnProperty.apply(c.options,["projectId"]))throw new ae(q.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new ol(c.options.projectId,h)}(o,i),o);return s={useFetchStreams:n,...s},a._setSettings(s),a},"PUBLIC").setMultipleInstances(!0)),br(nv,rv,e),br(nv,rv,"esm2020")})();/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const VE="firebasestorage.googleapis.com",cR="storageBucket",dR=2*60*1e3,hR=10*60*1e3;/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Dr extends Rr{constructor(e,n,r=0){super(Dh(e),`Firebase Storage: ${n} (${Dh(e)})`),this.status_=r,this.customData={serverResponse:null},this._baseMessage=this.message,Object.setPrototypeOf(this,Dr.prototype)}get status(){return this.status_}set status(e){this.status_=e}_codeEquals(e){return Dh(e)===this.code}get serverResponse(){return this.customData.serverResponse}set serverResponse(e){this.customData.serverResponse=e,this.customData.serverResponse?this.message=`${this._baseMessage} +${this.customData.serverResponse}`:this.message=this._baseMessage}}var Ar;(function(t){t.UNKNOWN="unknown",t.OBJECT_NOT_FOUND="object-not-found",t.BUCKET_NOT_FOUND="bucket-not-found",t.PROJECT_NOT_FOUND="project-not-found",t.QUOTA_EXCEEDED="quota-exceeded",t.UNAUTHENTICATED="unauthenticated",t.UNAUTHORIZED="unauthorized",t.UNAUTHORIZED_APP="unauthorized-app",t.RETRY_LIMIT_EXCEEDED="retry-limit-exceeded",t.INVALID_CHECKSUM="invalid-checksum",t.CANCELED="canceled",t.INVALID_EVENT_NAME="invalid-event-name",t.INVALID_URL="invalid-url",t.INVALID_DEFAULT_BUCKET="invalid-default-bucket",t.NO_DEFAULT_BUCKET="no-default-bucket",t.CANNOT_SLICE_BLOB="cannot-slice-blob",t.SERVER_FILE_WRONG_SIZE="server-file-wrong-size",t.NO_DOWNLOAD_URL="no-download-url",t.INVALID_ARGUMENT="invalid-argument",t.INVALID_ARGUMENT_COUNT="invalid-argument-count",t.APP_DELETED="app-deleted",t.INVALID_ROOT_OPERATION="invalid-root-operation",t.INVALID_FORMAT="invalid-format",t.INTERNAL_ERROR="internal-error",t.UNSUPPORTED_ENVIRONMENT="unsupported-environment"})(Ar||(Ar={}));function Dh(t){return"storage/"+t}function fR(){const t="An unknown error occurred, please check the error payload for server response.";return new Dr(Ar.UNKNOWN,t)}function pR(){return new Dr(Ar.RETRY_LIMIT_EXCEEDED,"Max retry time for operation exceeded, please try again.")}function mR(){return new Dr(Ar.CANCELED,"User canceled the upload/download.")}function gR(t){return new Dr(Ar.INVALID_URL,"Invalid URL '"+t+"'.")}function yR(t){return new Dr(Ar.INVALID_DEFAULT_BUCKET,"Invalid default bucket '"+t+"'.")}function tx(t){return new Dr(Ar.INVALID_ARGUMENT,t)}function FE(){return new Dr(Ar.APP_DELETED,"The Firebase app was deleted.")}function vR(t){return new Dr(Ar.INVALID_ROOT_OPERATION,"The operation '"+t+"' cannot be performed on a root reference, create a non-root reference using child, such as .child('file.png').")}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class ir{constructor(e,n){this.bucket=e,this.path_=n}get path(){return this.path_}get isRoot(){return this.path.length===0}fullServerUrl(){const e=encodeURIComponent;return"/b/"+e(this.bucket)+"/o/"+e(this.path)}bucketOnlyServerUrl(){return"/b/"+encodeURIComponent(this.bucket)+"/o"}static makeFromBucketSpec(e,n){let r;try{r=ir.makeFromUrl(e,n)}catch{return new ir(e,"")}if(r.path==="")return r;throw yR(e)}static makeFromUrl(e,n){let r=null;const i="([A-Za-z0-9.\\-_]+)";function s(L){L.path.charAt(L.path.length-1)==="/"&&(L.path_=L.path_.slice(0,-1))}const o="(/(.*))?$",a=new RegExp("^gs://"+i+o,"i"),u={bucket:1,path:3};function c(L){L.path_=decodeURIComponent(L.path)}const h="v[A-Za-z0-9_]+",f=n.replace(/[.]/g,"\\."),p="(/([^?#]*).*)?$",g=new RegExp(`^https?://${f}/${h}/b/${i}/o${p}`,"i"),_={bucket:1,path:3},T=n===VE?"(?:storage.googleapis.com|storage.cloud.google.com)":n,R="([^?#]*)",y=new RegExp(`^https?://${T}/${i}/${R}`,"i"),k=[{regex:a,indices:u,postModify:s},{regex:g,indices:_,postModify:c},{regex:y,indices:{bucket:1,path:2},postModify:c}];for(let L=0;L{i=null,t(g,u())},R)}function p(){s&&clearTimeout(s)}function g(R,...y){if(c){p();return}if(R){p(),h.call(null,R,...y);return}if(u()||o){p(),h.call(null,R,...y);return}r<64&&(r*=2);let k;a===1?(a=2,k=0):k=(r+Math.random())*1e3,f(k)}let _=!1;function T(R){_||(_=!0,p(),!c&&(i!==null?(R||(a=2),clearTimeout(i),f(0)):R||(a=1)))}return f(0),s=setTimeout(()=>{o=!0,T(!0)},n),T}function _R(t){t(!1)}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function bR(t){return t!==void 0}function nx(t,e,n,r){if(rn)throw tx(`Invalid value for '${t}'. Expected ${n} or less.`)}function ER(t){const e=encodeURIComponent;let n="?";for(const r in t)if(t.hasOwnProperty(r)){const i=e(r)+"="+e(t[r]);n=n+i+"&"}return n=n.slice(0,-1),n}var Nc;(function(t){t[t.NO_ERROR=0]="NO_ERROR",t[t.NETWORK_ERROR=1]="NETWORK_ERROR",t[t.ABORT=2]="ABORT"})(Nc||(Nc={}));/** + * @license + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function SR(t,e){const n=t>=500&&t<600,i=[408,429].indexOf(t)!==-1,s=e.indexOf(t)!==-1;return n||i||s}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class TR{constructor(e,n,r,i,s,o,a,u,c,h,f,p=!0,g=!1){this.url_=e,this.method_=n,this.headers_=r,this.body_=i,this.successCodes_=s,this.additionalRetryCodes_=o,this.callback_=a,this.errorCallback_=u,this.timeout_=c,this.progressCallback_=h,this.connectionFactory_=f,this.retry=p,this.isUsingEmulator=g,this.pendingConnection_=null,this.backoffId_=null,this.canceled_=!1,this.appDelete_=!1,this.promise_=new Promise((_,T)=>{this.resolve_=_,this.reject_=T,this.start_()})}start_(){const e=(r,i)=>{if(i){r(!1,new pu(!1,null,!0));return}const s=this.connectionFactory_();this.pendingConnection_=s;const o=a=>{const u=a.loaded,c=a.lengthComputable?a.total:-1;this.progressCallback_!==null&&this.progressCallback_(u,c)};this.progressCallback_!==null&&s.addUploadProgressListener(o),s.send(this.url_,this.method_,this.isUsingEmulator,this.body_,this.headers_).then(()=>{this.progressCallback_!==null&&s.removeUploadProgressListener(o),this.pendingConnection_=null;const a=s.getErrorCode()===Nc.NO_ERROR,u=s.getStatus();if(!a||SR(u,this.additionalRetryCodes_)&&this.retry){const h=s.getErrorCode()===Nc.ABORT;r(!1,new pu(!1,null,h));return}const c=this.successCodes_.indexOf(u)!==-1;r(!0,new pu(c,s))})},n=(r,i)=>{const s=this.resolve_,o=this.reject_,a=i.connection;if(i.wasSuccessCode)try{const u=this.callback_(a,a.getResponse());bR(u)?s(u):s()}catch(u){o(u)}else if(a!==null){const u=fR();u.serverResponse=a.getErrorText(),this.errorCallback_?o(this.errorCallback_(a,u)):o(u)}else if(i.canceled){const u=this.appDelete_?FE():mR();o(u)}else{const u=pR();o(u)}};this.canceled_?n(!1,new pu(!1,null,!0)):this.backoffId_=wR(e,n,this.timeout_)}getPromise(){return this.promise_}cancel(e){this.canceled_=!0,this.appDelete_=e||!1,this.backoffId_!==null&&_R(this.backoffId_),this.pendingConnection_!==null&&this.pendingConnection_.abort()}}class pu{constructor(e,n,r){this.wasSuccessCode=e,this.connection=n,this.canceled=!!r}}function IR(t,e){e!==null&&e.length>0&&(t.Authorization="Firebase "+e)}function kR(t,e){t["X-Firebase-Storage-Version"]="webjs/"+(e??"AppManager")}function CR(t,e){e&&(t["X-Firebase-GMPID"]=e)}function NR(t,e){e!==null&&(t["X-Firebase-AppCheck"]=e)}function AR(t,e,n,r,i,s,o=!0,a=!1){const u=ER(t.urlParams),c=t.url+u,h=Object.assign({},t.headers);return CR(h,e),IR(h,n),kR(h,s),NR(h,r),new TR(c,t.method,h,t.body,t.successCodes,t.additionalRetryCodes,t.handler,t.errorHandler,t.timeout,t.progressCallback,i,o,a)}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function PR(t){if(t.length===0)return null;const e=t.lastIndexOf("/");return e===-1?"":t.slice(0,e)}function RR(t){const e=t.lastIndexOf("/",t.length-2);return e===-1?t:t.slice(e+1)}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Ac{constructor(e,n){this._service=e,n instanceof ir?this._location=n:this._location=ir.makeFromUrl(n,e.host)}toString(){return"gs://"+this._location.bucket+"/"+this._location.path}_newRef(e,n){return new Ac(e,n)}get root(){const e=new ir(this._location.bucket,"");return this._newRef(this._service,e)}get bucket(){return this._location.bucket}get fullPath(){return this._location.path}get name(){return RR(this._location.path)}get storage(){return this._service}get parent(){const e=PR(this._location.path);if(e===null)return null;const n=new ir(this._location.bucket,e);return new Ac(this._service,n)}_throwIfRoot(e){if(this._location.path==="")throw vR(e)}}function rx(t,e){const n=e==null?void 0:e[cR];return n==null?null:ir.makeFromBucketSpec(n,t)}function DR(t,e,n,r={}){t.host=`${e}:${n}`;const i=Ns(e);i&&(Pm(`https://${t.host}/b`),Rm("Storage",!0)),t._isUsingEmulator=!0,t._protocol=i?"https":"http";const{mockUserToken:s}=r;s&&(t._overrideAuthToken=typeof s=="string"?s:eb(s,t.app.options.projectId))}class jR{constructor(e,n,r,i,s,o=!1){this.app=e,this._authProvider=n,this._appCheckProvider=r,this._url=i,this._firebaseVersion=s,this._isUsingEmulator=o,this._bucket=null,this._host=VE,this._protocol="https",this._appId=null,this._deleted=!1,this._maxOperationRetryTime=dR,this._maxUploadRetryTime=hR,this._requests=new Set,i!=null?this._bucket=ir.makeFromBucketSpec(i,this._host):this._bucket=rx(this._host,this.app.options)}get host(){return this._host}set host(e){this._host=e,this._url!=null?this._bucket=ir.makeFromBucketSpec(this._url,e):this._bucket=rx(e,this.app.options)}get maxUploadRetryTime(){return this._maxUploadRetryTime}set maxUploadRetryTime(e){nx("time",0,Number.POSITIVE_INFINITY,e),this._maxUploadRetryTime=e}get maxOperationRetryTime(){return this._maxOperationRetryTime}set maxOperationRetryTime(e){nx("time",0,Number.POSITIVE_INFINITY,e),this._maxOperationRetryTime=e}async _getAuthToken(){if(this._overrideAuthToken)return this._overrideAuthToken;const e=this._authProvider.getImmediate({optional:!0});if(e){const n=await e.getToken();if(n!==null)return n.accessToken}return null}async _getAppCheckToken(){if(rr(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const e=this._appCheckProvider.getImmediate({optional:!0});return e?(await e.getToken()).token:null}_delete(){return this._deleted||(this._deleted=!0,this._requests.forEach(e=>e.cancel()),this._requests.clear()),Promise.resolve()}_makeStorageReference(e){return new Ac(this,e)}_makeRequest(e,n,r,i,s=!0){if(this._deleted)return new xR(FE());{const o=AR(e,this._appId,r,i,n,this._firebaseVersion,s,this._isUsingEmulator);return this._requests.add(o),o.getPromise().then(()=>this._requests.delete(o),()=>this._requests.delete(o)),o}}async makeRequestWithTokens(e,n){const[r,i]=await Promise.all([this._getAuthToken(),this._getAppCheckToken()]);return this._makeRequest(e,n,r,i).getPromise()}}const ix="@firebase/storage",sx="0.14.0";/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const UE="storage";function LR(t=Lm(),e){t=Yt(t);const r=od(t,UE).getImmediate({identifier:e}),i=X1("storage");return i&&OR(r,...i),r}function OR(t,e,n,r={}){DR(t,e,n,r)}function MR(t,{instanceIdentifier:e}){const n=t.getProvider("app").getImmediate(),r=t.getProvider("auth-internal"),i=t.getProvider("app-check-internal");return new jR(n,r,i,e,As)}function VR(){Es(new Vi(UE,MR,"PUBLIC").setMultipleInstances(!0)),br(ix,sx,""),br(ix,sx,"esm2020")}VR();function zE(){return{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}}const FR=zE,BE=new _l("auth","Firebase",zE());/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Pc=new Dm("@firebase/auth");function UR(t,...e){Pc.logLevel<=Me.WARN&&Pc.warn(`Auth (${As}): ${t}`,...e)}function Vu(t,...e){Pc.logLevel<=Me.ERROR&&Pc.error(`Auth (${As}): ${t}`,...e)}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function ti(t,...e){throw _g(t,...e)}function kr(t,...e){return _g(t,...e)}function $E(t,e,n){const r={...FR(),[e]:n};return new _l("auth","Firebase",r).create(e,{appName:t.name})}function ms(t){return $E(t,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function _g(t,...e){if(typeof t!="string"){const n=e[0],r=[...e.slice(1)];return r[0]&&(r[0].appName=t.name),t._errorFactory.create(n,...r)}return BE.create(t,...e)}function ke(t,e,...n){if(!t)throw _g(e,...n)}function Ur(t){const e="INTERNAL ASSERTION FAILED: "+t;throw Vu(e),new Error(e)}function ni(t,e){t||Ur(e)}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function vp(){var t;return typeof self<"u"&&((t=self.location)==null?void 0:t.href)||""}function zR(){return ox()==="http:"||ox()==="https:"}function ox(){var t;return typeof self<"u"&&((t=self.location)==null?void 0:t.protocol)||null}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function BR(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(zR()||P2()||"connection"in navigator)?navigator.onLine:!0}function $R(){if(typeof navigator>"u")return null;const t=navigator;return t.languages&&t.languages[0]||t.language||null}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Nl{constructor(e,n){this.shortDelay=e,this.longDelay=n,ni(n>e,"Short delay should be less than long delay!"),this.isMobile=C2()||R2()}get(){return BR()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function bg(t,e){ni(t.emulator,"Emulator should always be set here");const{url:n}=t.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class HE{static initialize(e,n,r){this.fetchImpl=e,n&&(this.headersImpl=n),r&&(this.responseImpl=r)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;Ur("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;Ur("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;Ur("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const HR={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const qR=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],WR=new Nl(3e4,6e4);function Eg(t,e){return t.tenantId&&!e.tenantId?{...e,tenantId:t.tenantId}:e}async function Bo(t,e,n,r,i={}){return qE(t,i,async()=>{let s={},o={};r&&(e==="GET"?o=r:s={body:JSON.stringify(r)});const a=bl({key:t.config.apiKey,...o}).slice(1),u=await t._getAdditionalHeaders();u["Content-Type"]="application/json",t.languageCode&&(u["X-Firebase-Locale"]=t.languageCode);const c={method:e,headers:u,...s};return A2()||(c.referrerPolicy="no-referrer"),t.emulatorConfig&&Ns(t.emulatorConfig.host)&&(c.credentials="include"),HE.fetch()(await WE(t,t.config.apiHost,n,a),c)})}async function qE(t,e,n){t._canInitEmulator=!1;const r={...HR,...e};try{const i=new KR(t),s=await Promise.race([n(),i.promise]);i.clearNetworkTimeout();const o=await s.json();if("needConfirmation"in o)throw mu(t,"account-exists-with-different-credential",o);if(s.ok&&!("errorMessage"in o))return o;{const a=s.ok?o.errorMessage:o.error.message,[u,c]=a.split(" : ");if(u==="FEDERATED_USER_ID_ALREADY_LINKED")throw mu(t,"credential-already-in-use",o);if(u==="EMAIL_EXISTS")throw mu(t,"email-already-in-use",o);if(u==="USER_DISABLED")throw mu(t,"user-disabled",o);const h=r[u]||u.toLowerCase().replace(/[_\s]+/g,"-");if(c)throw $E(t,h,c);ti(t,h)}}catch(i){if(i instanceof Rr)throw i;ti(t,"network-request-failed",{message:String(i)})}}async function GR(t,e,n,r,i={}){const s=await Bo(t,e,n,r,i);return"mfaPendingCredential"in s&&ti(t,"multi-factor-auth-required",{_serverResponse:s}),s}async function WE(t,e,n,r){const i=`${e}${n}?${r}`,s=t,o=s.config.emulator?bg(t.config,i):`${t.config.apiScheme}://${i}`;return qR.includes(n)&&(await s._persistenceManagerAvailable,s._getPersistenceType()==="COOKIE")?s._getPersistence()._getFinalTarget(o).toString():o}class KR{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((n,r)=>{this.timer=setTimeout(()=>r(kr(this.auth,"network-request-failed")),WR.get())})}}function mu(t,e,n){const r={appName:t.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const i=kr(t,e,r);return i.customData._tokenResponse=n,i}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function QR(t,e){return Bo(t,"POST","/v1/accounts:delete",e)}async function Rc(t,e){return Bo(t,"POST","/v1/accounts:lookup",e)}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function La(t){if(t)try{const e=new Date(Number(t));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function YR(t,e=!1){const n=Yt(t),r=await n.getIdToken(e),i=Sg(r);ke(i&&i.exp&&i.auth_time&&i.iat,n.auth,"internal-error");const s=typeof i.firebase=="object"?i.firebase:void 0,o=s==null?void 0:s.sign_in_provider;return{claims:i,token:r,authTime:La(jh(i.auth_time)),issuedAtTime:La(jh(i.iat)),expirationTime:La(jh(i.exp)),signInProvider:o||null,signInSecondFactor:(s==null?void 0:s.sign_in_second_factor)||null}}function jh(t){return Number(t)*1e3}function Sg(t){const[e,n,r]=t.split(".");if(e===void 0||n===void 0||r===void 0)return Vu("JWT malformed, contained fewer than 3 sections"),null;try{const i=Q1(n);return i?JSON.parse(i):(Vu("Failed to decode base64 JWT payload"),null)}catch(i){return Vu("Caught error parsing JWT payload as JSON",i==null?void 0:i.toString()),null}}function ax(t){const e=Sg(t);return ke(e,"internal-error"),ke(typeof e.exp<"u","internal-error"),ke(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function hl(t,e,n=!1){if(n)return e;try{return await e}catch(r){throw r instanceof Rr&&XR(r)&&t.auth.currentUser===t&&await t.auth.signOut(),r}}function XR({code:t}){return t==="auth/user-disabled"||t==="auth/user-token-expired"}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class JR{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(e){if(e){const n=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),n}else{this.errorBackoff=3e4;const r=(this.user.stsTokenManager.expirationTime??0)-Date.now()-3e5;return Math.max(0,r)}}schedule(e=!1){if(!this.isRunning)return;const n=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},n)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){(e==null?void 0:e.code)==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class xp{constructor(e,n){this.createdAt=e,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=La(this.lastLoginAt),this.creationTime=La(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function Dc(t){var f;const e=t.auth,n=await t.getIdToken(),r=await hl(t,Rc(e,{idToken:n}));ke(r==null?void 0:r.users.length,e,"internal-error");const i=r.users[0];t._notifyReloadListener(i);const s=(f=i.providerUserInfo)!=null&&f.length?GE(i.providerUserInfo):[],o=e4(t.providerData,s),a=t.isAnonymous,u=!(t.email&&i.passwordHash)&&!(o!=null&&o.length),c=a?u:!1,h={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:o,metadata:new xp(i.createdAt,i.lastLoginAt),isAnonymous:c};Object.assign(t,h)}async function ZR(t){const e=Yt(t);await Dc(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function e4(t,e){return[...t.filter(r=>!e.some(i=>i.providerId===r.providerId)),...e]}function GE(t){return t.map(({providerId:e,...n})=>({providerId:e,uid:n.rawId||"",displayName:n.displayName||null,email:n.email||null,phoneNumber:n.phoneNumber||null,photoURL:n.photoUrl||null}))}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function t4(t,e){const n=await qE(t,{},async()=>{const r=bl({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:i,apiKey:s}=t.config,o=await WE(t,i,"/v1/token",`key=${s}`),a=await t._getAdditionalHeaders();a["Content-Type"]="application/x-www-form-urlencoded";const u={method:"POST",headers:a,body:r};return t.emulatorConfig&&Ns(t.emulatorConfig.host)&&(u.credentials="include"),HE.fetch()(o,u)});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function n4(t,e){return Bo(t,"POST","/v2/accounts:revokeToken",Eg(t,e))}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class fo{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){ke(e.idToken,"internal-error"),ke(typeof e.idToken<"u","internal-error"),ke(typeof e.refreshToken<"u","internal-error");const n="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):ax(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,n)}updateFromIdToken(e){ke(e.length!==0,"internal-error");const n=ax(e);this.updateTokensAndExpiration(e,null,n)}async getToken(e,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(ke(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(e,n){const{accessToken:r,refreshToken:i,expiresIn:s}=await t4(e,n);this.updateTokensAndExpiration(r,i,Number(s))}updateTokensAndExpiration(e,n,r){this.refreshToken=n||null,this.accessToken=e||null,this.expirationTime=Date.now()+r*1e3}static fromJSON(e,n){const{refreshToken:r,accessToken:i,expirationTime:s}=n,o=new fo;return r&&(ke(typeof r=="string","internal-error",{appName:e}),o.refreshToken=r),i&&(ke(typeof i=="string","internal-error",{appName:e}),o.accessToken=i),s&&(ke(typeof s=="number","internal-error",{appName:e}),o.expirationTime=s),o}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new fo,this.toJSON())}_performRefresh(){return Ur("not implemented")}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function di(t,e){ke(typeof t=="string"||typeof t>"u","internal-error",{appName:e})}class sr{constructor({uid:e,auth:n,stsTokenManager:r,...i}){this.providerId="firebase",this.proactiveRefresh=new JR(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=n,this.stsTokenManager=r,this.accessToken=r.accessToken,this.displayName=i.displayName||null,this.email=i.email||null,this.emailVerified=i.emailVerified||!1,this.phoneNumber=i.phoneNumber||null,this.photoURL=i.photoURL||null,this.isAnonymous=i.isAnonymous||!1,this.tenantId=i.tenantId||null,this.providerData=i.providerData?[...i.providerData]:[],this.metadata=new xp(i.createdAt||void 0,i.lastLoginAt||void 0)}async getIdToken(e){const n=await hl(this,this.stsTokenManager.getToken(this.auth,e));return ke(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(e){return YR(this,e)}reload(){return ZR(this)}_assign(e){this!==e&&(ke(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(n=>({...n})),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){const n=new sr({...this,auth:e,stsTokenManager:this.stsTokenManager._clone()});return n.metadata._copy(this.metadata),n}_onReload(e){ke(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,n=!1){let r=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),r=!0),n&&await Dc(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(rr(this.auth.app))return Promise.reject(ms(this.auth));const e=await this.getIdToken();return await hl(this,QR(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return{uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>({...e})),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId,...this.metadata.toJSON(),apiKey:this.auth.config.apiKey,appName:this.auth.name}}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,n){const r=n.displayName??void 0,i=n.email??void 0,s=n.phoneNumber??void 0,o=n.photoURL??void 0,a=n.tenantId??void 0,u=n._redirectEventId??void 0,c=n.createdAt??void 0,h=n.lastLoginAt??void 0,{uid:f,emailVerified:p,isAnonymous:g,providerData:_,stsTokenManager:T}=n;ke(f&&T,e,"internal-error");const R=fo.fromJSON(this.name,T);ke(typeof f=="string",e,"internal-error"),di(r,e.name),di(i,e.name),ke(typeof p=="boolean",e,"internal-error"),ke(typeof g=="boolean",e,"internal-error"),di(s,e.name),di(o,e.name),di(a,e.name),di(u,e.name),di(c,e.name),di(h,e.name);const y=new sr({uid:f,auth:e,email:i,emailVerified:p,displayName:r,isAnonymous:g,photoURL:o,phoneNumber:s,tenantId:a,stsTokenManager:R,createdAt:c,lastLoginAt:h});return _&&Array.isArray(_)&&(y.providerData=_.map(w=>({...w}))),u&&(y._redirectEventId=u),y}static async _fromIdTokenResponse(e,n,r=!1){const i=new fo;i.updateFromServerResponse(n);const s=new sr({uid:n.localId,auth:e,stsTokenManager:i,isAnonymous:r});return await Dc(s),s}static async _fromGetAccountInfoResponse(e,n,r){const i=n.users[0];ke(i.localId!==void 0,"internal-error");const s=i.providerUserInfo!==void 0?GE(i.providerUserInfo):[],o=!(i.email&&i.passwordHash)&&!(s!=null&&s.length),a=new fo;a.updateFromIdToken(r);const u=new sr({uid:i.localId,auth:e,stsTokenManager:a,isAnonymous:o}),c={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:s,metadata:new xp(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash)&&!(s!=null&&s.length)};return Object.assign(u,c),u}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const lx=new Map;function zr(t){ni(t instanceof Function,"Expected a class definition");let e=lx.get(t);return e?(ni(e instanceof t,"Instance stored in cache mismatched with class"),e):(e=new t,lx.set(t,e),e)}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class KE{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,n){this.storage[e]=n}async _get(e){const n=this.storage[e];return n===void 0?null:n}async _remove(e){delete this.storage[e]}_addListener(e,n){}_removeListener(e,n){}}KE.type="NONE";const ux=KE;/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Fu(t,e,n){return`firebase:${t}:${e}:${n}`}class po{constructor(e,n,r){this.persistence=e,this.auth=n,this.userKey=r;const{config:i,name:s}=this.auth;this.fullUserKey=Fu(this.userKey,i.apiKey,s),this.fullPersistenceKey=Fu("persistence",i.apiKey,s),this.boundEventHandler=n._onStorageEvent.bind(n),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){const e=await this.persistence._get(this.fullUserKey);if(!e)return null;if(typeof e=="string"){const n=await Rc(this.auth,{idToken:e}).catch(()=>{});return n?sr._fromGetAccountInfoResponse(this.auth,n,e):null}return sr._fromJSON(this.auth,e)}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;const n=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,n)return this.setCurrentUser(n)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,n,r="authUser"){if(!n.length)return new po(zr(ux),e,r);const i=(await Promise.all(n.map(async c=>{if(await c._isAvailable())return c}))).filter(c=>c);let s=i[0]||zr(ux);const o=Fu(r,e.config.apiKey,e.name);let a=null;for(const c of n)try{const h=await c._get(o);if(h){let f;if(typeof h=="string"){const p=await Rc(e,{idToken:h}).catch(()=>{});if(!p)break;f=await sr._fromGetAccountInfoResponse(e,p,h)}else f=sr._fromJSON(e,h);c!==s&&(a=f),s=c;break}}catch{}const u=i.filter(c=>c._shouldAllowMigration);return!s._shouldAllowMigration||!u.length?new po(s,e,r):(s=u[0],a&&await s._set(o,a.toJSON()),await Promise.all(n.map(async c=>{if(c!==s)try{await c._remove(o)}catch{}})),new po(s,e,r))}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function cx(t){const e=t.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(JE(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(QE(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(eS(e))return"Blackberry";if(tS(e))return"Webos";if(YE(e))return"Safari";if((e.includes("chrome/")||XE(e))&&!e.includes("edge/"))return"Chrome";if(ZE(e))return"Android";{const n=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,r=t.match(n);if((r==null?void 0:r.length)===2)return r[1]}return"Other"}function QE(t=on()){return/firefox\//i.test(t)}function YE(t=on()){const e=t.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function XE(t=on()){return/crios\//i.test(t)}function JE(t=on()){return/iemobile/i.test(t)}function ZE(t=on()){return/android/i.test(t)}function eS(t=on()){return/blackberry/i.test(t)}function tS(t=on()){return/webos/i.test(t)}function Tg(t=on()){return/iphone|ipad|ipod/i.test(t)||/macintosh/i.test(t)&&/mobile/i.test(t)}function r4(t=on()){var e;return Tg(t)&&!!((e=window.navigator)!=null&&e.standalone)}function i4(){return D2()&&document.documentMode===10}function nS(t=on()){return Tg(t)||ZE(t)||tS(t)||eS(t)||/windows phone/i.test(t)||JE(t)}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function rS(t,e=[]){let n;switch(t){case"Browser":n=cx(on());break;case"Worker":n=`${cx(on())}-${t}`;break;default:n=t}const r=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${As}/${r}`}/** + * @license + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class s4{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,n){const r=s=>new Promise((o,a)=>{try{const u=e(s);o(u)}catch(u){a(u)}});r.onAbort=n,this.queue.push(r);const i=this.queue.length-1;return()=>{this.queue[i]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;const n=[];try{for(const r of this.queue)await r(e),r.onAbort&&n.push(r.onAbort)}catch(r){n.reverse();for(const i of n)try{i()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:r==null?void 0:r.message})}}}/** + * @license + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function o4(t,e={}){return Bo(t,"GET","/v2/passwordPolicy",Eg(t,e))}/** + * @license + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const a4=6;class l4{constructor(e){var r;const n=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=n.minPasswordLength??a4,n.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=n.maxPasswordLength),n.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=n.containsLowercaseCharacter),n.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=n.containsUppercaseCharacter),n.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=n.containsNumericCharacter),n.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=n.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=((r=e.allowedNonAlphanumericCharacters)==null?void 0:r.join(""))??"",this.forceUpgradeOnSignin=e.forceUpgradeOnSignin??!1,this.schemaVersion=e.schemaVersion}validatePassword(e){const n={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,n),this.validatePasswordCharacterOptions(e,n),n.isValid&&(n.isValid=n.meetsMinPasswordLength??!0),n.isValid&&(n.isValid=n.meetsMaxPasswordLength??!0),n.isValid&&(n.isValid=n.containsLowercaseLetter??!0),n.isValid&&(n.isValid=n.containsUppercaseLetter??!0),n.isValid&&(n.isValid=n.containsNumericCharacter??!0),n.isValid&&(n.isValid=n.containsNonAlphanumericCharacter??!0),n}validatePasswordLengthOptions(e,n){const r=this.customStrengthOptions.minPasswordLength,i=this.customStrengthOptions.maxPasswordLength;r&&(n.meetsMinPasswordLength=e.length>=r),i&&(n.meetsMaxPasswordLength=e.length<=i)}validatePasswordCharacterOptions(e,n){this.updatePasswordCharacterOptionsStatuses(n,!1,!1,!1,!1);let r;for(let i=0;i="a"&&r<="z",r>="A"&&r<="Z",r>="0"&&r<="9",this.allowedNonAlphanumericCharacters.includes(r))}updatePasswordCharacterOptionsStatuses(e,n,r,i,s){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=n)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=r)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=i)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=s))}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class u4{constructor(e,n,r,i){this.app=e,this.heartbeatServiceProvider=n,this.appCheckServiceProvider=r,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new dx(this),this.idTokenSubscription=new dx(this),this.beforeStateQueue=new s4(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=BE,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this._resolvePersistenceManagerAvailable=void 0,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=i.sdkClientVersion,this._persistenceManagerAvailable=new Promise(s=>this._resolvePersistenceManagerAvailable=s)}_initializeWithPersistence(e,n){return n&&(this._popupRedirectResolver=zr(n)),this._initializationPromise=this.queue(async()=>{var r,i,s;if(!this._deleted&&(this.persistenceManager=await po.create(this,e),(r=this._resolvePersistenceManagerAvailable)==null||r.call(this),!this._deleted)){if((i=this._popupRedirectResolver)!=null&&i._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(n),this.lastNotifiedUid=((s=this.currentUser)==null?void 0:s.uid)||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const e=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!e)){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUserFromIdToken(e){try{const n=await Rc(this,{idToken:e}),r=await sr._fromGetAccountInfoResponse(this,n,e);await this.directlySetCurrentUser(r)}catch(n){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",n),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){var s;if(rr(this.app)){const o=this.app.settings.authIdToken;return o?new Promise(a=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(o).then(a,a))}):this.directlySetCurrentUser(null)}const n=await this.assertedPersistence.getCurrentUser();let r=n,i=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const o=(s=this.redirectUser)==null?void 0:s._redirectEventId,a=r==null?void 0:r._redirectEventId,u=await this.tryRedirectSignIn(e);(!o||o===a)&&(u!=null&&u.user)&&(r=u.user,i=!0)}if(!r)return this.directlySetCurrentUser(null);if(!r._redirectEventId){if(i)try{await this.beforeStateQueue.runMiddleware(r)}catch(o){r=n,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(o))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return ke(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===r._redirectEventId?this.directlySetCurrentUser(r):this.reloadAndSetCurrentUserOrClear(r)}async tryRedirectSignIn(e){let n=null;try{n=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return n}async reloadAndSetCurrentUserOrClear(e){try{await Dc(e)}catch(n){if((n==null?void 0:n.code)!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=$R()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(rr(this.app))return Promise.reject(ms(this));const n=e?Yt(e):null;return n&&ke(n.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(n&&n._clone(this))}async _updateCurrentUser(e,n=!1){if(!this._deleted)return e&&ke(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),n||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return rr(this.app)?Promise.reject(ms(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return rr(this.app)?Promise.reject(ms(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(zr(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();const n=this._getPasswordPolicyInternal();return n.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):n.validatePassword(e)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){const e=await o4(this),n=new l4(e);this.tenantId===null?this._projectPasswordPolicy=n:this._tenantPasswordPolicies[this.tenantId]=n}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(e){this._errorFactory=new _l("auth","Firebase",e())}onAuthStateChanged(e,n,r){return this.registerStateListener(this.authStateSubscription,e,n,r)}beforeAuthStateChanged(e,n){return this.beforeStateQueue.pushCallback(e,n)}onIdTokenChanged(e,n,r){return this.registerStateListener(this.idTokenSubscription,e,n,r)}authStateReady(){return new Promise((e,n)=>{if(this.currentUser)e();else{const r=this.onAuthStateChanged(()=>{r(),e()},n)}})}async revokeAccessToken(e){if(this.currentUser){const n=await this.currentUser.getIdToken(),r={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:n};this.tenantId!=null&&(r.tenantId=this.tenantId),await n4(this,r)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:(e=this._currentUser)==null?void 0:e.toJSON()}}async _setRedirectUser(e,n){const r=await this.getOrInitRedirectPersistenceManager(n);return e===null?r.removeCurrentUser():r.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){const n=e&&zr(e)||this._popupRedirectResolver;ke(n,this,"argument-error"),this.redirectPersistenceManager=await po.create(this,[zr(n._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var n,r;return this._isInitialized&&await this.queue(async()=>{}),((n=this._currentUser)==null?void 0:n._redirectEventId)===e?this._currentUser:((r=this.redirectUser)==null?void 0:r._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var n;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const e=((n=this.currentUser)==null?void 0:n.uid)??null;this.lastNotifiedUid!==e&&(this.lastNotifiedUid=e,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,n,r,i){if(this._deleted)return()=>{};const s=typeof n=="function"?n:n.next.bind(n);let o=!1;const a=this._isInitialized?Promise.resolve():this._initializationPromise;if(ke(a,this,"internal-error"),a.then(()=>{o||s(this.currentUser)}),typeof n=="function"){const u=e.addObserver(n,r,i);return()=>{o=!0,u()}}else{const u=e.addObserver(n);return()=>{o=!0,u()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return ke(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=rS(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var i;const e={"X-Client-Version":this.clientVersion};this.app.options.appId&&(e["X-Firebase-gmpid"]=this.app.options.appId);const n=await((i=this.heartbeatServiceProvider.getImmediate({optional:!0}))==null?void 0:i.getHeartbeatsHeader());n&&(e["X-Firebase-Client"]=n);const r=await this._getAppCheckToken();return r&&(e["X-Firebase-AppCheck"]=r),e}async _getAppCheckToken(){var n;if(rr(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const e=await((n=this.appCheckServiceProvider.getImmediate({optional:!0}))==null?void 0:n.getToken());return e!=null&&e.error&&UR(`Error while retrieving App Check token: ${e.error}`),e==null?void 0:e.token}}function Ig(t){return Yt(t)}class dx{constructor(e){this.auth=e,this.observer=null,this.addObserver=z2(n=>this.observer=n)}get next(){return ke(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */let kg={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function c4(t){kg=t}function d4(t){return kg.loadJS(t)}function h4(){return kg.gapiScript}function f4(t){return`__${t}${Math.floor(Math.random()*1e6)}`}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function p4(t,e){const n=od(t,"auth");if(n.isInitialized()){const i=n.getImmediate(),s=n.getOptions();if(bs(s,e??{}))return i;ti(i,"already-initialized")}return n.initialize({options:e})}function m4(t,e){const n=(e==null?void 0:e.persistence)||[],r=(Array.isArray(n)?n:[n]).map(zr);e!=null&&e.errorMap&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(r,e==null?void 0:e.popupRedirectResolver)}function g4(t,e,n){const r=Ig(t);ke(/^https?:\/\//.test(e),r,"invalid-emulator-scheme");const i=!1,s=iS(e),{host:o,port:a}=y4(e),u=a===null?"":`:${a}`,c={url:`${s}//${o}${u}/`},h=Object.freeze({host:o,port:a,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:i})});if(!r._canInitEmulator){ke(r.config.emulator&&r.emulatorConfig,r,"emulator-config-failed"),ke(bs(c,r.config.emulator)&&bs(h,r.emulatorConfig),r,"emulator-config-failed");return}r.config.emulator=c,r.emulatorConfig=h,r.settings.appVerificationDisabledForTesting=!0,Ns(o)?(Pm(`${s}//${o}${u}`),Rm("Auth",!0)):v4()}function iS(t){const e=t.indexOf(":");return e<0?"":t.substr(0,e+1)}function y4(t){const e=iS(t),n=/(\/\/)?([^?#/]+)/.exec(t.substr(e.length));if(!n)return{host:"",port:null};const r=n[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(r);if(i){const s=i[1];return{host:s,port:hx(r.substr(s.length+1))}}else{const[s,o]=r.split(":");return{host:s,port:hx(o)}}}function hx(t){if(!t)return null;const e=Number(t);return isNaN(e)?null:e}function v4(){function t(){const e=document.createElement("p"),n=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",n.position="fixed",n.width="100%",n.backgroundColor="#ffffff",n.border=".1em solid #000000",n.color="#b50000",n.bottom="0px",n.left="0px",n.margin="0px",n.zIndex="10000",n.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",t):t())}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class sS{constructor(e,n){this.providerId=e,this.signInMethod=n}toJSON(){return Ur("not implemented")}_getIdTokenResponse(e){return Ur("not implemented")}_linkToIdToken(e,n){return Ur("not implemented")}_getReauthenticationResolver(e){return Ur("not implemented")}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function mo(t,e){return GR(t,"POST","/v1/accounts:signInWithIdp",Eg(t,e))}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const x4="http://localhost";class Is extends sS{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const n=new Is(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(n.idToken=e.idToken),e.accessToken&&(n.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(n.nonce=e.nonce),e.pendingToken&&(n.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(n.accessToken=e.oauthToken,n.secret=e.oauthTokenSecret):ti("argument-error"),n}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){const n=typeof e=="string"?JSON.parse(e):e,{providerId:r,signInMethod:i,...s}=n;if(!r||!i)return null;const o=new Is(r,i);return o.idToken=s.idToken||void 0,o.accessToken=s.accessToken||void 0,o.secret=s.secret,o.nonce=s.nonce,o.pendingToken=s.pendingToken||null,o}_getIdTokenResponse(e){const n=this.buildRequest();return mo(e,n)}_linkToIdToken(e,n){const r=this.buildRequest();return r.idToken=n,mo(e,r)}_getReauthenticationResolver(e){const n=this.buildRequest();return n.autoCreate=!1,mo(e,n)}buildRequest(){const e={requestUri:x4,returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{const n={};this.idToken&&(n.id_token=this.idToken),this.accessToken&&(n.access_token=this.accessToken),this.secret&&(n.oauth_token_secret=this.secret),n.providerId=this.providerId,this.nonce&&!this.pendingToken&&(n.nonce=this.nonce),e.postBody=bl(n)}return e}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class oS{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Al extends oS{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class yi extends Al{constructor(){super("facebook.com")}static credential(e){return Is._fromParams({providerId:yi.PROVIDER_ID,signInMethod:yi.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return yi.credentialFromTaggedObject(e)}static credentialFromError(e){return yi.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return yi.credential(e.oauthAccessToken)}catch{return null}}}yi.FACEBOOK_SIGN_IN_METHOD="facebook.com";yi.PROVIDER_ID="facebook.com";/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Mr extends Al{constructor(){super("google.com"),this.addScope("profile")}static credential(e,n){return Is._fromParams({providerId:Mr.PROVIDER_ID,signInMethod:Mr.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:n})}static credentialFromResult(e){return Mr.credentialFromTaggedObject(e)}static credentialFromError(e){return Mr.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:n,oauthAccessToken:r}=e;if(!n&&!r)return null;try{return Mr.credential(n,r)}catch{return null}}}Mr.GOOGLE_SIGN_IN_METHOD="google.com";Mr.PROVIDER_ID="google.com";/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class vi extends Al{constructor(){super("github.com")}static credential(e){return Is._fromParams({providerId:vi.PROVIDER_ID,signInMethod:vi.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return vi.credentialFromTaggedObject(e)}static credentialFromError(e){return vi.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return vi.credential(e.oauthAccessToken)}catch{return null}}}vi.GITHUB_SIGN_IN_METHOD="github.com";vi.PROVIDER_ID="github.com";/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class xi extends Al{constructor(){super("twitter.com")}static credential(e,n){return Is._fromParams({providerId:xi.PROVIDER_ID,signInMethod:xi.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:n})}static credentialFromResult(e){return xi.credentialFromTaggedObject(e)}static credentialFromError(e){return xi.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthAccessToken:n,oauthTokenSecret:r}=e;if(!n||!r)return null;try{return xi.credential(n,r)}catch{return null}}}xi.TWITTER_SIGN_IN_METHOD="twitter.com";xi.PROVIDER_ID="twitter.com";/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Ro{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,n,r,i=!1){const s=await sr._fromIdTokenResponse(e,r,i),o=fx(r);return new Ro({user:s,providerId:o,_tokenResponse:r,operationType:n})}static async _forOperation(e,n,r){await e._updateTokensIfNecessary(r,!0);const i=fx(r);return new Ro({user:e,providerId:i,_tokenResponse:r,operationType:n})}}function fx(t){return t.providerId?t.providerId:"phoneNumber"in t?"phone":null}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class jc extends Rr{constructor(e,n,r,i){super(n.code,n.message),this.operationType=r,this.user=i,Object.setPrototypeOf(this,jc.prototype),this.customData={appName:e.name,tenantId:e.tenantId??void 0,_serverResponse:n.customData._serverResponse,operationType:r}}static _fromErrorAndOperation(e,n,r,i){return new jc(e,n,r,i)}}function aS(t,e,n,r){return(e==="reauthenticate"?n._getReauthenticationResolver(t):n._getIdTokenResponse(t)).catch(s=>{throw s.code==="auth/multi-factor-auth-required"?jc._fromErrorAndOperation(t,s,e,r):s})}async function w4(t,e,n=!1){const r=await hl(t,e._linkToIdToken(t.auth,await t.getIdToken()),n);return Ro._forOperation(t,"link",r)}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function _4(t,e,n=!1){const{auth:r}=t;if(rr(r.app))return Promise.reject(ms(r));const i="reauthenticate";try{const s=await hl(t,aS(r,i,e,t),n);ke(s.idToken,r,"internal-error");const o=Sg(s.idToken);ke(o,r,"internal-error");const{sub:a}=o;return ke(t.uid===a,r,"user-mismatch"),Ro._forOperation(t,i,s)}catch(s){throw(s==null?void 0:s.code)==="auth/user-not-found"&&ti(r,"user-mismatch"),s}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function b4(t,e,n=!1){if(rr(t.app))return Promise.reject(ms(t));const r="signIn",i=await aS(t,r,e),s=await Ro._fromIdTokenResponse(t,r,i);return n||await t._updateCurrentUser(s.user),s}function E4(t,e,n,r){return Yt(t).onIdTokenChanged(e,n,r)}function S4(t,e,n){return Yt(t).beforeAuthStateChanged(e,n)}const Lc="__sak";/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class lS{constructor(e,n){this.storageRetriever=e,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(Lc,"1"),this.storage.removeItem(Lc),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,n){return this.storage.setItem(e,JSON.stringify(n)),Promise.resolve()}_get(e){const n=this.storage.getItem(e);return Promise.resolve(n?JSON.parse(n):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const T4=1e3,I4=10;class uS extends lS{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,n)=>this.onStorageEvent(e,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=nS(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(const n of Object.keys(this.listeners)){const r=this.storage.getItem(n),i=this.localCache[n];r!==i&&e(n,i,r)}}onStorageEvent(e,n=!1){if(!e.key){this.forAllChangedKeys((o,a,u)=>{this.notifyListeners(o,u)});return}const r=e.key;n?this.detachListener():this.stopPolling();const i=()=>{const o=this.storage.getItem(r);!n&&this.localCache[r]===o||this.notifyListeners(r,o)},s=this.storage.getItem(r);i4()&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(i,I4):i()}notifyListeners(e,n){this.localCache[e]=n;const r=this.listeners[e];if(r)for(const i of Array.from(r))i(n&&JSON.parse(n))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,n,r)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:n,newValue:r}),!0)})},T4)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,n){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(e,n){await super._set(e,n),this.localCache[e]=JSON.stringify(n)}async _get(e){const n=await super._get(e);return this.localCache[e]=JSON.stringify(n),n}async _remove(e){await super._remove(e),delete this.localCache[e]}}uS.type="LOCAL";const k4=uS;/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class cS extends lS{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,n){}_removeListener(e,n){}}cS.type="SESSION";const dS=cS;/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function C4(t){return Promise.all(t.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(n){return{fulfilled:!1,reason:n}}}))}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Nd{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){const n=this.receivers.find(i=>i.isListeningto(e));if(n)return n;const r=new Nd(e);return this.receivers.push(r),r}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const n=e,{eventId:r,eventType:i,data:s}=n.data,o=this.handlersMap[i];if(!(o!=null&&o.size))return;n.ports[0].postMessage({status:"ack",eventId:r,eventType:i});const a=Array.from(o).map(async c=>c(n.origin,s)),u=await C4(a);n.ports[0].postMessage({status:"done",eventId:r,eventType:i,response:u})}_subscribe(e,n){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(n)}_unsubscribe(e,n){this.handlersMap[e]&&n&&this.handlersMap[e].delete(n),(!n||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}Nd.receivers=[];/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Cg(t="",e=10){let n="";for(let r=0;r{const c=Cg("",20);i.port1.start();const h=setTimeout(()=>{u(new Error("unsupported_event"))},r);o={messageChannel:i,onMessage(f){const p=f;if(p.data.eventId===c)switch(p.data.status){case"ack":clearTimeout(h),s=setTimeout(()=>{u(new Error("timeout"))},3e3);break;case"done":clearTimeout(s),a(p.data.response);break;default:clearTimeout(h),clearTimeout(s),u(new Error("invalid_response"));break}}},this.handlers.add(o),i.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:c,data:n},[i.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Cr(){return window}function A4(t){Cr().location.href=t}/** + * @license + * Copyright 2020 Google LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function hS(){return typeof Cr().WorkerGlobalScope<"u"&&typeof Cr().importScripts=="function"}async function P4(){if(!(navigator!=null&&navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function R4(){var t;return((t=navigator==null?void 0:navigator.serviceWorker)==null?void 0:t.controller)||null}function D4(){return hS()?self:null}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const fS="firebaseLocalStorageDb",j4=1,Oc="firebaseLocalStorage",pS="fbase_key";class Pl{constructor(e){this.request=e}toPromise(){return new Promise((e,n)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{n(this.request.error)})})}}function Ad(t,e){return t.transaction([Oc],e?"readwrite":"readonly").objectStore(Oc)}function L4(){const t=indexedDB.deleteDatabase(fS);return new Pl(t).toPromise()}function wp(){const t=indexedDB.open(fS,j4);return new Promise((e,n)=>{t.addEventListener("error",()=>{n(t.error)}),t.addEventListener("upgradeneeded",()=>{const r=t.result;try{r.createObjectStore(Oc,{keyPath:pS})}catch(i){n(i)}}),t.addEventListener("success",async()=>{const r=t.result;r.objectStoreNames.contains(Oc)?e(r):(r.close(),await L4(),e(await wp()))})})}async function px(t,e,n){const r=Ad(t,!0).put({[pS]:e,value:n});return new Pl(r).toPromise()}async function O4(t,e){const n=Ad(t,!1).get(e),r=await new Pl(n).toPromise();return r===void 0?null:r.value}function mx(t,e){const n=Ad(t,!0).delete(e);return new Pl(n).toPromise()}const M4=800,V4=3;class mS{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.db?this.db:(this.db=await wp(),this.db)}async _withRetries(e){let n=0;for(;;)try{const r=await this._openDb();return await e(r)}catch(r){if(n++>V4)throw r;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return hS()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Nd._getInstance(D4()),this.receiver._subscribe("keyChanged",async(e,n)=>({keyProcessed:(await this._poll()).includes(n.key)})),this.receiver._subscribe("ping",async(e,n)=>["keyChanged"])}async initializeSender(){var n,r;if(this.activeServiceWorker=await P4(),!this.activeServiceWorker)return;this.sender=new N4(this.activeServiceWorker);const e=await this.sender._send("ping",{},800);e&&(n=e[0])!=null&&n.fulfilled&&(r=e[0])!=null&&r.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||R4()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;const e=await wp();return await px(e,Lc,"1"),await mx(e,Lc),!0}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,n){return this._withPendingWrite(async()=>(await this._withRetries(r=>px(r,e,n)),this.localCache[e]=n,this.notifyServiceWorker(e)))}async _get(e){const n=await this._withRetries(r=>O4(r,e));return this.localCache[e]=n,n}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(n=>mx(n,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){const e=await this._withRetries(i=>{const s=Ad(i,!1).getAll();return new Pl(s).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];const n=[],r=new Set;if(e.length!==0)for(const{fbase_key:i,value:s}of e)r.add(i),JSON.stringify(this.localCache[i])!==JSON.stringify(s)&&(this.notifyListeners(i,s),n.push(i));for(const i of Object.keys(this.localCache))this.localCache[i]&&!r.has(i)&&(this.notifyListeners(i,null),n.push(i));return n}notifyListeners(e,n){this.localCache[e]=n;const r=this.listeners[e];if(r)for(const i of Array.from(r))i(n)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),M4)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,n){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&this.stopPolling()}}mS.type="LOCAL";const F4=mS;new Nl(3e4,6e4);/** + * @license + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function U4(t,e){return e?zr(e):(ke(t._popupRedirectResolver,t,"argument-error"),t._popupRedirectResolver)}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Ng extends sS{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return mo(e,this._buildIdpRequest())}_linkToIdToken(e,n){return mo(e,this._buildIdpRequest(n))}_getReauthenticationResolver(e){return mo(e,this._buildIdpRequest())}_buildIdpRequest(e){const n={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(n.idToken=e),n}}function z4(t){return b4(t.auth,new Ng(t),t.bypassAuthState)}function B4(t){const{auth:e,user:n}=t;return ke(n,e,"internal-error"),_4(n,new Ng(t),t.bypassAuthState)}async function $4(t){const{auth:e,user:n}=t;return ke(n,e,"internal-error"),w4(n,new Ng(t),t.bypassAuthState)}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class gS{constructor(e,n,r,i,s=!1){this.auth=e,this.resolver=r,this.user=i,this.bypassAuthState=s,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(n)?n:[n]}execute(){return new Promise(async(e,n)=>{this.pendingPromise={resolve:e,reject:n};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(r){this.reject(r)}})}async onAuthEvent(e){const{urlResponse:n,sessionId:r,postBody:i,tenantId:s,error:o,type:a}=e;if(o){this.reject(o);return}const u={auth:this.auth,requestUri:n,sessionId:r,tenantId:s||void 0,postBody:i||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(a)(u))}catch(c){this.reject(c)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return z4;case"linkViaPopup":case"linkViaRedirect":return $4;case"reauthViaPopup":case"reauthViaRedirect":return B4;default:ti(this.auth,"internal-error")}}resolve(e){ni(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){ni(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const H4=new Nl(2e3,1e4);class no extends gS{constructor(e,n,r,i,s){super(e,n,i,s),this.provider=r,this.authWindow=null,this.pollId=null,no.currentPopupAction&&no.currentPopupAction.cancel(),no.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return ke(e,this.auth,"internal-error"),e}async onExecution(){ni(this.filter.length===1,"Popup operations only handle one event");const e=Cg();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(n=>{this.reject(n)}),this.resolver._isIframeWebStorageSupported(this.auth,n=>{n||this.reject(kr(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return((e=this.authWindow)==null?void 0:e.associatedEvent)||null}cancel(){this.reject(kr(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,no.currentPopupAction=null}pollUserCancellation(){const e=()=>{var n,r;if((r=(n=this.authWindow)==null?void 0:n.window)!=null&&r.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(kr(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,H4.get())};e()}}no.currentPopupAction=null;/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const q4="pendingRedirect",Uu=new Map;class W4 extends gS{constructor(e,n,r=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,r),this.eventId=null}async execute(){let e=Uu.get(this.auth._key());if(!e){try{const r=await G4(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(r)}catch(n){e=()=>Promise.reject(n)}Uu.set(this.auth._key(),e)}return this.bypassAuthState||Uu.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if(e.type==="signInViaRedirect")return super.onAuthEvent(e);if(e.type==="unknown"){this.resolve(null);return}if(e.eventId){const n=await this.auth._redirectUserForId(e.eventId);if(n)return this.user=n,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}}async function G4(t,e){const n=Y4(e),r=Q4(t);if(!await r._isAvailable())return!1;const i=await r._get(n)==="true";return await r._remove(n),i}function K4(t,e){Uu.set(t._key(),e)}function Q4(t){return zr(t._redirectPersistence)}function Y4(t){return Fu(q4,t.config.apiKey,t.name)}async function X4(t,e,n=!1){if(rr(t.app))return Promise.reject(ms(t));const r=Ig(t),i=U4(r,e),o=await new W4(r,i,n).execute();return o&&!n&&(delete o.user._redirectEventId,await r._persistUserIfCurrent(o.user),await r._setRedirectUser(null,e)),o}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const J4=10*60*1e3;class Z4{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let n=!1;return this.consumers.forEach(r=>{this.isEventForConsumer(e,r)&&(n=!0,this.sendToConsumer(e,r),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!eD(e)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=e,n=!0)),n}sendToConsumer(e,n){var r;if(e.error&&!yS(e)){const i=((r=e.error.code)==null?void 0:r.split("auth/")[1])||"internal-error";n.onError(kr(this.auth,i))}else n.onAuthEvent(e)}isEventForConsumer(e,n){const r=n.eventId===null||!!e.eventId&&e.eventId===n.eventId;return n.filter.includes(e.type)&&r}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=J4&&this.cachedEventUids.clear(),this.cachedEventUids.has(gx(e))}saveEventToCache(e){this.cachedEventUids.add(gx(e)),this.lastProcessedEventTime=Date.now()}}function gx(t){return[t.type,t.eventId,t.sessionId,t.tenantId].filter(e=>e).join("-")}function yS({type:t,error:e}){return t==="unknown"&&(e==null?void 0:e.code)==="auth/no-auth-event"}function eD(t){switch(t.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return yS(t);default:return!1}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function tD(t,e={}){return Bo(t,"GET","/v1/projects",e)}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const nD=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,rD=/^https?/;async function iD(t){if(t.config.emulator)return;const{authorizedDomains:e}=await tD(t);for(const n of e)try{if(sD(n))return}catch{}ti(t,"unauthorized-domain")}function sD(t){const e=vp(),{protocol:n,hostname:r}=new URL(e);if(t.startsWith("chrome-extension://")){const o=new URL(t);return o.hostname===""&&r===""?n==="chrome-extension:"&&t.replace("chrome-extension://","")===e.replace("chrome-extension://",""):n==="chrome-extension:"&&o.hostname===r}if(!rD.test(n))return!1;if(nD.test(t))return r===t;const i=t.replace(/\./g,"\\.");return new RegExp("^(.+\\."+i+"|"+i+")$","i").test(r)}/** + * @license + * Copyright 2020 Google LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const oD=new Nl(3e4,6e4);function yx(){const t=Cr().___jsl;if(t!=null&&t.H){for(const e of Object.keys(t.H))if(t.H[e].r=t.H[e].r||[],t.H[e].L=t.H[e].L||[],t.H[e].r=[...t.H[e].L],t.CP)for(let n=0;n{var i,s,o;function r(){yx(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{yx(),n(kr(t,"network-request-failed"))},timeout:oD.get()})}if((s=(i=Cr().gapi)==null?void 0:i.iframes)!=null&&s.Iframe)e(gapi.iframes.getContext());else if((o=Cr().gapi)!=null&&o.load)r();else{const a=f4("iframefcb");return Cr()[a]=()=>{gapi.load?r():n(kr(t,"network-request-failed"))},d4(`${h4()}?onload=${a}`).catch(u=>n(u))}}).catch(e=>{throw zu=null,e})}let zu=null;function lD(t){return zu=zu||aD(t),zu}/** + * @license + * Copyright 2020 Google LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const uD=new Nl(5e3,15e3),cD="__/auth/iframe",dD="emulator/auth/iframe",hD={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},fD=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function pD(t){const e=t.config;ke(e.authDomain,t,"auth-domain-config-required");const n=e.emulator?bg(e,dD):`https://${t.config.authDomain}/${cD}`,r={apiKey:e.apiKey,appName:t.name,v:As},i=fD.get(t.config.apiHost);i&&(r.eid=i);const s=t._getFrameworks();return s.length&&(r.fw=s.join(",")),`${n}?${bl(r).slice(1)}`}async function mD(t){const e=await lD(t),n=Cr().gapi;return ke(n,t,"internal-error"),e.open({where:document.body,url:pD(t),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:hD,dontclear:!0},r=>new Promise(async(i,s)=>{await r.restyle({setHideOnLeave:!1});const o=kr(t,"network-request-failed"),a=Cr().setTimeout(()=>{s(o)},uD.get());function u(){Cr().clearTimeout(a),i(r)}r.ping(u).then(u,()=>{s(o)})}))}/** + * @license + * Copyright 2020 Google LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const gD={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},yD=500,vD=600,xD="_blank",wD="http://localhost";class vx{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function _D(t,e,n,r=yD,i=vD){const s=Math.max((window.screen.availHeight-i)/2,0).toString(),o=Math.max((window.screen.availWidth-r)/2,0).toString();let a="";const u={...gD,width:r.toString(),height:i.toString(),top:s,left:o},c=on().toLowerCase();n&&(a=XE(c)?xD:n),QE(c)&&(e=e||wD,u.scrollbars="yes");const h=Object.entries(u).reduce((p,[g,_])=>`${p}${g}=${_},`,"");if(r4(c)&&a!=="_self")return bD(e||"",a),new vx(null);const f=window.open(e||"",a,h);ke(f,t,"popup-blocked");try{f.focus()}catch{}return new vx(f)}function bD(t,e){const n=document.createElement("a");n.href=t,n.target=e;const r=document.createEvent("MouseEvent");r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(r)}/** + * @license + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const ED="__/auth/handler",SD="emulator/auth/handler",TD=encodeURIComponent("fac");async function xx(t,e,n,r,i,s){ke(t.config.authDomain,t,"auth-domain-config-required"),ke(t.config.apiKey,t,"invalid-api-key");const o={apiKey:t.config.apiKey,appName:t.name,authType:n,redirectUrl:r,v:As,eventId:i};if(e instanceof oS){e.setDefaultLanguage(t.languageCode),o.providerId=e.providerId||"",U2(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(const[h,f]of Object.entries({}))o[h]=f}if(e instanceof Al){const h=e.getScopes().filter(f=>f!=="");h.length>0&&(o.scopes=h.join(","))}t.tenantId&&(o.tid=t.tenantId);const a=o;for(const h of Object.keys(a))a[h]===void 0&&delete a[h];const u=await t._getAppCheckToken(),c=u?`#${TD}=${encodeURIComponent(u)}`:"";return`${ID(t)}?${bl(a).slice(1)}${c}`}function ID({config:t}){return t.emulator?bg(t,SD):`https://${t.authDomain}/${ED}`}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Lh="webStorageSupport";class kD{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=dS,this._completeRedirectFn=X4,this._overrideRedirectResult=K4}async _openPopup(e,n,r,i){var o;ni((o=this.eventManagers[e._key()])==null?void 0:o.manager,"_initialize() not called before _openPopup()");const s=await xx(e,n,r,vp(),i);return _D(e,s,Cg())}async _openRedirect(e,n,r,i){await this._originValidation(e);const s=await xx(e,n,r,vp(),i);return A4(s),new Promise(()=>{})}_initialize(e){const n=e._key();if(this.eventManagers[n]){const{manager:i,promise:s}=this.eventManagers[n];return i?Promise.resolve(i):(ni(s,"If manager is not set, promise should be"),s)}const r=this.initAndGetManager(e);return this.eventManagers[n]={promise:r},r.catch(()=>{delete this.eventManagers[n]}),r}async initAndGetManager(e){const n=await mD(e),r=new Z4(e);return n.register("authEvent",i=>(ke(i==null?void 0:i.authEvent,e,"invalid-auth-event"),{status:r.onEvent(i.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:r},this.iframes[e._key()]=n,r}_isIframeWebStorageSupported(e,n){this.iframes[e._key()].send(Lh,{type:Lh},i=>{var o;const s=(o=i==null?void 0:i[0])==null?void 0:o[Lh];s!==void 0&&n(!!s),ti(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const n=e._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=iD(e)),this.originValidationPromises[n]}get _shouldInitProactively(){return nS()||YE()||Tg()}}const CD=kD;var wx="@firebase/auth",_x="1.11.1";/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class ND{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),((e=this.auth.currentUser)==null?void 0:e.uid)||null}async getToken(e){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;const n=this.auth.onIdTokenChanged(r=>{e((r==null?void 0:r.stsTokenManager.accessToken)||null)});this.internalListeners.set(e,n),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();const n=this.internalListeners.get(e);n&&(this.internalListeners.delete(e),n(),this.updateProactiveRefresh())}assertAuthConfigured(){ke(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function AD(t){switch(t){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function PD(t){Es(new Vi("auth",(e,{options:n})=>{const r=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),s=e.getProvider("app-check-internal"),{apiKey:o,authDomain:a}=r.options;ke(o&&!o.includes(":"),"invalid-api-key",{appName:r.name});const u={apiKey:o,authDomain:a,clientPlatform:t,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:rS(t)},c=new u4(r,i,s,u);return m4(c,n),c},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,n,r)=>{e.getProvider("auth-internal").initialize()})),Es(new Vi("auth-internal",e=>{const n=Ig(e.getProvider("auth").getImmediate());return(r=>new ND(r))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),br(wx,_x,AD(t)),br(wx,_x,"esm2020")}/** + * @license + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const RD=5*60,DD=Z1("authIdTokenMaxAge")||RD;let bx=null;const jD=t=>async e=>{const n=e&&await e.getIdTokenResult(),r=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(r&&r>DD)return;const i=n==null?void 0:n.token;bx!==i&&(bx=i,await fetch(t,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))};function LD(t=Lm()){const e=od(t,"auth");if(e.isInitialized())return e.getImmediate();const n=p4(t,{popupRedirectResolver:CD,persistence:[F4,k4,dS]}),r=Z1("authTokenSyncURL");if(r&&typeof isSecureContext=="boolean"&&isSecureContext){const s=new URL(r,location.origin);if(location.origin===s.origin){const o=jD(s.toString());S4(n,o,()=>o(n.currentUser)),E4(n,a=>o(a))}}const i=Y1("auth");return i&&g4(n,`http://${i}`),n}function OD(){var t;return((t=document.getElementsByTagName("head"))==null?void 0:t[0])??document}c4({loadJS(t){return new Promise((e,n)=>{const r=document.createElement("script");r.setAttribute("src",t),r.onload=e,r.onerror=i=>{const s=kr("internal-error");s.customData=i,n(s)},r.type="text/javascript",r.charset="UTF-8",OD().appendChild(r)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="});PD("Browser");const MD={apiKey:"AIzaSyAH3jvbe0_QLzIuuv5kTMK8246HNvohvfE",authDomain:"twistedbrody-9d163.firebaseapp.com",projectId:"twistedbrody-9d163",storageBucket:"twistedbrody-9d163.firebasestorage.app",messagingSenderId:"733213514129",appId:"1:733213514129:web:e9694684f5c3994ed06230",measurementId:"G-N8TQ7MY42W"},Ag=rb(MD),Be=YP(Ag);LR(Ag);LD(Ag);new Mr;function fl(t){if(t!=null){if(Array.isArray(t)){const e=t.map(n=>fl(n)).filter(n=>n!=null&&n!=="");return e.length>0?e:void 0}if(typeof t=="object"&&!(t instanceof We)){const e={};for(const n in t)if(t.hasOwnProperty(n)){const r=fl(t[n]);r!=null&&(e[n]=r)}return Object.keys(e).length>0?e:void 0}return t}}const Rl={MANGA_PREFIX:"mangalib_detail_v2_"};function Pd(t,e){try{localStorage.setItem(t,JSON.stringify(e))}catch(n){console.warn(`Error saving ${t} to localStorage`,n)}}function VD(t){try{localStorage.removeItem(t)}catch(e){console.warn(`Error removing ${t} from localStorage`,e)}}async function Rd(){const t=Zr(Cn(Be,"mangas"),oR("created_at","desc")),e=await lr(t),r=(await lr(Cn(Be,"categories"))).docs.reduce((o,a)=>(o[a.id]={id:a.id,...a.data()},o),{}),i=await Promise.all(e.docs.map(async o=>{var a,u;try{const c=o.data();let h=new Date().toISOString();(a=c.created_at)!=null&&a.toDate?h=c.created_at.toDate().toISOString():c.created_at&&(h=new Date(c.created_at).toISOString());let f=h;(u=c.updated_at)!=null&&u.toDate&&(f=c.updated_at.toDate().toISOString());const p=Zr(Cn(Be,"chapters"),Ds("manga_id","==",o.id)),_=(await lr(p)).docs.map(y=>{var U,j;const w=y.data(),k=(U=w.created_at)!=null&&U.toDate?w.created_at.toDate().toISOString():new Date().toISOString(),L=(j=w.updated_at)!=null&&j.toDate?w.updated_at.toDate().toISOString():new Date().toISOString();return{id:y.id,manga_id:w.manga_id,number:w.number,title:w.title,pages:w.pages||[],page_formats:w.page_formats||[],original_pages:w.original_pages||[],created_at:k,updated_at:L}}).sort((y,w)=>y.number-w.number),R=(c.categories||[]).map(y=>r[y]).filter(y=>y!==void 0);return{id:o.id,...c,created_at:h,updated_at:f,categories:R,chapters:_}}catch(c){return console.error(`[DATA ERROR] Skipping corrupt manga ${o.id}:`,c),null}})),s=i.filter(o=>o!==null);return console.log(`[DATA] Loaded ${s.length} mangas (Skipped ${i.length-s.length} corrupt)`),s}const Do=new Map;async function vS(t){var h,f;const e=Pt(Be,"mangas",t),n=await ei(e);if(!n.exists())return null;const r=n.data(),i=Zr(Cn(Be,"chapters"),Ds("manga_id","==",t)),o=(await lr(i)).docs.map(p=>{const g=p.data();return{id:p.id,manga_id:g.manga_id,number:g.number,title:g.title,pages:g.pages||[],page_formats:g.page_formats||[],original_pages:g.original_pages||[],created_at:g.created_at.toDate().toISOString(),updated_at:g.updated_at.toDate().toISOString()}}).sort((p,g)=>p.number-g.number),a=r.categories||[],u=[];for(const p of a){const g=Pt(Be,"categories",p),_=await ei(g);_.exists()&&u.push({id:_.id,..._.data(),created_at:((f=(h=_.data().created_at)==null?void 0:h.toDate)==null?void 0:f.call(h).toISOString())||new Date().toISOString()})}const c={id:n.id,...r,created_at:r.created_at.toDate().toISOString(),categories:u,chapters:o,updated_at:r.updated_at?r.updated_at.toDate().toISOString():r.created_at.toDate().toISOString()};return Do.set(t,c),Pd(`${Rl.MANGA_PREFIX}${t}`,c),c}function FD(t,e){const n=Pt(Be,"mangas",t);return wg(n,async r=>{if(!r.exists()){e(null);return}const i=r.data();let s=Do.get(t),o=(s==null?void 0:s.chapters)||[],a=(s==null?void 0:s.categories)||[];if(!s){const c=Zr(Cn(Be,"chapters"),Ds("manga_id","==",t));o=(await lr(c)).docs.map(p=>({id:p.id,...p.data(),created_at:p.data().created_at.toDate().toISOString(),updated_at:p.data().updated_at.toDate().toISOString()})).sort((p,g)=>p.number-g.number);const f=i.categories||[];a=[];for(const p of f){const g=await ei(Pt(Be,"categories",p));g.exists()&&a.push({id:g.id,...g.data()})}}const u={id:r.id,...i,chapters:o,categories:a,created_at:i.created_at.toDate().toISOString(),updated_at:i.updated_at?i.updated_at.toDate().toISOString():i.created_at.toDate().toISOString()};Do.set(t,u),Pd(`${Rl.MANGA_PREFIX}${t}`,u),e(u)})}async function UD(t){const e=We.now(),n={title:t.title,author:t.author,description:t.description||"",status:t.status||"En curso",categories:t.categoryIds||[],views:0,rating:0,created_at:e,updated_at:e};t.thumbnail_url&&(n.thumbnail_url=t.thumbnail_url),t.cover_url&&(n.cover_url=t.cover_url);const r=await xg(Cn(Be,"mangas"),n),i=new Date().toISOString(),s={id:r.id,title:t.title,author:t.author,description:t.description||"",status:t.status||"En curso",categories:t.categoryIds||[],chapters:[],views:0,rating:0,created_at:i,updated_at:i};return t.thumbnail_url&&(s.thumbnail_url=t.thumbnail_url),t.cover_url&&(s.cover_url=t.cover_url),Do.set(s.id,s),Pd(`${Rl.MANGA_PREFIX}${s.id}`,s),s}async function xS(){return(await lr(Cn(Be,"categories"))).docs.map(e=>({id:e.id,...e.data()}))}async function wS(t,e="genre"){const n=await xg(Cn(Be,"categories"),{name:t,type:e}),r=await ei(n);return{id:r.id,...r.data()}}async function _S(t){const e=Pt(Be,"categories",t);await yp(e);const n=Zr(Cn(Be,"mangas"),Ds("categories","array-contains",t)),i=(await lr(n)).docs.map(s=>{const u=(s.data().categories||[]).filter(c=>c!==t);return Xi(Pt(Be,"mangas",s.id),{categories:u})});await Promise.all(i)}async function Ex(t){const e=We.now(),n=await xg(Cn(Be,"chapters"),{manga_id:t.manga_id,number:t.number,title:t.title,pages:t.pages,page_formats:t.page_formats||[],original_pages:t.original_pages||[],created_at:e,updated_at:e}),r=await ei(n),i=r.data();return{id:r.id,manga_id:i.manga_id,number:i.number,title:i.title,pages:i.pages||[],page_formats:i.page_formats||[],original_pages:i.original_pages||[],created_at:i.created_at.toDate().toISOString(),updated_at:i.updated_at.toDate().toISOString()}}async function zD(){const e=(await Rd()).map(n=>{const r=Pt(Be,"mangas",n.id);return Xi(r,{views:0})});await Promise.all(e)}async function BD(t){const e=Pt(Be,"mangas",t);await Xi(e,{views:uR(1)})}async function bS(t,e){var _,T;const n=Pt(Be,"mangas",t),r=We.now(),i={title:e.title,author:e.author,categories:e.categoryIds||[],updated_at:r};e.status&&(i.status=e.status),e.description!==void 0&&e.description!==null&&(i.description=e.description),e.thumbnail_url&&(i.thumbnail_url=e.thumbnail_url),e.cover_url&&(i.cover_url=e.cover_url);const s=fl(i);await Xi(n,s);const o=await ei(n);if(!o.exists())throw new Error("Manga no encontrado");const a=o.data(),u=Zr(Cn(Be,"chapters"),Ds("manga_id","==",t)),h=(await lr(u)).docs.map(R=>{const y=R.data();return{id:R.id,manga_id:y.manga_id,number:y.number,title:y.title,pages:y.pages||[],page_formats:y.page_formats||[],original_pages:y.original_pages||[],created_at:y.created_at.toDate().toISOString(),updated_at:y.updated_at.toDate().toISOString()}}).sort((R,y)=>R.number-y.number),f=a.categories||[],p=[];for(const R of f){const y=Pt(Be,"categories",R),w=await ei(y);w.exists()&&p.push({id:w.id,...w.data(),created_at:((T=(_=w.data().created_at)==null?void 0:_.toDate)==null?void 0:T.call(_).toISOString())||new Date().toISOString()})}const g={id:o.id,...a,created_at:a.created_at.toDate().toISOString(),categories:p,chapters:h,updated_at:a.updated_at.toDate().toISOString()};return Do.set(g.id,g),Pd(`${Rl.MANGA_PREFIX}${g.id}`,g),g}async function Sx(t){const e=Pt(Be,"mangas",t),n=Zr(Cn(Be,"chapters"),Ds("manga_id","==",t)),r=await lr(n);for(const i of r.docs)await yp(i.ref);await yp(e),Do.delete(t),VD(`${Rl.MANGA_PREFIX}${t}`)}async function $D(t,e){const n=Pt(Be,"mangas",t),r=await ei(n);if(!r.exists())throw new Error("Manga no encontrado");const s={external_links:[...r.data().external_links||[],e]},o=fl(s);await Xi(n,o)}async function HD(t,e){const n=Pt(Be,"mangas",t),r=await ei(n);if(!r.exists())throw new Error("Manga no encontrado");const s={external_links:(r.data().external_links||[]).filter((a,u)=>u!==e)},o=fl(s);await Xi(n,o)}async function qD(t,e,n,r){const s=(await Rd()).filter(o=>o.id!==t).map(o=>{var T,R;let a=0;const u=((T=o.categories)==null?void 0:T.map(y=>y.id))||[],c=e.filter(y=>u.includes(y));a+=c.length*10;const h=n.toLowerCase().split(/\s+/).filter(y=>y.length>2),f=o.title.toLowerCase().split(/\s+/).filter(y=>y.length>2),p=h.filter(y=>f.includes(y));a+=p.length*5;const g=((R=o.author)==null?void 0:R.toLowerCase().split(/\s+/).filter(y=>y.length>2))||[],_=h.filter(y=>g.includes(y));return a+=_.length*3,{manga:o,score:a}}).filter(o=>o.score>0).sort((o,a)=>{const u=o.manga.title.toLowerCase(),c=a.manga.title.toLowerCase();return u.localeCompare(c)}).map(o=>o.manga);return r?s.slice(0,r):s}async function WD(t){const e=Zr(Cn(Be,"mangas"),Ds("author","==",t)),r=(await lr(e)).docs.map(i=>Xi(Pt(Be,"mangas",i.id),{author:""}));await Promise.all(r)}async function GD(){const t=Zr(Cn(Be,"mangas")),e=await lr(t),n=new Set;return e.forEach(r=>{const i=r.data();i&&i.author&&typeof i.author=="string"&&i.author.trim()!==""&&n.add(i.author.trim())}),Array.from(n).sort()}function KD(t){if(typeof document>"u")return;let e=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",e.appendChild(n),n.styleSheet?n.styleSheet.cssText=t:n.appendChild(document.createTextNode(t))}const QD=t=>{switch(t){case"success":return JD;case"info":return ej;case"warning":return ZD;case"error":return tj;default:return null}},YD=Array(12).fill(0),XD=({visible:t,className:e})=>ne.createElement("div",{className:["sonner-loading-wrapper",e].filter(Boolean).join(" "),"data-visible":t},ne.createElement("div",{className:"sonner-spinner"},YD.map((n,r)=>ne.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),JD=ne.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ne.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),ZD=ne.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},ne.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),ej=ne.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ne.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),tj=ne.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ne.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),nj=ne.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},ne.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),ne.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),rj=()=>{const[t,e]=ne.useState(document.hidden);return ne.useEffect(()=>{const n=()=>{e(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),t};let _p=1;class ij{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{const n=this.subscribers.indexOf(e);this.subscribers.splice(n,1)}),this.publish=e=>{this.subscribers.forEach(n=>n(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var n;const{message:r,...i}=e,s=typeof(e==null?void 0:e.id)=="number"||((n=e.id)==null?void 0:n.length)>0?e.id:_p++,o=this.toasts.find(u=>u.id===s),a=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(s)&&this.dismissedToasts.delete(s),o?this.toasts=this.toasts.map(u=>u.id===s?(this.publish({...u,...e,id:s,title:r}),{...u,...e,id:s,dismissible:a,title:r}):u):this.addToast({title:r,...i,dismissible:a,id:s}),s},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(n=>n({id:e,dismiss:!0})))):this.toasts.forEach(n=>{this.subscribers.forEach(r=>r({id:n.id,dismiss:!0}))}),e),this.message=(e,n)=>this.create({...n,message:e}),this.error=(e,n)=>this.create({...n,message:e,type:"error"}),this.success=(e,n)=>this.create({...n,type:"success",message:e}),this.info=(e,n)=>this.create({...n,type:"info",message:e}),this.warning=(e,n)=>this.create({...n,type:"warning",message:e}),this.loading=(e,n)=>this.create({...n,type:"loading",message:e}),this.promise=(e,n)=>{if(!n)return;let r;n.loading!==void 0&&(r=this.create({...n,promise:e,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));const i=Promise.resolve(e instanceof Function?e():e);let s=r!==void 0,o;const a=i.then(async c=>{if(o=["resolve",c],ne.isValidElement(c))s=!1,this.create({id:r,type:"default",message:c});else if(oj(c)&&!c.ok){s=!1;const f=typeof n.error=="function"?await n.error(`HTTP error! status: ${c.status}`):n.error,p=typeof n.description=="function"?await n.description(`HTTP error! status: ${c.status}`):n.description,_=typeof f=="object"&&!ne.isValidElement(f)?f:{message:f};this.create({id:r,type:"error",description:p,..._})}else if(c instanceof Error){s=!1;const f=typeof n.error=="function"?await n.error(c):n.error,p=typeof n.description=="function"?await n.description(c):n.description,_=typeof f=="object"&&!ne.isValidElement(f)?f:{message:f};this.create({id:r,type:"error",description:p,..._})}else if(n.success!==void 0){s=!1;const f=typeof n.success=="function"?await n.success(c):n.success,p=typeof n.description=="function"?await n.description(c):n.description,_=typeof f=="object"&&!ne.isValidElement(f)?f:{message:f};this.create({id:r,type:"success",description:p,..._})}}).catch(async c=>{if(o=["reject",c],n.error!==void 0){s=!1;const h=typeof n.error=="function"?await n.error(c):n.error,f=typeof n.description=="function"?await n.description(c):n.description,g=typeof h=="object"&&!ne.isValidElement(h)?h:{message:h};this.create({id:r,type:"error",description:f,...g})}}).finally(()=>{s&&(this.dismiss(r),r=void 0),n.finally==null||n.finally.call(n)}),u=()=>new Promise((c,h)=>a.then(()=>o[0]==="reject"?h(o[1]):c(o[1])).catch(h));return typeof r!="string"&&typeof r!="number"?{unwrap:u}:Object.assign(r,{unwrap:u})},this.custom=(e,n)=>{const r=(n==null?void 0:n.id)||_p++;return this.create({jsx:e(r),id:r,...n}),r},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const vn=new ij,sj=(t,e)=>{const n=(e==null?void 0:e.id)||_p++;return vn.addToast({title:t,...e,id:n}),n},oj=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",aj=sj,lj=()=>vn.toasts,uj=()=>vn.getActiveToasts(),kt=Object.assign(aj,{success:vn.success,info:vn.info,warning:vn.warning,error:vn.error,custom:vn.custom,message:vn.message,promise:vn.promise,dismiss:vn.dismiss,loading:vn.loading},{getHistory:lj,getToasts:uj});KD("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function gu(t){return t.label!==void 0}const cj=3,dj="24px",hj="16px",Tx=4e3,fj=356,pj=14,mj=45,gj=200;function pr(...t){return t.filter(Boolean).join(" ")}function yj(t){const[e,n]=t.split("-"),r=[];return e&&r.push(e),n&&r.push(n),r}const vj=t=>{var e,n,r,i,s,o,a,u,c;const{invert:h,toast:f,unstyled:p,interacting:g,setHeights:_,visibleToasts:T,heights:R,index:y,toasts:w,expanded:k,removeToast:L,defaultRichColors:U,closeButton:j,style:b,cancelButtonStyle:x,actionButtonStyle:E,className:I="",descriptionClassName:N="",duration:D,position:C,gap:ge,expandByDefault:ie,classNames:fe,icons:we,closeButtonAriaLabel:G="Close toast"}=t,[se,A]=ne.useState(null),[pe,_e]=ne.useState(null),[P,$]=ne.useState(!1),[Y,re]=ne.useState(!1),[Ce,de]=ne.useState(!1),[Qe,Ze]=ne.useState(!1),[dt,Vt]=ne.useState(!1),[xt,Rt]=ne.useState(0),[ln,St]=ne.useState(0),st=ne.useRef(f.duration||D||Tx),Ht=ne.useRef(null),Oe=ne.useRef(null),Ye=y===0,ee=y+1<=T,Q=f.type,V=f.dismissible!==!1,K=f.className||"",me=f.descriptionClassName||"",O=ne.useMemo(()=>R.findIndex(Se=>Se.toastId===f.id)||0,[R,f.id]),B=ne.useMemo(()=>{var Se;return(Se=f.closeButton)!=null?Se:j},[f.closeButton,j]),oe=ne.useMemo(()=>f.duration||D||Tx,[f.duration,D]),le=ne.useRef(0),he=ne.useRef(0),$e=ne.useRef(0),je=ne.useRef(null),[He,et]=C.split("-"),H=ne.useMemo(()=>R.reduce((Se,ut,Ft)=>Ft>=O?Se:Se+ut.height,0),[R,O]),Z=rj(),be=f.invert||h,ye=Q==="loading";he.current=ne.useMemo(()=>O*ge+H,[O,H]),ne.useEffect(()=>{st.current=oe},[oe]),ne.useEffect(()=>{$(!0)},[]),ne.useEffect(()=>{const Se=Oe.current;if(Se){const ut=Se.getBoundingClientRect().height;return St(ut),_(Ft=>[{toastId:f.id,height:ut,position:f.position},...Ft]),()=>_(Ft=>Ft.filter(un=>un.toastId!==f.id))}},[_,f.id]),ne.useLayoutEffect(()=>{if(!P)return;const Se=Oe.current,ut=Se.style.height;Se.style.height="auto";const Ft=Se.getBoundingClientRect().height;Se.style.height=ut,St(Ft),_(un=>un.find(Dt=>Dt.toastId===f.id)?un.map(Dt=>Dt.toastId===f.id?{...Dt,height:Ft}:Dt):[{toastId:f.id,height:Ft,position:f.position},...un])},[P,f.title,f.description,_,f.id,f.jsx,f.action,f.cancel]);const ve=ne.useCallback(()=>{re(!0),Rt(he.current),_(Se=>Se.filter(ut=>ut.toastId!==f.id)),setTimeout(()=>{L(f)},gj)},[f,L,_,he]);ne.useEffect(()=>{if(f.promise&&Q==="loading"||f.duration===1/0||f.type==="loading")return;let Se;return k||g||Z?(()=>{if($e.current{st.current!==1/0&&(le.current=new Date().getTime(),Se=setTimeout(()=>{f.onAutoClose==null||f.onAutoClose.call(f,f),ve()},st.current))})(),()=>clearTimeout(Se)},[k,g,f,Q,Z,ve]),ne.useEffect(()=>{f.delete&&(ve(),f.onDismiss==null||f.onDismiss.call(f,f))},[ve,f.delete]);function Xe(){var Se;if(we!=null&&we.loading){var ut;return ne.createElement("div",{className:pr(fe==null?void 0:fe.loader,f==null||(ut=f.classNames)==null?void 0:ut.loader,"sonner-loader"),"data-visible":Q==="loading"},we.loading)}return ne.createElement(XD,{className:pr(fe==null?void 0:fe.loader,f==null||(Se=f.classNames)==null?void 0:Se.loader),visible:Q==="loading"})}const wt=f.icon||(we==null?void 0:we[Q])||QD(Q);var Ee,_t;return ne.createElement("li",{tabIndex:0,ref:Oe,className:pr(I,K,fe==null?void 0:fe.toast,f==null||(e=f.classNames)==null?void 0:e.toast,fe==null?void 0:fe.default,fe==null?void 0:fe[Q],f==null||(n=f.classNames)==null?void 0:n[Q]),"data-sonner-toast":"","data-rich-colors":(Ee=f.richColors)!=null?Ee:U,"data-styled":!(f.jsx||f.unstyled||p),"data-mounted":P,"data-promise":!!f.promise,"data-swiped":dt,"data-removed":Y,"data-visible":ee,"data-y-position":He,"data-x-position":et,"data-index":y,"data-front":Ye,"data-swiping":Ce,"data-dismissible":V,"data-type":Q,"data-invert":be,"data-swipe-out":Qe,"data-swipe-direction":pe,"data-expanded":!!(k||ie&&P),"data-testid":f.testId,style:{"--index":y,"--toasts-before":y,"--z-index":w.length-y,"--offset":`${Y?xt:he.current}px`,"--initial-height":ie?"auto":`${ln}px`,...b,...f.style},onDragEnd:()=>{de(!1),A(null),je.current=null},onPointerDown:Se=>{Se.button!==2&&(ye||!V||(Ht.current=new Date,Rt(he.current),Se.target.setPointerCapture(Se.pointerId),Se.target.tagName!=="BUTTON"&&(de(!0),je.current={x:Se.clientX,y:Se.clientY})))},onPointerUp:()=>{var Se,ut,Ft;if(Qe||!V)return;je.current=null;const un=Number(((Se=Oe.current)==null?void 0:Se.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Jn=Number(((ut=Oe.current)==null?void 0:ut.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Dt=new Date().getTime()-((Ft=Ht.current)==null?void 0:Ft.getTime()),pn=se==="x"?un:Jn,jr=Math.abs(pn)/Dt;if(Math.abs(pn)>=mj||jr>.11){Rt(he.current),f.onDismiss==null||f.onDismiss.call(f,f),_e(se==="x"?un>0?"right":"left":Jn>0?"down":"up"),ve(),Ze(!0);return}else{var mn,gn;(mn=Oe.current)==null||mn.style.setProperty("--swipe-amount-x","0px"),(gn=Oe.current)==null||gn.style.setProperty("--swipe-amount-y","0px")}Vt(!1),de(!1),A(null)},onPointerMove:Se=>{var ut,Ft,un;if(!je.current||!V||((ut=window.getSelection())==null?void 0:ut.toString().length)>0)return;const Dt=Se.clientY-je.current.y,pn=Se.clientX-je.current.x;var jr;const mn=(jr=t.swipeDirections)!=null?jr:yj(C);!se&&(Math.abs(pn)>1||Math.abs(Dt)>1)&&A(Math.abs(pn)>Math.abs(Dt)?"x":"y");let gn={x:0,y:0};const Ls=Pn=>1/(1.5+Math.abs(Pn)/20);if(se==="y"){if(mn.includes("top")||mn.includes("bottom"))if(mn.includes("top")&&Dt<0||mn.includes("bottom")&&Dt>0)gn.y=Dt;else{const Pn=Dt*Ls(Dt);gn.y=Math.abs(Pn)0)gn.x=pn;else{const Pn=pn*Ls(pn);gn.x=Math.abs(Pn)0||Math.abs(gn.y)>0)&&Vt(!0),(Ft=Oe.current)==null||Ft.style.setProperty("--swipe-amount-x",`${gn.x}px`),(un=Oe.current)==null||un.style.setProperty("--swipe-amount-y",`${gn.y}px`)}},B&&!f.jsx&&Q!=="loading"?ne.createElement("button",{"aria-label":G,"data-disabled":ye,"data-close-button":!0,onClick:ye||!V?()=>{}:()=>{ve(),f.onDismiss==null||f.onDismiss.call(f,f)},className:pr(fe==null?void 0:fe.closeButton,f==null||(r=f.classNames)==null?void 0:r.closeButton)},(_t=we==null?void 0:we.close)!=null?_t:nj):null,(Q||f.icon||f.promise)&&f.icon!==null&&((we==null?void 0:we[Q])!==null||f.icon)?ne.createElement("div",{"data-icon":"",className:pr(fe==null?void 0:fe.icon,f==null||(i=f.classNames)==null?void 0:i.icon)},f.promise||f.type==="loading"&&!f.icon?f.icon||Xe():null,f.type!=="loading"?wt:null):null,ne.createElement("div",{"data-content":"",className:pr(fe==null?void 0:fe.content,f==null||(s=f.classNames)==null?void 0:s.content)},ne.createElement("div",{"data-title":"",className:pr(fe==null?void 0:fe.title,f==null||(o=f.classNames)==null?void 0:o.title)},f.jsx?f.jsx:typeof f.title=="function"?f.title():f.title),f.description?ne.createElement("div",{"data-description":"",className:pr(N,me,fe==null?void 0:fe.description,f==null||(a=f.classNames)==null?void 0:a.description)},typeof f.description=="function"?f.description():f.description):null),ne.isValidElement(f.cancel)?f.cancel:f.cancel&&gu(f.cancel)?ne.createElement("button",{"data-button":!0,"data-cancel":!0,style:f.cancelButtonStyle||x,onClick:Se=>{gu(f.cancel)&&V&&(f.cancel.onClick==null||f.cancel.onClick.call(f.cancel,Se),ve())},className:pr(fe==null?void 0:fe.cancelButton,f==null||(u=f.classNames)==null?void 0:u.cancelButton)},f.cancel.label):null,ne.isValidElement(f.action)?f.action:f.action&&gu(f.action)?ne.createElement("button",{"data-button":!0,"data-action":!0,style:f.actionButtonStyle||E,onClick:Se=>{gu(f.action)&&(f.action.onClick==null||f.action.onClick.call(f.action,Se),!Se.defaultPrevented&&ve())},className:pr(fe==null?void 0:fe.actionButton,f==null||(c=f.classNames)==null?void 0:c.actionButton)},f.action.label):null)};function Ix(){if(typeof window>"u"||typeof document>"u")return"ltr";const t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}function xj(t,e){const n={};return[t,e].forEach((r,i)=>{const s=i===1,o=s?"--mobile-offset":"--offset",a=s?hj:dj;function u(c){["top","right","bottom","left"].forEach(h=>{n[`${o}-${h}`]=typeof c=="number"?`${c}px`:c})}typeof r=="number"||typeof r=="string"?u(r):typeof r=="object"?["top","right","bottom","left"].forEach(c=>{r[c]===void 0?n[`${o}-${c}`]=a:n[`${o}-${c}`]=typeof r[c]=="number"?`${r[c]}px`:r[c]}):u(a)}),n}const wj=ne.forwardRef(function(e,n){const{id:r,invert:i,position:s="bottom-right",hotkey:o=["altKey","KeyT"],expand:a,closeButton:u,className:c,offset:h,mobileOffset:f,theme:p="light",richColors:g,duration:_,style:T,visibleToasts:R=cj,toastOptions:y,dir:w=Ix(),gap:k=pj,icons:L,containerAriaLabel:U="Notifications"}=e,[j,b]=ne.useState([]),x=ne.useMemo(()=>r?j.filter(P=>P.toasterId===r):j.filter(P=>!P.toasterId),[j,r]),E=ne.useMemo(()=>Array.from(new Set([s].concat(x.filter(P=>P.position).map(P=>P.position)))),[x,s]),[I,N]=ne.useState([]),[D,C]=ne.useState(!1),[ge,ie]=ne.useState(!1),[fe,we]=ne.useState(p!=="system"?p:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),G=ne.useRef(null),se=o.join("+").replace(/Key/g,"").replace(/Digit/g,""),A=ne.useRef(null),pe=ne.useRef(!1),_e=ne.useCallback(P=>{b($=>{var Y;return(Y=$.find(re=>re.id===P.id))!=null&&Y.delete||vn.dismiss(P.id),$.filter(({id:re})=>re!==P.id)})},[]);return ne.useEffect(()=>vn.subscribe(P=>{if(P.dismiss){requestAnimationFrame(()=>{b($=>$.map(Y=>Y.id===P.id?{...Y,delete:!0}:Y))});return}setTimeout(()=>{Zk.flushSync(()=>{b($=>{const Y=$.findIndex(re=>re.id===P.id);return Y!==-1?[...$.slice(0,Y),{...$[Y],...P},...$.slice(Y+1)]:[P,...$]})})})}),[j]),ne.useEffect(()=>{if(p!=="system"){we(p);return}if(p==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?we("dark"):we("light")),typeof window>"u")return;const P=window.matchMedia("(prefers-color-scheme: dark)");try{P.addEventListener("change",({matches:$})=>{we($?"dark":"light")})}catch{P.addListener(({matches:Y})=>{try{we(Y?"dark":"light")}catch(re){console.error(re)}})}},[p]),ne.useEffect(()=>{j.length<=1&&C(!1)},[j]),ne.useEffect(()=>{const P=$=>{var Y;if(o.every(de=>$[de]||$.code===de)){var Ce;C(!0),(Ce=G.current)==null||Ce.focus()}$.code==="Escape"&&(document.activeElement===G.current||(Y=G.current)!=null&&Y.contains(document.activeElement))&&C(!1)};return document.addEventListener("keydown",P),()=>document.removeEventListener("keydown",P)},[o]),ne.useEffect(()=>{if(G.current)return()=>{A.current&&(A.current.focus({preventScroll:!0}),A.current=null,pe.current=!1)}},[G.current]),ne.createElement("section",{ref:n,"aria-label":`${U} ${se}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},E.map((P,$)=>{var Y;const[re,Ce]=P.split("-");return x.length?ne.createElement("ol",{key:P,dir:w==="auto"?Ix():w,tabIndex:-1,ref:G,className:c,"data-sonner-toaster":!0,"data-sonner-theme":fe,"data-y-position":re,"data-x-position":Ce,style:{"--front-toast-height":`${((Y=I[0])==null?void 0:Y.height)||0}px`,"--width":`${fj}px`,"--gap":`${k}px`,...T,...xj(h,f)},onBlur:de=>{pe.current&&!de.currentTarget.contains(de.relatedTarget)&&(pe.current=!1,A.current&&(A.current.focus({preventScroll:!0}),A.current=null))},onFocus:de=>{de.target instanceof HTMLElement&&de.target.dataset.dismissible==="false"||pe.current||(pe.current=!0,A.current=de.relatedTarget)},onMouseEnter:()=>C(!0),onMouseMove:()=>C(!0),onMouseLeave:()=>{ge||C(!1)},onDragEnd:()=>C(!1),onPointerDown:de=>{de.target instanceof HTMLElement&&de.target.dataset.dismissible==="false"||ie(!0)},onPointerUp:()=>ie(!1)},x.filter(de=>!de.position&&$===0||de.position===P).map((de,Qe)=>{var Ze,dt;return ne.createElement(vj,{key:de.id,icons:L,index:Qe,toast:de,defaultRichColors:g,duration:(Ze=y==null?void 0:y.duration)!=null?Ze:_,className:y==null?void 0:y.className,descriptionClassName:y==null?void 0:y.descriptionClassName,invert:i,visibleToasts:R,closeButton:(dt=y==null?void 0:y.closeButton)!=null?dt:u,interacting:ge,position:P,style:y==null?void 0:y.style,unstyled:y==null?void 0:y.unstyled,classNames:y==null?void 0:y.classNames,cancelButtonStyle:y==null?void 0:y.cancelButtonStyle,actionButtonStyle:y==null?void 0:y.actionButtonStyle,closeButtonAriaLabel:y==null?void 0:y.closeButtonAriaLabel,removeToast:_e,toasts:x.filter(Vt=>Vt.position==de.position),heights:I.filter(Vt=>Vt.position==de.position),setHeights:N,expandByDefault:a,gap:k,expanded:D,swipeDirections:e.swipeDirections})})):null}))});function Ei({label:t,type:e,categories:n,selectedIds:r,onSelect:i,onRemove:s,onCreate:o,onDeleteCategory:a,colorClass:u,placeholder:c="Añadir..."}){const[h,f]=F.useState(""),[p,g]=F.useState(!1),_=F.useRef(null),T=F.useMemo(()=>n.filter(j=>j.type===e||!j.type&&e==="genre"),[n,e]),R=F.useMemo(()=>h.trim()?T.filter(j=>j.name.toLowerCase().includes(h.toLowerCase())):T,[T,h]);F.useEffect(()=>{const j=b=>{_.current&&!_.current.contains(b.target)&&g(!1)};return document.addEventListener("mousedown",j),()=>document.removeEventListener("mousedown",j)},[]);const y=j=>{j.key==="Enter"&&(j.preventDefault(),w())},w=()=>{if(!h.trim())return;const j=T.find(b=>b.name.toLowerCase()===h.trim().toLowerCase());j?r.includes(j.id)||i(j.id):o(h.trim()),f(""),g(!1)},k=(j,b)=>{j.stopPropagation(),kt("¿Eliminar esta categoría permanentemente?",{description:"Esta acción no se puede deshacer.",action:{label:"Eliminar",onClick:()=>a(b)},cancel:{label:"Cancelar",onClick:()=>{}},duration:5e3})},U=u.includes("blue")?{bg:"bg-blue-500/20",text:"text-blue-300",border:"border-blue-500/30"}:u.includes("green")?{bg:"bg-green-500/20",text:"text-green-300",border:"border-green-500/30"}:u.includes("purple")?{bg:"bg-purple-500/20",text:"text-purple-300",border:"border-purple-500/30"}:u.includes("pink")?{bg:"bg-pink-500/20",text:"text-pink-300",border:"border-pink-500/30"}:{bg:"bg-gray-500/20",text:"text-gray-300",border:"border-gray-500/30"};return d.jsxs("div",{className:"space-y-3 mb-6",ref:_,children:[d.jsx("label",{className:`text-xs uppercase font-bold tracking-wider ${u}`,children:t}),d.jsxs("div",{className:"relative",children:[d.jsxs("div",{className:"flex gap-2",children:[d.jsxs("div",{className:"relative flex-1",children:[d.jsx("input",{type:"text",value:h,onChange:j=>{f(j.target.value),g(!0)},onFocus:()=>g(!0),onKeyDown:y,placeholder:c,className:"w-full bg-[#1a1a1a] border border-gray-600/50 rounded-lg px-4 py-2 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-[#bb86fc] transition-all"}),h&&d.jsx("button",{onClick:()=>f(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-500 hover:text-white",children:d.jsx(In,{className:"w-3 h-3"})})]}),d.jsx("button",{onClick:w,disabled:!h.trim(),className:"bg-[#bb86fc]/20 hover:bg-[#bb86fc]/30 text-[#bb86fc] px-3 rounded-lg transition-all",children:d.jsx(co,{className:"w-5 h-5"})})]}),p&&(R.length>0||h)&&d.jsx("div",{className:"absolute top-full left-0 right-0 mt-1 bg-[#1a1a1a] border border-gray-700/50 rounded-lg shadow-xl z-50 max-h-60 overflow-y-auto w-full custom-scrollbar",children:R.length>0?R.map(j=>{const b=r.includes(j.id);return d.jsxs("div",{className:"flex items-center justify-between px-4 py-2 hover:bg-white/5 cursor-pointer group",onClick:()=>{b||(i(j.id),f(""),g(!1))},children:[d.jsx("span",{className:`text-sm ${b?"text-[#bb86fc]":"text-gray-300"}`,children:j.name}),d.jsxs("div",{className:"flex items-center gap-2",children:[b&&d.jsx(wl,{className:"w-4 h-4 text-[#bb86fc]"}),d.jsx("button",{onClick:x=>k(x,j.id),className:"opacity-0 group-hover:opacity-100 p-1 hover:bg-red-500/20 text-gray-500 hover:text-red-400 rounded transition-all",title:"Eliminar permanentemente",children:d.jsx($r,{className:"w-3.5 h-3.5"})})]})]},j.id)}):d.jsxs("div",{className:"px-4 py-3 text-center",children:[d.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"No encontrado."}),d.jsxs("button",{onClick:w,className:"text-xs text-[#bb86fc] hover:underline font-semibold",children:['Crear "',h,'"']})]})})]}),d.jsx("div",{className:"flex gap-2 flex-wrap",children:r.map(j=>{const b=n.find(x=>x.id===j);return!b||b.type!==e&&!(e==="genre"&&!b.type)?null:d.jsxs("span",{className:`px-3 py-1 ${U.bg} ${U.text} text-xs rounded-full border ${U.border} flex items-center gap-2`,children:[b.name,d.jsx("button",{onClick:()=>s(j),className:"hover:text-white",children:d.jsx(In,{className:"w-3 h-3"})})]},j)})})]})}function gs({size:t=40,borderWidth:e=2,className:n=""}){return d.jsx("div",{className:`flex items-center justify-center ${n}`,children:d.jsx("div",{className:"relative",style:{width:`${t}px`,height:`${t}px`},children:d.jsx("div",{className:"rounded-full animate-spin",style:{width:`${t}px`,height:`${t}px`,borderWidth:`${e}px`,borderStyle:"solid",borderColor:"rgba(187, 134, 252, 0.3)",borderTopColor:"#bb86fc",animation:"spin 1.2s linear infinite",boxShadow:"0 0 20px rgba(139, 92, 246, 0.2)"}})})})}function _j(t){const e=new Map,n=t.split(` +`);let r="",i="";for(const a of n){const u=a.trim();if(u.includes("---- WEB P LINKS ----")){r="WEB P LINKS";continue}if(u.includes("---- ORIGINAL LINKS ----")){r="ORIGINAL LINKS";continue}if(u.includes("Para Hugging Face (Público):")){i="Hugging Face";continue}if(u.includes("Para tu PC Local (Pruebas):")){i="Local";continue}if(i==="Hugging Face"&&u.match(/^\(\d+\)\s+.*?\s+=\s+http/)){const c=u.match(/^\((\d+)\)\s+.*?\s+=\s+(http.*)$/);if(c){const h=parseInt(c[1],10),f=c[2].trim();e.has(h)||e.set(h,{originalFormat:"webp",originalBase64:""});const p=e.get(h);f.includes("/stream/")||f.includes("hash="),r==="WEB P LINKS"?(p.thumbnail=f,p.webpDisplay=f,p.webpCover=f):r==="ORIGINAL LINKS"&&(p.original=f,p.originalUnmodified=f)}}}const s=[],o=Array.from(e.keys()).sort((a,u)=>a-u);for(const a of o){const u=e.get(a);u&&u.thumbnail&&u.original?s.push(u):u&&u.thumbnail&&(u.original=u.thumbnail,u.originalUnmodified=u.thumbnail,s.push(u))}return s}function bj({isOpen:t,onClose:e,onMangaCreated:n,editingManga:r,onDelete:i}){const[s,o]=F.useState({title:"",name:"",description:"",selectedCategories:[]}),[a,u]=F.useState(null),[c,h]=F.useState(!1),[f,p]=F.useState(null),[g,_]=F.useState([]),[T,R]=F.useState(!1),[y,w]=F.useState([]),[k,L]=F.useState(!1),[U,j]=F.useState(null),[b,x]=F.useState(0),[E,I]=F.useState(!1),[N,D]=F.useState(0),[C,ge]=F.useState(0),[ie,fe]=F.useState(!1),[we,G]=F.useState(null),[se,A]=F.useState(null),[pe,_e]=F.useState(!1),[P,$]=F.useState(W1()),Y=!!r;F.useEffect(()=>{var ee,Q;if(t&&(re(),r)){o({title:r.title,name:r.author,description:r.description||"",selectedCategories:((ee=r.categories)==null?void 0:ee.map(K=>typeof K=="string"?K:K.id))||[]}),r.thumbnail_url&&p(r.thumbnail_url);const V=(Q=r.chapters)==null?void 0:Q[0];if(V!=null&&V.pages&&V.pages.length>0){const K=V.pages,me=V.original_pages||[],O=K.map((B,oe)=>{var le;return{thumbnail:B,original:me[oe]||B,webpDisplay:B,webpCover:B,originalFormat:((le=V.page_formats)==null?void 0:le[oe])||"jpg",originalBase64:"",originalUnmodified:""}});w(O)}}},[t,r]),F.useEffect(()=>{y.length>0&&we===null&&!a&&!se&&!f&&Oe(0)},[y]);async function re(){try{const ee=await xS();_(ee)}catch(ee){console.error("Error loading categories:",ee)}}const Ce=async ee=>{const{name:Q,value:V}=ee.target;o(K=>({...K,[Q]:V}))},de=ee=>{o(Q=>({...Q,selectedCategories:Q.selectedCategories.filter(V=>V!==ee)}))},Qe=async(ee,Q)=>{if(ee.trim()){if(Q==="tag"){const V=ee.split(" ").map(K=>K.trim()).filter(K=>K.length>0);for(const K of V)await Ze(K,Q);return}await Ze(ee,Q)}},Ze=async(ee,Q)=>{try{const V=g.find(K=>K.name.toLowerCase()===ee.trim().toLowerCase()&&K.type===Q);if(V)o(K=>K.selectedCategories.includes(V.id)?K:{...K,selectedCategories:[...K.selectedCategories,V.id]});else{const K=await wS(ee.trim(),Q);_(me=>me.find(O=>O.id===K.id)?me:[...me,K]),o(me=>me.selectedCategories.includes(K.id)?me:{...me,selectedCategories:[...me.selectedCategories,K.id]})}}catch(V){console.error("Error creating category:",V)}},dt=async ee=>{try{await _S(ee),_(Q=>Q.filter(V=>V.id!==ee)),o(Q=>({...Q,selectedCategories:Q.selectedCategories.filter(V=>V!==ee)}))}catch(Q){console.error("Error deleting category:",Q),alert("Error al eliminar la categoría")}},Vt=async ee=>{var V;const Q=(V=ee.target.files)==null?void 0:V[0];if(Q){h(!0);try{const K=await d2(Q);u(K),p(K.originalUnmodified)}catch(K){console.error("Error processing image:",K),alert("Error al procesar la imagen. Intenta con otro archivo.")}finally{h(!1)}}},xt=async ee=>{let Q="";if(ee.target instanceof HTMLInputElement&&ee.target.files&&ee.target.files.length>0){const V=ee.target.files[0];try{Q=await V.text()}catch(K){console.error("Error reading text file:",K),alert("Error al leer el archivo de texto.");return}}else ee.target instanceof HTMLTextAreaElement&&(Q=ee.target.value);if(Q.trim()){L(!0);try{const V=_j(Q);if(V.length===0){alert("No se encontraron enlaces válidos en el texto provisto. Asegúrate de copiar el formato correcto.");return}w(K=>[...K,...V])}catch(V){console.error("Error parsing pages from text:",V),alert("Error al procesar los enlaces.")}finally{L(!1),ee.target instanceof HTMLInputElement&&(ee.target.value="")}}},Rt=ee=>{w(Q=>Q.filter((V,K)=>K!==ee))},ln=ee=>{j(ee)},St=(ee,Q)=>{if(ee.preventDefault(),U===null||U===Q)return;const V=[...y],K=V[U];V.splice(U,1),V.splice(Q,0,K),w(V),j(Q)},st=()=>{j(null)},Ht=async()=>{var ee,Q,V,K,me;if(!s.title||!s.title.trim()){alert("El título es requerido");return}R(!0);try{let O=[...s.selectedCategories],B=(r==null?void 0:r.thumbnail_url)||void 0,oe=(r==null?void 0:r.cover_url)||void 0;if(se)B=se.thumbnail,oe=se.original;else if(a)if(a.originalBase64==="")B=a.thumbnail,oe=a.originalUnmodified;else try{I(!0),ge(2),D(1),x(0);const le=await Gf(a.thumbnail,`${s.title}_thumb`);x(50),D(2);const he=await Gf(a.originalUnmodified,`${s.title}_cover`);x(100),B=le.data.url,oe=he.data.url}catch(le){console.error("Error uploading cover images:",le),alert("Error al subir la portada. Continuar sin portada.")}finally{I(!1),x(0)}else y.length>0&&(B=y[0].webpDisplay,oe=y[0].originalUnmodified);if(Y&&r){const le={title:s.title.trim(),author:((ee=s.name)==null?void 0:ee.trim())||"",description:((Q=s.description)==null?void 0:Q.trim())||"",categoryIds:O};if(B&&(le.thumbnail_url=B),oe&&(le.cover_url=oe),await bS(r.id,le),y.length>0&&y.length>0)try{I(!0);const he=y.filter(ye=>ye.originalBase64!==""&&!ye.original.includes("/stream/")&&!ye.original.includes("hash="));let $e=[],je=[];if(he.length>0){ge(he.length*2),D(0),x(0);const ye=he.map(Ee=>Ee.webpDisplay),ve=he.map(Ee=>Ee.originalUnmodified),Xe=await lu(ye,`${s.title}_updated_webp`,(Ee,_t)=>{D(Ee),x(Math.round(Ee/(he.length*2)*100))}),wt=await lu(ve,`${s.title}_updated_original`,(Ee,_t)=>{D(he.length+Ee),x(Math.round((he.length+Ee)/(he.length*2)*100))});$e=Xe.map(Ee=>Ee.data.url),je=wt.map(Ee=>Ee.data.url)}let He=0;const et=y.map(ye=>ye.originalBase64!==""&&!ye.original.includes("/stream/")&&!ye.original.includes("hash=")?$e[He++]:ye.webpDisplay);He=0;const H=y.map(ye=>ye.originalBase64!==""&&!ye.original.includes("/stream/")&&!ye.original.includes("hash=")?je[He++]:ye.original),Z=y.map(ye=>ye.originalFormat);I(!1),x(0);const be=(V=r.chapters)==null?void 0:V[0];be?await Xi(Pt(Be,"chapters",be.id),{pages:et,page_formats:Z,original_pages:H,updated_at:We.now()}):await Ex({manga_id:r.id,number:1,title:"Páginas",pages:et,page_formats:Z,original_pages:H})}catch(he){console.error("Error updating chapter:",he),alert("Error al actualizar las páginas.")}n(r.id)}else{const le={title:s.title.trim(),author:((K=s.name)==null?void 0:K.trim())||"",categoryIds:O};(me=s.description)!=null&&me.trim()&&(le.description=s.description.trim()),B&&(le.thumbnail_url=B),oe&&(le.cover_url=oe);const he=await UD(le);if(!he.id)throw new Error("No se pudo obtener el ID del manga creado");const $e=he.id;if(y.length>0)try{I(!0);const je=y.filter(ve=>ve.originalBase64!==""&&!ve.original.includes("/stream/")&&!ve.original.includes("hash="));let He=[],et=[];if(je.length>0){ge(je.length*2),D(0),x(0);const ve=je.map(_t=>_t.webpDisplay),Xe=je.map(_t=>_t.originalUnmodified),wt=await lu(ve,`${s.title}_ch1_webp`,(_t,Se)=>{D(_t),x(Math.round(_t/(je.length*2)*100))}),Ee=await lu(Xe,`${s.title}_ch1_original`,(_t,Se)=>{D(je.length+_t),x(Math.round((je.length+_t)/(je.length*2)*100))});He=wt.map(_t=>_t.data.url),et=Ee.map(_t=>_t.data.url)}let H=0;const Z=y.map(ve=>ve.originalBase64!==""&&!ve.original.includes("/stream/")&&!ve.original.includes("hash=")?He[H++]:ve.webpDisplay);H=0;const be=y.map(ve=>ve.originalBase64!==""&&!ve.original.includes("/stream/")&&!ve.original.includes("hash=")?et[H++]:ve.original),ye=y.map(ve=>ve.originalFormat);I(!1),x(0),await Ex({manga_id:$e,number:1,title:"Páginas",pages:Z,page_formats:ye,original_pages:be})}catch(je){console.error("Error creating chapter:",je),alert("Error al crear el capítulo. Por favor intenta de nuevo.")}n($e)}Ye()}catch(O){console.error("Error creating/updating manga:",O);let B="Error al guardar el manga. ";if(O.message)B+=O.message;else if(O.code)switch(O.code){case"permission-denied":B+="No tienes permisos para realizar esta operación.";break;case"unavailable":B+="El servicio no está disponible. Verifica tu conexión.";break;case"invalid-argument":B+="Algunos datos no son válidos. Revisa el formulario.";break;default:B+=`Código de error: ${O.code}`}else B+="Por favor intenta de nuevo.";alert(B)}finally{R(!1),I(!1),x(0)}},Oe=ee=>{const Q=y[ee];if(!Q.originalBase64)A({thumbnail:Q.thumbnail,original:Q.original}),u(null);else{const K={thumbnail:Q.thumbnail,original:Q.originalUnmodified,webpDisplay:Q.originalUnmodified,webpCover:Q.originalUnmodified,originalFormat:Q.originalFormat,originalBase64:Q.originalBase64,originalUnmodified:Q.originalUnmodified};u(K),A(null)}p(Q.thumbnail),G(ee),fe(!1)},Ye=()=>{o({title:"",name:"",description:"",selectedCategories:[]}),u(null),A(null),p(null),w([]),x(0),I(!1),D(0),ge(0),fe(!1),G(null),e()};return t?d.jsxs("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:[d.jsxs("div",{className:"bg-gradient-to-b from-[#1f1f1f] to-[#121212] rounded-2xl border border-gray-700/40 w-full max-w-2xl max-h-[90vh] overflow-y-auto shadow-2xl",children:[d.jsxs("div",{className:"sticky top-0 bg-gradient-to-b from-[#2a2a2a] to-[#1f1f1f] border-b border-gray-700/30 px-8 py-6 flex items-center justify-between z-10",children:[d.jsxs("div",{children:[d.jsxs("h2",{className:"text-2xl font-bold flex items-center gap-3",children:[d.jsx("div",{className:"p-2 bg-gradient-to-br from-[#bb86fc] to-[#9966dd] rounded-lg shadow-lg shadow-[#bb86fc]/30",children:d.jsx(nl,{className:"w-5 h-5 text-white"})}),Y?"Editar Manga":"Crear Manga"]}),d.jsx("p",{className:"text-sm text-gray-400 mt-1.5",children:Y?"Actualiza los detalles de tu obra":"Comparte tu historia con el mundo"})]}),d.jsx("button",{onClick:Ye,className:"text-gray-500 hover:text-white hover:bg-white/10 transition-all p-2 rounded-lg",children:d.jsx(In,{className:"w-6 h-6"})})]}),d.jsxs("div",{className:"p-8 space-y-5",children:[d.jsxs("div",{className:"bg-gradient-to-br from-[#242424] to-[#1a1a1a] rounded-xl p-6 border border-gray-700/40 shadow-lg hover:border-gray-700/60 transition-all",children:[d.jsxs("div",{className:"flex items-center gap-3 mb-5",children:[d.jsx("div",{className:"w-1 h-5 bg-gradient-to-b from-[#bb86fc] to-[#7744cc] rounded-full"}),d.jsx("h3",{className:"text-sm font-semibold text-white tracking-wide uppercase",children:"Información Principal"})]}),d.jsxs("div",{className:"space-y-3.5",children:[d.jsxs("div",{children:[d.jsxs("label",{className:"block text-xs font-semibold text-gray-200 mb-2",children:["Título del Manga ",d.jsx("span",{className:"text-red-400 font-bold",children:"*"})]}),d.jsx("input",{type:"text",name:"title",placeholder:"El nombre de tu obra maestra",value:s.title,onChange:Ce,onKeyPress:ee=>ee.key==="Enter"&&Y&&!T&&Ht(),className:"w-full bg-[#1a1a1a] border border-gray-600/50 rounded-lg px-4 py-3 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-[#bb86fc] focus:ring-2 focus:ring-[#bb86fc]/30 transition-all shadow-md hover:border-gray-600/70"})]}),d.jsxs("div",{children:[d.jsxs("label",{className:"block text-xs font-semibold text-gray-200 mb-2",children:["Autor ",d.jsx("span",{className:"text-gray-500 font-normal",children:"(opcional)"})]}),d.jsx("input",{type:"text",name:"name",placeholder:"Tu nombre o seudónimo",value:s.name,onChange:Ce,onKeyPress:ee=>ee.key==="Enter"&&Y&&!T&&Ht(),className:"w-full bg-[#1a1a1a] border border-gray-600/50 rounded-lg px-4 py-3 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-[#bb86fc] focus:ring-2 focus:ring-[#bb86fc]/30 transition-all shadow-md hover:border-gray-600/70"})]}),d.jsxs("div",{children:[d.jsxs("label",{className:"block text-xs font-semibold text-gray-200 mb-2",children:["Sinopsis ",d.jsx("span",{className:"text-gray-500 font-normal",children:"(opcional)"})]}),d.jsx("textarea",{name:"description",placeholder:"Cuéntanos de qué trata tu manga, qué lo hace especial...",value:s.description,onChange:Ce,onKeyDown:ee=>ee.key==="Enter"&&ee.ctrlKey&&Y&&!T&&Ht(),rows:3,className:"w-full bg-[#1a1a1a] border border-gray-600/50 rounded-lg px-4 py-3 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-[#bb86fc] focus:ring-2 focus:ring-[#bb86fc]/30 transition-all shadow-md hover:border-gray-600/70 resize-none"})]})]})]}),d.jsxs("div",{className:"bg-gradient-to-br from-[#242424] to-[#1a1a1a] rounded-xl p-6 border border-gray-700/40 shadow-lg hover:border-gray-700/60 transition-all",children:[d.jsxs("div",{className:"flex items-center gap-3 mb-5",children:[d.jsx("div",{className:"w-1 h-5 bg-gradient-to-b from-[#bb86fc] to-[#7744cc] rounded-full"}),d.jsx("h3",{className:"text-sm font-semibold text-white tracking-wide uppercase",children:"Clasificación"})]}),d.jsx(Ei,{label:"Personajes",type:"character",categories:g,selectedIds:s.selectedCategories,onSelect:ee=>{s.selectedCategories.includes(ee)||o(Q=>({...Q,selectedCategories:[...Q.selectedCategories,ee]}))},onRemove:de,onCreate:ee=>Qe(ee,"character"),onDeleteCategory:dt,colorClass:"text-blue-400",placeholder:"Añadir personaje..."}),d.jsx(Ei,{label:"Series",type:"series",categories:g,selectedIds:s.selectedCategories,onSelect:ee=>{s.selectedCategories.includes(ee)||o(Q=>({...Q,selectedCategories:[...Q.selectedCategories,ee]}))},onRemove:de,onCreate:ee=>Qe(ee,"series"),onDeleteCategory:dt,colorClass:"text-green-400",placeholder:"Añadir serie..."}),d.jsx(Ei,{label:"Géneros",type:"genre",categories:g,selectedIds:s.selectedCategories,onSelect:ee=>{s.selectedCategories.includes(ee)||o(Q=>({...Q,selectedCategories:[...Q.selectedCategories,ee]}))},onRemove:de,onCreate:ee=>Qe(ee,"genre"),onDeleteCategory:dt,colorClass:"text-purple-400",placeholder:"Añadir género..."}),d.jsx(Ei,{label:"Etiquetas",type:"tag",categories:g,selectedIds:s.selectedCategories,onSelect:ee=>{s.selectedCategories.includes(ee)||o(Q=>({...Q,selectedCategories:[...Q.selectedCategories,ee]}))},onRemove:de,onCreate:ee=>Qe(ee,"tag"),onDeleteCategory:dt,colorClass:"text-pink-400",placeholder:"Añadir etiqueta..."})]}),d.jsxs("div",{className:"bg-gradient-to-br from-[#242424] to-[#1a1a1a] rounded-xl p-6 border border-gray-700/40 shadow-lg hover:border-gray-700/60 transition-all",children:[d.jsxs("div",{className:"flex items-center gap-3 mb-5",children:[d.jsx("div",{className:"w-1 h-5 bg-gradient-to-b from-[#bb86fc] to-[#7744cc] rounded-full"}),d.jsx("h3",{className:"text-sm font-semibold text-white tracking-wide uppercase",children:"Portada"}),d.jsx("span",{className:"text-xs text-gray-500 ml-auto",children:"Opcional"})]}),c&&d.jsxs("div",{className:"mb-4",children:[d.jsx("div",{className:"flex items-center justify-between mb-2",children:d.jsx("span",{className:"text-xs font-semibold text-[#bb86fc]",children:"Procesando portada..."})}),d.jsx("div",{className:"w-full bg-gray-700/40 rounded-full h-2 overflow-hidden border border-[#bb86fc]/30",children:d.jsx("div",{className:"bg-gradient-to-r from-[#bb86fc] to-[#9966dd] h-full transition-all duration-300 ease-out animate-pulse",style:{width:"100%"}})})]}),f&&!c&&d.jsxs("div",{className:"mb-4 relative group max-w-xs mx-auto",children:[d.jsx(Gn,{src:f,alt:"Preview",aspectRatio:"3/4",objectFit:"cover",loading:"eager",className:"rounded-xl border border-gray-600 shadow-2xl shadow-[#bb86fc]/20"}),d.jsx("div",{className:"absolute inset-0 rounded-xl bg-black/40 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center gap-2",children:d.jsx("button",{onClick:()=>{u(null),p(null),G(null)},className:"bg-red-600/80 hover:bg-red-600 text-white p-2 rounded-lg transition-all shadow-lg",children:d.jsx($r,{className:"w-4 h-4"})})}),we!==null&&d.jsxs("div",{className:"absolute bottom-2 left-2 bg-green-600/90 text-white text-xs px-2.5 py-1 rounded-lg font-semibold",children:["Página ",we+1]})]}),d.jsxs("div",{className:"flex gap-3 mb-4",children:[d.jsxs("label",{className:"flex-1 border-2 border-dashed border-gray-600/50 rounded-xl p-6 cursor-pointer hover:border-[#bb86fc]/50 hover:bg-[#bb86fc]/5 transition-all block group",children:[d.jsxs("div",{className:"flex flex-col items-center gap-2",children:[d.jsx("div",{className:"w-12 h-12 bg-gradient-to-br from-[#bb86fc] to-[#9966dd] rounded-xl flex items-center justify-center shadow-lg shadow-[#bb86fc]/40 group-hover:scale-110 group-hover:shadow-[#bb86fc]/60 transition-all",children:c?d.jsx(gs,{size:24,borderWidth:2}):d.jsx(co,{className:"w-6 h-6 text-white"})}),d.jsxs("div",{className:"text-center",children:[d.jsx("p",{className:"text-xs font-semibold text-white mb-0.5",children:c?"Procesando...":"Subir portada"}),d.jsx("p",{className:"text-xs text-gray-400",children:"Archivo"})]})]}),d.jsx("input",{type:"file",accept:"image/*",onChange:Vt,disabled:c,className:"hidden"})]}),y.length>0&&d.jsxs("button",{onClick:()=>fe(!ie),className:"flex-1 border-2 border-dashed border-gray-600/50 rounded-xl p-6 hover:border-[#bb86fc]/50 hover:bg-[#bb86fc]/5 transition-all group flex flex-col items-center justify-center gap-2 bg-gradient-to-br from-[#1a1a1a] to-[#0f0f0f]",children:[d.jsx("div",{className:"w-12 h-12 bg-gradient-to-br from-[#9966dd] to-[#bb86fc] rounded-xl flex items-center justify-center shadow-lg shadow-[#bb86fc]/40 group-hover:scale-110 group-hover:shadow-[#bb86fc]/60 transition-all",children:d.jsx(z0,{className:"w-6 h-6 text-white"})}),d.jsxs("div",{className:"text-center",children:[d.jsx("p",{className:"text-xs font-semibold text-white mb-0.5",children:"Elegir página"}),d.jsxs("p",{className:"text-xs text-gray-400",children:[y.length," disponibles"]})]})]})]})]}),d.jsxs("div",{className:"bg-gradient-to-br from-[#242424] to-[#1a1a1a] rounded-xl p-6 border border-gray-700/40 shadow-lg hover:border-gray-700/60 transition-all",children:[d.jsxs("div",{className:"flex items-center gap-3 mb-5",children:[d.jsx("div",{className:"w-1 h-5 bg-gradient-to-b from-[#bb86fc] to-[#7744cc] rounded-full"}),d.jsx("h3",{className:"text-sm font-semibold text-white tracking-wide uppercase",children:"Páginas del Capítulo"}),d.jsx("span",{className:"text-xs text-gray-500 ml-auto",children:"Opcional"}),d.jsxs("button",{onClick:()=>_e(!0),className:"bg-[#1a1a1a] hover:bg-[#242424] border border-gray-600/50 hover:border-[#bb86fc]/50 text-gray-300 hover:text-[#bb86fc] p-2 rounded-lg transition-all flex items-center gap-1.5 text-xs font-medium",title:"Configurar tamaño de lote de subida",children:[d.jsx(B0,{className:"w-3.5 h-3.5"}),d.jsxs("span",{className:"hidden sm:inline",children:["Subida: ",P===0?"Sin límite":`${P} por lote`]})]})]}),k&&d.jsxs("div",{className:"mb-5",children:[d.jsx("div",{className:"flex items-center justify-between mb-2",children:d.jsx("span",{className:"text-xs font-semibold text-[#bb86fc]",children:"Procesando enlaces..."})}),d.jsx("div",{className:"w-full bg-gray-700/40 rounded-full h-2 overflow-hidden border border-[#bb86fc]/30",children:d.jsx("div",{className:"bg-gradient-to-r from-[#bb86fc] to-[#9966dd] h-full transition-all duration-300 ease-out animate-pulse",style:{width:"100%"}})})]}),y.length>0&&!k&&d.jsxs("div",{className:"mb-5",children:[d.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[d.jsx(U0,{className:"w-3.5 h-3.5 text-gray-500"}),d.jsxs("p",{className:"text-xs text-gray-400",children:[y.length," página",y.length!==1?"s":""," • Arrastra para reordenar"]})]}),d.jsx("div",{className:"grid grid-cols-4 gap-2",children:y.map((ee,Q)=>d.jsxs("div",{draggable:!0,onDragStart:()=>ln(Q),onDragOver:V=>St(V,Q),onDragEnd:st,style:{animationDelay:`${Q*40}ms`},className:`relative group cursor-move opacity-0 animate-[fadeIn_0.7s_ease-out_forwards] ${U===Q?"opacity-50 scale-95":"hover:scale-105"} transition-all duration-200`,children:[d.jsxs("div",{className:"relative overflow-hidden w-full aspect-[3/4] rounded-lg border border-gray-600/50 shadow-md bg-black",children:[d.jsx("div",{className:"absolute inset-0 flex items-center justify-center z-10 transition-opacity duration-300",children:d.jsx("div",{className:"rounded-full animate-spin",style:{width:"24px",height:"24px",borderWidth:"2px",borderStyle:"solid",borderColor:"rgba(187, 134, 252, 0.2)",borderTopColor:"#bb86fc",animation:"spin 0.6s linear infinite"}})}),d.jsx("img",{src:ee.thumbnail,alt:`Página ${Q+1}`,className:"w-full h-full object-cover transition-all duration-700 ease-out transform-gpu group-hover:scale-[1.08] group-hover:shadow-[#bb86fc]/30 opacity-0 scale-95",onLoad:V=>{var me;V.currentTarget.classList.remove("opacity-0","scale-95"),V.currentTarget.classList.add("opacity-100","scale-100");const K=(me=V.currentTarget.parentElement)==null?void 0:me.querySelector("div:nth-child(1)");K&&K.classList.add("opacity-0","pointer-events-none")}})]}),d.jsxs("div",{className:"absolute inset-0 bg-black/60 opacity-0 group-hover:opacity-100 transition-opacity rounded-lg flex items-center justify-center gap-2",children:[d.jsx(U0,{className:"w-4 h-4 text-white/70"}),d.jsx("button",{onClick:()=>Rt(Q),className:"bg-red-600/80 hover:bg-red-600 text-white p-1.5 rounded-lg transition-all shadow-lg",children:d.jsx($r,{className:"w-3.5 h-3.5"})})]}),d.jsx("div",{className:"absolute top-1.5 left-1.5 bg-black/80 text-white text-xs px-2 py-0.5 rounded-md font-semibold",children:Q+1})]},Q))})]}),y.length===0&&d.jsxs("label",{className:"border-2 border-dashed border-gray-600/50 rounded-xl p-8 text-center hover:border-[#bb86fc]/50 hover:bg-[#bb86fc]/5 transition-all block group",children:[d.jsx("div",{className:"w-14 h-14 bg-gradient-to-br from-[#bb86fc] to-[#9966dd] rounded-xl flex items-center justify-center mx-auto mb-4 shadow-lg shadow-[#bb86fc]/40 group-hover:scale-110 group-hover:shadow-[#bb86fc]/60 transition-all",children:k?d.jsx(gs,{size:24,borderWidth:2}):d.jsx(z0,{className:"w-7 h-7 text-white"})}),d.jsx("p",{className:"text-sm font-semibold text-white mb-2",children:k?"Procesando...":"Sube tu archivo TXT"}),d.jsx("div",{className:"flex flex-col gap-4 max-w-lg mx-auto mt-4",children:d.jsxs("div",{className:"relative",children:[d.jsx("span",{className:"bg-[#1a1a1a] hover:bg-[#242424] border border-gray-600/50 text-white px-4 py-2 rounded-lg text-sm font-medium transition-all block w-max mx-auto cursor-pointer relative z-10",children:"Seleccionar Archivo .txt"}),d.jsx("input",{type:"file",accept:".txt",onChange:xt,disabled:k,className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer z-20"})]})})]})]}),E&&d.jsxs("div",{className:"mb-6 bg-gradient-to-br from-[#242424] to-[#1a1a1a] rounded-xl p-5 border border-[#bb86fc]/30 shadow-xl",children:[d.jsxs("div",{className:"flex items-center justify-between mb-3",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(gs,{size:16,borderWidth:2}),d.jsxs("span",{className:"text-sm font-semibold text-white",children:["Subiendo imagen ",N," de ",C]})]}),d.jsxs("span",{className:"text-sm font-bold text-[#bb86fc]",children:[b,"%"]})]}),d.jsx("div",{className:"w-full bg-gray-700/40 rounded-full h-3 overflow-hidden border border-[#bb86fc]/40 shadow-inner",children:d.jsx("div",{className:"bg-gradient-to-r from-[#bb86fc] via-[#9966dd] to-[#bb86fc] h-full transition-all duration-500 ease-out relative overflow-hidden",style:{width:`${b}%`},children:d.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent animate-pulse"})})}),d.jsx("p",{className:"text-xs text-gray-400 mt-2 text-center",children:"Por favor no cierres esta ventana..."})]}),d.jsxs("div",{className:"flex gap-3 pt-6 border-t border-gray-700/50",children:[Y&&i&&d.jsxs("button",{onClick:()=>{window.confirm("¿Estás seguro de que deseas eliminar este manga? Esta acción no se puede deshacer.")&&r&&(i(r.id),e())},className:"bg-red-500/10 border border-red-500/30 hover:bg-red-500/20 text-red-500 px-4 py-3 rounded-lg font-semibold text-sm transition-all flex items-center gap-2 mr-auto",children:[d.jsx($r,{className:"w-4 h-4"}),"Eliminar"]}),d.jsx("button",{onClick:Ye,disabled:T||E,className:"flex-1 bg-[#1a1a1a] border border-gray-600/50 hover:border-gray-500 hover:bg-[#242424] text-white px-5 py-3 rounded-lg font-semibold text-sm transition-all shadow-md disabled:opacity-50 disabled:cursor-not-allowed",children:"Cancelar"}),d.jsx("button",{onClick:Ht,disabled:T||E||!s.title.trim(),children:E?"Subiendo imágenes...":T?Y?"Actualizando...":"Creando...":Y?"Guardar Cambios":"Crear Manga"})]})]})]}),ie&&d.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:d.jsxs("div",{className:"bg-gradient-to-b from-[#1f1f1f] to-[#121212] rounded-2xl border border-gray-700/40 w-full max-w-2xl max-h-[80vh] shadow-2xl overflow-hidden flex flex-col",children:[d.jsxs("div",{className:"bg-gradient-to-b from-[#2a2a2a]/80 to-[#1f1f1f]/80 border-b border-gray-700/30 px-6 py-4 flex items-center justify-between flex-shrink-0",children:[d.jsxs("div",{children:[d.jsx("h2",{className:"text-xl font-bold text-white",children:"Selecciona portada"}),d.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Elige una página para usar como portada del manga"})]}),d.jsx("button",{onClick:()=>fe(!1),className:"text-gray-500 hover:text-white transition-colors p-1.5 rounded-lg hover:bg-white/10 flex-shrink-0",children:d.jsx(In,{className:"w-5 h-5"})})]}),d.jsx("div",{className:"overflow-y-auto flex-1 p-6",children:d.jsx("div",{className:"grid grid-cols-3 md:grid-cols-4 gap-3",children:y.map((ee,Q)=>d.jsxs("button",{onClick:()=>Oe(Q),className:`group relative aspect-[3/4] rounded-lg overflow-hidden transition-all duration-300 hover:scale-105 border-2 ${we===Q?"border-green-500 shadow-lg shadow-green-500/40":"border-gray-600/50 hover:border-[#bb86fc]/50"}`,children:[d.jsxs("div",{className:"absolute inset-0 overflow-hidden bg-black flex items-center justify-center",children:[d.jsx("div",{className:"absolute inset-0 flex items-center justify-center z-10 transition-opacity duration-300",children:d.jsx("div",{className:"rounded-full animate-spin",style:{width:"20px",height:"20px",borderWidth:"2px",borderStyle:"solid",borderColor:"rgba(187, 134, 252, 0.2)",borderTopColor:"#bb86fc",animation:"spin 0.6s linear infinite"}})}),d.jsx("img",{src:ee.thumbnail,alt:`Página ${Q+1}`,className:"w-full h-full object-cover transition-all duration-700 ease-out transform-gpu group-hover:scale-[1.10] opacity-0 scale-95",onLoad:V=>{var me;V.currentTarget.classList.remove("opacity-0","scale-95"),V.currentTarget.classList.add("opacity-100","scale-100");const K=(me=V.currentTarget.parentElement)==null?void 0:me.querySelector("div:nth-child(1)");K&&K.classList.add("opacity-0","pointer-events-none")}})]}),d.jsx("div",{className:"absolute inset-0 bg-black/40 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center",children:d.jsx("div",{className:"bg-[#bb86fc]/90 text-white px-3 py-1.5 rounded-lg font-semibold text-sm",children:"Seleccionar"})}),d.jsx("div",{className:"absolute bottom-2 left-2 bg-black/80 text-white text-xs px-2 py-1 rounded-md font-semibold",children:Q+1}),we===Q&&d.jsxs("div",{className:"absolute top-2 right-2 bg-green-600/90 text-white px-2.5 py-1.5 rounded-lg flex items-center gap-1.5 font-semibold text-xs",children:[d.jsx("div",{className:"w-2 h-2 bg-white rounded-full"}),"Seleccionado"]})]},Q))})}),d.jsxs("div",{className:"bg-gradient-to-b from-[#1f1f1f]/80 to-[#1a1a1a]/80 border-t border-gray-700/30 px-6 py-4 flex items-center justify-end gap-3 flex-shrink-0",children:[d.jsx("button",{onClick:()=>fe(!1),className:"bg-[#1a1a1a] border border-gray-600/50 hover:border-gray-500 hover:bg-[#242424] text-white px-4 py-2 rounded-lg font-semibold text-sm transition-all",children:"Cancelar"}),d.jsx("button",{onClick:()=>fe(!1),className:"bg-gradient-to-r from-[#bb86fc] to-[#9966dd] hover:from-[#9966dd] hover:to-[#7744cc] text-white px-4 py-2 rounded-lg font-semibold text-sm transition-all shadow-lg shadow-[#bb86fc]/40 hover:shadow-[#bb86fc]/60",children:"Confirmar"})]})]})}),pe&&d.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:d.jsxs("div",{className:"bg-gradient-to-b from-[#1f1f1f] to-[#121212] rounded-2xl border border-gray-700/40 w-full max-w-md shadow-2xl",children:[d.jsxs("div",{className:"bg-gradient-to-b from-[#2a2a2a]/80 to-[#1f1f1f]/80 border-b border-gray-700/30 px-6 py-4 flex items-center justify-between",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx("div",{className:"p-2 bg-gradient-to-br from-[#bb86fc] to-[#9966dd] rounded-lg shadow-lg shadow-[#bb86fc]/30",children:d.jsx(B0,{className:"w-5 h-5 text-white"})}),d.jsxs("div",{children:[d.jsx("h2",{className:"text-xl font-bold text-white",children:"Configurar Subida"}),d.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:"Tamaño de lote de imágenes"})]})]}),d.jsx("button",{onClick:()=>_e(!1),className:"text-gray-500 hover:text-white transition-colors p-1.5 rounded-lg hover:bg-white/10",children:d.jsx(In,{className:"w-5 h-5"})})]}),d.jsxs("div",{className:"p-6 space-y-4",children:[d.jsxs("div",{className:"bg-[#1a1a1a] border border-gray-700/40 rounded-lg p-4 mb-4",children:[d.jsx("h3",{className:"text-xs font-semibold text-gray-300 mb-2",children:"Opciones disponibles:"}),d.jsxs("ul",{className:"text-xs text-gray-400 space-y-1.5",children:[d.jsx("li",{children:"• 1 por lote: Más lento pero más estable"}),d.jsx("li",{children:"• 10 por lote: Balance entre velocidad y estabilidad (predeterminado)"}),d.jsx("li",{children:"• 50 por lote: Más rápido para muchas imágenes"}),d.jsx("li",{children:"• Sin límite: Sube todas las imágenes simultáneamente"})]})]}),d.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[d.jsx("button",{onClick:()=>{$(1),au(1)},className:`p-4 rounded-lg border-2 transition-all ${P===1?"border-[#bb86fc] bg-[#bb86fc]/10 shadow-lg shadow-[#bb86fc]/30":"border-gray-600/50 hover:border-gray-600 bg-[#1a1a1a]"}`,children:d.jsxs("div",{className:"text-center",children:[d.jsx("div",{className:"text-2xl font-bold text-white mb-1",children:"1"}),d.jsx("div",{className:"text-xs text-gray-400",children:"Por lote"})]})}),d.jsx("button",{onClick:()=>{$(10),au(10)},className:`p-4 rounded-lg border-2 transition-all ${P===10?"border-[#bb86fc] bg-[#bb86fc]/10 shadow-lg shadow-[#bb86fc]/30":"border-gray-600/50 hover:border-gray-600 bg-[#1a1a1a]"}`,children:d.jsxs("div",{className:"text-center",children:[d.jsx("div",{className:"text-2xl font-bold text-white mb-1",children:"10"}),d.jsx("div",{className:"text-xs text-gray-400",children:"Por lote"})]})}),d.jsx("button",{onClick:()=>{$(50),au(50)},className:`p-4 rounded-lg border-2 transition-all ${P===50?"border-[#bb86fc] bg-[#bb86fc]/10 shadow-lg shadow-[#bb86fc]/30":"border-gray-600/50 hover:border-gray-600 bg-[#1a1a1a]"}`,children:d.jsxs("div",{className:"text-center",children:[d.jsx("div",{className:"text-2xl font-bold text-white mb-1",children:"50"}),d.jsx("div",{className:"text-xs text-gray-400",children:"Por lote"})]})}),d.jsx("button",{onClick:()=>{$(0),au(999999)},className:`p-4 rounded-lg border-2 transition-all ${P===0||P>=999999?"border-[#bb86fc] bg-[#bb86fc]/10 shadow-lg shadow-[#bb86fc]/30":"border-gray-600/50 hover:border-gray-600 bg-[#1a1a1a]"}`,children:d.jsxs("div",{className:"text-center",children:[d.jsx("div",{className:"text-2xl font-bold text-white mb-1",children:"∞"}),d.jsx("div",{className:"text-xs text-gray-400",children:"Sin límite"})]})})]}),d.jsx("div",{className:"bg-green-500/10 border border-green-500/30 rounded-lg p-3",children:d.jsxs("p",{className:"text-green-400 text-xs font-semibold",children:["Configuración guardada: ",P===0||P>=999999?"Sin límite":`${P} imagen${P!==1?"es":""} por lote`]})}),d.jsx("button",{onClick:()=>_e(!1),className:"w-full bg-gradient-to-r from-[#bb86fc] to-[#9966dd] hover:from-[#9966dd] hover:to-[#7744cc] text-white px-4 py-3 rounded-lg font-semibold text-sm transition-all shadow-lg shadow-[#bb86fc]/40 hover:shadow-[#bb86fc]/60",children:"Cerrar"})]})]})})]}):null}const ES="settings",SS="announcement";async function kx(t,e){const n=Pt(Be,ES,SS),r=new Date;let i=null;e&&(i=new Date(r.getTime()+e).toISOString());const s={text:t,updatedAt:r.toISOString(),expiresAt:i};await OE(n,s)}function Ej(t){const e=Pt(Be,ES,SS);return wg(e,n=>{n.exists()?t(n.data()):t(null)})}function Sj({isOpen:t,onClose:e,isCategoryPlusEnabled:n,onCategoryPlusChange:r,isCopyIdsEnabled:i,onCopyIdsChange:s,isDeletePlusEnabled:o,onDeletePlusChange:a}){const[u,c]=F.useState(""),[h,f]=F.useState(24),[p,g]=F.useState("hours"),[_,T]=F.useState(!1);F.useEffect(()=>{},[t]);const R=async()=>{if(!u.trim()){kt.error("El texto del anuncio no puede estar vacío");return}let w=0;p==="seconds"&&(w=h*1e3),p==="minutes"&&(w=h*60*1e3),p==="hours"&&(w=h*60*60*1e3),p==="days"&&(w=h*24*60*60*1e3);try{await kx(u,w),kt.success("Anuncio publicado exitosamente"),c(""),e()}catch(k){console.error(k),kt.error("Error al publicar el anuncio")}},y=async()=>{try{await kx("",null),c(""),T(!1),kt.success("Anuncio eliminado.")}catch(w){console.error(w),kt.error("Error al eliminar")}};return t?d.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50 p-4 animate-in fade-in duration-200",children:d.jsxs("div",{className:"bg-[#121212] rounded-2xl border border-gray-800 w-full max-w-lg shadow-2xl overflow-hidden flex flex-col max-h-[90vh]",children:[d.jsxs("div",{className:"bg-[#1a1a1a] border-b border-gray-800 px-6 py-4 flex items-center justify-between sticky top-0 z-10",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx("div",{className:"p-2 bg-[#bb86fc]/10 rounded-lg text-[#bb86fc]",children:d.jsx($1,{className:"w-5 h-5"})}),d.jsx("h2",{className:"text-xl font-bold text-white",children:"Ajustes de Administrador"})]}),d.jsx("button",{onClick:e,className:"text-gray-400 hover:text-white transition-colors p-2 hover:bg-white/5 rounded-lg",children:d.jsx(In,{className:"w-5 h-5"})})]}),d.jsxs("div",{className:"p-6 space-y-8 overflow-y-auto custom-scrollbar",children:[d.jsx("section",{className:"space-y-4",children:d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx("div",{className:`p-2 rounded-lg ${n?"bg-purple-500/10 text-purple-400":"bg-gray-800 text-gray-400"}`,children:d.jsx(F1,{className:"w-5 h-5"})}),d.jsxs("div",{children:[d.jsx("h3",{className:"text-sm font-semibold text-white",children:"Categorías Plus"}),d.jsx("p",{className:"text-xs text-gray-400",children:"Habilitar selección múltiple y edición masiva"})]})]}),d.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[d.jsx("input",{type:"checkbox",className:"sr-only peer",checked:n,onChange:w=>r(w.target.checked)}),d.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-purple-300 dark:peer-focus:ring-purple-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-[#bb86fc]"})]})]})}),d.jsx("section",{className:"space-y-4 pt-4 border-t border-gray-800",children:d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx("div",{className:`p-2 rounded-lg ${i?"bg-blue-500/10 text-blue-400":"bg-gray-800 text-gray-400"}`,children:d.jsx(O1,{className:"w-5 h-5"})}),d.jsxs("div",{children:[d.jsx("h3",{className:"text-sm font-semibold text-white",children:"Copiar IDs Plus"}),d.jsx("p",{className:"text-xs text-gray-400",children:"Habilitar selección masiva para copiar IDs"})]})]}),d.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[d.jsx("input",{type:"checkbox",className:"sr-only peer",checked:i,onChange:w=>s(w.target.checked)}),d.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-blue-300 dark:peer-focus:ring-blue-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-blue-500"})]})]})}),d.jsx("section",{className:"space-y-4 pt-4 border-t border-gray-800",children:d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx("div",{className:`p-2 rounded-lg ${o?"bg-red-500/10 text-red-500":"bg-gray-800 text-gray-400"}`,children:d.jsx($r,{className:"w-5 h-5"})}),d.jsxs("div",{children:[d.jsx("h3",{className:"text-sm font-semibold text-white",children:"Eliminar Plus"}),d.jsx("p",{className:"text-xs text-gray-400",children:"Habilitar selección masiva para eliminar mangas"})]})]}),d.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[d.jsx("input",{type:"checkbox",className:"sr-only peer",checked:o,onChange:w=>a(w.target.checked)}),d.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-red-300 dark:peer-focus:ring-red-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-red-500"})]})]})}),d.jsxs("section",{className:"space-y-4 pt-4 border-t border-gray-800",children:[d.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[d.jsx("div",{className:"p-2 bg-red-500/10 rounded-lg text-red-500",children:d.jsx(Bf,{className:"w-5 h-5"})}),d.jsxs("div",{children:[d.jsx("h3",{className:"tex-sm font-semibold text-white",children:"Gestión de Vistas"}),d.jsx("p",{className:"text-xs text-gray-400",children:"Restablecer contadores de visualización"})]})]}),d.jsx("button",{onClick:async()=>{if(window.confirm("¿Seguro que quieres reiniciar las vistas de TODOS los mangas a 0? Esta acción no se puede deshacer."))try{await zD(),kt.success("Vistas reiniciadas correctamente.")}catch(w){console.error(w),kt.error("Error al reiniciar vistas.")}},className:"w-full bg-red-500/10 hover:bg-red-500/20 text-red-500 py-2.5 rounded-lg font-semibold text-sm transition-all border border-red-500/20 hover:border-red-500/40",children:"Reiniciar Vistas a 0"})]}),d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"h-px bg-gray-800"}),d.jsxs("section",{className:"space-y-4",children:[d.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[d.jsx("div",{className:"p-2 bg-purple-500/10 rounded-lg text-purple-400",children:d.jsx(U1,{className:"w-5 h-5"})}),d.jsxs("div",{children:[d.jsx("h3",{className:"tex-sm font-semibold text-white",children:"Publicar Anuncio"}),d.jsx("p",{className:"text-xs text-gray-400",children:"Visible para todos los usuarios"})]})]}),d.jsxs("div",{className:"space-y-3",children:[d.jsx("textarea",{value:u,onChange:w=>c(w.target.value),placeholder:"Escribe el mensaje del anuncio...",className:"w-full bg-[#1a1a1a] border border-gray-700 rounded-lg px-4 py-3 text-sm text-white placeholder-gray-600 focus:outline-none focus:border-[#bb86fc] min-h-[100px] resize-none"}),d.jsxs("div",{className:"flex gap-3",children:[d.jsxs("div",{className:"flex-1 bg-[#1a1a1a] border border-gray-700 rounded-lg px-3 py-2 flex items-center gap-2",children:[d.jsx(o2,{className:"w-4 h-4 text-gray-400"}),d.jsx("input",{type:"number",min:"1",value:h,onChange:w=>f(Number(w.target.value)),className:"bg-transparent text-white text-sm w-full focus:outline-none"})]}),d.jsxs("select",{value:p,onChange:w=>g(w.target.value),className:"bg-[#1a1a1a] border border-gray-700 rounded-lg px-3 py-2 text-sm text-white focus:outline-none focus:border-[#bb86fc]",children:[d.jsx("option",{value:"seconds",children:"Segundos"}),d.jsx("option",{value:"minutes",children:"Minutos"}),d.jsx("option",{value:"hours",children:"Horas"}),d.jsx("option",{value:"days",children:"Días"})]})]}),d.jsxs("div",{className:"flex gap-2",children:[d.jsx("button",{onClick:()=>T(!0),className:"px-4 py-2.5 rounded-lg font-semibold text-sm bg-red-500/10 text-red-500 border border-red-500/20 hover:bg-red-500/20 transition-colors",title:"Eliminar anuncio",children:d.jsx($r,{className:"w-5 h-5"})}),d.jsx("button",{onClick:R,className:"flex-1 bg-gradient-to-r from-[#bb86fc] to-[#9966dd] hover:from-[#9966dd] hover:to-[#7744cc] text-white py-2.5 rounded-lg font-semibold text-sm transition-all shadow-lg shadow-[#bb86fc]/20",children:"Publicar Anuncio"})]})]})]})]})]}),_&&d.jsx("div",{className:"absolute inset-0 bg-black/80 backdrop-blur-sm flex items-center justify-center z-50 p-6 animate-in fade-in duration-200",children:d.jsx("div",{className:"bg-[#1a1a1a] border border-gray-700 w-full max-w-sm rounded-xl shadow-2xl p-6 transform scale-100 animate-in zoom-in-95 duration-200",children:d.jsxs("div",{className:"flex flex-col items-center text-center gap-4",children:[d.jsx("div",{className:"p-3 bg-red-500/10 rounded-full text-red-500",children:d.jsx($r,{className:"w-8 h-8"})}),d.jsxs("div",{children:[d.jsx("h3",{className:"text-lg font-bold text-white mb-1",children:"¿Eliminar anuncio?"}),d.jsx("p",{className:"text-sm text-gray-400",children:"Esta acción eliminará el anuncio actual inmediatamente. No se puede deshacer."})]}),d.jsxs("div",{className:"flex gap-3 w-full mt-2",children:[d.jsx("button",{onClick:()=>T(!1),className:"flex-1 px-4 py-2 rounded-lg text-sm font-semibold text-gray-300 hover:bg-gray-800 transition-colors",children:"Cancelar"}),d.jsx("button",{onClick:y,className:"flex-1 px-4 py-2 rounded-lg text-sm font-semibold bg-red-500 hover:bg-red-600 text-white transition-colors shadow-lg shadow-red-500/20",children:"Eliminar"})]})]})})})]})}):null}function Tj({isAdmin:t}){const[e,n]=F.useState(""),[r,i]=F.useState(null),[s,o]=F.useState(""),[a,u]=F.useState(!0);return F.useEffect(()=>{const c=Ej(h=>{h?(n(h.text),i(h.expiresAt)):(n(""),i(null)),u(!1)});return()=>c()},[]),F.useEffect(()=>{if(!r){o("");return}const c=setInterval(()=>{const h=new Date().getTime(),p=new Date(r).getTime()-h;if(p<=0)n(""),i(null),clearInterval(c);else{const g=Math.floor(p/864e5),_=Math.floor(p%(1e3*60*60*24)/(1e3*60*60)),T=Math.floor(p%(1e3*60*60)/(1e3*60)),R=Math.floor(p%(1e3*60)/1e3);let y="";g>0&&(y+=`${g}d `),y+=`${_.toString().padStart(2,"0")}h ${T.toString().padStart(2,"0")}m ${R.toString().padStart(2,"0")}s`,o(y)}},1e3);return()=>clearInterval(c)},[r]),!e&&!a||!e?null:d.jsx("div",{className:"w-full max-w-[1800px] mx-auto px-4 sm:px-6 md:px-12 mt-6 mb-8 animate-in fade-in slide-in-from-top-4 duration-500 flex justify-center",children:d.jsxs("div",{className:"bg-gradient-to-r from-[#bb86fc]/20 to-[#121212] border border-[#bb86fc]/30 rounded-xl p-6 flex flex-col items-center gap-4 shadow-lg shadow-[#bb86fc]/10 relative group backdrop-blur-sm max-w-2xl w-full text-center",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx("div",{className:"p-2.5 bg-[#bb86fc]/20 rounded-lg animate-pulse",children:d.jsx(U1,{className:"w-6 h-6 text-[#bb86fc]"})}),d.jsxs("h3",{className:"text-sm font-bold text-[#bb86fc] uppercase tracking-wider flex items-center gap-2",children:["Información Importante",d.jsx("span",{className:"w-2 h-2 rounded-full bg-[#bb86fc] animate-ping"})]})]}),d.jsx("div",{className:"text-base text-gray-200 leading-relaxed whitespace-pre-wrap font-medium max-w-lg",children:e}),s&&d.jsxs("div",{className:"flex items-center gap-2 text-xs font-mono text-gray-400 bg-black/30 px-3 py-1.5 rounded-full border border-gray-800",children:[d.jsx(u2,{className:"w-3.5 h-3.5"}),d.jsxs("span",{children:["Expira en: ",s]})]})]})})}const TS=()=>"",Ij=t=>{if(!t)return;if(t.startsWith("blob:")||t.startsWith("data:"))return t;const e=TS(),n=new URLSearchParams({url:t,width:"600",quality:"85",format:"webp"});return`${e}/api/image-proxy?${n.toString()}`},kj=(t,e)=>{if(!t)return"";if(t.startsWith("blob:")||t.startsWith("data:"))return t;const n=TS(),r=new URLSearchParams({url:t});return`${n}/api/image-proxy?${r.toString()}`};function IS({id:t,title:e,author:n,pageCount:r,thumbnail:i,manga:s,onSelect:o,onEdit:a,onDelete:u,isCategoryPlusEnabled:c,isSelected:h,onToggleSelect:f}){const[p,g]=F.useState(!1),_=i?Ij(i):void 0,T=w=>{w.stopPropagation(),g(!0)},R=w=>{w.stopPropagation(),u==null||u(t),g(!1)},y=w=>{w.stopPropagation(),s&&(a==null||a(s))};return d.jsxs("div",{className:"group cursor-pointer flex flex-col w-full max-w-xs",children:[d.jsxs("div",{onClick:()=>{c&&f?f():(BD(t),o==null||o(t))},className:`relative bg-black rounded-lg shadow-lg overflow-hidden transition-transform duration-300 hover:scale-[1.02] aspect-[2/3] ${h?"ring-4 ring-[#bb86fc]":""}`,children:[_?d.jsxs(d.Fragment,{children:[d.jsx(Gn,{src:_,alt:e,aspectRatio:"2/3",objectFit:"cover",loading:"lazy",imgClassName:"group-hover:scale-110"}),d.jsx("div",{className:"absolute inset-x-0 bottom-0 h-1/3 bg-gradient-to-t from-black/60 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300 pointer-events-none"})]}):d.jsx("div",{className:"w-full aspect-[2/3] flex items-center justify-center text-white/40 bg-gradient-to-br from-gray-800 to-gray-900 rounded-lg group-hover:text-white/60",children:d.jsx(nl,{className:"w-12 h-12"})}),d.jsxs("div",{className:"absolute bottom-2 left-2 bg-black/70 text-white text-xs px-2 py-1 rounded-md font-semibold opacity-0 group-hover:opacity-100 transition-opacity duration-300",children:[r," paginas"]}),c&&d.jsx("div",{className:`absolute top-2 left-2 w-6 h-6 rounded-md border-2 flex items-center justify-center transition-all ${h?"bg-[#bb86fc] border-[#bb86fc]":"bg-black/50 border-white/50 hover:border-white"}`,children:h&&d.jsx(wl,{className:"w-4 h-4 text-white"})}),!c&&d.jsxs("div",{className:"absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity duration-300 flex gap-1",children:[s&&a&&d.jsx("button",{onClick:y,className:"bg-black/60 hover:bg-purple-600 text-white p-1.5 rounded-full transition-colors backdrop-blur-sm",title:"Editar manga",children:d.jsx(z1,{className:"w-3 h-3"})}),u&&d.jsx("button",{onClick:T,className:"bg-black/60 hover:bg-red-600 text-white p-1.5 rounded-full transition-colors backdrop-blur-sm",title:"Eliminar manga",children:d.jsx($r,{className:"w-3 h-3"})})]}),p&&d.jsxs("div",{className:"absolute inset-0 bg-black/80 backdrop-blur-sm flex flex-col items-center justify-center gap-3 rounded-lg z-20 animate-in fade-in duration-200",children:[d.jsx("p",{className:"text-white text-sm font-semibold text-center px-3",children:"Eliminar manga?"}),d.jsxs("div",{className:"flex gap-2",children:[d.jsx("button",{onClick:w=>{w.stopPropagation(),g(!1)},className:"bg-gray-600 hover:bg-gray-700 text-white px-3 py-1.5 rounded-md text-xs font-semibold transition-all duration-200 transform hover:scale-105 active:scale-95",children:"Cancelar"}),d.jsx("button",{onClick:R,className:"bg-red-600 hover:bg-red-700 text-white px-3 py-1.5 rounded-md text-xs font-semibold transition-all duration-200 transform hover:scale-105 active:scale-95",children:"Eliminar"})]})]})]}),d.jsxs("div",{className:"mt-1 sm:mt-2 flex flex-col gap-0.5 text-center mb-2",children:[d.jsx("h3",{onClick:()=>o==null?void 0:o(t),className:"font-semibold text-xs sm:text-sm text-white line-clamp-2 cursor-pointer text-center group-hover:text-purple-400 transition-colors duration-300 ease-out",children:e}),n&&n.trim()!==""&&n.toLowerCase()!=="anónimo"&&n.toLowerCase()!=="anonimo"&&d.jsx("p",{className:"text-xs text-gray-400 text-center group-hover:text-gray-300 transition-colors duration-300 ease-out",children:n})]})]})}function Cj({id:t,onBack:e,onNavigateToManga:n,onMangaLoaded:r,onSelectCategory:i,onSelectAuthor:s,isAdmin:o=!1}){var he,$e,je,He,et;const[a,u]=F.useState(null),[c,h]=F.useState(!0),[f,p]=F.useState(!1),[g,_]=F.useState(0),[T,R]=F.useState(!1),[y,w]=F.useState(!1),[k,L]=F.useState(!1),[U,j]=F.useState(0),[b,x]=F.useState(!1),[E,I]=F.useState({name:"",url:""}),[N,D]=F.useState([]),[C,ge]=F.useState("portrait"),[ie,fe]=F.useState("vertical"),[we,G]=F.useState(!1),[se,A]=F.useState(0),[pe,_e]=F.useState([]),[P,$]=F.useState(!1),[Y,re]=F.useState(""),[Ce,de]=F.useState([]),[Qe,Ze]=F.useState(!1),[dt,Vt]=F.useState(!1),[xt,Rt]=F.useState(1),[ln,St]=F.useState(1),st=6,Ht=()=>St(H=>Math.min(H+.25,3)),Oe=()=>St(H=>Math.max(H-.25,.5)),Ye=()=>St(1);F.useEffect(()=>{me();const H=FD(t,be=>{be&&(u(()=>be),h(!1))});ee(),re("");const Z=localStorage.getItem("manga-view-mode");return(Z==="vertical"||Z==="gallery"||Z==="grid")&&fe(Z),()=>H()},[t]);async function ee(){try{Ze(!0);const H=await Rd();de(H)}catch(H){console.error("Error loading all mangas:",H)}finally{Ze(!1)}}F.useEffect(()=>{function H(Z){const be=Z.target;T&&!be.closest(".download-menu-container")&&R(!1),y&&!be.closest(".pdf-menu-container")&&w(!1)}return document.addEventListener("mousedown",H),()=>document.removeEventListener("mousedown",H)},[T,y]);const Q=async()=>{if(E.name.trim()&&E.url.trim()&&a)try{await $D(a.id,E),D([...N,E]),I({name:"",url:""}),x(!1)}catch(H){console.error("Error al guardar el enlace:",H),alert("Error al guardar el enlace")}},V=async H=>{if(a)try{await HD(a.id,H),D(N.filter((Z,be)=>be!==H))}catch(Z){console.error("Error al eliminar el enlace:",Z),alert("Error al eliminar el enlace")}},K=H=>{fe(H),localStorage.setItem("manga-view-mode",H)};async function me(){try{h(!0);const H=await vS(t);if(H){if(u(H),D(H.external_links||[]),H.cover_url)try{const Z=await p2(H.cover_url);ge(Z)}catch(Z){console.warn("Failed to detect image orientation:",Z),ge("portrait")}O(H)}}catch(H){console.error("Error loading manga:",H)}finally{}}async function O(H){var Z;try{$(!0);const be=((Z=H.categories)==null?void 0:Z.map(ve=>ve.id))||[],ye=await qD(H.id,be,H.title);_e(ye),Rt(1)}catch(be){console.error("Error loading recommendations:",be)}finally{$(!1)}}async function B(H){const Z=(a==null?void 0:a.id)||t;if(!Z){alert("Error: ID no encontrado.");return}const be=Z;console.log(`🚀 [CLIENTE] Suscribiendo a progreso: ${be}`);const ye=new EventSource(`/api/download/progress/${be}`);ye.onmessage=ve=>{const Xe=JSON.parse(ve.data);_(Xe.progress),Xe.progress>=100&&ye.close()};try{console.log("🚀 [CLIENTE] Iniciando descarga para ID:",Z),p(!0),R(!1),_(0);const ve=await fetch("/api/download/zip",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mangaId:Z,mangaTitle:(a==null?void 0:a.title)||"Descarga",format:H,jobId:be})});if(!ve.ok)throw new Error("Error en el servidor");const Xe=await ve.blob(),wt=window.URL.createObjectURL(Xe),Ee=document.createElement("a");Ee.href=wt,Ee.download=`${(a==null?void 0:a.title)||"manga"}.zip`,document.body.appendChild(Ee),Ee.click(),Ee.remove(),window.URL.revokeObjectURL(wt),console.log("✅ [CLIENTE] Descarga disparada con éxito")}catch(ve){console.error("❌ Error en la descarga:",ve),alert("Hubo un fallo en la matriz de descarga.")}finally{p(!1),ye.close()}}async function oe(H){const Z=(a==null?void 0:a.id)||t;if(!Z){alert("Error: ID no encontrado.");return}const be=Z;console.log(`🚀 [CLIENTE] Suscribiendo a progreso PDF: ${be}`);const ye=new EventSource(`/api/download/progress/${be}`);ye.onmessage=ve=>{const Xe=JSON.parse(ve.data);Xe.progress&&j(Xe.progress),Xe.progress>=100&&ye.close()};try{console.log("🚀 [CLIENTE] Iniciando PDF para ID:",Z),L(!0),j(0),w(!1);const ve=await fetch("/api/download/pdf",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mangaId:Z,mangaTitle:(a==null?void 0:a.title)||"Descarga",format:H,jobId:be})});if(!ve.ok)throw new Error("Error en el servidor al generar PDF");const Xe=await ve.blob(),wt=window.URL.createObjectURL(Xe),Ee=document.createElement("a");Ee.href=wt,Ee.download=`${(a==null?void 0:a.title)||"manga"}.pdf`,document.body.appendChild(Ee),Ee.click(),Ee.remove(),window.URL.revokeObjectURL(wt),console.log("✅ [CLIENTE] PDF descargado con éxito")}catch(ve){console.error("Error initiating PDF generation:",ve),alert("Error al generar PDF (puede que el archivo sea muy grande o Python falló).")}finally{L(!1),ye.close()}}if(c)return d.jsxs("div",{className:"h-screen bg-[#121212] flex flex-col items-center justify-center gap-4",children:[d.jsx(gs,{size:40,borderWidth:2}),d.jsx("div",{className:"text-gray-400 text-sm",children:"Cargando..."})]});if(!a)return d.jsx("div",{className:"h-screen bg-[#121212] flex items-center justify-center",children:d.jsx("div",{className:"text-gray-400 text-lg",children:"Manga no encontrado"})});const le=Y.trim()?Ce.filter(H=>{var Xe;if(!H.id||!H.title||H.id===a.id)return!1;const Z=Y.toLowerCase(),be=H.title.toLowerCase().includes(Z),ye=H.author?H.author.toLowerCase().includes(Z):!1,ve=((Xe=H.categories)==null?void 0:Xe.some(wt=>{var Ee;return(Ee=wt==null?void 0:wt.name)==null?void 0:Ee.toLowerCase().includes(Z)}))||!1;return be||ye||ve}):[];return d.jsxs("div",{className:"h-screen flex flex-col bg-[#121212] overflow-hidden",children:[d.jsx("header",{className:"border-b border-gray-800 z-40 bg-[#121212] flex-shrink-0",children:d.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 py-3 sm:py-4 flex items-center gap-3 sm:gap-4",children:[d.jsx("button",{onClick:e,className:"p-2 hover:bg-[#333] rounded-lg transition-colors text-gray-300 hover:text-white flex-shrink-0",children:d.jsx(To,{className:"w-5 h-5"})}),d.jsx("h1",{className:"text-base sm:text-lg font-bold text-white truncate flex-shrink-0",children:a.title}),d.jsx("div",{className:"flex-1 max-w-md ml-auto",children:d.jsxs("div",{className:"relative",children:[d.jsx(mc,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400"}),d.jsx("input",{type:"text",placeholder:"Buscar comics…",value:Y,onChange:H=>re(H.target.value),className:"w-full bg-[#1a1a1a] text-white rounded-lg pl-10 pr-3 py-2 text-sm placeholder-gray-400 focus:ring-2 focus:ring-[#bb86fc] focus:outline-none transition-all border border-gray-700/50 focus:border-[#bb86fc]"})]})})]})}),d.jsxs("main",{className:"flex-1 overflow-y-auto bg-[#121212]",children:[d.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 py-4 sm:py-8",children:[!Y.trim()&&d.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 sm:gap-6",children:[d.jsx("div",{className:"flex-shrink-0 mx-auto sm:mx-0",children:d.jsx("div",{className:"group w-56 sm:w-64",children:d.jsx("div",{className:"relative bg-black rounded-lg shadow-lg overflow-hidden transition-transform duration-300 hover:scale-[1.02]",children:a.cover_url?d.jsxs(d.Fragment,{children:[d.jsx(Gn,{src:a.cover_url,alt:a.title,aspectRatio:"2/3",objectFit:"cover",loading:"eager",imgClassName:"group-hover:scale-110"}),d.jsx("div",{className:"absolute inset-x-0 bottom-0 h-1/3 bg-gradient-to-t from-black/60 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300 ease-in-out pointer-events-none"})]}):d.jsx("div",{className:"w-full aspect-[2/3] flex items-center justify-center text-white/40 bg-black",children:d.jsx(F0,{className:"w-16 h-16"})})})})}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsx("h2",{className:"text-2xl sm:text-4xl font-bold text-white mb-3 sm:mb-4",children:a.title}),d.jsx("div",{className:"mb-4",children:d.jsxs("div",{className:"flex items-center gap-2 text-gray-300",children:[a.author&&a.author.toLowerCase()!=="anónimo"&&a.author.toLowerCase()!=="anonimo"&&d.jsxs(d.Fragment,{children:[d.jsx(Cm,{className:"w-4 h-4 text-[#bb86fc]"}),d.jsx("button",{onClick:()=>s==null?void 0:s(a.author),className:"text-sm hover:text-[#bb86fc] hover:underline transition-colors",children:a.author}),d.jsx("div",{className:"w-1 h-1 bg-gray-600 rounded-full mx-2"})]}),d.jsx(Bf,{className:"w-4 h-4 text-[#bb86fc]"}),d.jsxs("span",{className:"text-sm",children:[((he=a.views)==null?void 0:he.toLocaleString())||0," vistas"]})]})}),d.jsxs("div",{className:"mb-6",children:[d.jsx("h3",{className:"text-sm font-semibold text-gray-300 mb-3",children:"Categorías"}),d.jsx("div",{className:"flex gap-2 flex-wrap",children:($e=a.categories)==null?void 0:$e.sort((H,Z)=>{const be={series:1,character:2,genre:3,tag:4,other:5},ye=H.type||"genre",ve=Z.type||"genre";return(be[ye]||5)-(be[ve]||5)}).map(H=>{let Z="bg-[#bb86fc]/20 text-[#bb86fc] border-[#bb86fc]/40";return H.type==="character"?Z="bg-blue-500/20 text-blue-300 border-blue-500/30":H.type==="series"?Z="bg-green-500/20 text-green-300 border-green-500/30":H.type==="tag"&&(Z="bg-pink-500/20 text-pink-300 border-pink-500/30"),d.jsx("button",{onClick:()=>i==null?void 0:i(H.name),className:`px-3 py-1.5 text-xs rounded-full border ${Z} hover:opacity-80 transition-opacity cursor-pointer`,children:H.name},H.id)})})]}),a.description&&a.description.trim()!==""&&d.jsxs("div",{className:"mb-6",children:[d.jsx("h3",{className:"text-sm font-semibold text-gray-300 mb-2",children:"Sinopsis"}),d.jsx("p",{className:"text-sm text-gray-400 leading-relaxed whitespace-pre-wrap",children:a.description})]}),d.jsx("div",{className:"flex flex-col gap-3 sm:gap-4",children:a.chapters&&a.chapters.length>0&&a.chapters[0].pages&&a.chapters[0].pages.length>0&&d.jsxs(d.Fragment,{children:[f&&d.jsxs("div",{className:"w-full",children:[d.jsxs("div",{className:"flex items-center justify-between mb-2",children:[d.jsx("span",{className:"text-xs sm:text-sm font-semibold text-[#bb86fc]",children:"Descargando ZIP"}),d.jsxs("span",{className:"text-xs sm:text-sm font-bold text-[#bb86fc]",children:[g,"%"]})]}),d.jsx("div",{className:"w-full bg-gray-700/40 rounded-full h-2 overflow-hidden border border-[#bb86fc]/30",children:d.jsx("div",{className:"bg-gradient-to-r from-[#bb86fc] to-[#9966dd] h-full transition-all duration-300 ease-out",style:{width:`${g}%`}})})]}),k&&d.jsxs("div",{className:"w-full",children:[d.jsxs("div",{className:"flex items-center justify-between mb-2",children:[d.jsx("span",{className:"text-xs sm:text-sm font-semibold text-[#bb86fc]",children:"Generando PDF"}),d.jsxs("span",{className:"text-xs sm:text-sm font-bold text-[#bb86fc]",children:[U,"%"]})]}),d.jsx("div",{className:"w-full bg-gray-700/40 rounded-full h-2 overflow-hidden border border-[#bb86fc]/30",children:d.jsx("div",{className:"bg-gradient-to-r from-[#bb86fc] to-[#9966dd] h-full transition-all duration-300 ease-out",style:{width:`${U}%`}})})]}),d.jsxs("div",{className:"flex flex-wrap gap-2 items-center",children:[d.jsxs("div",{className:"relative download-menu-container",children:[d.jsxs("button",{onClick:()=>R(!T),disabled:f,className:"bg-[#121212] hover:bg-[#1f1f1f] border border-[#bb86fc]/50 hover:border-[#bb86fc] text-[#bb86fc] px-2 sm:px-3 py-1.5 sm:py-2 rounded-lg flex items-center gap-1 font-semibold text-xs sm:text-sm transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed",children:[d.jsx(ua,{className:"w-3 h-3 sm:w-4 sm:h-4 flex-shrink-0"}),d.jsx("span",{className:"hidden sm:inline",children:f?`Descargando (${g}%)`:"ZIP"}),d.jsx("span",{className:"sm:hidden",children:"ZIP"})]}),T&&!f&&d.jsxs("div",{className:"absolute top-full mt-2 left-0 bg-[#1f1f1f] border border-gray-700/60 rounded-lg shadow-2xl shadow-black/50 overflow-hidden z-50 min-w-[200px]",children:[d.jsxs("button",{onClick:()=>B("original"),className:"w-full px-3 py-2 text-left text-xs sm:text-sm text-white hover:bg-[#bb86fc]/20 transition-colors flex items-center gap-2 border-b border-gray-700/40",children:[d.jsx(ua,{className:"w-3 h-3 text-[#bb86fc]"}),d.jsxs("div",{children:[d.jsx("div",{className:"font-semibold",children:"Original"}),d.jsx("div",{className:"text-xs text-gray-400",children:"Sin cambios"})]})]}),d.jsxs("button",{onClick:()=>B("webp"),className:"w-full px-3 py-2 text-left text-xs sm:text-sm text-white hover:bg-[#bb86fc]/20 transition-colors flex items-center gap-2 border-b border-gray-700/40",children:[d.jsx(ua,{className:"w-3 h-3 text-[#bb86fc]"}),d.jsxs("div",{children:[d.jsx("div",{className:"font-semibold",children:"WebP"}),d.jsx("div",{className:"text-xs text-gray-400",children:"Optimizado"})]})]}),d.jsxs("button",{onClick:()=>B("png"),className:"w-full px-3 py-2 text-left text-xs sm:text-sm text-white hover:bg-[#bb86fc]/20 transition-colors flex items-center gap-2 border-b border-gray-700/40",children:[d.jsx(ua,{className:"w-3 h-3 text-[#bb86fc]"}),d.jsxs("div",{children:[d.jsx("div",{className:"font-semibold",children:"PNG"}),d.jsx("div",{className:"text-xs text-gray-400",children:"Sin pérdida"})]})]}),d.jsxs("button",{onClick:()=>B("jpg"),className:"w-full px-3 py-2 text-left text-xs sm:text-sm text-white hover:bg-[#bb86fc]/20 transition-colors flex items-center gap-2",children:[d.jsx(ua,{className:"w-3 h-3 text-[#bb86fc]"}),d.jsxs("div",{children:[d.jsx("div",{className:"font-semibold",children:"JPG"}),d.jsx("div",{className:"text-xs text-gray-400",children:"Comprimido"})]})]})]})]}),d.jsxs("div",{className:"relative pdf-menu-container",children:[d.jsxs("button",{onClick:()=>w(!y),disabled:k,className:"bg-[#121212] hover:bg-[#1f1f1f] border border-[#bb86fc]/50 hover:border-[#bb86fc] text-[#bb86fc] px-2 sm:px-3 py-1.5 sm:py-2 rounded-lg flex items-center gap-1 font-semibold text-xs sm:text-sm transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed",children:[d.jsx(ca,{className:"w-3 h-3 sm:w-4 sm:h-4 flex-shrink-0"}),d.jsx("span",{className:"hidden sm:inline",children:k?`Generando (${U}%)`:"PDF"}),d.jsx("span",{className:"sm:hidden",children:"PDF"})]}),y&&!k&&d.jsxs("div",{className:"absolute top-full mt-2 left-0 bg-[#1f1f1f] border border-gray-700/60 rounded-lg shadow-2xl shadow-black/50 overflow-hidden z-50 min-w-[200px]",children:[d.jsxs("button",{onClick:()=>oe("original"),className:"w-full px-3 py-2 text-left text-xs sm:text-sm text-white hover:bg-[#bb86fc]/20 transition-colors flex items-center gap-2 border-b border-gray-700/40",children:[d.jsx(ca,{className:"w-3 h-3 text-[#bb86fc]"}),d.jsxs("div",{children:[d.jsx("div",{className:"font-semibold",children:"Original"}),d.jsx("div",{className:"text-xs text-gray-400",children:"Sin cambios"})]})]}),d.jsxs("button",{onClick:()=>oe("webp"),className:"w-full px-3 py-2 text-left text-xs sm:text-sm text-white hover:bg-[#bb86fc]/20 transition-colors flex items-center gap-2 border-b border-gray-700/40",children:[d.jsx(ca,{className:"w-3 h-3 text-[#bb86fc]"}),d.jsxs("div",{children:[d.jsx("div",{className:"font-semibold",children:"WebP"}),d.jsx("div",{className:"text-xs text-gray-400",children:"Optimizado"})]})]}),d.jsxs("button",{onClick:()=>oe("png"),className:"w-full px-3 py-2 text-left text-xs sm:text-sm text-white hover:bg-[#bb86fc]/20 transition-colors flex items-center gap-2 border-b border-gray-700/40",children:[d.jsx(ca,{className:"w-3 h-3 text-[#bb86fc]"}),d.jsxs("div",{children:[d.jsx("div",{className:"font-semibold",children:"PNG"}),d.jsx("div",{className:"text-xs text-gray-400",children:"Sin pérdida"})]})]}),d.jsxs("button",{onClick:()=>oe("jpg"),className:"w-full px-3 py-2 text-left text-xs sm:text-sm text-white hover:bg-[#bb86fc]/20 transition-colors flex items-center gap-2",children:[d.jsx(ca,{className:"w-3 h-3 text-[#bb86fc]"}),d.jsxs("div",{children:[d.jsx("div",{className:"font-semibold",children:"JPG"}),d.jsx("div",{className:"text-xs text-gray-400",children:"Comprimido"})]})]})]})]}),d.jsxs("button",{onClick:()=>{a!=null&&a.id&&(window.location.hash=`manga/${a.id}/hd`)},className:"bg-[#121212] hover:bg-[#1f1f1f] border border-[#bb86fc]/50 hover:border-[#bb86fc] text-[#bb86fc] px-2 sm:px-3 py-1.5 sm:py-2 rounded-lg flex items-center gap-1 font-semibold text-xs sm:text-sm transition-all duration-200",children:[d.jsx(Bf,{className:"w-3 h-3 sm:w-4 sm:h-4 flex-shrink-0"}),d.jsx("span",{className:"hidden sm:inline",children:"Ver HD"}),d.jsx("span",{className:"sm:hidden",children:"HD"})]}),d.jsxs("button",{onClick:async()=>{try{await navigator.clipboard.writeText(a.id),Vt(!0),setTimeout(()=>Vt(!1),2e3),window.open("https://t.me/twistedbrodymangaflowbot","_blank")}catch(H){console.error("Failed to copy:",H)}},className:"bg-[#121212] hover:bg-[#1f1f1f] border border-[#bb86fc]/50 hover:border-[#bb86fc] text-[#bb86fc] px-2 sm:px-3 py-1.5 sm:py-2 rounded-lg flex items-center gap-1 font-semibold text-xs sm:text-sm transition-all duration-200",children:[dt?d.jsx(wl,{className:"w-3 h-3 sm:w-4 sm:h-4 flex-shrink-0"}):d.jsx(l2,{className:"w-3 h-3 sm:w-4 sm:h-4 flex-shrink-0"}),d.jsx("span",{className:"hidden sm:inline",children:dt?"ID Copiado":"Bot Telegram"}),d.jsx("span",{className:"sm:hidden",children:dt?"Copiado":"Bot"})]}),N.map((H,Z)=>d.jsxs("a",{href:H.url,target:"_blank",rel:"noopener noreferrer",className:"bg-[#121212] hover:bg-[#1f1f1f] border border-[#bb86fc]/50 hover:border-[#bb86fc] text-[#bb86fc] px-2 sm:px-3 py-1.5 sm:py-2 rounded-lg flex items-center gap-1.5 font-semibold text-xs sm:text-sm transition-all duration-200 group",children:[d.jsx(a2,{className:"w-3 h-3 sm:w-4 sm:h-4 flex-shrink-0"}),d.jsx("span",{className:"truncate max-w-[150px]",children:H.name}),o&&d.jsx("button",{onClick:be=>{be.preventDefault(),be.stopPropagation(),V(Z)},className:"opacity-0 group-hover:opacity-100 hover:text-red-400 transition-all flex-shrink-0",children:d.jsx(In,{className:"w-3 h-3 sm:w-4 sm:h-4"})})]},Z)),o&&d.jsx("button",{onClick:()=>x(!0),className:"bg-[#121212] hover:bg-[#1f1f1f] border border-[#bb86fc]/50 hover:border-[#bb86fc] text-[#bb86fc] p-1.5 sm:p-2 rounded-lg transition-all duration-200 flex items-center justify-center",title:"Añadir enlace externo",children:d.jsx(co,{className:"w-4 h-4 sm:w-5 sm:h-5"})})]})]})})]})]}),Y.trim()?d.jsxs("div",{className:"mt-2",children:[d.jsxs("h3",{className:"text-lg font-semibold text-white mb-4",children:["Resultados de búsqueda",le.length>0&&d.jsxs("span",{className:"text-sm text-gray-400 ml-2",children:["(",le.length," ",le.length===1?"resultado":"resultados",")"]})]}),Qe?d.jsx("div",{className:"flex justify-center py-12",children:d.jsx(gs,{size:40,borderWidth:2})}):le.length===0?d.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[d.jsx(mc,{className:"w-12 h-12 text-gray-600 mb-3"}),d.jsxs("p",{className:"text-gray-400 text-sm",children:['No se encontraron comics que coincidan con "',Y,'"']})]}):d.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 gap-1.5 sm:gap-2 md:gap-3",children:le.map(H=>{var be,ye;if(!H.id||!H.title)return null;(be=H.chapters)!=null&&be.length;const Z=((ye=H.chapters)==null?void 0:ye.reduce((ve,Xe)=>{var wt;return ve+(((wt=Xe.pages)==null?void 0:wt.length)||0)},0))||0;return d.jsx(IS,{id:H.id,title:H.title,author:H.author||"Desconocido",pageCount:Z,thumbnail:H.cover_url||H.thumbnail_url||void 0,manga:H,onSelect:ve=>{n&&(window.scrollTo({top:0,behavior:"smooth"}),n(ve))}},H.id)})})]}):a.chapters&&a.chapters.length>0&&a.chapters[0].pages&&a.chapters[0].pages.length>0&&d.jsxs("div",{className:"mt-6 sm:mt-8 border-t border-gray-800 pt-6 sm:pt-8",children:[d.jsxs("div",{className:"flex items-center justify-between mb-4 sm:mb-6",children:[d.jsx("h3",{className:"text-lg font-semibold text-white",children:"Páginas"}),d.jsxs("div",{className:"flex items-center gap-1 bg-[#0a0a0a] border border-gray-800 rounded-lg p-1",children:[d.jsxs("button",{onClick:()=>K("vertical"),className:`px-3 py-2 rounded-md flex items-center gap-2 text-xs sm:text-sm font-medium transition-all duration-200 ${ie==="vertical"?"bg-gradient-to-r from-[#bb86fc] to-[#9966dd] text-white shadow-lg shadow-[#bb86fc]/30":"text-gray-400 hover:text-white hover:bg-[#242424]"}`,title:"Vista vertical",children:[d.jsx(qf,{className:"w-4 h-4"}),d.jsx("span",{className:"hidden sm:inline",children:"Vertical"})]}),d.jsxs("button",{onClick:()=>K("gallery"),className:`px-3 py-2 rounded-md flex items-center gap-2 text-xs sm:text-sm font-medium transition-all duration-200 ${ie==="gallery"?"bg-gradient-to-r from-[#bb86fc] to-[#9966dd] text-white shadow-lg shadow-[#bb86fc]/30":"text-gray-400 hover:text-white hover:bg-[#242424]"}`,title:"Vista galería",children:[d.jsx($f,{className:"w-4 h-4"}),d.jsx("span",{className:"hidden sm:inline",children:"Galería"})]}),d.jsxs("button",{onClick:()=>K("grid"),className:`px-3 py-2 rounded-md flex items-center gap-2 text-xs sm:text-sm font-medium transition-all duration-200 ${ie==="grid"?"bg-gradient-to-r from-[#bb86fc] to-[#9966dd] text-white shadow-lg shadow-[#bb86fc]/30":"text-gray-400 hover:text-white hover:bg-[#242424]"}`,title:"Vista cuadrícula",children:[d.jsx(Hf,{className:"w-4 h-4"}),d.jsx("span",{className:"hidden sm:inline",children:"Cuadrícula"})]}),ie==="vertical"&&d.jsxs("div",{className:"flex items-center gap-1 ml-2 border-l border-gray-700 pl-2",children:[d.jsx("button",{onClick:Oe,className:"p-2 text-gray-400 hover:text-white hover:bg-[#242424] rounded-md transition-colors",title:"Reducir",children:d.jsx(Am,{className:"w-4 h-4"})}),d.jsxs("span",{className:"text-xs text-gray-300 w-8 text-center hidden sm:inline-block",children:[Math.round(ln*100),"%"]}),d.jsx("button",{onClick:Ht,className:"p-2 text-gray-400 hover:text-white hover:bg-[#242424] rounded-md transition-colors",title:"Aumentar",children:d.jsx(Nm,{className:"w-4 h-4"})}),d.jsx("button",{onClick:Ye,className:"p-2 text-gray-400 hover:text-white hover:bg-[#242424] rounded-md transition-colors",title:"Restablecer",children:d.jsx(km,{className:"w-3 h-3"})})]})]})]}),d.jsx("div",{className:`bg-[#121212] rounded-lg p-2 sm:p-4 transition-all duration-150 ease-out ${ie==="vertical"?"flex flex-col items-center gap-4":ie==="gallery"?"masonry-container":"grid grid-cols-3 md:grid-cols-5 gap-2"}`,children:ie==="gallery"?a.chapters[0].pages.map((H,Z)=>({pageUrl:H,index:Z})).map(({pageUrl:H,index:Z})=>d.jsx("div",{className:"masonry-item group cursor-pointer relative bg-black rounded-lg shadow-lg overflow-hidden transition-transform duration-300 hover:scale-[1.02]",onClick:()=>{A(Z),G(!0)},children:d.jsx(Gn,{src:H,alt:`Página ${Z+1}`,aspectRatio:"auto",objectFit:"contain",loading:Z>2?"lazy":"eager",className:"rounded-lg",imgClassName:"group-hover:scale-110"})},Z)):a.chapters[0].pages.map((H,Z)=>({pageUrl:H,index:Z})).map(({pageUrl:H,index:Z})=>d.jsx("div",{className:ie==="vertical"?"relative transition-all duration-200 mx-auto":"group cursor-pointer relative bg-black rounded-lg shadow-lg overflow-hidden transition-transform duration-300 hover:scale-[1.02]",style:ie==="vertical"?{width:`${Math.min(100*ln,100)}%`,maxWidth:ln>1?"none":void 0}:void 0,onClick:()=>{ie==="grid"&&(A(Z),G(!0))},children:d.jsx(Gn,{src:H,alt:`Página ${Z+1}`,aspectRatio:ie==="vertical"?"auto":"1/1",objectFit:ie==="vertical"?"contain":"cover",loading:Z>2?"lazy":"eager",className:ie==="vertical"?"rounded-lg shadow-2xl w-full":"rounded-lg",imgClassName:ie==="vertical"?"w-full":"group-hover:scale-110"})},Z))})]}),!Y.trim()&&pe.length>0&&d.jsxs("div",{className:"mt-8 sm:mt-12 border-t border-gray-800 pt-8 sm:pt-12",children:[d.jsx("h3",{className:"text-xl sm:text-2xl font-bold text-white mb-6",children:"Recomendaciones"}),P?d.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 gap-1.5 sm:gap-2 md:gap-3",children:Array.from({length:6}).map((H,Z)=>d.jsxs("div",{className:"animate-pulse",children:[d.jsx("div",{className:"bg-gray-800 rounded-lg aspect-[2/3] w-full mb-2"}),d.jsx("div",{className:"h-3 bg-gray-800 rounded w-3/4 mx-auto mb-1"}),d.jsx("div",{className:"h-2 bg-gray-800 rounded w-1/2 mx-auto"})]},Z))}):d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 gap-1.5 sm:gap-2 md:gap-3 mb-6 animate-slide-in-right",children:pe.slice((xt-1)*st,xt*st).map((H,Z)=>d.jsx("div",{children:d.jsxs("div",{onClick:()=>{window.scrollTo({top:0,behavior:"smooth"}),n&&n(H.id)},className:"group cursor-pointer flex flex-col",children:[d.jsx("div",{className:"relative bg-black rounded-lg shadow-lg overflow-hidden transition-transform duration-300 hover:scale-[1.02]",children:H.cover_url||H.thumbnail_url?d.jsxs(d.Fragment,{children:[d.jsx(Gn,{src:H.cover_url||H.thumbnail_url||"",alt:H.title,aspectRatio:"2/3",objectFit:"cover",loading:"lazy",imgClassName:"group-hover:scale-110"}),d.jsx("div",{className:"absolute inset-x-0 bottom-0 h-1/3 bg-gradient-to-t from-black/60 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300 ease-in-out pointer-events-none"})]}):d.jsx("div",{className:"w-full aspect-[2/3] flex items-center justify-center text-white/40 bg-black",children:d.jsx(F0,{className:"w-8 h-8"})})}),d.jsxs("div",{className:"mt-2 flex flex-col gap-0.5",children:[d.jsx("h4",{className:"font-semibold text-xs text-white line-clamp-2 text-center group-hover:text-[#bb86fc] transition-colors duration-300",children:H.title}),H.categories&&H.categories.length>0&&d.jsx("p",{className:"text-xs text-gray-500 text-center truncate",children:(H.categories.find(be=>be.type==="series")||H.categories[0]).name})]})]})},H.id))},xt),pe.length>st&&d.jsxs("div",{className:"flex items-center justify-center gap-2 mt-4 flex-wrap",children:[d.jsx("button",{onClick:()=>Rt(1),disabled:xt===1,className:"p-2 rounded-lg bg-[#1a1a1a] text-white hover:bg-[#bb86fc] disabled:opacity-50 disabled:hover:bg-[#1a1a1a] transition-colors",children:d.jsx(j1,{className:"w-4 h-4"})}),d.jsx("button",{onClick:()=>Rt(H=>Math.max(1,H-1)),disabled:xt===1,className:"p-2 rounded-lg bg-[#1a1a1a] text-white hover:bg-[#bb86fc] disabled:opacity-50 disabled:hover:bg-[#1a1a1a] transition-colors",children:d.jsx(nd,{className:"w-4 h-4"})}),d.jsxs("span",{className:"text-sm text-gray-400 px-2",children:["Página ",xt," de ",Math.ceil(pe.length/st)]}),d.jsx("button",{onClick:()=>Rt(H=>Math.min(Math.ceil(pe.length/st),H+1)),disabled:xt===Math.ceil(pe.length/st),className:"p-2 rounded-lg bg-[#1a1a1a] text-white hover:bg-[#bb86fc] disabled:opacity-50 disabled:hover:bg-[#1a1a1a] transition-colors",children:d.jsx(rd,{className:"w-4 h-4"})}),d.jsx("button",{onClick:()=>Rt(Math.ceil(pe.length/st)),disabled:xt===Math.ceil(pe.length/st),className:"p-2 rounded-lg bg-[#1a1a1a] text-white hover:bg-[#bb86fc] disabled:opacity-50 disabled:hover:bg-[#1a1a1a] transition-colors",children:d.jsx(L1,{className:"w-4 h-4"})})]})]})]})]}),d.jsx(id,{})]}),we&&((He=(je=a.chapters)==null?void 0:je[0])==null?void 0:He.pages)&&d.jsx(H1,{images:((et=a.chapters)==null?void 0:et[0].pages)||[],initialIndex:se,onClose:()=>G(!1)}),b&&d.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:d.jsxs("div",{className:"bg-gradient-to-b from-[#1f1f1f] to-[#121212] rounded-2xl border border-gray-700/40 w-full max-w-md shadow-2xl",children:[d.jsxs("div",{className:"bg-gradient-to-b from-[#2a2a2a]/80 to-[#1f1f1f]/80 border-b border-gray-700/30 px-6 py-4 flex items-center justify-between",children:[d.jsx("h2",{className:"text-xl font-bold text-white",children:"Añadir Enlace Externo"}),d.jsx("button",{onClick:()=>x(!1),className:"text-gray-500 hover:text-white transition-colors p-1.5 rounded-lg hover:bg-white/10",children:d.jsx(In,{className:"w-5 h-5"})})]}),d.jsxs("div",{className:"p-6 space-y-4",children:[d.jsxs("div",{children:[d.jsx("label",{className:"block text-sm font-semibold text-gray-200 mb-2",children:"Nombre del Enlace"}),d.jsx("input",{type:"text",placeholder:"Ej: Servidor Alternativo",value:E.name,onChange:H=>I({...E,name:H.target.value}),className:"w-full bg-[#1a1a1a] border border-gray-600/50 rounded-lg px-4 py-3 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-[#bb86fc] focus:ring-2 focus:ring-[#bb86fc]/30 transition-all"})]}),d.jsxs("div",{children:[d.jsx("label",{className:"block text-sm font-semibold text-gray-200 mb-2",children:"URL del Enlace"}),d.jsx("input",{type:"url",placeholder:"https://ejemplo.com/descarga",value:E.url,onChange:H=>I({...E,url:H.target.value}),className:"w-full bg-[#1a1a1a] border border-gray-600/50 rounded-lg px-4 py-3 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-[#bb86fc] focus:ring-2 focus:ring-[#bb86fc]/30 transition-all"})]}),d.jsxs("div",{className:"flex gap-3 pt-2",children:[d.jsx("button",{onClick:()=>x(!1),className:"flex-1 bg-[#1a1a1a] border border-gray-600/50 hover:border-gray-500 hover:bg-[#242424] text-white px-4 py-3 rounded-lg font-semibold text-sm transition-all",children:"Cancelar"}),d.jsx("button",{onClick:Q,disabled:!E.name.trim()||!E.url.trim(),className:"flex-1 bg-gradient-to-r from-[#bb86fc] to-[#9966dd] hover:from-[#9966dd] hover:to-[#7744cc] disabled:opacity-50 disabled:cursor-not-allowed text-white px-4 py-3 rounded-lg font-semibold text-sm transition-all shadow-lg shadow-[#bb86fc]/40 hover:shadow-[#bb86fc]/60",children:"Añadir Enlace"})]})]})]})})]})}function Nj({manga:t,chapter:e,onBack:n}){const[r,i]=F.useState(0);if(!e.pages||e.pages.length===0)return d.jsxs("div",{className:"h-screen bg-[#121212] flex flex-col items-center justify-center",children:[d.jsx("button",{onClick:n,className:"absolute top-6 left-6 p-2 hover:bg-[#333] rounded-lg transition-colors text-gray-300 hover:text-white",children:d.jsx(To,{className:"w-5 h-5"})}),d.jsx("div",{className:"text-gray-400 text-lg",children:"No hay páginas disponibles"})]});const s=()=>{r>0&&i(r-1)},o=()=>{r{const c=u<2,h=kj(a);return d.jsx("div",{className:"w-full flex justify-center",children:d.jsx(Gn,{src:h,alt:`Página ${u+1}`,aspectRatio:"auto",objectFit:"contain",loading:c?"eager":"lazy",className:"max-w-full shadow-2xl",showPlaceholder:u>0})},u)}),d.jsx("div",{className:"w-full mt-8",children:d.jsx(id,{})})]})}),d.jsx("div",{className:"border-t border-gray-700/60 bg-gradient-to-r from-[#2a2a2a] to-[#252525] px-6 py-6 flex-shrink-0",children:d.jsxs("div",{className:"max-w-7xl mx-auto flex items-center justify-between",children:[d.jsxs("button",{onClick:s,disabled:r===0,className:"flex items-center gap-2 px-4 py-2 rounded-lg bg-gray-800 hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed text-white transition-all",children:[d.jsx(nd,{className:"w-5 h-5"}),"Anterior"]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("input",{type:"range",min:"0",max:e.pages.length-1,value:r,onChange:a=>i(parseInt(a.target.value)),className:"w-64 h-2 bg-gray-700 rounded-lg appearance-none cursor-pointer accent-[#bb86fc]"}),d.jsxs("span",{className:"text-sm text-gray-400 w-12 text-right",children:[r+1,"/",e.pages.length]})]}),d.jsxs("button",{onClick:o,disabled:r===e.pages.length-1,className:"flex items-center gap-2 px-4 py-2 rounded-lg bg-gray-800 hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed text-white transition-all",children:["Siguiente",d.jsx(rd,{className:"w-5 h-5"})]})]})})]})}const kS="settings",CS="info",Aj=`# Bienvenid@ a Twisted Brody MangaFlow +¡Tu plataforma definitiva para la gestión y lectura de mangas! + +Este proyecto nació con la misión de ofrecer una experiencia de lectura fluida, moderna y sin interrupciones, diseñada por fans para fans. + +## 🌟 Características Principales + +* **⚡ Lectura sin límites:** Disfruta de una interfaz optimizada, rápida y responsiva. +* **📥 Descargas Flexibles:** Baja tus capítulos favoritos en formato **ZIP** o **PDF** para leer offline. +* **🔄 Conversión Inteligente:** Nuestro servidor procesa las imágenes para darte la mejor calidad y compatibilidad. + +## 🤝 Comunidad y Apoyo + +Este es un proyecto **sin fines de lucro**, desarrollado por pura pasión. + +Sin embargo, si valoras mi trabajo y quieres apoyarme para mantener el proyecto vivo, puedes suscribirte a mi **Patreon**. ¡Tu apoyo significa mucho! + +* [**💜 Apóyame en Patreon**](https://www.patreon.com/cw/Twistedbrody) + +### 💡 ¿Tienes nuevas ideas? +¡Quiero escucharlas! Si tienes sugerencias, feedback o ideas locas, háblame directamente: + +* **Telegram:** [@twistedbrodyoficial](https://t.me/twistedbrodyoficial) + +También puedes unirte a nuestros canales: +* [Canal Principal](https://t.me/twistedbrody) +* [Canal Hub](https://t.me/+CmmZFHM9hpViYzMx) +* [X (Twitter)](https://x.com/TwistedBrody) + +--- +> **Disclaimer:** Todo el contenido es propiedad de sus respectivos autores. Apoya el material original siempre que sea posible. + + +`;async function Pj(t){const e=Pt(Be,kS,CS),n={content:t,updatedAt:new Date().toISOString()};await OE(e,n)}function Rj(t){const e=Pt(Be,kS,CS);return wg(e,n=>{n.exists()?t(n.data()):t({content:Aj,updatedAt:new Date().toISOString()})})}function Dj(t,e){const n={};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const jj=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Lj=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Oj={};function Cx(t,e){return(Oj.jsx?Lj:jj).test(t)}const Mj=/[ \t\n\f\r]/g;function Vj(t){return typeof t=="object"?t.type==="text"?Nx(t.value):!1:Nx(t)}function Nx(t){return t.replace(Mj,"")===""}class Dl{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}Dl.prototype.normal={};Dl.prototype.property={};Dl.prototype.space=void 0;function NS(t,e){const n={},r={};for(const i of t)Object.assign(n,i.property),Object.assign(r,i.normal);return new Dl(n,r,e)}function bp(t){return t.toLowerCase()}class An{constructor(e,n){this.attribute=n,this.property=e}}An.prototype.attribute="";An.prototype.booleanish=!1;An.prototype.boolean=!1;An.prototype.commaOrSpaceSeparated=!1;An.prototype.commaSeparated=!1;An.prototype.defined=!1;An.prototype.mustUseProperty=!1;An.prototype.number=!1;An.prototype.overloadedBoolean=!1;An.prototype.property="";An.prototype.spaceSeparated=!1;An.prototype.space=void 0;let Fj=0;const Pe=js(),It=js(),Ep=js(),J=js(),tt=js(),go=js(),Dn=js();function js(){return 2**++Fj}const Sp=Object.freeze(Object.defineProperty({__proto__:null,boolean:Pe,booleanish:It,commaOrSpaceSeparated:Dn,commaSeparated:go,number:J,overloadedBoolean:Ep,spaceSeparated:tt},Symbol.toStringTag,{value:"Module"})),Oh=Object.keys(Sp);class Pg extends An{constructor(e,n,r,i){let s=-1;if(super(e,n),Ax(this,"space",i),typeof r=="number")for(;++s4&&n.slice(0,4)==="data"&&Hj.test(e)){if(e.charAt(4)==="-"){const s=e.slice(5).replace(Px,Gj);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=e.slice(4);if(!Px.test(s)){let o=s.replace($j,Wj);o.charAt(0)!=="-"&&(o="-"+o),e="data"+o}}i=Pg}return new i(r,e)}function Wj(t){return"-"+t.toLowerCase()}function Gj(t){return t.charAt(1).toUpperCase()}const Kj=NS([AS,Uj,DS,jS,LS],"html"),Rg=NS([AS,zj,DS,jS,LS],"svg");function Qj(t){return t.join(" ").trim()}var Dg={},Rx=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,Yj=/\n/g,Xj=/^\s*/,Jj=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,Zj=/^:\s*/,e3=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,t3=/^[;\s]*/,n3=/^\s+|\s+$/g,r3=` +`,Dx="/",jx="*",os="",i3="comment",s3="declaration";function o3(t,e){if(typeof t!="string")throw new TypeError("First argument must be a string");if(!t)return[];e=e||{};var n=1,r=1;function i(_){var T=_.match(Yj);T&&(n+=T.length);var R=_.lastIndexOf(r3);r=~R?_.length-R:r+_.length}function s(){var _={line:n,column:r};return function(T){return T.position=new o(_),c(),T}}function o(_){this.start=_,this.end={line:n,column:r},this.source=e.source}o.prototype.content=t;function a(_){var T=new Error(e.source+":"+n+":"+r+": "+_);if(T.reason=_,T.filename=e.source,T.line=n,T.column=r,T.source=t,!e.silent)throw T}function u(_){var T=_.exec(t);if(T){var R=T[0];return i(R),t=t.slice(R.length),T}}function c(){u(Xj)}function h(_){var T;for(_=_||[];T=f();)T!==!1&&_.push(T);return _}function f(){var _=s();if(!(Dx!=t.charAt(0)||jx!=t.charAt(1))){for(var T=2;os!=t.charAt(T)&&(jx!=t.charAt(T)||Dx!=t.charAt(T+1));)++T;if(T+=2,os===t.charAt(T-1))return a("End of comment missing");var R=t.slice(2,T-2);return r+=2,i(R),t=t.slice(T),r+=2,_({type:i3,comment:R})}}function p(){var _=s(),T=u(Jj);if(T){if(f(),!u(Zj))return a("property missing ':'");var R=u(e3),y=_({type:s3,property:Lx(T[0].replace(Rx,os)),value:R?Lx(R[0].replace(Rx,os)):os});return u(t3),y}}function g(){var _=[];h(_);for(var T;T=p();)T!==!1&&(_.push(T),h(_));return _}return c(),g()}function Lx(t){return t?t.replace(n3,os):os}var a3=o3,l3=Hu&&Hu.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Dg,"__esModule",{value:!0});Dg.default=c3;const u3=l3(a3);function c3(t,e){let n=null;if(!t||typeof t!="string")return n;const r=(0,u3.default)(t),i=typeof e=="function";return r.forEach(s=>{if(s.type!=="declaration")return;const{property:o,value:a}=s;i?e(o,a,s):a&&(n=n||{},n[o]=a)}),n}var Dd={};Object.defineProperty(Dd,"__esModule",{value:!0});Dd.camelCase=void 0;var d3=/^--[a-zA-Z0-9_-]+$/,h3=/-([a-z])/g,f3=/^[^-]+$/,p3=/^-(webkit|moz|ms|o|khtml)-/,m3=/^-(ms)-/,g3=function(t){return!t||f3.test(t)||d3.test(t)},y3=function(t,e){return e.toUpperCase()},Ox=function(t,e){return"".concat(e,"-")},v3=function(t,e){return e===void 0&&(e={}),g3(t)?t:(t=t.toLowerCase(),e.reactCompat?t=t.replace(m3,Ox):t=t.replace(p3,Ox),t.replace(h3,y3))};Dd.camelCase=v3;var x3=Hu&&Hu.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},w3=x3(Dg),_3=Dd;function Tp(t,e){var n={};return!t||typeof t!="string"||(0,w3.default)(t,function(r,i){r&&i&&(n[(0,_3.camelCase)(r,e)]=i)}),n}Tp.default=Tp;var b3=Tp;const E3=Fc(b3),OS=MS("end"),jg=MS("start");function MS(t){return e;function e(n){const r=n&&n.position&&n.position[t]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function S3(t){const e=jg(t),n=OS(t);if(e&&n)return{start:e,end:n}}function Oa(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?Mx(t.position):"start"in t||"end"in t?Mx(t):"line"in t||"column"in t?Ip(t):""}function Ip(t){return Vx(t&&t.line)+":"+Vx(t&&t.column)}function Mx(t){return Ip(t&&t.start)+"-"+Ip(t&&t.end)}function Vx(t){return t&&typeof t=="number"?t:1}class an extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",s={},o=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof e=="string"?i=e:!s.cause&&e&&(o=!0,i=e.message,s.cause=e),!s.ruleId&&!s.source&&typeof r=="string"){const u=r.indexOf(":");u===-1?s.ruleId=r:(s.source=r.slice(0,u),s.ruleId=r.slice(u+1))}if(!s.place&&s.ancestors&&s.ancestors){const u=s.ancestors[s.ancestors.length-1];u&&(s.place=u.position)}const a=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=a?a.line:void 0,this.name=Oa(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}an.prototype.file="";an.prototype.name="";an.prototype.reason="";an.prototype.message="";an.prototype.stack="";an.prototype.column=void 0;an.prototype.line=void 0;an.prototype.ancestors=void 0;an.prototype.cause=void 0;an.prototype.fatal=void 0;an.prototype.place=void 0;an.prototype.ruleId=void 0;an.prototype.source=void 0;const Lg={}.hasOwnProperty,T3=new Map,I3=/[A-Z]/g,k3=new Set(["table","tbody","thead","tfoot","tr"]),C3=new Set(["td","th"]),VS="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function N3(t,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=e.filePath||void 0;let r;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=M3(n,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=O3(n,e.jsx,e.jsxs)}const i={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:r,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?Rg:Kj,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},s=FS(i,t,void 0);return s&&typeof s!="string"?s:i.create(t,i.Fragment,{children:s||void 0},void 0)}function FS(t,e,n){if(e.type==="element")return A3(t,e,n);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return P3(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return D3(t,e,n);if(e.type==="mdxjsEsm")return R3(t,e);if(e.type==="root")return j3(t,e,n);if(e.type==="text")return L3(t,e)}function A3(t,e,n){const r=t.schema;let i=r;e.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=Rg,t.schema=i),t.ancestors.push(e);const s=zS(t,e.tagName,!1),o=V3(t,e);let a=Mg(t,e);return k3.has(e.tagName)&&(a=a.filter(function(u){return typeof u=="string"?!Vj(u):!0})),US(t,o,s,e),Og(o,a),t.ancestors.pop(),t.schema=r,t.create(e,s,o,n)}function P3(t,e){if(e.data&&e.data.estree&&t.evaluater){const r=e.data.estree.body[0];return r.type,t.evaluater.evaluateExpression(r.expression)}pl(t,e.position)}function R3(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);pl(t,e.position)}function D3(t,e,n){const r=t.schema;let i=r;e.name==="svg"&&r.space==="html"&&(i=Rg,t.schema=i),t.ancestors.push(e);const s=e.name===null?t.Fragment:zS(t,e.name,!0),o=F3(t,e),a=Mg(t,e);return US(t,o,s,e),Og(o,a),t.ancestors.pop(),t.schema=r,t.create(e,s,o,n)}function j3(t,e,n){const r={};return Og(r,Mg(t,e)),t.create(e,t.Fragment,r,n)}function L3(t,e){return e.value}function US(t,e,n,r){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=r)}function Og(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function O3(t,e,n){return r;function r(i,s,o,a){const c=Array.isArray(o.children)?n:e;return a?c(s,o,a):c(s,o)}}function M3(t,e){return n;function n(r,i,s,o){const a=Array.isArray(s.children),u=jg(r);return e(i,s,o,a,{columnNumber:u?u.column-1:void 0,fileName:t,lineNumber:u?u.line:void 0},void 0)}}function V3(t,e){const n={};let r,i;for(i in e.properties)if(i!=="children"&&Lg.call(e.properties,i)){const s=U3(t,i,e.properties[i]);if(s){const[o,a]=s;t.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&C3.has(e.tagName)?r=a:n[o]=a}}if(r){const s=n.style||(n.style={});s[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function F3(t,e){const n={};for(const r of e.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&t.evaluater){const s=r.data.estree.body[0];s.type;const o=s.expression;o.type;const a=o.properties[0];a.type,Object.assign(n,t.evaluater.evaluateExpression(a.argument))}else pl(t,e.position);else{const i=r.name;let s;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&t.evaluater){const a=r.value.data.estree.body[0];a.type,s=t.evaluater.evaluateExpression(a.expression)}else pl(t,e.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function Mg(t,e){const n=[];let r=-1;const i=t.passKeys?new Map:T3;for(;++ri?0:i+e:e=e>i?i:e,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(e,n),t.splice(...o);else for(n&&t.splice(e,n);s0?(Pr(t,t.length,0,e),t):e}const zx={}.hasOwnProperty;function K3(t){const e={};let n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function yo(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const xr=Ji(/[A-Za-z]/),Mn=Ji(/[\dA-Za-z]/),X3=Ji(/[#-'*+\--9=?A-Z^-~]/);function kp(t){return t!==null&&(t<32||t===127)}const Cp=Ji(/\d/),J3=Ji(/[\dA-Fa-f]/),Z3=Ji(/[!-/:-@[-`{-~]/);function Ie(t){return t!==null&&t<-2}function Nn(t){return t!==null&&(t<0||t===32)}function qe(t){return t===-2||t===-1||t===32}const e6=Ji(new RegExp("\\p{P}|\\p{S}","u")),t6=Ji(/\s/);function Ji(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function Ho(t){const e=[];let n=-1,r=0,i=0;for(;++n55295&&s<57344){const a=t.charCodeAt(n+1);s<56320&&a>56319&&a<57344?(o=String.fromCharCode(s,a),i=1):o="�"}else o=String.fromCharCode(s);o&&(e.push(t.slice(r,n),encodeURIComponent(o)),r=n+i+1,o=""),i&&(n+=i,i=0)}return e.join("")+t.slice(r)}function it(t,e,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(u){return qe(u)?(t.enter(n),a(u)):e(u)}function a(u){return qe(u)&&s++o))return;const b=e.events.length;let x=b,E,I;for(;x--;)if(e.events[x][0]==="exit"&&e.events[x][1].type==="chunkFlow"){if(E){I=e.events[x][1].end;break}E=!0}for(y(r),j=b;jk;){const U=n[L];e.containerState=U[1],U[0].exit.call(e,t)}n.length=k}function w(){i.write([null]),s=void 0,i=void 0,e.containerState._closeFlow=void 0}}function o6(t,e,n){return it(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function $x(t){if(t===null||Nn(t)||t6(t))return 1;if(e6(t))return 2}function Fg(t,e,n){const r=[];let i=-1;for(;++i1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const f={...t[r][1].end},p={...t[n][1].start};Hx(f,-u),Hx(p,u),o={type:u>1?"strongSequence":"emphasisSequence",start:f,end:{...t[r][1].end}},a={type:u>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:p},s={type:u>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},i={type:u>1?"strong":"emphasis",start:{...o.start},end:{...a.end}},t[r][1].end={...o.start},t[n][1].start={...a.end},c=[],t[r][1].end.offset-t[r][1].start.offset&&(c=Hn(c,[["enter",t[r][1],e],["exit",t[r][1],e]])),c=Hn(c,[["enter",i,e],["enter",o,e],["exit",o,e],["enter",s,e]]),c=Hn(c,Fg(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),c=Hn(c,[["exit",s,e],["enter",a,e],["exit",a,e],["exit",i,e]]),t[n][1].end.offset-t[n][1].start.offset?(h=2,c=Hn(c,[["enter",t[n][1],e],["exit",t[n][1],e]])):h=0,Pr(t,r-1,n-r+3,c),n=r+c.length-h-2;break}}for(n=-1;++n0&&qe(j)?it(t,w,"linePrefix",s+1)(j):w(j)}function w(j){return j===null||Ie(j)?t.check(qx,T,L)(j):(t.enter("codeFlowValue"),k(j))}function k(j){return j===null||Ie(j)?(t.exit("codeFlowValue"),w(j)):(t.consume(j),k)}function L(j){return t.exit("codeFenced"),e(j)}function U(j,b,x){let E=0;return I;function I(ie){return j.enter("lineEnding"),j.consume(ie),j.exit("lineEnding"),N}function N(ie){return j.enter("codeFencedFence"),qe(ie)?it(j,D,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(ie):D(ie)}function D(ie){return ie===a?(j.enter("codeFencedFenceSequence"),C(ie)):x(ie)}function C(ie){return ie===a?(E++,j.consume(ie),C):E>=o?(j.exit("codeFencedFenceSequence"),qe(ie)?it(j,ge,"whitespace")(ie):ge(ie)):x(ie)}function ge(ie){return ie===null||Ie(ie)?(j.exit("codeFencedFence"),b(ie)):x(ie)}}}function v6(t,e,n){const r=this;return i;function i(o){return o===null?n(o):(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s)}function s(o){return r.parser.lazy[r.now().line]?n(o):e(o)}}const Vh={name:"codeIndented",tokenize:w6},x6={partial:!0,tokenize:_6};function w6(t,e,n){const r=this;return i;function i(c){return t.enter("codeIndented"),it(t,s,"linePrefix",5)(c)}function s(c){const h=r.events[r.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?o(c):n(c)}function o(c){return c===null?u(c):Ie(c)?t.attempt(x6,o,u)(c):(t.enter("codeFlowValue"),a(c))}function a(c){return c===null||Ie(c)?(t.exit("codeFlowValue"),o(c)):(t.consume(c),a)}function u(c){return t.exit("codeIndented"),e(c)}}function _6(t,e,n){const r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):Ie(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),i):it(t,s,"linePrefix",5)(o)}function s(o){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(o):Ie(o)?i(o):n(o)}}const b6={name:"codeText",previous:S6,resolve:E6,tokenize:T6};function E6(t){let e=t.length-4,n=3,r,i;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(r=n;++r=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return ethis.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(e,n,r){const i=n||0;this.setCursor(Math.trunc(e));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&da(this.left,r),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),da(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),da(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e=4?e(o):t.interrupt(r.parser.constructs.flow,n,e)(o)}}function KS(t,e,n,r,i,s,o,a,u){const c=u||Number.POSITIVE_INFINITY;let h=0;return f;function f(y){return y===60?(t.enter(r),t.enter(i),t.enter(s),t.consume(y),t.exit(s),p):y===null||y===32||y===41||kp(y)?n(y):(t.enter(r),t.enter(o),t.enter(a),t.enter("chunkString",{contentType:"string"}),T(y))}function p(y){return y===62?(t.enter(s),t.consume(y),t.exit(s),t.exit(i),t.exit(r),e):(t.enter(a),t.enter("chunkString",{contentType:"string"}),g(y))}function g(y){return y===62?(t.exit("chunkString"),t.exit(a),p(y)):y===null||y===60||Ie(y)?n(y):(t.consume(y),y===92?_:g)}function _(y){return y===60||y===62||y===92?(t.consume(y),g):g(y)}function T(y){return!h&&(y===null||y===41||Nn(y))?(t.exit("chunkString"),t.exit(a),t.exit(o),t.exit(r),e(y)):h999||g===null||g===91||g===93&&!u||g===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?n(g):g===93?(t.exit(s),t.enter(i),t.consume(g),t.exit(i),t.exit(r),e):Ie(g)?(t.enter("lineEnding"),t.consume(g),t.exit("lineEnding"),h):(t.enter("chunkString",{contentType:"string"}),f(g))}function f(g){return g===null||g===91||g===93||Ie(g)||a++>999?(t.exit("chunkString"),h(g)):(t.consume(g),u||(u=!qe(g)),g===92?p:f)}function p(g){return g===91||g===92||g===93?(t.consume(g),a++,f):f(g)}}function YS(t,e,n,r,i,s){let o;return a;function a(p){return p===34||p===39||p===40?(t.enter(r),t.enter(i),t.consume(p),t.exit(i),o=p===40?41:p,u):n(p)}function u(p){return p===o?(t.enter(i),t.consume(p),t.exit(i),t.exit(r),e):(t.enter(s),c(p))}function c(p){return p===o?(t.exit(s),u(o)):p===null?n(p):Ie(p)?(t.enter("lineEnding"),t.consume(p),t.exit("lineEnding"),it(t,c,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),h(p))}function h(p){return p===o||p===null||Ie(p)?(t.exit("chunkString"),c(p)):(t.consume(p),p===92?f:h)}function f(p){return p===o||p===92?(t.consume(p),h):h(p)}}function Ma(t,e){let n;return r;function r(i){return Ie(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),n=!0,r):qe(i)?it(t,r,n?"linePrefix":"lineSuffix")(i):e(i)}}const D6={name:"definition",tokenize:L6},j6={partial:!0,tokenize:O6};function L6(t,e,n){const r=this;let i;return s;function s(g){return t.enter("definition"),o(g)}function o(g){return QS.call(r,t,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(g)}function a(g){return i=yo(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),g===58?(t.enter("definitionMarker"),t.consume(g),t.exit("definitionMarker"),u):n(g)}function u(g){return Nn(g)?Ma(t,c)(g):c(g)}function c(g){return KS(t,h,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(g)}function h(g){return t.attempt(j6,f,f)(g)}function f(g){return qe(g)?it(t,p,"whitespace")(g):p(g)}function p(g){return g===null||Ie(g)?(t.exit("definition"),r.parser.defined.push(i),e(g)):n(g)}}function O6(t,e,n){return r;function r(a){return Nn(a)?Ma(t,i)(a):n(a)}function i(a){return YS(t,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function s(a){return qe(a)?it(t,o,"whitespace")(a):o(a)}function o(a){return a===null||Ie(a)?e(a):n(a)}}const M6={name:"hardBreakEscape",tokenize:V6};function V6(t,e,n){return r;function r(s){return t.enter("hardBreakEscape"),t.consume(s),i}function i(s){return Ie(s)?(t.exit("hardBreakEscape"),e(s)):n(s)}}const F6={name:"headingAtx",resolve:U6,tokenize:z6};function U6(t,e){let n=t.length-2,r=3,i,s;return t[r][1].type==="whitespace"&&(r+=2),n-2>r&&t[n][1].type==="whitespace"&&(n-=2),t[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&t[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:t[r][1].start,end:t[n][1].end},s={type:"chunkText",start:t[r][1].start,end:t[n][1].end,contentType:"text"},Pr(t,r,n-r+1,[["enter",i,e],["enter",s,e],["exit",s,e],["exit",i,e]])),t}function z6(t,e,n){let r=0;return i;function i(h){return t.enter("atxHeading"),s(h)}function s(h){return t.enter("atxHeadingSequence"),o(h)}function o(h){return h===35&&r++<6?(t.consume(h),o):h===null||Nn(h)?(t.exit("atxHeadingSequence"),a(h)):n(h)}function a(h){return h===35?(t.enter("atxHeadingSequence"),u(h)):h===null||Ie(h)?(t.exit("atxHeading"),e(h)):qe(h)?it(t,a,"whitespace")(h):(t.enter("atxHeadingText"),c(h))}function u(h){return h===35?(t.consume(h),u):(t.exit("atxHeadingSequence"),a(h))}function c(h){return h===null||h===35||Nn(h)?(t.exit("atxHeadingText"),a(h)):(t.consume(h),c)}}const B6=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Gx=["pre","script","style","textarea"],$6={concrete:!0,name:"htmlFlow",resolveTo:W6,tokenize:G6},H6={partial:!0,tokenize:Q6},q6={partial:!0,tokenize:K6};function W6(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function G6(t,e,n){const r=this;let i,s,o,a,u;return c;function c(P){return h(P)}function h(P){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(P),f}function f(P){return P===33?(t.consume(P),p):P===47?(t.consume(P),s=!0,T):P===63?(t.consume(P),i=3,r.interrupt?e:A):xr(P)?(t.consume(P),o=String.fromCharCode(P),R):n(P)}function p(P){return P===45?(t.consume(P),i=2,g):P===91?(t.consume(P),i=5,a=0,_):xr(P)?(t.consume(P),i=4,r.interrupt?e:A):n(P)}function g(P){return P===45?(t.consume(P),r.interrupt?e:A):n(P)}function _(P){const $="CDATA[";return P===$.charCodeAt(a++)?(t.consume(P),a===$.length?r.interrupt?e:D:_):n(P)}function T(P){return xr(P)?(t.consume(P),o=String.fromCharCode(P),R):n(P)}function R(P){if(P===null||P===47||P===62||Nn(P)){const $=P===47,Y=o.toLowerCase();return!$&&!s&&Gx.includes(Y)?(i=1,r.interrupt?e(P):D(P)):B6.includes(o.toLowerCase())?(i=6,$?(t.consume(P),y):r.interrupt?e(P):D(P)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(P):s?w(P):k(P))}return P===45||Mn(P)?(t.consume(P),o+=String.fromCharCode(P),R):n(P)}function y(P){return P===62?(t.consume(P),r.interrupt?e:D):n(P)}function w(P){return qe(P)?(t.consume(P),w):I(P)}function k(P){return P===47?(t.consume(P),I):P===58||P===95||xr(P)?(t.consume(P),L):qe(P)?(t.consume(P),k):I(P)}function L(P){return P===45||P===46||P===58||P===95||Mn(P)?(t.consume(P),L):U(P)}function U(P){return P===61?(t.consume(P),j):qe(P)?(t.consume(P),U):k(P)}function j(P){return P===null||P===60||P===61||P===62||P===96?n(P):P===34||P===39?(t.consume(P),u=P,b):qe(P)?(t.consume(P),j):x(P)}function b(P){return P===u?(t.consume(P),u=null,E):P===null||Ie(P)?n(P):(t.consume(P),b)}function x(P){return P===null||P===34||P===39||P===47||P===60||P===61||P===62||P===96||Nn(P)?U(P):(t.consume(P),x)}function E(P){return P===47||P===62||qe(P)?k(P):n(P)}function I(P){return P===62?(t.consume(P),N):n(P)}function N(P){return P===null||Ie(P)?D(P):qe(P)?(t.consume(P),N):n(P)}function D(P){return P===45&&i===2?(t.consume(P),fe):P===60&&i===1?(t.consume(P),we):P===62&&i===4?(t.consume(P),pe):P===63&&i===3?(t.consume(P),A):P===93&&i===5?(t.consume(P),se):Ie(P)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(H6,_e,C)(P)):P===null||Ie(P)?(t.exit("htmlFlowData"),C(P)):(t.consume(P),D)}function C(P){return t.check(q6,ge,_e)(P)}function ge(P){return t.enter("lineEnding"),t.consume(P),t.exit("lineEnding"),ie}function ie(P){return P===null||Ie(P)?C(P):(t.enter("htmlFlowData"),D(P))}function fe(P){return P===45?(t.consume(P),A):D(P)}function we(P){return P===47?(t.consume(P),o="",G):D(P)}function G(P){if(P===62){const $=o.toLowerCase();return Gx.includes($)?(t.consume(P),pe):D(P)}return xr(P)&&o.length<8?(t.consume(P),o+=String.fromCharCode(P),G):D(P)}function se(P){return P===93?(t.consume(P),A):D(P)}function A(P){return P===62?(t.consume(P),pe):P===45&&i===2?(t.consume(P),A):D(P)}function pe(P){return P===null||Ie(P)?(t.exit("htmlFlowData"),_e(P)):(t.consume(P),pe)}function _e(P){return t.exit("htmlFlow"),e(P)}}function K6(t,e,n){const r=this;return i;function i(o){return Ie(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s):n(o)}function s(o){return r.parser.lazy[r.now().line]?n(o):e(o)}}function Q6(t,e,n){return r;function r(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(jd,e,n)}}const Y6={name:"htmlText",tokenize:X6};function X6(t,e,n){const r=this;let i,s,o;return a;function a(A){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(A),u}function u(A){return A===33?(t.consume(A),c):A===47?(t.consume(A),U):A===63?(t.consume(A),k):xr(A)?(t.consume(A),x):n(A)}function c(A){return A===45?(t.consume(A),h):A===91?(t.consume(A),s=0,_):xr(A)?(t.consume(A),w):n(A)}function h(A){return A===45?(t.consume(A),g):n(A)}function f(A){return A===null?n(A):A===45?(t.consume(A),p):Ie(A)?(o=f,we(A)):(t.consume(A),f)}function p(A){return A===45?(t.consume(A),g):f(A)}function g(A){return A===62?fe(A):A===45?p(A):f(A)}function _(A){const pe="CDATA[";return A===pe.charCodeAt(s++)?(t.consume(A),s===pe.length?T:_):n(A)}function T(A){return A===null?n(A):A===93?(t.consume(A),R):Ie(A)?(o=T,we(A)):(t.consume(A),T)}function R(A){return A===93?(t.consume(A),y):T(A)}function y(A){return A===62?fe(A):A===93?(t.consume(A),y):T(A)}function w(A){return A===null||A===62?fe(A):Ie(A)?(o=w,we(A)):(t.consume(A),w)}function k(A){return A===null?n(A):A===63?(t.consume(A),L):Ie(A)?(o=k,we(A)):(t.consume(A),k)}function L(A){return A===62?fe(A):k(A)}function U(A){return xr(A)?(t.consume(A),j):n(A)}function j(A){return A===45||Mn(A)?(t.consume(A),j):b(A)}function b(A){return Ie(A)?(o=b,we(A)):qe(A)?(t.consume(A),b):fe(A)}function x(A){return A===45||Mn(A)?(t.consume(A),x):A===47||A===62||Nn(A)?E(A):n(A)}function E(A){return A===47?(t.consume(A),fe):A===58||A===95||xr(A)?(t.consume(A),I):Ie(A)?(o=E,we(A)):qe(A)?(t.consume(A),E):fe(A)}function I(A){return A===45||A===46||A===58||A===95||Mn(A)?(t.consume(A),I):N(A)}function N(A){return A===61?(t.consume(A),D):Ie(A)?(o=N,we(A)):qe(A)?(t.consume(A),N):E(A)}function D(A){return A===null||A===60||A===61||A===62||A===96?n(A):A===34||A===39?(t.consume(A),i=A,C):Ie(A)?(o=D,we(A)):qe(A)?(t.consume(A),D):(t.consume(A),ge)}function C(A){return A===i?(t.consume(A),i=void 0,ie):A===null?n(A):Ie(A)?(o=C,we(A)):(t.consume(A),C)}function ge(A){return A===null||A===34||A===39||A===60||A===61||A===96?n(A):A===47||A===62||Nn(A)?E(A):(t.consume(A),ge)}function ie(A){return A===47||A===62||Nn(A)?E(A):n(A)}function fe(A){return A===62?(t.consume(A),t.exit("htmlTextData"),t.exit("htmlText"),e):n(A)}function we(A){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(A),t.exit("lineEnding"),G}function G(A){return qe(A)?it(t,se,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(A):se(A)}function se(A){return t.enter("htmlTextData"),o(A)}}const Ug={name:"labelEnd",resolveAll:t5,resolveTo:n5,tokenize:r5},J6={tokenize:i5},Z6={tokenize:s5},e5={tokenize:o5};function t5(t){let e=-1;const n=[];for(;++e=3&&(c===null||Ie(c))?(t.exit("thematicBreak"),e(c)):n(c)}function u(c){return c===i?(t.consume(c),r++,u):(t.exit("thematicBreakSequence"),qe(c)?it(t,a,"whitespace")(c):a(c))}}const yn={continuation:{tokenize:g5},exit:v5,name:"list",tokenize:m5},f5={partial:!0,tokenize:x5},p5={partial:!0,tokenize:y5};function m5(t,e,n){const r=this,i=r.events[r.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return a;function a(g){const _=r.containerState.type||(g===42||g===43||g===45?"listUnordered":"listOrdered");if(_==="listUnordered"?!r.containerState.marker||g===r.containerState.marker:Cp(g)){if(r.containerState.type||(r.containerState.type=_,t.enter(_,{_container:!0})),_==="listUnordered")return t.enter("listItemPrefix"),g===42||g===45?t.check(Bu,n,c)(g):c(g);if(!r.interrupt||g===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),u(g)}return n(g)}function u(g){return Cp(g)&&++o<10?(t.consume(g),u):(!r.interrupt||o<2)&&(r.containerState.marker?g===r.containerState.marker:g===41||g===46)?(t.exit("listItemValue"),c(g)):n(g)}function c(g){return t.enter("listItemMarker"),t.consume(g),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||g,t.check(jd,r.interrupt?n:h,t.attempt(f5,p,f))}function h(g){return r.containerState.initialBlankLine=!0,s++,p(g)}function f(g){return qe(g)?(t.enter("listItemPrefixWhitespace"),t.consume(g),t.exit("listItemPrefixWhitespace"),p):n(g)}function p(g){return r.containerState.size=s+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(g)}}function g5(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(jd,i,s);function i(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,it(t,e,"listItemIndent",r.containerState.size+1)(a)}function s(a){return r.containerState.furtherBlankLines||!qe(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(p5,e,o)(a))}function o(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,it(t,t.attempt(yn,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function y5(t,e,n){const r=this;return it(t,i,"listItemIndent",r.containerState.size+1);function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?e(s):n(s)}}function v5(t){t.exit(this.containerState.type)}function x5(t,e,n){const r=this;return it(t,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const o=r.events[r.events.length-1];return!qe(s)&&o&&o[1].type==="listItemPrefixWhitespace"?e(s):n(s)}}const Kx={name:"setextUnderline",resolveTo:w5,tokenize:_5};function w5(t,e){let n=t.length,r,i,s;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){r=n;break}t[n][1].type==="paragraph"&&(i=n)}else t[n][1].type==="content"&&t.splice(n,1),!s&&t[n][1].type==="definition"&&(s=n);const o={type:"setextHeading",start:{...t[r][1].start},end:{...t[t.length-1][1].end}};return t[i][1].type="setextHeadingText",s?(t.splice(i,0,["enter",o,e]),t.splice(s+1,0,["exit",t[r][1],e]),t[r][1].end={...t[s][1].end}):t[r][1]=o,t.push(["exit",o,e]),t}function _5(t,e,n){const r=this;let i;return s;function s(c){let h=r.events.length,f;for(;h--;)if(r.events[h][1].type!=="lineEnding"&&r.events[h][1].type!=="linePrefix"&&r.events[h][1].type!=="content"){f=r.events[h][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(t.enter("setextHeadingLine"),i=c,o(c)):n(c)}function o(c){return t.enter("setextHeadingLineSequence"),a(c)}function a(c){return c===i?(t.consume(c),a):(t.exit("setextHeadingLineSequence"),qe(c)?it(t,u,"lineSuffix")(c):u(c))}function u(c){return c===null||Ie(c)?(t.exit("setextHeadingLine"),e(c)):n(c)}}const b5={tokenize:E5};function E5(t){const e=this,n=t.attempt(jd,r,t.attempt(this.parser.constructs.flowInitial,i,it(t,t.attempt(this.parser.constructs.flow,i,t.attempt(C6,i)),"linePrefix")));return n;function r(s){if(s===null){t.consume(s);return}return t.enter("lineEndingBlank"),t.consume(s),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n}function i(s){if(s===null){t.consume(s);return}return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),e.currentConstruct=void 0,n}}const S5={resolveAll:JS()},T5=XS("string"),I5=XS("text");function XS(t){return{resolveAll:JS(t==="text"?k5:void 0),tokenize:e};function e(n){const r=this,i=this.parser.constructs[t],s=n.attempt(i,o,a);return o;function o(h){return c(h)?s(h):a(h)}function a(h){if(h===null){n.consume(h);return}return n.enter("data"),n.consume(h),u}function u(h){return c(h)?(n.exit("data"),s(h)):(n.consume(h),u)}function c(h){if(h===null)return!0;const f=i[h];let p=-1;if(f)for(;++p-1){const a=o[0];typeof a=="string"?o[0]=a.slice(r):o.shift()}s>0&&o.push(t[i].slice(0,s))}return o}function U5(t,e){let n=-1;const r=[];let i;for(;++n0){const $e=oe.tokenStack[oe.tokenStack.length-1];($e[1]||Yx).call(oe,void 0,$e[0])}for(B.position={start:hi(O.length>0?O[0][1].start:{line:1,column:1,offset:0}),end:hi(O.length>0?O[O.length-2][1].end:{line:1,column:1,offset:0})},he=-1;++he0&&(r.className=["language-"+i[0]]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return e.meta&&(s.data={meta:e.meta}),t.patch(e,s),s=t.applyData(e,s),s={type:"element",tagName:"pre",properties:{},children:[s]},t.patch(e,s),s}function eL(t,e){const n={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function tL(t,e){const n={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function nL(t,e){const n=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=String(e.identifier).toUpperCase(),i=Ho(r.toLowerCase()),s=t.footnoteOrder.indexOf(r);let o,a=t.footnoteCounts.get(r);a===void 0?(a=0,t.footnoteOrder.push(r),o=t.footnoteOrder.length):o=s+1,a+=1,t.footnoteCounts.set(r,a);const u={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};t.patch(e,u);const c={type:"element",tagName:"sup",properties:{},children:[u]};return t.patch(e,c),t.applyData(e,c)}function rL(t,e){const n={type:"element",tagName:"h"+e.depth,properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function iL(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}}function tT(t,e){const n=e.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+r}];const i=t.all(e),s=i[0];s&&s.type==="text"?s.value="["+s.value:i.unshift({type:"text",value:"["});const o=i[i.length-1];return o&&o.type==="text"?o.value+=r:i.push({type:"text",value:r}),i}function sL(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return tT(t,e);const i={src:Ho(r.url||""),alt:e.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"img",properties:i,children:[]};return t.patch(e,s),t.applyData(e,s)}function oL(t,e){const n={src:Ho(e.url)};e.alt!==null&&e.alt!==void 0&&(n.alt=e.alt),e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"img",properties:n,children:[]};return t.patch(e,r),t.applyData(e,r)}function aL(t,e){const n={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};t.patch(e,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return t.patch(e,r),t.applyData(e,r)}function lL(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return tT(t,e);const i={href:Ho(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"a",properties:i,children:t.all(e)};return t.patch(e,s),t.applyData(e,s)}function uL(t,e){const n={href:Ho(e.url)};e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"a",properties:n,children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function cL(t,e,n){const r=t.all(e),i=n?dL(n):nT(e),s={},o=[];if(typeof e.checked=="boolean"){const h=r[0];let f;h&&h.type==="element"&&h.tagName==="p"?f=h:(f={type:"element",tagName:"p",properties:{},children:[]},r.unshift(f)),f.children.length>0&&f.children.unshift({type:"text",value:" "}),f.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let a=-1;for(;++a1}function hL(t,e){const n={},r=t.all(e);let i=-1;for(typeof e.start=="number"&&e.start!==1&&(n.start=e.start);++i0){const o={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},a=jg(e.children[1]),u=OS(e.children[e.children.length-1]);a&&u&&(o.position={start:a,end:u}),i.push(o)}const s={type:"element",tagName:"table",properties:{},children:t.wrap(i,!0)};return t.patch(e,s),t.applyData(e,s)}function yL(t,e,n){const r=n?n.children:void 0,s=(r?r.indexOf(e):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,a=o?o.length:e.children.length;let u=-1;const c=[];for(;++u0,!0),r[0]),i=r.index+r[0].length,r=n.exec(e);return s.push(Zx(e.slice(i),i>0,!1)),s.join("")}function Zx(t,e,n){let r=0,i=t.length;if(e){let s=t.codePointAt(r);for(;s===Xx||s===Jx;)r++,s=t.codePointAt(r)}if(n){let s=t.codePointAt(i-1);for(;s===Xx||s===Jx;)i--,s=t.codePointAt(i-1)}return i>r?t.slice(r,i):""}function wL(t,e){const n={type:"text",value:xL(String(e.value))};return t.patch(e,n),t.applyData(e,n)}function _L(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)}const bL={blockquote:X5,break:J5,code:Z5,delete:eL,emphasis:tL,footnoteReference:nL,heading:rL,html:iL,imageReference:sL,image:oL,inlineCode:aL,linkReference:lL,link:uL,listItem:cL,list:hL,paragraph:fL,root:pL,strong:mL,table:gL,tableCell:vL,tableRow:yL,text:wL,thematicBreak:_L,toml:yu,yaml:yu,definition:yu,footnoteDefinition:yu};function yu(){}const rT=-1,Ld=0,Va=1,Mc=2,zg=3,Bg=4,$g=5,Hg=6,iT=7,sT=8,ew=typeof self=="object"?self:globalThis,EL=(t,e)=>{const n=(i,s)=>(t.set(s,i),i),r=i=>{if(t.has(i))return t.get(i);const[s,o]=e[i];switch(s){case Ld:case rT:return n(o,i);case Va:{const a=n([],i);for(const u of o)a.push(r(u));return a}case Mc:{const a=n({},i);for(const[u,c]of o)a[r(u)]=r(c);return a}case zg:return n(new Date(o),i);case Bg:{const{source:a,flags:u}=o;return n(new RegExp(a,u),i)}case $g:{const a=n(new Map,i);for(const[u,c]of o)a.set(r(u),r(c));return a}case Hg:{const a=n(new Set,i);for(const u of o)a.add(r(u));return a}case iT:{const{name:a,message:u}=o;return n(new ew[a](u),i)}case sT:return n(BigInt(o),i);case"BigInt":return n(Object(BigInt(o)),i);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:a}=new Uint8Array(o);return n(new DataView(a),o)}}return n(new ew[s](o),i)};return r},tw=t=>EL(new Map,t)(0),Fs="",{toString:SL}={},{keys:TL}=Object,ha=t=>{const e=typeof t;if(e!=="object"||!t)return[Ld,e];const n=SL.call(t).slice(8,-1);switch(n){case"Array":return[Va,Fs];case"Object":return[Mc,Fs];case"Date":return[zg,Fs];case"RegExp":return[Bg,Fs];case"Map":return[$g,Fs];case"Set":return[Hg,Fs];case"DataView":return[Va,n]}return n.includes("Array")?[Va,n]:n.includes("Error")?[iT,n]:[Mc,n]},vu=([t,e])=>t===Ld&&(e==="function"||e==="symbol"),IL=(t,e,n,r)=>{const i=(o,a)=>{const u=r.push(o)-1;return n.set(a,u),u},s=o=>{if(n.has(o))return n.get(o);let[a,u]=ha(o);switch(a){case Ld:{let h=o;switch(u){case"bigint":a=sT,h=o.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+u);h=null;break;case"undefined":return i([rT],o)}return i([a,h],o)}case Va:{if(u){let p=o;return u==="DataView"?p=new Uint8Array(o.buffer):u==="ArrayBuffer"&&(p=new Uint8Array(o)),i([u,[...p]],o)}const h=[],f=i([a,h],o);for(const p of o)h.push(s(p));return f}case Mc:{if(u)switch(u){case"BigInt":return i([u,o.toString()],o);case"Boolean":case"Number":case"String":return i([u,o.valueOf()],o)}if(e&&"toJSON"in o)return s(o.toJSON());const h=[],f=i([a,h],o);for(const p of TL(o))(t||!vu(ha(o[p])))&&h.push([s(p),s(o[p])]);return f}case zg:return i([a,o.toISOString()],o);case Bg:{const{source:h,flags:f}=o;return i([a,{source:h,flags:f}],o)}case $g:{const h=[],f=i([a,h],o);for(const[p,g]of o)(t||!(vu(ha(p))||vu(ha(g))))&&h.push([s(p),s(g)]);return f}case Hg:{const h=[],f=i([a,h],o);for(const p of o)(t||!vu(ha(p)))&&h.push(s(p));return f}}const{message:c}=o;return i([a,{name:u,message:c}],o)};return s},nw=(t,{json:e,lossy:n}={})=>{const r=[];return IL(!(e||n),!!e,new Map,r)(t),r},Vc=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?tw(nw(t,e)):structuredClone(t):(t,e)=>tw(nw(t,e));function kL(t,e){const n=[{type:"text",value:"↩"}];return e>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),n}function CL(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function NL(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=t.options.footnoteBackContent||kL,r=t.options.footnoteBackLabel||CL,i=t.options.footnoteLabel||"Footnotes",s=t.options.footnoteLabelTagName||"h2",o=t.options.footnoteLabelProperties||{className:["sr-only"]},a=[];let u=-1;for(;++u0&&_.push({type:"text",value:" "});let w=typeof n=="string"?n:n(u,g);typeof w=="string"&&(w={type:"text",value:w}),_.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+p+(g>1?"-"+g:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(u,g),className:["data-footnote-backref"]},children:Array.isArray(w)?w:[w]})}const R=h[h.length-1];if(R&&R.type==="element"&&R.tagName==="p"){const w=R.children[R.children.length-1];w&&w.type==="text"?w.value+=" ":R.children.push({type:"text",value:" "}),R.children.push(..._)}else h.push(..._);const y={type:"element",tagName:"li",properties:{id:e+"fn-"+p},children:t.wrap(h,!0)};t.patch(c,y),a.push(y)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...Vc(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:` +`},{type:"element",tagName:"ol",properties:{},children:t.wrap(a,!0)},{type:"text",value:` +`}]}}const oT=function(t){if(t==null)return DL;if(typeof t=="function")return Od(t);if(typeof t=="object")return Array.isArray(t)?AL(t):PL(t);if(typeof t=="string")return RL(t);throw new Error("Expected function, string, or object as test")};function AL(t){const e=[];let n=-1;for(;++n":""))+")"})}return p;function p(){let g=aT,_,T,R;if((!e||s(u,c,h[h.length-1]||void 0))&&(g=VL(n(u,h)),g[0]===rw))return g;if("children"in u&&u.children){const y=u;if(y.children&&g[0]!==OL)for(T=(r?y.children.length:-1)+o,R=h.concat(y);T>-1&&T0&&n.push({type:"text",value:` +`}),n}function iw(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function sw(t,e){const n=UL(t,e),r=n.one(t,void 0),i=NL(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&s.children.push({type:"text",value:` +`},i),s}function qL(t,e){return t&&"run"in t?async function(n,r){const i=sw(n,{file:r,...e});await t.run(i,r)}:function(n,r){return sw(n,{file:r,...t||e})}}function ow(t){if(t)throw t}var $u=Object.prototype.hasOwnProperty,uT=Object.prototype.toString,aw=Object.defineProperty,lw=Object.getOwnPropertyDescriptor,uw=function(e){return typeof Array.isArray=="function"?Array.isArray(e):uT.call(e)==="[object Array]"},cw=function(e){if(!e||uT.call(e)!=="[object Object]")return!1;var n=$u.call(e,"constructor"),r=e.constructor&&e.constructor.prototype&&$u.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!r)return!1;var i;for(i in e);return typeof i>"u"||$u.call(e,i)},dw=function(e,n){aw&&n.name==="__proto__"?aw(e,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):e[n.name]=n.newValue},hw=function(e,n){if(n==="__proto__")if($u.call(e,n)){if(lw)return lw(e,n).value}else return;return e[n]},WL=function t(){var e,n,r,i,s,o,a=arguments[0],u=1,c=arguments.length,h=!1;for(typeof a=="boolean"&&(h=a,a=arguments[1]||{},u=2),(a==null||typeof a!="object"&&typeof a!="function")&&(a={});uo.length;let u;a&&o.push(i);try{u=t.apply(this,o)}catch(c){const h=c;if(a&&n)throw h;return i(h)}a||(u&&u.then&&typeof u.then=="function"?u.then(s,i):u instanceof Error?i(u):s(u))}function i(o,...a){n||(n=!0,e(o,...a))}function s(o){i(null,o)}}const gr={basename:QL,dirname:YL,extname:XL,join:JL,sep:"/"};function QL(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');jl(t);let n=0,r=-1,i=t.length,s;if(e===void 0||e.length===0||e.length>t.length){for(;i--;)if(t.codePointAt(i)===47){if(s){n=i+1;break}}else r<0&&(s=!0,r=i+1);return r<0?"":t.slice(n,r)}if(e===t)return"";let o=-1,a=e.length-1;for(;i--;)if(t.codePointAt(i)===47){if(s){n=i+1;break}}else o<0&&(s=!0,o=i+1),a>-1&&(t.codePointAt(i)===e.codePointAt(a--)?a<0&&(r=i):(a=-1,r=o));return n===r?r=o:r<0&&(r=t.length),t.slice(n,r)}function YL(t){if(jl(t),t.length===0)return".";let e=-1,n=t.length,r;for(;--n;)if(t.codePointAt(n)===47){if(r){e=n;break}}else r||(r=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function XL(t){jl(t);let e=t.length,n=-1,r=0,i=-1,s=0,o;for(;e--;){const a=t.codePointAt(e);if(a===47){if(o){r=e+1;break}continue}n<0&&(o=!0,n=e+1),a===46?i<0?i=e:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||n<0||s===0||s===1&&i===n-1&&i===r+1?"":t.slice(i,n)}function JL(...t){let e=-1,n;for(;++e0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function eO(t,e){let n="",r=0,i=-1,s=0,o=-1,a,u;for(;++o<=t.length;){if(o2){if(u=n.lastIndexOf("/"),u!==n.length-1){u<0?(n="",r=0):(n=n.slice(0,u),r=n.length-1-n.lastIndexOf("/")),i=o,s=0;continue}}else if(n.length>0){n="",r=0,i=o,s=0;continue}}e&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+t.slice(i+1,o):n=t.slice(i+1,o),r=o-i-1;i=o,s=0}else a===46&&s>-1?s++:s=-1}return n}function jl(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const tO={cwd:nO};function nO(){return"/"}function Rp(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function rO(t){if(typeof t=="string")t=new URL(t);else if(!Rp(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return iO(t)}function iO(t){if(t.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const e=t.pathname;let n=-1;for(;++n0){let[g,..._]=h;const T=r[p][1];Pp(T)&&Pp(g)&&(g=Uh(!0,T,g)),r[p]=[c,g,..._]}}}}const lO=new qg().freeze();function Hh(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function qh(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function Wh(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function pw(t){if(!Pp(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function mw(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function xu(t){return uO(t)?t:new cT(t)}function uO(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function cO(t){return typeof t=="string"||dO(t)}function dO(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const hO="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",gw=[],yw={allowDangerousHtml:!0},fO=/^(https?|ircs?|mailto|xmpp)$/i,pO=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function mO(t){const e=gO(t),n=yO(t);return vO(e.runSync(e.parse(n),n),t)}function gO(t){const e=t.rehypePlugins||gw,n=t.remarkPlugins||gw,r=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...yw}:yw;return lO().use(Y5).use(n).use(qL,r).use(e)}function yO(t){const e=t.children||"",n=new cT;return typeof e=="string"&&(n.value=e),n}function vO(t,e){const n=e.allowedElements,r=e.allowElement,i=e.components,s=e.disallowedElements,o=e.skipHtml,a=e.unwrapDisallowed,u=e.urlTransform||xO;for(const h of pO)Object.hasOwn(e,h.from)&&(""+h.from+(h.to?"use `"+h.to+"` instead":"remove it")+hO+h.id,void 0);return lT(t,c),N3(t,{Fragment:d.Fragment,components:i,ignoreInvalidStyle:!0,jsx:d.jsx,jsxs:d.jsxs,passKeys:!0,passNode:!0});function c(h,f,p){if(h.type==="raw"&&p&&typeof f=="number")return o?p.children.splice(f,1):p.children[f]={type:"text",value:h.value},f;if(h.type==="element"){let g;for(g in Mh)if(Object.hasOwn(Mh,g)&&Object.hasOwn(h.properties,g)){const _=h.properties[g],T=Mh[g];(T===null||T.includes(h.tagName))&&(h.properties[g]=u(String(_||""),g,h))}}if(h.type==="element"){let g=n?!n.includes(h.tagName):s?s.includes(h.tagName):!1;if(!g&&r&&typeof f=="number"&&(g=!r(h,f,p)),g&&p&&typeof f=="number")return a&&h.children?p.children.splice(f,1,...h.children):p.children.splice(f,1),f}}}function xO(t){const e=t.indexOf(":"),n=t.indexOf("?"),r=t.indexOf("#"),i=t.indexOf("/");return e===-1||i!==-1&&e>i||n!==-1&&e>n||r!==-1&&e>r||fO.test(t.slice(0,e))?t:""}function wO({onBack:t,isAdmin:e}){const[n,r]=F.useState(""),[i,s]=F.useState(!1),[o,a]=F.useState(""),[u,c]=F.useState(!0);F.useEffect(()=>{const p=Rj(g=>{g&&r(g.content),c(!1)});return()=>p()},[]);const h=async()=>{try{await Pj(o),s(!1)}catch(p){console.error("Error saving info:",p),alert("Error al guardar la información.")}},f=()=>{a(n),s(!0)};return d.jsx("div",{className:"min-h-screen bg-[#0a0a0a] text-white p-4 sm:p-6 md:p-12 animate-in fade-in slide-in-from-bottom-4 duration-300",children:d.jsxs("div",{className:"max-w-4xl mx-auto",children:[d.jsxs("button",{onClick:t,className:"flex items-center gap-2 text-gray-400 hover:text-white transition-colors mb-8 group",children:[d.jsx(To,{className:"w-5 h-5 group-hover:-translate-x-1 transition-transform"}),d.jsx("span",{className:"font-medium",children:"Volver al inicio"})]}),d.jsxs("div",{className:"bg-[#1a1a1a] rounded-2xl border border-gray-800 p-8 sm:p-12 shadow-2xl relative",children:[e&&!i&&d.jsx("button",{onClick:f,className:"absolute top-8 right-8 p-2 rounded-lg bg-gray-800 text-gray-400 hover:text-[#bb86fc] hover:bg-[#bb86fc]/10 transition-colors",title:"Editar información",children:d.jsx(z1,{className:"w-5 h-5"})}),d.jsxs("div",{className:"flex items-center gap-4 mb-8 border-b border-gray-800 pb-8",children:[d.jsx("div",{className:"p-3 bg-gradient-to-br from-[#bb86fc] to-[#9966dd] rounded-xl shadow-lg shadow-[#bb86fc]/20",children:d.jsx(V1,{className:"w-8 h-8 text-white"})}),d.jsxs("div",{children:[d.jsx("h1",{className:"text-3xl font-bold bg-gradient-to-r from-white to-gray-400 bg-clip-text text-transparent",children:"Información"}),d.jsx("p",{className:"text-gray-400 mt-1",children:"Sobre Twisted Brody MangaFlow"})]})]}),i?d.jsxs("div",{className:"space-y-4",children:[d.jsx("textarea",{value:o,onChange:p=>a(p.target.value),className:"w-full h-[500px] bg-black/50 border border-[#bb86fc]/50 rounded-lg p-4 text-sm text-white focus:outline-none focus:border-[#bb86fc] font-mono",placeholder:"Escribe el contenido en Markdown..."}),d.jsxs("div",{className:"flex gap-3 justify-end",children:[d.jsxs("button",{onClick:()=>s(!1),className:"px-4 py-2 rounded-lg font-semibold text-gray-400 hover:text-white hover:bg-white/10 transition-colors flex items-center gap-2",children:[d.jsx(In,{className:"w-4 h-4"}),"Cancelar"]}),d.jsxs("button",{onClick:h,className:"px-4 py-2 rounded-lg font-semibold bg-[#bb86fc] hover:bg-[#9966dd] text-white transition-colors shadow-lg shadow-[#bb86fc]/20 flex items-center gap-2",children:[d.jsx(B1,{className:"w-4 h-4"}),"Guardar Cambios"]})]})]}):d.jsx("div",{className:"prose prose-invert prose-p:text-gray-300 prose-headings:text-white prose-a:no-underline max-w-none",children:d.jsx(mO,{components:{h1:({node:p,...g})=>d.jsx("h1",{className:"text-3xl font-bold bg-gradient-to-r from-[#bb86fc] to-[#7744cc] bg-clip-text text-transparent mb-6 pb-2 border-b border-gray-800",...g}),h2:({node:p,...g})=>d.jsx("h2",{className:"text-xl font-semibold text-white mt-8 mb-4 flex items-center gap-2",...g}),p:({node:p,...g})=>d.jsx("p",{className:"text-gray-300 leading-relaxed mb-4",...g}),ul:({node:p,...g})=>d.jsx("ul",{className:"space-y-2 mb-6",...g}),li:({node:p,...g})=>d.jsx("li",{className:"flex items-start gap-2 text-gray-300",...g}),a:({node:p,href:g,children:_,...T})=>{const R=g==null?void 0:g.startsWith("http");if((g==null?void 0:g.includes("t.me"))||(g==null?void 0:g.includes("patreon.com"))||(g==null?void 0:g.includes("x.com"))){let w="bg-[#1a1a1a] border border-gray-700 hover:border-gray-500",k="text-gray-300 hover:text-white";return g!=null&&g.includes("patreon")&&(w="bg-[#1a1a1a] border border-gray-700 hover:border-[#FF424D] hover:text-[#FF424D]"),g!=null&&g.includes("t.me")&&(w="bg-[#1a1a1a] border border-gray-700 hover:border-[#24A1DE] hover:text-[#24A1DE]"),g!=null&&g.includes("x.com")&&(w="bg-[#1a1a1a] border border-gray-700 hover:border-white hover:text-white"),d.jsx("a",{href:g,target:R?"_blank":void 0,rel:R?"noopener noreferrer":void 0,className:`inline-flex items-center gap-2 px-3 py-1.5 rounded-lg transition-all transform hover:scale-105 shadow-sm my-1 mr-2 no-underline text-xs sm:text-sm font-medium ${w} ${k}`,...T,children:_})}return d.jsx("a",{href:g,className:"text-[#bb86fc] hover:underline",target:R?"_blank":void 0,rel:R?"noopener noreferrer":void 0,...T,children:_})},blockquote:({node:p,...g})=>d.jsx("blockquote",{className:"border-l-4 border-[#bb86fc] pl-4 py-2 bg-[#bb86fc]/10 rounded-r-lg italic text-gray-400 my-6",...g}),hr:({node:p,...g})=>d.jsx("hr",{className:"border-gray-800 my-8",...g}),img:()=>null},children:n})}),!i&&d.jsxs("div",{className:"pt-8 border-t border-gray-800 text-center text-sm text-gray-500 mt-8",children:["© ",new Date().getFullYear()," Twisted Brody. Todos los derechos reservados."]})]})]})})}function _O({label:t,authors:e,value:n,onChange:r,onDelete:i,placeholder:s="Añadir autor...",colorClass:o="text-gray-400"}){const[a,u]=F.useState(""),[c,h]=F.useState(!1),f=F.useRef(null);F.useEffect(()=>{n&&n!==a&&!c?u(n):!n&&!c&&u("")},[n]);const p=F.useMemo(()=>a.trim()?e.filter(y=>y.toLowerCase().includes(a.toLowerCase())):e,[e,a]);F.useEffect(()=>{const y=w=>{f.current&&!f.current.contains(w.target)&&h(!1)};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[]);const g=y=>{y.key==="Enter"&&(y.preventDefault(),_(a))},_=y=>{const w=y.trim();w&&(r(w),u(w),h(!1))},T=()=>{r(""),u(""),h(!1)},R=(y,w)=>{y.stopPropagation(),y.preventDefault(),i&&i(w)};return d.jsxs("div",{className:"space-y-3 mb-6",ref:f,children:[d.jsx("label",{className:`text-xs uppercase font-bold tracking-wider ${o}`,children:t}),d.jsxs("div",{className:"relative",children:[d.jsxs("div",{className:"relative",children:[d.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:d.jsx(Cm,{className:"h-4 w-4 text-gray-500"})}),d.jsx("input",{type:"text",value:a,onChange:y=>{u(y.target.value),h(!0)},onFocus:()=>h(!0),onKeyDown:g,placeholder:s,className:"w-full bg-[#1a1a1a] border border-gray-600/50 rounded-lg pl-10 pr-10 py-2.5 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-[#bb86fc] transition-all"}),a&&d.jsx("button",{onClick:T,className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-500 hover:text-white",children:d.jsx(In,{className:"w-3.5 h-3.5"})})]}),c&&p.length>0&&d.jsx("div",{className:"absolute top-full left-0 right-0 mt-1 bg-[#1a1a1a] border border-gray-700/50 rounded-lg shadow-xl z-50 max-h-60 overflow-y-auto w-full custom-scrollbar",children:p.map((y,w)=>{const k=n===y;return d.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5 hover:bg-white/5 cursor-pointer group",onMouseDown:L=>{L.preventDefault(),_(y)},children:[d.jsx("span",{className:`text-sm ${k?"text-[#bb86fc]":"text-gray-300"}`,children:y}),d.jsxs("div",{className:"flex items-center gap-2",children:[k&&d.jsx(wl,{className:"w-4 h-4 text-[#bb86fc]"}),i&&d.jsx("button",{onMouseDown:L=>R(L,y),className:"opacity-0 group-hover:opacity-100 p-1 hover:bg-red-500/20 text-gray-500 hover:text-red-400 rounded transition-all",title:"Eliminar autor de todos los mangas",children:d.jsx($r,{className:"w-3.5 h-3.5"})})]})]},w)})})]}),d.jsx("p",{className:"text-[10px] text-gray-500 mt-1",children:n?`Se actualizará el autor a: "${n}"`:"Deja en blanco para no modificar el autor."})]})}function bO({isOpen:t,onClose:e,selectedMangaIds:n,onSaveComplete:r}){const[i,s]=F.useState([]),[o,a]=F.useState([]),[u,c]=F.useState([]),[h,f]=F.useState(""),[p,g]=F.useState(!1),[_,T]=F.useState(!1);F.useEffect(()=>{t&&(R(),a([]),f(""))},[t]);const R=async()=>{try{T(!0);const b=await xS();s(b);const x=await GD();c(x)}catch(b){console.error("Error loading categories:",b)}finally{T(!1)}},y=async(b,x)=>{if(b.trim()){if(x==="tag"){const E=b.split(" ").map(I=>I.trim()).filter(I=>I.length>0);for(const I of E)await w(I,x);return}await w(b,x)}},w=async(b,x)=>{try{const E=i.find(I=>I.name.toLowerCase()===b.trim().toLowerCase()&&I.type===x);if(E)a(I=>I.includes(E.id)?I:[...I,E.id]);else{const I=await wS(b.trim(),x);s(N=>N.find(D=>D.id===I.id)?N:[...N,I]),a(N=>N.includes(I.id)?N:[...N,I.id])}}catch(E){console.error("Error creating category:",E)}},k=b=>{a(x=>x.filter(E=>E!==b))},L=async b=>{try{await _S(b),s(x=>x.filter(E=>E.id!==b)),a(x=>x.filter(E=>E!==b))}catch(x){console.error("Error deleting category:",x),kt.error("Error al eliminar la categoría")}},U=b=>{kt(`¿Eliminar al autor "${b}" permanentemente?`,{description:"Se eliminará este autor de TODOS los mangas. Esta acción no se puede deshacer.",action:{label:"Eliminar",onClick:async()=>{try{T(!0),await WD(b),kt.success(`Autor "${b}" eliminado correctamente.`),c(x=>x.filter(E=>E!==b)),h===b&&f("")}catch(x){console.error("Error deleting author:",x),kt.error("Error al eliminar el autor.")}finally{T(!1)}}},cancel:{label:"Cancelar",onClick:()=>{}},duration:5e3})},j=async()=>{if(o.length===0&&!h.trim()){kt.error("Selecciona al menos una categoría o un autor para aplicar.");return}g(!0);try{const b=n.map(async x=>{var E;try{const I=await vS(x);if(!I)return;const N=((E=I.categories)==null?void 0:E.map(ge=>ge.id))||[],D=Array.from(new Set([...N,...o])),C={title:I.title,author:I.author,categoryIds:D};h.trim()&&(C.author=h.trim()),await bS(x,C)}catch(I){console.error(`Error updating manga ${x}`,I)}});await Promise.all(b),kt.success("Categorías aplicadas correctamente."),r(),e()}catch(b){console.error("Error bulk updating mangas:",b),kt.error("Error al aplicar cambios.")}finally{g(!1)}};return t?d.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50 p-4 animate-in fade-in duration-200",children:d.jsxs("div",{className:"bg-[#121212] rounded-2xl border border-gray-800 w-full max-w-2xl shadow-2xl overflow-hidden flex flex-col max-h-[90vh]",children:[d.jsxs("div",{className:"bg-[#1a1a1a] border-b border-gray-800 px-6 py-4 flex items-center justify-between sticky top-0 z-10",children:[d.jsxs("h2",{className:"text-xl font-bold text-white",children:["Aplicar Categorías a ",n.length," Mangas"]}),d.jsx("button",{onClick:e,className:"text-gray-400 hover:text-white transition-colors p-2 hover:bg-white/5 rounded-lg",children:d.jsx(In,{className:"w-5 h-5"})})]}),d.jsx("div",{className:"p-6 overflow-y-auto custom-scrollbar flex-1",children:_?d.jsx("div",{className:"flex justify-center p-8",children:d.jsx(gs,{size:32})}):d.jsxs("div",{className:"space-y-6",children:[d.jsx("div",{className:"bg-[#1f1f1f] p-4 rounded-xl border border-gray-800",children:d.jsx(_O,{label:"Autor",authors:u,value:h,onChange:f,onDelete:U,placeholder:"Seleccionar o escribir autor..."})}),d.jsx(Ei,{label:"Personajes",type:"character",categories:i,selectedIds:o,onSelect:b=>{o.includes(b)||a(x=>[...x,b])},onRemove:k,onCreate:b=>y(b,"character"),onDeleteCategory:L,colorClass:"text-blue-400",placeholder:"Añadir personaje..."}),d.jsx(Ei,{label:"Series",type:"series",categories:i,selectedIds:o,onSelect:b=>{o.includes(b)||a(x=>[...x,b])},onRemove:k,onCreate:b=>y(b,"series"),onDeleteCategory:L,colorClass:"text-green-400",placeholder:"Añadir serie..."}),d.jsx(Ei,{label:"Géneros",type:"genre",categories:i,selectedIds:o,onSelect:b=>{o.includes(b)||a(x=>[...x,b])},onRemove:k,onCreate:b=>y(b,"genre"),onDeleteCategory:L,colorClass:"text-purple-400",placeholder:"Añadir género..."}),d.jsx(Ei,{label:"Etiquetas",type:"tag",categories:i,selectedIds:o,onSelect:b=>{o.includes(b)||a(x=>[...x,b])},onRemove:k,onCreate:b=>y(b,"tag"),onDeleteCategory:L,colorClass:"text-pink-400",placeholder:"Añadir etiqueta..."})]})}),d.jsxs("div",{className:"p-6 border-t border-gray-800 flex justify-end gap-3 bg-[#1a1a1a]",children:[d.jsx("button",{onClick:e,className:"px-4 py-2 rounded-lg text-sm font-semibold text-gray-300 hover:text-white transition-colors",children:"Cancelar"}),d.jsx("button",{onClick:j,disabled:p||o.length===0&&!h.trim(),className:"bg-[#bb86fc] hover:bg-[#9966dd] text-white px-6 py-2 rounded-lg font-semibold text-sm transition-all shadow-lg shadow-[#bb86fc]/20 flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",children:p?d.jsxs(d.Fragment,{children:[d.jsx(gs,{size:16}),"Guardando..."]}):d.jsxs(d.Fragment,{children:[d.jsx(B1,{className:"w-4 h-4"}),"Aplicar Cambios"]})})]})]})}):null}const vw=["series","character","genre","tag","other"],EO={series:"Series",character:"Personajes",genre:"Géneros",tag:"Etiquetas",other:"Otros"};function SO({isOpen:t,onClose:e,categories:n,selectedCategories:r,onToggleCategory:i,onClearFilters:s}){const[o,a]=F.useState(""),u=F.useMemo(()=>{const c=n.filter(f=>f.name.toLowerCase().includes(o.toLowerCase())),h={};return vw.forEach(f=>{h[f]=[]}),h.other=[],c.forEach(f=>{const p=f.type||"other";h[p]||(h[p]=[]),h[p].push(f)}),h},[n,o]);return t?d.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/80 backdrop-blur-sm animate-in fade-in duration-200",children:d.jsxs("div",{className:"bg-[#1a1a1a] w-full max-w-4xl max-h-[85vh] rounded-2xl border border-gray-800 shadow-2xl flex flex-col overflow-hidden animate-in zoom-in-95 duration-200",onClick:c=>c.stopPropagation(),children:[d.jsxs("div",{className:"p-4 sm:p-6 border-b border-gray-800 flex items-center justify-between bg-[#1a1a1a]",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx("div",{className:"bg-purple-500/20 p-2 rounded-lg",children:d.jsx(M1,{className:"w-5 h-5 text-purple-400"})}),d.jsxs("div",{children:[d.jsx("h2",{className:"text-xl font-bold text-white",children:"Filtrar por Categorías"}),d.jsx("p",{className:"text-sm text-gray-400",children:"Selecciona múltiples opciones para refinar tu búsqueda"})]})]}),d.jsx("button",{onClick:e,className:"text-gray-400 hover:text-white hover:bg-gray-800 p-2 rounded-lg transition-all",children:d.jsx(In,{className:"w-5 h-5"})})]}),d.jsx("div",{className:"p-4 border-b border-gray-800 bg-[#151515]",children:d.jsxs("div",{className:"relative",children:[d.jsx(mc,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400"}),d.jsx("input",{type:"text",placeholder:"Buscar categorías...",value:o,onChange:c=>a(c.target.value),className:"w-full bg-[#0f0f0f] border border-gray-700/50 rounded-lg pl-10 pr-4 py-2.5 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-purple-500/50 focus:ring-1 focus:ring-purple-500/50 transition-all"})]})}),d.jsx("div",{className:"flex-1 overflow-y-auto p-4 sm:p-6 space-y-8 custom-scrollbar",children:vw.map(c=>{const h=u[c];return!h||h.length===0?null:d.jsxs("div",{className:"animate-in slide-in-from-bottom-2 duration-300",children:[d.jsxs("h3",{className:"text-sm font-bold text-purple-400 uppercase tracking-wider mb-3 flex items-center gap-2",children:[d.jsx("span",{className:"w-1 h-4 bg-purple-500 rounded-full"}),EO[c]||c]}),d.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-2",children:h.sort((f,p)=>f.name.localeCompare(p.name)).map(f=>{const p=r.includes(f.name);return d.jsxs("button",{onClick:()=>i(f.name),className:` + relative group flex items-center justify-between px-3 py-2 rounded-lg text-sm text-left transition-all duration-200 border + ${p?"bg-purple-500/20 border-purple-500/50 text-purple-100 shadow-[0_0_15px_-3px_rgba(168,85,247,0.3)]":"bg-[#252525] border-transparent text-gray-300 hover:bg-[#2a2a2a] hover:border-gray-700"} + `,children:[d.jsx("span",{className:"truncate mr-2 font-medium",children:f.name}),p&&d.jsx("div",{className:"bg-purple-500 rounded-full p-0.5 animate-in zoom-in duration-200",children:d.jsx(wl,{className:"w-3 h-3 text-white"})})]},f.id)})})]},c)})}),d.jsxs("div",{className:"p-4 border-t border-gray-800 bg-[#1a1a1a] flex items-center justify-between",children:[d.jsxs("div",{className:"text-sm text-gray-400",children:[r.length," seleccionada",r.length!==1?"s":""]}),d.jsxs("div",{className:"flex items-center gap-3",children:[r.length>0&&d.jsx("button",{onClick:s,className:"px-4 py-2 text-sm text-gray-400 hover:text-white transition-colors",children:"Limpiar todo"}),d.jsx("button",{onClick:e,className:"px-6 py-2 bg-purple-600 hover:bg-purple-700 text-white rounded-lg text-sm font-semibold shadow-lg shadow-purple-900/20 transition-all hover:scale-105 active:scale-95",children:"Listo"})]})]})]})}):null}const xw={random:"Aleatorio",name:"Nombre",date:"Fecha de creación",modified:"Última modificación",pages:"Páginas",views:"Vistas"};function TO({value:t,onChange:e,placeholder:n="Buscar manga...",sortType:r="random",onSortTypeChange:i,sortDirection:s="asc",onSortDirectionChange:o,onOpenFilter:a}){const[u,c]=F.useState(!1),h=()=>{e("")},f=()=>{const _=["modified","name","date","pages","views","random"],R=(_.indexOf(r)+1)%_.length,y=_[R];i==null||i(y),window.innerWidth<640&&kt.success(`Ordenado por: ${xw[y]}`,{position:"top-center",duration:1500,className:"bg-purple-900/90 text-white border-purple-500/50"})},p=()=>{const _=s==="asc"?"desc":"asc";if(o==null||o(_),window.innerWidth<640){let T=_==="asc"?"Ascendente (A-Z)":"Descendente (Z-A)";r==="views"?T=_==="asc"?"Menos vistos primero":"Más vistos primero":r==="date"||r==="modified"?T=_==="asc"?"Más antiguos primero":"Más recientes primero":r==="pages"&&(T=_==="asc"?"Menos páginas":"Más páginas"),kt.success(`Orden: ${T}`,{position:"top-center",duration:1500,className:"bg-purple-900/90 text-white border-purple-500/50"})}},g=()=>r==="views"?s==="asc"?"Menos vistos":"Más vistos":s==="asc"?"ASC":"DESC";return d.jsxs("div",{className:"w-full flex gap-2 items-center",children:[d.jsxs("div",{className:"relative flex-1",children:[d.jsx(mc,{className:`absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 pointer-events-none ${u?"text-purple-400":"text-gray-400"}`}),d.jsx("input",{type:"text",placeholder:n,value:t,onChange:_=>e(_.target.value),onFocus:()=>c(!0),onBlur:()=>c(!1),className:"w-full bg-[#1a1a1a] text-white rounded-lg pl-10 pr-10 py-2.5 text-sm placeholder-gray-400 border border-gray-700/50 focus:border-purple-500 focus:outline-none"}),t&&d.jsx("button",{onClick:h,className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-400 hover:text-purple-400 transition-all p-1 hover:scale-125 hover:rotate-90 duration-300",title:"Limpiar búsqueda",children:d.jsx(In,{className:"w-4 h-4"})})]}),d.jsx("button",{onClick:a,className:"bg-gray-800 hover:bg-gray-700 border border-gray-700 hover:border-purple-500/50 text-white p-2.5 rounded-lg transition-all duration-300 hover:shadow-lg hover:shadow-purple-500/10 group",title:"Filtrar por categorías",children:d.jsx(M1,{className:"w-4 h-4 text-gray-400 group-hover:text-purple-400 transition-colors"})}),d.jsxs("button",{onClick:f,className:"bg-gradient-to-r from-gray-700/40 to-gray-600/40 hover:from-gray-700/60 hover:to-gray-600/60 border border-gray-600/50 hover:border-purple-500/50 text-white px-2.5 py-2.5 rounded-lg flex items-center justify-center gap-1.5 font-medium text-xs transition-all duration-300 active:scale-95 whitespace-nowrap hover:scale-110 hover:shadow-lg hover:shadow-purple-500/20 hover:border-purple-500",title:"Cambiar tipo de ordenamiento",children:[d.jsx(s2,{className:"w-3.5 h-3.5 transition-transform duration-300 hover:rotate-180"}),d.jsx("span",{className:"hidden sm:inline",children:xw[r]})]}),d.jsxs("button",{onClick:p,className:"bg-gradient-to-r from-gray-700/40 to-gray-600/40 hover:from-gray-700/60 hover:to-gray-600/60 border border-gray-600/50 hover:border-purple-500/50 text-white px-2.5 py-2.5 rounded-lg flex items-center justify-center gap-1.5 font-medium text-xs transition-all duration-300 active:scale-95 whitespace-nowrap hover:scale-110 hover:shadow-lg hover:shadow-purple-500/20 hover:border-purple-500",title:s==="asc"?"Cambiar a descendente":"Cambiar a ascendente",children:[d.jsx(r2,{className:`w-3.5 h-3.5 transition-all duration-500 ${s==="desc"?"rotate-180":""} hover:scale-125`}),d.jsx("span",{className:"hidden sm:inline text-[10px]",children:g()})]})]})}function IO(){return d.jsxs("div",{className:"flex flex-col w-full max-w-xs",children:[d.jsx("div",{className:"relative bg-black rounded-lg shadow-lg overflow-hidden aspect-[2/3] mb-2",children:d.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:d.jsx("div",{className:"rounded-full animate-spin",style:{width:"30px",height:"30px",borderWidth:"2px",borderStyle:"solid",borderColor:"rgba(187, 134, 252, 0.2)",borderTopColor:"#bb86fc",animation:"spin 0.6s linear infinite"}})})}),d.jsxs("div",{className:"flex flex-col gap-2 items-center animate-pulse",children:[d.jsx("div",{className:"h-4 bg-gray-800 rounded w-3/4"}),d.jsx("div",{className:"h-3 bg-gray-800 rounded w-1/2"})]})]})}const Gh=24;function kO({items:t,searchTerm:e,isSearching:n,onSelectComic:r,onEditManga:i,onDeleteManga:s,isLoading:o=!1,isCategoryPlusEnabled:a=!1,selectedMangaIds:u=[],onToggleSelectManga:c}){const[h,f]=F.useState(()=>{const y=new URLSearchParams(window.location.search).get("page");return y?Math.max(1,Number(y)):1});F.useEffect(()=>{const R=()=>{const w=new URLSearchParams(window.location.search).get("page");f(w?Math.max(1,Number(w)):1)};return window.addEventListener("popstate",R),()=>window.removeEventListener("popstate",R)},[]);const p=Math.ceil(t.length/Gh);F.useEffect(()=>{if(p>0&&h>p){f(p);const R=new URL(window.location.href);R.searchParams.set("page",String(p)),window.history.replaceState({},"",R)}},[p,h]),F.useEffect(()=>{if(e){f(1);const R=new URL(window.location.href);R.searchParams.delete("page"),window.history.replaceState({},"",R)}},[e]);const g=t.slice((h-1)*Gh,h*Gh),_=R=>{f(R);const y=new URL(window.location.href);y.searchParams.set("page",String(R)),window.history.pushState({},"",y),window.scrollTo({top:0,behavior:"smooth"})},T=()=>{if(p<=1)return null;const R=[],y=5;let w=Math.max(1,h-Math.floor(y/2)),k=Math.min(p,w+y-1);k-w+1_(1),disabled:h===1,className:"p-2 rounded-lg bg-[#1a1a1a] text-white hover:bg-[#bb86fc] disabled:opacity-50 disabled:hover:bg-[#1a1a1a] transition-colors",title:"Primera página",children:d.jsx(j1,{className:"w-4 h-4"})}),d.jsx("button",{onClick:()=>_(h-1),disabled:h===1,className:"p-2 rounded-lg bg-[#1a1a1a] text-white hover:bg-[#bb86fc] disabled:opacity-50 disabled:hover:bg-[#1a1a1a] transition-colors",title:"Anterior",children:d.jsx(nd,{className:"w-4 h-4"})}),w>1&&d.jsx("span",{className:"text-gray-500 px-1",children:"..."}),R.map(L=>d.jsx("button",{onClick:()=>_(L),className:`w-8 h-8 rounded-lg text-sm font-medium transition-colors ${h===L?"bg-[#bb86fc] text-white":"bg-[#1a1a1a] text-gray-400 hover:bg-[#333] hover:text-white"}`,children:L},L)),k_(h+1),disabled:h===p,className:"p-2 rounded-lg bg-[#1a1a1a] text-white hover:bg-[#bb86fc] disabled:opacity-50 disabled:hover:bg-[#1a1a1a] transition-colors",title:"Siguiente",children:d.jsx(rd,{className:"w-4 h-4"})}),d.jsx("button",{onClick:()=>_(p),disabled:h===p,className:"p-2 rounded-lg bg-[#1a1a1a] text-white hover:bg-[#bb86fc] disabled:opacity-50 disabled:hover:bg-[#1a1a1a] transition-colors",title:"Última página",children:d.jsx(L1,{className:"w-4 h-4"})})]})};return n&&e?d.jsx("div",{className:"flex flex-col items-center justify-center py-16 animate-in fade-in duration-300",children:d.jsxs("div",{className:"text-gray-400 text-sm animate-pulse",children:['Buscando "',e,'"...']})}):o?d.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 2xl:grid-cols-6 gap-1.5 sm:gap-2 md:gap-3 justify-center items-start animate-in fade-in duration-300",children:Array.from({length:12}).map((R,y)=>d.jsx(IO,{},y))}):e&&t.length===0?d.jsxs("div",{className:"flex flex-col items-center justify-center py-16 animate-in fade-in duration-300",children:[d.jsx(nl,{className:"w-16 h-16 text-gray-600 mb-4 animate-bounce"}),d.jsx("p",{className:"text-gray-400 text-lg mb-2",children:"No se encontraron resultados"}),d.jsx("p",{className:"text-gray-500 text-sm",children:"Intenta con otros términos de búsqueda"})]}):!e&&t.length===0?d.jsxs("div",{className:"flex flex-col items-center justify-center py-20 animate-in fade-in duration-300",children:[d.jsx(nl,{className:"w-16 h-16 text-gray-600 mb-4 animate-bounce"}),d.jsx("p",{className:"text-gray-400 text-lg mb-2",children:"No hay mangas disponibles"}),d.jsx("p",{className:"text-gray-500 text-sm",children:'Crea tu primer manga usando el botón "Nuevo"'})]}):d.jsxs("div",{className:"flex flex-col gap-6",children:[d.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 2xl:grid-cols-6 gap-1.5 sm:gap-2 md:gap-3 justify-center items-start",children:g.map(R=>d.jsx("div",{children:d.jsx(IS,{id:R.id,title:R.title,author:R.author,pageCount:R.pageCount,thumbnail:R.thumbnail,manga:R.manga,onSelect:()=>r(R.id),onEdit:i,onDelete:s?()=>s(R.id):void 0,isCategoryPlusEnabled:a,isSelected:u.includes(R.id),onToggleSelect:c?()=>c(R.id):void 0})},R.id))}),T()]})}function ro(t){return t.toLowerCase().trim().normalize("NFD").replace(/[\u0300-\u036f]/g,"")}function Kh(t,e){const n=ro(t),r=ro(e);if(n===r)return 1;if(n.length<2||r.length<2)return n.includes(r)?.8:0;const i=n.length>r.length?n:r,s=n.length>r.length?r:n,o=CO(s,i);return(i.length-o)/i.length}function CO(t,e){const n=[];for(let r=0;r<=t.length;r++){let i=r;for(let s=0;s<=e.length;s++)if(r===0)n[s]=s;else if(s>0){let o=n[s-1];t.charAt(r-1)!==e.charAt(s-1)&&(o=Math.min(Math.min(o,i),n[s])+1),n[s-1]=i,i=o}r>0&&(n[e.length]=i)}return n[e.length]}function NO(t,e,n={}){const{minChars:r=1,fuzzyMatch:i=!0}=n;if(!e.trim()||e.length{let u=0;const c=Kh(a.title,e),h=Kh(a.author,e),f=ro(a.title).includes(s)?.3:0,p=ro(a.author).includes(s)?.2:0;let g=0,_=0;if(a.categories&&a.categories.length>0){const T=a.categories.map(y=>Kh(y,e));g=Math.max(...T),_=a.categories.some(y=>ro(y).includes(s))?.3:0}return u=Math.max(c*.6+f,h*.4+p,g*.5+_),{item:a,score:u}}).filter(a=>i?a.score>.3:a.score>.7).sort((a,u)=>u.score-a.score).map(a=>a.item);return{items:o,query:e,resultCount:o.length}}function AO(){const[t,e]=F.useState(!1),[n,r]=F.useState(!1),[i,s]=F.useState(!1),[o,a]=F.useState(!1),[u,c]=F.useState(null),[h,f]=F.useState(!1),[p,g]=F.useState(!1),[_,T]=F.useState(!1),[R,y]=F.useState([]),[w,k]=F.useState(!1),[L,U]=F.useState(null),[j,b]=F.useState([]),[x,E]=F.useState(null),[I,N]=F.useState([]),[D,C]=F.useState(!1),[ge,ie]=F.useState(!1),[fe,we]=F.useState(!0),[G,se]=F.useState(""),[A,pe]=F.useState([]),[_e,P]=F.useState([]),[$,Y]=F.useState(()=>localStorage.getItem("sortType")||"modified"),[re,Ce]=F.useState(()=>localStorage.getItem("sortDirection")||"desc");F.useEffect(()=>{const K=new URLSearchParams(window.location.search).get("admin")==="true";a(K)},[]),F.useEffect(()=>{localStorage.setItem("sortType",$)},[$]),F.useEffect(()=>{localStorage.setItem("sortDirection",re)},[re]),F.useEffect(()=>{var me;(me=window.Telegram)!=null&&me.WebApp&&window.Telegram.WebApp.ready(),de();const V=window.location.hash.slice(1);if(V&&V.startsWith("manga/"))if(V.endsWith("/hd")){const O=V.replace("manga/","").replace("/hd","");U(O),C(!0)}else{const O=V.replace("manga/","");U(O),C(!1)}else V==="info"&&ie(!0);const K=()=>{const O=window.location.hash.slice(1);if(!O)U(null),E(null),ie(!1),C(!1);else if(O.startsWith("manga/")){if(O.endsWith("/hd")){const B=O.replace("manga/","").replace("/hd","");U(B),C(!0)}else{const B=O.replace("manga/","");U(B),C(!1)}E(null),ie(!1)}else O==="info"&&(ie(!0),U(null),E(null))};return window.addEventListener("hashchange",K),()=>window.removeEventListener("hashchange",K)},[]),F.useEffect(()=>{!h&&!p&&!_&&y([])},[h,p,_]);async function de(){try{we(!0);const V=await Rd();N(V)}catch(V){console.error("Error loading mangas:",V)}finally{we(!1)}}const Qe=F.useMemo(()=>{const V=new Map;return I.forEach(K=>{var me;(me=K.categories)==null||me.forEach(O=>{V.has(O.id)||V.set(O.id,O)})}),Array.from(V.values())},[I]),Ze=F.useMemo(()=>G.trim()?NO(I.map(V=>({id:V.id,title:V.title,author:V.author,categories:V.categories?V.categories.map(K=>K.name):[]})),G,{fuzzyMatch:!0,minChars:1}):{items:I,query:"",resultCount:I.length},[I,G]),dt=F.useMemo(()=>{let V=Ze.items.length>0?Ze.items.map(me=>I.find(O=>O.id===me.id)).filter(Boolean):[];A.length>0&&(V=V.filter(me=>A.some(O=>{var B;return(B=me.categories)==null?void 0:B.some(oe=>oe.name===O)}))),_e.length>0&&(V=V.filter(me=>_e.includes(me.author)));const K=[...V];return $==="random"?K.sort(()=>Math.random()-.5):(K.sort((me,O)=>{var oe,le;let B=0;if($==="name")B=me.title.localeCompare(O.title);else if($==="date"){const he=new Date(me.created_at||0).getTime(),$e=new Date(O.created_at||0).getTime();B=he-$e}else if($==="modified"){const he=new Date(me.updated_at||me.created_at||0).getTime(),$e=new Date(O.updated_at||O.created_at||0).getTime();B=he-$e}else if($==="pages"){const he=((oe=me.chapters)==null?void 0:oe.reduce((je,He)=>{var et;return je+(((et=He.pages)==null?void 0:et.length)||0)},0))||0,$e=((le=O.chapters)==null?void 0:le.reduce((je,He)=>{var et;return je+(((et=He.pages)==null?void 0:et.length)||0)},0))||0;B=he-$e}else $==="views"&&(B=(me.views||0)-(O.views||0));return re==="asc"?B:-B}),K)},[I,G,Ze.items,$,re,A,_e]),Vt=V=>{c(V),e(!0)},xt=async V=>{try{await Sx(V),await de()}catch(K){console.error("Error deleting manga:",K),alert("Error al eliminar el manga. Por favor intenta de nuevo.")}},Rt=V=>{y(K=>K.includes(V)?K.filter(me=>me!==V):[...K,V])},ln=V=>{if(h||p||_){Rt(V);return}window.location.hash=`manga/${V}`,U(V),C(!1)},St=()=>{window.location.hash="",U(null),ie(!1)},st=V=>{L&&b([...j,L]),window.location.hash=`manga / ${V} `,U(V)},Ht=V=>{pe(K=>K.includes(V)?K.filter(me=>me!==V):[...K,V]),St()},Oe=V=>{pe(K=>K.filter(me=>me!==V))},Ye=V=>{P(K=>K.includes(V)?K.filter(me=>me!==V):[...K,V]),St()},ee=V=>{P(K=>K.filter(me=>me!==V))},Q=F.useMemo(()=>dt.map(V=>{var O,B;const K=((O=V.chapters)==null?void 0:O.length)||0,me=((B=V.chapters)==null?void 0:B.reduce((oe,le)=>{var he;return oe+(((he=le.pages)==null?void 0:he.length)||0)},0))||0;return{id:V.id,title:V.title,author:V.author,chapterCount:K,pageCount:me,thumbnail:V.cover_url||V.thumbnail_url||void 0,manga:V}}),[dt]);if(x)return d.jsx(Nj,{manga:x.manga,chapter:x.chapter,onBack:()=>E(null)});if(ge)return d.jsx(wO,{onBack:St,isAdmin:o});if(L!==null){let V=I.find(K=>K.id===L);return D&&V?d.jsx(c2,{manga:V,onBack:()=>{window.history.back()}}):d.jsx(Cj,{id:L,onBack:()=>{if(j.length>0){const K=j[j.length-1];b(j.slice(0,-1)),window.location.hash=`manga / ${K} `,U(K)}else St()},onReadChapter:K=>{V&&E({manga:V,chapter:K})},onMangaLoaded:K=>{V||(V=K)},onNavigateToManga:st,onSelectCategory:Ht,onSelectAuthor:Ye,isAdmin:o})}return d.jsxs("div",{className:"min-h-screen bg-[#121212] text-white flex flex-col",children:[d.jsx("header",{className:"border-b border-gray-800/50 px-3 sm:px-6 md:px-12 py-4 sm:py-6 flex-shrink-0 transition-all duration-300",children:d.jsxs("div",{className:"max-w-[1800px] mx-auto flex items-center justify-between gap-2 sm:gap-0",children:[d.jsxs("div",{className:"flex items-center gap-1 sm:gap-1.5 group cursor-pointer",children:[d.jsx("img",{src:"/icons/icones.png",alt:"Twisted Brody Logo",className:"w-10 h-10 sm:w-14 sm:h-14 object-contain transition-all duration-300 group-hover:rotate-12 group-hover:scale-110"}),d.jsx("h1",{className:"text-lg sm:text-2xl font-bold text-white transition-colors duration-300 group-hover:text-[#bb86fc]",children:"Twisted Brody MangaFlow"})]}),d.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-3",children:[(h||p||_)&&d.jsxs("div",{className:"hidden sm:flex items-center gap-2 mr-2 px-3 py-1.5 bg-purple-500/10 rounded-lg border border-purple-500/20",children:[d.jsx(F1,{className:"w-4 h-4 text-purple-400"}),d.jsx("span",{className:"text-xs font-semibold text-purple-300",children:p?"Modo Copiar Activo":_?"Modo Eliminar Activo":"Modo Plus Activo"}),d.jsx("span",{className:"text-xs bg-purple-500/20 px-2 py-0.5 rounded text-purple-200",children:R.length})]}),o&&d.jsxs(d.Fragment,{children:[d.jsxs("button",{onClick:()=>r(!0),className:"bg-gray-800 hover:bg-gray-700 active:scale-95 text-white px-2 py-2 sm:px-4 sm:py-2.5 rounded-lg flex items-center gap-1.5 sm:gap-2 font-semibold transition-all duration-300 border border-gray-700/50 hover:border-gray-600 text-xs sm:text-sm hover:scale-110 hover:shadow-lg hover:shadow-700/50",title:"Ajustes y Admin",children:[d.jsx($1,{className:"w-4 h-4 sm:w-5 sm:h-5 transition-transform duration-300 hover:rotate-180"}),d.jsx("span",{className:"hidden sm:inline",children:"Ajustes"})]}),d.jsxs("button",{onClick:()=>e(!0),className:"bg-purple-600 hover:bg-purple-700 active:scale-95 text-white px-2 py-2 sm:px-4 sm:py-2.5 rounded-lg flex items-center gap-1.5 sm:gap-2 font-semibold transition-all duration-300 shadow-lg shadow-purple-600/30 hover:shadow-purple-600/50 text-xs sm:text-sm hover:scale-110",children:[d.jsx(co,{className:"w-4 h-4 sm:w-5 sm:h-5 transition-transform duration-300 hover:rotate-180"}),d.jsx("span",{className:"hidden sm:inline",children:"Nuevo Manga"})]})]})]})]})}),d.jsxs("main",{className:"flex-1 px-4 sm:px-6 md:px-12 py-8",children:[d.jsx(Tj,{isAdmin:o}),d.jsxs("div",{className:"max-w-[1800px] mx-auto mb-8 flex-shrink-0",children:[d.jsx(TO,{value:G,onChange:se,placeholder:"Buscar por título, autor...",sortType:$,onSortTypeChange:Y,sortDirection:re,onSortDirectionChange:Ce,onOpenFilter:()=>s(!0)}),G&&d.jsxs("div",{className:"mt-2 text-sm text-gray-400",children:[Ze.resultCount," resultado",Ze.resultCount!==1?"s":""," encontrado",Ze.resultCount!==1?"s":""]}),(A.length>0||_e.length>0)&&d.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-2 animate-in fade-in slide-in-from-top-2 duration-300",children:[d.jsx("span",{className:"text-sm text-gray-400",children:"Filtrado por:"}),A.map(V=>d.jsxs("button",{onClick:()=>Oe(V),className:"bg-purple-500/20 hover:bg-purple-500/30 text-purple-300 px-3 py-1 rounded-full text-sm font-medium flex items-center gap-2 border border-purple-500/30 hover:border-purple-500/50 transition-all group",children:[V,d.jsx("div",{className:"bg-purple-500/20 rounded-full p-0.5 group-hover:bg-purple-500/40 transition-colors",children:d.jsx(co,{className:"w-3 h-3 transform rotate-45"})})]},V)),_e.map(V=>d.jsxs("button",{onClick:()=>ee(V),className:"bg-[#bb86fc]/20 hover:bg-[#bb86fc]/30 text-[#bb86fc] px-3 py-1 rounded-full text-sm font-medium flex items-center gap-2 border border-[#bb86fc]/30 hover:border-[#bb86fc]/50 transition-all group",children:[d.jsx(Cm,{size:14}),V,d.jsx("div",{className:"bg-[#bb86fc]/20 rounded-full p-0.5 group-hover:bg-[#bb86fc]/40 transition-colors",children:d.jsx(co,{className:"w-3 h-3 transform rotate-45"})})]},V)),(A.length>0||_e.length>0)&&d.jsx("button",{onClick:()=>{pe([]),P([])},className:"text-xs text-gray-400 hover:text-white underline decoration-gray-600 hover:decoration-white transition-colors ml-2",children:"Limpiar todo"})]})]}),d.jsx("div",{className:"max-w-[1800px] mx-auto",children:d.jsxs(d.Fragment,{children:[d.jsx("link",{rel:"preconnect",href:"https://i.ibb.co"}),d.jsx(kO,{items:Q,searchTerm:G,isSearching:!1,isLoading:fe,onSelectComic:ln,onEditManga:o?Vt:void 0,onDeleteManga:o?xt:void 0,isCategoryPlusEnabled:h||p||_,selectedMangaIds:R,onToggleSelectManga:Rt})]})})]}),(h||p||_)&&R.length>0&&d.jsx("div",{className:"fixed bottom-6 left-1/2 transform -translate-x-1/2 z-40 animate-in slide-in-from-bottom-4 duration-200",children:d.jsxs("div",{className:"bg-[#1a1a1a] border border-gray-700/50 shadow-2xl rounded-xl px-6 py-3 flex items-center gap-4",children:[d.jsxs("div",{className:"flex flex-col",children:[d.jsxs("span",{className:"text-sm font-bold text-white",children:[R.length," seleccionados"]}),d.jsx("span",{className:"text-xs text-gray-400",children:"Listos para acción"})]}),d.jsx("div",{className:"h-8 w-px bg-gray-700"}),d.jsx("button",{onClick:()=>y([]),className:"text-gray-400 hover:text-white text-sm font-semibold transition-colors",children:"Cancelar"}),d.jsxs("div",{className:"flex gap-2",children:[h&&d.jsx("button",{onClick:()=>k(!0),className:"bg-[#bb86fc] hover:bg-[#9966dd] text-white px-4 py-2 rounded-lg text-sm font-bold shadow-lg shadow-purple-500/20 transition-all transform hover:scale-105 active:scale-95",children:"Aplicar Categorías"}),p&&d.jsxs("button",{onClick:()=>{navigator.clipboard.writeText(R.join(", ")),kt.success("IDs copiados al portapapeles"),y([])},className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg text-sm font-bold shadow-lg shadow-blue-500/20 transition-all transform hover:scale-105 active:scale-95 flex items-center gap-2",children:[d.jsx(O1,{className:"w-4 h-4"}),"Copiar IDs"]}),_&&d.jsx("button",{onClick:async()=>{if(window.confirm(`¿Seguro que quieres eliminar ${R.length} mangas de forma masiva? Esta acción no se puede deshacer.`))try{for(const V of R)await Sx(V);kt.success(`Se eliminaron ${R.length} mangas correctamente.`),y([]),de()}catch(V){console.error("Error in bulk delete:",V),kt.error("Ocurrió un error al intentar eliminar los mangas")}},className:"bg-red-600 hover:bg-red-700 text-white px-4 py-2 rounded-lg text-sm font-bold shadow-lg shadow-red-500/20 transition-all transform hover:scale-105 active:scale-95",children:"Eliminar Selección"})]})]})}),d.jsx(id,{}),d.jsx(bj,{isOpen:t,onClose:()=>{e(!1),c(null)},editingManga:u,onMangaCreated:V=>{de(),c(null),V&&!u&&setTimeout(()=>{ln(V)},500)},onDelete:o?xt:void 0}),d.jsx(bO,{isOpen:w,onClose:()=>k(!1),selectedMangaIds:R,onSaveComplete:()=>{de(),y([])}}),d.jsx(Sj,{isOpen:n,onClose:()=>r(!1),isAdmin:o,onAdminChange:a,isCategoryPlusEnabled:h,onCategoryPlusChange:f,isCopyIdsEnabled:p,onCopyIdsChange:g,isDeletePlusEnabled:_,onDeletePlusChange:T}),d.jsx(SO,{isOpen:i,onClose:()=>s(!1),categories:Qe,selectedCategories:A,onToggleCategory:Ht,onClearFilters:()=>pe([])}),d.jsx(wj,{position:"top-center",richColors:!0,theme:"dark"})]})}D1(document.getElementById("root")).render(d.jsx(F.StrictMode,{children:d.jsx(AO,{})})); diff --git a/dist/assets/index-DO2fexES.css b/dist/assets/index-DO2fexES.css new file mode 100644 index 0000000000000000000000000000000000000000..46f789a10bbaee8219c70bfa1facb9f15ba1a222 --- /dev/null +++ b/dist/assets/index-DO2fexES.css @@ -0,0 +1 @@ +:root{--swiper-theme-color: #007aff}:host{position:relative;display:block;margin-left:auto;margin-right:auto;z-index:1}.swiper{margin-left:auto;margin-right:auto;position:relative;overflow:hidden;list-style:none;padding:0;z-index:1;display:block}.swiper-vertical>.swiper-wrapper{flex-direction:column}.swiper-wrapper{position:relative;width:100%;height:100%;z-index:1;display:flex;transition-property:transform;transition-timing-function:var(--swiper-wrapper-transition-timing-function, initial);box-sizing:content-box}.swiper-android .swiper-slide,.swiper-ios .swiper-slide,.swiper-wrapper{transform:translateZ(0)}.swiper-horizontal{touch-action:pan-y}.swiper-vertical{touch-action:pan-x}.swiper-slide{flex-shrink:0;width:100%;height:100%;position:relative;transition-property:transform;display:block}.swiper-slide-invisible-blank{visibility:hidden}.swiper-autoheight,.swiper-autoheight .swiper-slide{height:auto}.swiper-autoheight .swiper-wrapper{align-items:flex-start;transition-property:transform,height}.swiper-backface-hidden .swiper-slide{transform:translateZ(0);backface-visibility:hidden}.swiper-3d.swiper-css-mode .swiper-wrapper{perspective:1200px}.swiper-3d .swiper-wrapper{transform-style:preserve-3d}.swiper-3d{perspective:1200px}.swiper-3d .swiper-slide,.swiper-3d .swiper-cube-shadow{transform-style:preserve-3d}.swiper-css-mode>.swiper-wrapper{overflow:auto;scrollbar-width:none;-ms-overflow-style:none}.swiper-css-mode>.swiper-wrapper::-webkit-scrollbar{display:none}.swiper-css-mode>.swiper-wrapper>.swiper-slide{scroll-snap-align:start start}.swiper-css-mode.swiper-horizontal>.swiper-wrapper{scroll-snap-type:x mandatory}.swiper-css-mode.swiper-horizontal>.swiper-wrapper>.swiper-slide:first-child{margin-inline-start:var(--swiper-slides-offset-before);scroll-margin-inline-start:var(--swiper-slides-offset-before)}.swiper-css-mode.swiper-horizontal>.swiper-wrapper>.swiper-slide:last-child{margin-inline-end:var(--swiper-slides-offset-after)}.swiper-css-mode.swiper-vertical>.swiper-wrapper{scroll-snap-type:y mandatory}.swiper-css-mode.swiper-vertical>.swiper-wrapper>.swiper-slide:first-child{margin-block-start:var(--swiper-slides-offset-before);scroll-margin-block-start:var(--swiper-slides-offset-before)}.swiper-css-mode.swiper-vertical>.swiper-wrapper>.swiper-slide:last-child{margin-block-end:var(--swiper-slides-offset-after)}.swiper-css-mode.swiper-free-mode>.swiper-wrapper{scroll-snap-type:none}.swiper-css-mode.swiper-free-mode>.swiper-wrapper>.swiper-slide{scroll-snap-align:none}.swiper-css-mode.swiper-centered>.swiper-wrapper:before{content:"";flex-shrink:0;order:9999}.swiper-css-mode.swiper-centered>.swiper-wrapper>.swiper-slide{scroll-snap-align:center center;scroll-snap-stop:always}.swiper-css-mode.swiper-centered.swiper-horizontal>.swiper-wrapper>.swiper-slide:first-child{margin-inline-start:var(--swiper-centered-offset-before)}.swiper-css-mode.swiper-centered.swiper-horizontal>.swiper-wrapper:before{height:100%;min-height:1px;width:var(--swiper-centered-offset-after)}.swiper-css-mode.swiper-centered.swiper-vertical>.swiper-wrapper>.swiper-slide:first-child{margin-block-start:var(--swiper-centered-offset-before)}.swiper-css-mode.swiper-centered.swiper-vertical>.swiper-wrapper:before{width:100%;min-width:1px;height:var(--swiper-centered-offset-after)}.swiper-3d .swiper-slide-shadow,.swiper-3d .swiper-slide-shadow-left,.swiper-3d .swiper-slide-shadow-right,.swiper-3d .swiper-slide-shadow-top,.swiper-3d .swiper-slide-shadow-bottom{position:absolute;left:0;top:0;width:100%;height:100%;pointer-events:none;z-index:10}.swiper-3d .swiper-slide-shadow{background:#00000026}.swiper-3d .swiper-slide-shadow-left{background-image:linear-gradient(to left,#00000080,#0000)}.swiper-3d .swiper-slide-shadow-right{background-image:linear-gradient(to right,#00000080,#0000)}.swiper-3d .swiper-slide-shadow-top{background-image:linear-gradient(to top,#00000080,#0000)}.swiper-3d .swiper-slide-shadow-bottom{background-image:linear-gradient(to bottom,#00000080,#0000)}.swiper-lazy-preloader{width:42px;height:42px;position:absolute;left:50%;top:50%;margin-left:-21px;margin-top:-21px;z-index:10;transform-origin:50%;box-sizing:border-box;border:4px solid var(--swiper-preloader-color, var(--swiper-theme-color));border-radius:50%;border-top-color:transparent}.swiper:not(.swiper-watch-progress) .swiper-lazy-preloader,.swiper-watch-progress .swiper-slide-visible .swiper-lazy-preloader{animation:swiper-preloader-spin 1s infinite linear}.swiper-lazy-preloader-white{--swiper-preloader-color: #fff}.swiper-lazy-preloader-black{--swiper-preloader-color: #000}@keyframes swiper-preloader-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.swiper-creative .swiper-slide{backface-visibility:hidden;overflow:hidden;transition-property:transform,opacity,height}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.visible{visibility:visible}.invisible{visibility:hidden}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.-left-6{left:-1.5rem}.bottom-0{bottom:0}.bottom-2{bottom:.5rem}.bottom-6{bottom:1.5rem}.left-0{left:0}.left-0\.5{left:.125rem}.left-1\.5{left:.375rem}.left-1\/2{left:50%}.left-2{left:.5rem}.left-3{left:.75rem}.left-4{left:1rem}.left-6{left:1.5rem}.right-0{right:0}.right-2{right:.5rem}.right-3{right:.75rem}.right-4{right:1rem}.right-6{right:1.5rem}.right-8{right:2rem}.top-0{top:0}.top-0\.5{top:.125rem}.top-1\.5{top:.375rem}.top-1\/2{top:50%}.top-2{top:.5rem}.top-4{top:1rem}.top-6{top:1.5rem}.top-8{top:2rem}.top-full{top:100%}.z-0{z-index:0}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.z-40{z-index:40}.z-50{z-index:50}.z-\[100\]{z-index:100}.z-\[45\]{z-index:45}.z-\[60\]{z-index:60}.z-\[70\]{z-index:70}.z-\[80\]{z-index:80}.col-span-2{grid-column:span 2 / span 2}.col-span-full{grid-column:1 / -1}.mx-1{margin-left:.25rem;margin-right:.25rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-auto{margin-left:auto;margin-right:auto}.my-1{margin-top:.25rem;margin-bottom:.25rem}.my-4{margin-top:1rem;margin-bottom:1rem}.my-6{margin-top:1.5rem;margin-bottom:1.5rem}.my-8{margin-top:2rem;margin-bottom:2rem}.mb-0\.5{margin-bottom:.125rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-5{margin-bottom:1.25rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-2{margin-left:.5rem}.ml-auto{margin-left:auto}.mr-2{margin-right:.5rem}.mr-auto{margin-right:auto}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-8{margin-top:2rem}.mt-auto{margin-top:auto}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.block{display:block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.grid{display:grid}.hidden{display:none}.aspect-\[2\/3\]{aspect-ratio:2/3}.aspect-\[3\/4\]{aspect-ratio:3/4}.aspect-square{aspect-ratio:1 / 1}.h-1{height:.25rem}.h-1\/3{height:33.333333%}.h-10{height:2.5rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-32{height:8rem}.h-4{height:1rem}.h-48{height:12rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-\[20px\]{height:20px}.h-\[40\%\]{height:40%}.h-\[500px\]{height:500px}.h-\[90vh\]{height:90vh}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.max-h-20{max-height:5rem}.max-h-60{max-height:15rem}.max-h-\[80vh\]{max-height:80vh}.max-h-\[85vh\]{max-height:85vh}.max-h-\[90vh\]{max-height:90vh}.max-h-screen{max-height:100vh}.min-h-0{min-height:0px}.min-h-\[100px\]{min-height:100px}.min-h-\[300px\]{min-height:300px}.min-h-\[60vh\]{min-height:60vh}.min-h-screen{min-height:100vh}.w-1{width:.25rem}.w-1\/2{width:50%}.w-1\/3{width:33.333333%}.w-10{width:2.5rem}.w-11{width:2.75rem}.w-12{width:3rem}.w-14{width:3.5rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-3\/4{width:75%}.w-4{width:1rem}.w-5{width:1.25rem}.w-56{width:14rem}.w-6{width:1.5rem}.w-64{width:16rem}.w-7{width:1.75rem}.w-72{width:18rem}.w-8{width:2rem}.w-9{width:2.25rem}.w-\[20px\]{width:20px}.w-\[300\%\]{width:300%}.w-\[40\%\]{width:40%}.w-\[55\%\]{width:55%}.w-full{width:100%}.w-max{width:-moz-max-content;width:max-content}.w-px{width:1px}.min-w-0{min-width:0px}.min-w-\[200px\]{min-width:200px}.min-w-\[3ch\]{min-width:3ch}.max-w-2xl{max-width:42rem}.max-w-4xl{max-width:56rem}.max-w-5xl{max-width:64rem}.max-w-6xl{max-width:72rem}.max-w-7xl{max-width:80rem}.max-w-\[150px\]{max-width:150px}.max-w-\[1800px\]{max-width:1800px}.max-w-\[1920px\]{max-width:1920px}.max-w-\[200px\]{max-width:200px}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-none{max-width:none}.max-w-sm{max-width:24rem}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.flex-shrink-0,.shrink-0{flex-shrink:0}.origin-center{transform-origin:center}.origin-left{transform-origin:left}.origin-right{transform-origin:right}.-translate-x-1\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-x-full{--tw-translate-x: -100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-4{--tw-translate-x: 1rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-45{--tw-rotate: 45deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-90{--tw-rotate: 90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-100{--tw-scale-x: 1;--tw-scale-y: 1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-110{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-95{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-\[0\.80\]{--tw-scale-x: .8;--tw-scale-y: .8;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform-gpu{transform:translate3d(var(--tw-translate-x),var(--tw-translate-y),0) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.animate-\[fadeIn_0\.2s_ease-out\]{animation:fadeIn .2s ease-out}.animate-\[fadeIn_0\.7s_ease-out_forwards\]{animation:fadeIn .7s ease-out forwards}.animate-\[scaleIn_0\.2s_ease-out\]{animation:scaleIn .2s ease-out}@keyframes bounce{0%,to{transform:translateY(-25%);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;animation-timing-function:cubic-bezier(0,0,.2,1)}}.animate-bounce{animation:bounce 1s infinite}@keyframes ping{75%,to{transform:scale(2);opacity:0}}.animate-ping{animation:ping 1s cubic-bezier(0,0,.2,1) infinite}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.cursor-move{cursor:move}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-none{resize:none}.resize{resize:both}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0{gap:0px}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.gap-\[3px\]{gap:3px}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-3\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.875rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.875rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse: 0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse))}.divide-gray-800>:not([hidden])~:not([hidden]){--tw-divide-opacity: 1;border-color:rgb(31 41 55 / var(--tw-divide-opacity, 1))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-y-auto{overflow-y:auto}.overscroll-contain{overscroll-behavior:contain}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-normal{white-space:normal}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-\[3px\]{border-radius:3px}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-none{border-radius:0}.rounded-sm{border-radius:.125rem}.rounded-xl{border-radius:.75rem}.rounded-r-lg{border-top-right-radius:.5rem;border-bottom-right-radius:.5rem}.border{border-width:1px}.border-2{border-width:2px}.border-y{border-top-width:1px;border-bottom-width:1px}.border-b{border-bottom-width:1px}.border-l{border-left-width:1px}.border-l-4{border-left-width:4px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-\[\#00AFF0\]{--tw-border-opacity: 1;border-color:rgb(0 175 240 / var(--tw-border-opacity, 1))}.border-\[\#00AFF0\]\/20{border-color:#00aff033}.border-\[\#333\]{--tw-border-opacity: 1;border-color:rgb(51 51 51 / var(--tw-border-opacity, 1))}.border-\[\#bb86fc\]{--tw-border-opacity: 1;border-color:rgb(187 134 252 / var(--tw-border-opacity, 1))}.border-\[\#bb86fc\]\/20{border-color:#bb86fc33}.border-\[\#bb86fc\]\/30{border-color:#bb86fc4d}.border-\[\#bb86fc\]\/40{border-color:#bb86fc66}.border-\[\#bb86fc\]\/50{border-color:#bb86fc80}.border-\[\#f96854\]{--tw-border-opacity: 1;border-color:rgb(249 104 84 / var(--tw-border-opacity, 1))}.border-\[\#f96854\]\/20{border-color:#f9685433}.border-amber-500{--tw-border-opacity: 1;border-color:rgb(245 158 11 / var(--tw-border-opacity, 1))}.border-blue-500{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.border-blue-500\/20{border-color:#3b82f633}.border-blue-500\/30{border-color:#3b82f64d}.border-emerald-500\/10{border-color:#10b9811a}.border-emerald-500\/20{border-color:#10b98133}.border-emerald-500\/30{border-color:#10b9814d}.border-gray-300{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.border-gray-500\/30{border-color:#6b72804d}.border-gray-500\/50{border-color:#6b728080}.border-gray-600{--tw-border-opacity: 1;border-color:rgb(75 85 99 / var(--tw-border-opacity, 1))}.border-gray-600\/40{border-color:#4b556366}.border-gray-600\/50{border-color:#4b556380}.border-gray-700{--tw-border-opacity: 1;border-color:rgb(55 65 81 / var(--tw-border-opacity, 1))}.border-gray-700\/30{border-color:#3741514d}.border-gray-700\/40{border-color:#37415166}.border-gray-700\/50{border-color:#37415180}.border-gray-700\/60{border-color:#37415199}.border-gray-800{--tw-border-opacity: 1;border-color:rgb(31 41 55 / var(--tw-border-opacity, 1))}.border-gray-800\/50{border-color:#1f293780}.border-green-500{--tw-border-opacity: 1;border-color:rgb(34 197 94 / var(--tw-border-opacity, 1))}.border-green-500\/30{border-color:#22c55e4d}.border-indigo-500\/20{border-color:#6366f133}.border-pink-500{--tw-border-opacity: 1;border-color:rgb(236 72 153 / var(--tw-border-opacity, 1))}.border-pink-500\/30{border-color:#ec48994d}.border-purple-500\/20{border-color:#a855f733}.border-purple-500\/30{border-color:#a855f74d}.border-purple-500\/50{border-color:#a855f780}.border-red-500\/20{border-color:#ef444433}.border-red-500\/30{border-color:#ef44444d}.border-red-500\/50{border-color:#ef444480}.border-transparent{border-color:transparent}.border-white\/10{border-color:#ffffff1a}.border-white\/30{border-color:#ffffff4d}.border-white\/5{border-color:#ffffff0d}.border-white\/50{border-color:#ffffff80}.border-yellow-500\/20{border-color:#eab30833}.border-t-emerald-500{--tw-border-opacity: 1;border-top-color:rgb(16 185 129 / var(--tw-border-opacity, 1))}.border-t-transparent{border-top-color:transparent}.border-t-white{--tw-border-opacity: 1;border-top-color:rgb(255 255 255 / var(--tw-border-opacity, 1))}.bg-\[\#00AFF0\]\/10{background-color:#00aff01a}.bg-\[\#00AFF0\]\/20{background-color:#00aff033}.bg-\[\#050505\]{--tw-bg-opacity: 1;background-color:rgb(5 5 5 / var(--tw-bg-opacity, 1))}.bg-\[\#0a0a0a\]{--tw-bg-opacity: 1;background-color:rgb(10 10 10 / var(--tw-bg-opacity, 1))}.bg-\[\#0f0f0f\]{--tw-bg-opacity: 1;background-color:rgb(15 15 15 / var(--tw-bg-opacity, 1))}.bg-\[\#111\]{--tw-bg-opacity: 1;background-color:rgb(17 17 17 / var(--tw-bg-opacity, 1))}.bg-\[\#121212\]{--tw-bg-opacity: 1;background-color:rgb(18 18 18 / var(--tw-bg-opacity, 1))}.bg-\[\#121212\]\/90{background-color:#121212e6}.bg-\[\#151515\]{--tw-bg-opacity: 1;background-color:rgb(21 21 21 / var(--tw-bg-opacity, 1))}.bg-\[\#1a1a1a\]{--tw-bg-opacity: 1;background-color:rgb(26 26 26 / var(--tw-bg-opacity, 1))}.bg-\[\#1a1a1a\]\/50{background-color:#1a1a1a80}.bg-\[\#1f1f1f\]{--tw-bg-opacity: 1;background-color:rgb(31 31 31 / var(--tw-bg-opacity, 1))}.bg-\[\#252525\]{--tw-bg-opacity: 1;background-color:rgb(37 37 37 / var(--tw-bg-opacity, 1))}.bg-\[\#2a2a2a\]{--tw-bg-opacity: 1;background-color:rgb(42 42 42 / var(--tw-bg-opacity, 1))}.bg-\[\#bb86fc\]{--tw-bg-opacity: 1;background-color:rgb(187 134 252 / var(--tw-bg-opacity, 1))}.bg-\[\#bb86fc\]\/10{background-color:#bb86fc1a}.bg-\[\#bb86fc\]\/20{background-color:#bb86fc33}.bg-\[\#bb86fc\]\/5{background-color:#bb86fc0d}.bg-\[\#bb86fc\]\/90{background-color:#bb86fce6}.bg-\[\#f96854\]\/10{background-color:#f968541a}.bg-\[\#f96854\]\/20{background-color:#f9685433}.bg-amber-500{--tw-bg-opacity: 1;background-color:rgb(245 158 11 / var(--tw-bg-opacity, 1))}.bg-amber-500\/10{background-color:#f59e0b1a}.bg-amber-500\/20{background-color:#f59e0b33}.bg-amber-600{--tw-bg-opacity: 1;background-color:rgb(217 119 6 / var(--tw-bg-opacity, 1))}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-black\/20{background-color:#0003}.bg-black\/30{background-color:#0000004d}.bg-black\/40{background-color:#0006}.bg-black\/50{background-color:#00000080}.bg-black\/60{background-color:#0009}.bg-black\/70{background-color:#000000b3}.bg-black\/80{background-color:#000c}.bg-black\/95{background-color:#000000f2}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.bg-blue-500\/10{background-color:#3b82f61a}.bg-blue-500\/20{background-color:#3b82f633}.bg-blue-600{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.bg-blue-900\/10{background-color:#1e3a8a1a}.bg-cyan-500\/10{background-color:#06b6d41a}.bg-emerald-500\/10{background-color:#10b9811a}.bg-emerald-500\/5{background-color:#10b9810d}.bg-emerald-600{--tw-bg-opacity: 1;background-color:rgb(5 150 105 / var(--tw-bg-opacity, 1))}.bg-gray-500\/20{background-color:#6b728033}.bg-gray-600{--tw-bg-opacity: 1;background-color:rgb(75 85 99 / var(--tw-bg-opacity, 1))}.bg-gray-700{--tw-bg-opacity: 1;background-color:rgb(55 65 81 / var(--tw-bg-opacity, 1))}.bg-gray-700\/40{background-color:#37415166}.bg-gray-700\/50{background-color:#37415180}.bg-gray-800{--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.bg-gray-800\/40{background-color:#1f293766}.bg-gray-800\/50{background-color:#1f293780}.bg-gray-800\/70{background-color:#1f2937b3}.bg-gray-900{--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity, 1))}.bg-gray-900\/50{background-color:#11182780}.bg-green-500\/10{background-color:#22c55e1a}.bg-green-500\/20{background-color:#22c55e33}.bg-green-600\/90{background-color:#16a34ae6}.bg-indigo-500\/10{background-color:#6366f11a}.bg-indigo-600{--tw-bg-opacity: 1;background-color:rgb(79 70 229 / var(--tw-bg-opacity, 1))}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.bg-orange-500\/10{background-color:#f973161a}.bg-pink-500{--tw-bg-opacity: 1;background-color:rgb(236 72 153 / var(--tw-bg-opacity, 1))}.bg-pink-500\/10{background-color:#ec48991a}.bg-pink-500\/20{background-color:#ec489933}.bg-pink-600{--tw-bg-opacity: 1;background-color:rgb(219 39 119 / var(--tw-bg-opacity, 1))}.bg-purple-500{--tw-bg-opacity: 1;background-color:rgb(168 85 247 / var(--tw-bg-opacity, 1))}.bg-purple-500\/10{background-color:#a855f71a}.bg-purple-500\/20{background-color:#a855f733}.bg-purple-600{--tw-bg-opacity: 1;background-color:rgb(147 51 234 / var(--tw-bg-opacity, 1))}.bg-purple-900\/10{background-color:#581c871a}.bg-purple-900\/90{background-color:#581c87e6}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-500\/10{background-color:#ef44441a}.bg-red-500\/20{background-color:#ef444433}.bg-red-600{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.bg-red-600\/80{background-color:#dc2626cc}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-white\/10{background-color:#ffffff1a}.bg-white\/20{background-color:#fff3}.bg-yellow-500\/10{background-color:#eab3081a}.bg-\[url\(\'data\:image\/svg\+xml\;base64\,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI\+PGNpcmNsZSBjeD0iMSIgY3k9IjEiIHI9IjEiIGZpbGw9IiMzMzMiLz48L3N2Zz4\=\'\)\]{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGNpcmNsZSBjeD0iMSIgY3k9IjEiIHI9IjEiIGZpbGw9IiMzMzMiLz48L3N2Zz4=)}.bg-gradient-to-b{background-image:linear-gradient(to bottom,var(--tw-gradient-stops))}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.bg-gradient-to-t{background-image:linear-gradient(to top,var(--tw-gradient-stops))}.from-\[\#1a1a1a\]{--tw-gradient-from: #1a1a1a var(--tw-gradient-from-position);--tw-gradient-to: rgb(26 26 26 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-\[\#1f1f1f\]{--tw-gradient-from: #1f1f1f var(--tw-gradient-from-position);--tw-gradient-to: rgb(31 31 31 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-\[\#1f1f1f\]\/80{--tw-gradient-from: rgb(31 31 31 / .8) var(--tw-gradient-from-position);--tw-gradient-to: rgb(31 31 31 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-\[\#242424\]{--tw-gradient-from: #242424 var(--tw-gradient-from-position);--tw-gradient-to: rgb(36 36 36 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-\[\#2a2a2a\]{--tw-gradient-from: #2a2a2a var(--tw-gradient-from-position);--tw-gradient-to: rgb(42 42 42 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-\[\#2a2a2a\]\/80{--tw-gradient-from: rgb(42 42 42 / .8) var(--tw-gradient-from-position);--tw-gradient-to: rgb(42 42 42 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-\[\#9966dd\]{--tw-gradient-from: #9966dd var(--tw-gradient-from-position);--tw-gradient-to: rgb(153 102 221 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-\[\#bb86fc\]{--tw-gradient-from: #bb86fc var(--tw-gradient-from-position);--tw-gradient-to: rgb(187 134 252 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-\[\#bb86fc\]\/20{--tw-gradient-from: rgb(187 134 252 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(187 134 252 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-black\/60{--tw-gradient-from: rgb(0 0 0 / .6) var(--tw-gradient-from-position);--tw-gradient-to: rgb(0 0 0 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-blue-500{--tw-gradient-from: #3b82f6 var(--tw-gradient-from-position);--tw-gradient-to: rgb(59 130 246 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-gray-700\/40{--tw-gradient-from: rgb(55 65 81 / .4) var(--tw-gradient-from-position);--tw-gradient-to: rgb(55 65 81 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-gray-800{--tw-gradient-from: #1f2937 var(--tw-gradient-from-position);--tw-gradient-to: rgb(31 41 55 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-red-500{--tw-gradient-from: #ef4444 var(--tw-gradient-from-position);--tw-gradient-to: rgb(239 68 68 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-transparent{--tw-gradient-from: transparent var(--tw-gradient-from-position);--tw-gradient-to: rgb(0 0 0 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-white{--tw-gradient-from: #fff var(--tw-gradient-from-position);--tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.via-\[\#9966dd\]{--tw-gradient-to: rgb(153 102 221 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), #9966dd var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-white\/20{--tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), rgb(255 255 255 / .2) var(--tw-gradient-via-position), var(--tw-gradient-to)}.to-\[\#0f0f0f\]{--tw-gradient-to: #0f0f0f var(--tw-gradient-to-position)}.to-\[\#121212\]{--tw-gradient-to: #121212 var(--tw-gradient-to-position)}.to-\[\#1a1a1a\]{--tw-gradient-to: #1a1a1a var(--tw-gradient-to-position)}.to-\[\#1a1a1a\]\/80{--tw-gradient-to: rgb(26 26 26 / .8) var(--tw-gradient-to-position)}.to-\[\#1f1f1f\]{--tw-gradient-to: #1f1f1f var(--tw-gradient-to-position)}.to-\[\#1f1f1f\]\/80{--tw-gradient-to: rgb(31 31 31 / .8) var(--tw-gradient-to-position)}.to-\[\#252525\]{--tw-gradient-to: #252525 var(--tw-gradient-to-position)}.to-\[\#2a2a2a\]{--tw-gradient-to: #2a2a2a var(--tw-gradient-to-position)}.to-\[\#7744cc\]{--tw-gradient-to: #7744cc var(--tw-gradient-to-position)}.to-\[\#9966dd\]{--tw-gradient-to: #9966dd var(--tw-gradient-to-position)}.to-\[\#bb86fc\]{--tw-gradient-to: #bb86fc var(--tw-gradient-to-position)}.to-blue-600{--tw-gradient-to: #2563eb var(--tw-gradient-to-position)}.to-gray-400{--tw-gradient-to: #9ca3af var(--tw-gradient-to-position)}.to-gray-600\/40{--tw-gradient-to: rgb(75 85 99 / .4) var(--tw-gradient-to-position)}.to-gray-900{--tw-gradient-to: #111827 var(--tw-gradient-to-position)}.to-red-600{--tw-gradient-to: #dc2626 var(--tw-gradient-to-position)}.to-transparent{--tw-gradient-to: transparent var(--tw-gradient-to-position)}.bg-clip-text{-webkit-background-clip:text;background-clip:text}.fill-black\/20{fill:#0003}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.object-left{-o-object-position:left;object-position:left}.object-right{-o-object-position:right;object-position:right}.p-0{padding:0}.p-0\.5{padding:.125rem}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-2{padding:.5rem}.p-2\.5{padding:.625rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.p-\[3px\]{padding:3px}.px-0{padding-left:0;padding-right:0}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-8{padding-left:2rem;padding-right:2rem}.py-0{padding-top:0;padding-bottom:0}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-16{padding-top:4rem;padding-bottom:4rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-20{padding-top:5rem;padding-bottom:5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-5{padding-top:1.25rem;padding-bottom:1.25rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-2{padding-bottom:.5rem}.pb-8{padding-bottom:2rem}.pl-10{padding-left:2.5rem}.pl-2{padding-left:.5rem}.pl-3{padding-left:.75rem}.pl-4{padding-left:1rem}.pr-10{padding-right:2.5rem}.pr-3{padding-right:.75rem}.pr-4{padding-right:1rem}.pt-2{padding-top:.5rem}.pt-4{padding-top:1rem}.pt-5{padding-top:1.25rem}.pt-6{padding-top:1.5rem}.pt-8{padding-top:2rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-\[10px\]{font-size:10px}.text-\[9px\]{font-size:9px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.italic{font-style:italic}.leading-relaxed{line-height:1.625}.tracking-tight{letter-spacing:-.025em}.tracking-wide{letter-spacing:.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-\[\#00AFF0\]{--tw-text-opacity: 1;color:rgb(0 175 240 / var(--tw-text-opacity, 1))}.text-\[\#bb86fc\]{--tw-text-opacity: 1;color:rgb(187 134 252 / var(--tw-text-opacity, 1))}.text-\[\#f96854\]{--tw-text-opacity: 1;color:rgb(249 104 84 / var(--tw-text-opacity, 1))}.text-amber-300{--tw-text-opacity: 1;color:rgb(252 211 77 / var(--tw-text-opacity, 1))}.text-amber-400{--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.text-amber-500{--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}.text-blue-300{--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-cyan-400{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.text-emerald-400{--tw-text-opacity: 1;color:rgb(52 211 153 / var(--tw-text-opacity, 1))}.text-emerald-500{--tw-text-opacity: 1;color:rgb(16 185 129 / var(--tw-text-opacity, 1))}.text-emerald-500\/50{color:#10b98180}.text-gray-200{--tw-text-opacity: 1;color:rgb(229 231 235 / var(--tw-text-opacity, 1))}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-green-300{--tw-text-opacity: 1;color:rgb(134 239 172 / var(--tw-text-opacity, 1))}.text-green-400{--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.text-indigo-400{--tw-text-opacity: 1;color:rgb(129 140 248 / var(--tw-text-opacity, 1))}.text-orange-400{--tw-text-opacity: 1;color:rgb(251 146 60 / var(--tw-text-opacity, 1))}.text-pink-300{--tw-text-opacity: 1;color:rgb(249 168 212 / var(--tw-text-opacity, 1))}.text-pink-400{--tw-text-opacity: 1;color:rgb(244 114 182 / var(--tw-text-opacity, 1))}.text-purple-100{--tw-text-opacity: 1;color:rgb(243 232 255 / var(--tw-text-opacity, 1))}.text-purple-200{--tw-text-opacity: 1;color:rgb(233 213 255 / var(--tw-text-opacity, 1))}.text-purple-300{--tw-text-opacity: 1;color:rgb(216 180 254 / var(--tw-text-opacity, 1))}.text-purple-400{--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-red-500\/80{color:#ef4444cc}.text-transparent{color:transparent}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-white\/40{color:#fff6}.text-white\/50{color:#ffffff80}.text-white\/70{color:#ffffffb3}.text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.no-underline{text-decoration-line:none}.decoration-\[\#bb86fc\]\/30{text-decoration-color:#bb86fc4d}.decoration-gray-600{text-decoration-color:#4b5563}.underline-offset-2{text-underline-offset:2px}.placeholder-gray-400::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(156 163 175 / var(--tw-placeholder-opacity, 1))}.placeholder-gray-400::placeholder{--tw-placeholder-opacity: 1;color:rgb(156 163 175 / var(--tw-placeholder-opacity, 1))}.placeholder-gray-500::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(107 114 128 / var(--tw-placeholder-opacity, 1))}.placeholder-gray-500::placeholder{--tw-placeholder-opacity: 1;color:rgb(107 114 128 / var(--tw-placeholder-opacity, 1))}.placeholder-gray-600::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(75 85 99 / var(--tw-placeholder-opacity, 1))}.placeholder-gray-600::placeholder{--tw-placeholder-opacity: 1;color:rgb(75 85 99 / var(--tw-placeholder-opacity, 1))}.accent-\[\#bb86fc\]{accent-color:#bb86fc}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-30{opacity:.3}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.opacity-70{opacity:.7}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\[0_0_15px_-3px_rgba\(168\,85\,247\,0\.3\)\]{--tw-shadow: 0 0 15px -3px rgba(168,85,247,.3);--tw-shadow-colored: 0 0 15px -3px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\[0_0_15px_rgba\(245\,158\,11\,0\.4\)\]{--tw-shadow: 0 0 15px rgba(245,158,11,.4);--tw-shadow-colored: 0 0 15px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\[0_8px_32px_0_rgba\(0\,0\,0\,0\.5\)\]{--tw-shadow: 0 8px 32px 0 rgba(0,0,0,.5);--tw-shadow-colored: 0 8px 32px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-inner{--tw-shadow: inset 0 2px 4px 0 rgb(0 0 0 / .05);--tw-shadow-colored: inset 0 2px 4px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-none{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\[\#bb86fc\]\/10{--tw-shadow-color: rgb(187 134 252 / .1);--tw-shadow: var(--tw-shadow-colored)}.shadow-\[\#bb86fc\]\/20{--tw-shadow-color: rgb(187 134 252 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-\[\#bb86fc\]\/30{--tw-shadow-color: rgb(187 134 252 / .3);--tw-shadow: var(--tw-shadow-colored)}.shadow-\[\#bb86fc\]\/40{--tw-shadow-color: rgb(187 134 252 / .4);--tw-shadow: var(--tw-shadow-colored)}.shadow-amber-500\/20{--tw-shadow-color: rgb(245 158 11 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-black\/50{--tw-shadow-color: rgb(0 0 0 / .5);--tw-shadow: var(--tw-shadow-colored)}.shadow-blue-500\/20{--tw-shadow-color: rgb(59 130 246 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-emerald-500\/20{--tw-shadow-color: rgb(16 185 129 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-green-500\/40{--tw-shadow-color: rgb(34 197 94 / .4);--tw-shadow: var(--tw-shadow-colored)}.shadow-indigo-500\/20{--tw-shadow-color: rgb(99 102 241 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-orange-500\/20{--tw-shadow-color: rgb(249 115 22 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-pink-500\/20{--tw-shadow-color: rgb(236 72 153 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-purple-500\/20{--tw-shadow-color: rgb(168 85 247 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-purple-600\/30{--tw-shadow-color: rgb(147 51 234 / .3);--tw-shadow: var(--tw-shadow-colored)}.shadow-purple-900\/20{--tw-shadow-color: rgb(88 28 135 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-red-500\/20{--tw-shadow-color: rgb(239 68 68 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-red-600\/20{--tw-shadow-color: rgb(220 38 38 / .2);--tw-shadow: var(--tw-shadow-colored)}.ring-4{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-\[\#bb86fc\]{--tw-ring-opacity: 1;--tw-ring-color: rgb(187 134 252 / var(--tw-ring-opacity, 1))}.blur-0{--tw-blur: blur(0);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.blur-md{--tw-blur: blur(12px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.drop-shadow-\[0_0_5px_rgba\(255\,255\,255\,0\.5\)\]{--tw-drop-shadow: drop-shadow(0 0 5px rgba(255,255,255,.5));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.drop-shadow-\[0_2px_4px_rgba\(0\,0\,0\,0\.6\)\]{--tw-drop-shadow: drop-shadow(0 2px 4px rgba(0,0,0,.6));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.grayscale{--tw-grayscale: grayscale(100%);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-\[8px\]{--tw-backdrop-blur: blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-md{--tw-backdrop-blur: blur(12px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-none{transition-property:none}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-1000{transition-duration:1s}.duration-150{transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}.duration-700{transition-duration:.7s}.duration-\[400ms\]{transition-duration:.4s}.duration-\[600ms\]{transition-duration:.6s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.ease-linear{transition-timing-function:linear}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}.will-change-transform{will-change:transform}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}@keyframes fadeIn{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}@keyframes fadeOut{0%{opacity:1}to{opacity:0}}@keyframes fadeInUp{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}@keyframes quickFadeIn{0%{opacity:0;transform:scale(.98)}to{opacity:1;transform:scale(1)}}.animate-quick-fade-in{animation:quickFadeIn .15s ease-out forwards}@keyframes smoothFadeIn{0%{opacity:0;transform:scale(.98)}50%{opacity:.5}to{opacity:1;transform:scale(1)}}.animate-smooth-fade-in{animation:smoothFadeIn 1.2s ease-out forwards}.masonry-container{-moz-column-count:2;column-count:2;-moz-column-gap:4px;column-gap:4px}@media (min-width: 640px){.masonry-container{-moz-column-count:3;column-count:3}}@media (min-width: 768px){.masonry-container{-moz-column-count:4;column-count:4}}@media (min-width: 1024px){.masonry-container{-moz-column-count:5;column-count:5}}@media (min-width: 1280px){.masonry-container{-moz-column-count:6;column-count:6}}@keyframes shimmer{0%{background-position:-1000px 0}to{background-position:1000px 0}}.animate-shimmer{animation:shimmer 2.5s infinite}.masonry-item{-moz-column-break-inside:avoid;break-inside:avoid;margin-bottom:4px;display:inline-block;width:100%}@keyframes slideInUp{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}@keyframes slideInDown{0%{opacity:0;transform:translateY(-20px)}to{opacity:1;transform:translateY(0)}}@keyframes slideInLeft{0%{opacity:0;transform:translate(-20px)}to{opacity:1;transform:translate(0)}}@keyframes slideInRight{0%{opacity:0;transform:translate(20px)}to{opacity:1;transform:translate(0)}}@keyframes glow{0%,to{box-shadow:0 0 5px #8b5cf61a}50%{box-shadow:0 0 20px #8b5cf64d}}@keyframes pulse-color{0%,to{color:currentColor}50%{color:#8b5cf699}}.animate-slide-in-up{animation:slideInUp .5s ease-out forwards}.animate-slide-in-down{animation:slideInDown .5s ease-out forwards}.animate-slide-in-left{animation:slideInLeft .5s ease-out forwards}.animate-slide-in-right{animation:slideInRight .5s ease-out forwards}.animate-glow{animation:glow 2s ease-in-out infinite}.animate-pulse-color{animation:pulse-color 2s ease-in-out infinite}::-webkit-scrollbar,html::-webkit-scrollbar,body::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-track,html::-webkit-scrollbar-track,body::-webkit-scrollbar-track{background:transparent}::-webkit-scrollbar-thumb,html::-webkit-scrollbar-thumb,body::-webkit-scrollbar-thumb{background-color:#4b5563;border-radius:10px;border:2px solid transparent;background-clip:padding-box}::-webkit-scrollbar-thumb:hover,html::-webkit-scrollbar-thumb:hover,body::-webkit-scrollbar-thumb:hover{background-color:#bb86fc;border:2px solid transparent;background-clip:padding-box}*{scrollbar-width:thin;scrollbar-color:#4b5563 transparent}html,body{scrollbar-width:thin;scrollbar-color:#4b5563 #121212}.after\:absolute:after{content:var(--tw-content);position:absolute}.after\:left-\[2px\]:after{content:var(--tw-content);left:2px}.after\:top-\[2px\]:after{content:var(--tw-content);top:2px}.after\:h-4:after{content:var(--tw-content);height:1rem}.after\:h-5:after{content:var(--tw-content);height:1.25rem}.after\:w-4:after{content:var(--tw-content);width:1rem}.after\:w-5:after{content:var(--tw-content);width:1.25rem}.after\:rounded-full:after{content:var(--tw-content);border-radius:9999px}.after\:border:after{content:var(--tw-content);border-width:1px}.after\:border-gray-300:after{content:var(--tw-content);--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.after\:bg-white:after{content:var(--tw-content);--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.after\:transition-all:after{content:var(--tw-content);transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.after\:content-\[\'\'\]:after{--tw-content: "";content:var(--tw-content)}.hover\:rotate-180:hover{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:rotate-90:hover{--tw-rotate: 90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:scale-105:hover{--tw-scale-x: 1.05;--tw-scale-y: 1.05;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:scale-110:hover{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:scale-125:hover{--tw-scale-x: 1.25;--tw-scale-y: 1.25;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:scale-\[1\.02\]:hover{--tw-scale-x: 1.02;--tw-scale-y: 1.02;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:border-\[\#24A1DE\]:hover{--tw-border-opacity: 1;border-color:rgb(36 161 222 / var(--tw-border-opacity, 1))}.hover\:border-\[\#FF424D\]:hover{--tw-border-opacity: 1;border-color:rgb(255 66 77 / var(--tw-border-opacity, 1))}.hover\:border-\[\#bb86fc\]:hover{--tw-border-opacity: 1;border-color:rgb(187 134 252 / var(--tw-border-opacity, 1))}.hover\:border-\[\#bb86fc\]\/50:hover{border-color:#bb86fc80}.hover\:border-blue-500:hover{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.hover\:border-blue-500\/40:hover{border-color:#3b82f666}.hover\:border-emerald-500\/40:hover{border-color:#10b98166}.hover\:border-gray-500:hover{--tw-border-opacity: 1;border-color:rgb(107 114 128 / var(--tw-border-opacity, 1))}.hover\:border-gray-600:hover{--tw-border-opacity: 1;border-color:rgb(75 85 99 / var(--tw-border-opacity, 1))}.hover\:border-gray-600\/70:hover{border-color:#4b5563b3}.hover\:border-gray-700:hover{--tw-border-opacity: 1;border-color:rgb(55 65 81 / var(--tw-border-opacity, 1))}.hover\:border-gray-700\/60:hover{border-color:#37415199}.hover\:border-indigo-500\/40:hover{border-color:#6366f166}.hover\:border-purple-500:hover{--tw-border-opacity: 1;border-color:rgb(168 85 247 / var(--tw-border-opacity, 1))}.hover\:border-purple-500\/50:hover{border-color:#a855f780}.hover\:border-red-500:hover{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.hover\:border-red-500\/40:hover{border-color:#ef444466}.hover\:border-white:hover{--tw-border-opacity: 1;border-color:rgb(255 255 255 / var(--tw-border-opacity, 1))}.hover\:border-yellow-500\/40:hover{border-color:#eab30866}.hover\:bg-\[\#00AFF0\]\/20:hover{background-color:#00aff033}.hover\:bg-\[\#1f1f1f\]:hover{--tw-bg-opacity: 1;background-color:rgb(31 31 31 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#242424\]:hover{--tw-bg-opacity: 1;background-color:rgb(36 36 36 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#2a2a2a\]:hover{--tw-bg-opacity: 1;background-color:rgb(42 42 42 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#333\]:hover{--tw-bg-opacity: 1;background-color:rgb(51 51 51 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#9966dd\]:hover{--tw-bg-opacity: 1;background-color:rgb(153 102 221 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#bb86fc\]:hover{--tw-bg-opacity: 1;background-color:rgb(187 134 252 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#bb86fc\]\/10:hover{background-color:#bb86fc1a}.hover\:bg-\[\#bb86fc\]\/20:hover{background-color:#bb86fc33}.hover\:bg-\[\#bb86fc\]\/30:hover{background-color:#bb86fc4d}.hover\:bg-\[\#bb86fc\]\/5:hover{background-color:#bb86fc0d}.hover\:bg-\[\#f96854\]\/20:hover{background-color:#f9685433}.hover\:bg-amber-600:hover{--tw-bg-opacity: 1;background-color:rgb(217 119 6 / var(--tw-bg-opacity, 1))}.hover\:bg-amber-700:hover{--tw-bg-opacity: 1;background-color:rgb(180 83 9 / var(--tw-bg-opacity, 1))}.hover\:bg-blue-500\/20:hover{background-color:#3b82f633}.hover\:bg-blue-500\/5:hover{background-color:#3b82f60d}.hover\:bg-blue-700:hover{--tw-bg-opacity: 1;background-color:rgb(29 78 216 / var(--tw-bg-opacity, 1))}.hover\:bg-emerald-500\/20:hover{background-color:#10b98133}.hover\:bg-emerald-700:hover{--tw-bg-opacity: 1;background-color:rgb(4 120 87 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-600:hover{--tw-bg-opacity: 1;background-color:rgb(75 85 99 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-700:hover{--tw-bg-opacity: 1;background-color:rgb(55 65 81 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-800:hover{--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.hover\:bg-indigo-500\/20:hover{background-color:#6366f133}.hover\:bg-indigo-700:hover{--tw-bg-opacity: 1;background-color:rgb(67 56 202 / var(--tw-bg-opacity, 1))}.hover\:bg-orange-600:hover{--tw-bg-opacity: 1;background-color:rgb(234 88 12 / var(--tw-bg-opacity, 1))}.hover\:bg-pink-600:hover{--tw-bg-opacity: 1;background-color:rgb(219 39 119 / var(--tw-bg-opacity, 1))}.hover\:bg-pink-700:hover{--tw-bg-opacity: 1;background-color:rgb(190 24 93 / var(--tw-bg-opacity, 1))}.hover\:bg-purple-500\/30:hover{background-color:#a855f74d}.hover\:bg-purple-600:hover{--tw-bg-opacity: 1;background-color:rgb(147 51 234 / var(--tw-bg-opacity, 1))}.hover\:bg-purple-700:hover{--tw-bg-opacity: 1;background-color:rgb(126 34 206 / var(--tw-bg-opacity, 1))}.hover\:bg-red-500\/20:hover{background-color:#ef444433}.hover\:bg-red-500\/30:hover{background-color:#ef44444d}.hover\:bg-red-600:hover{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.hover\:bg-red-700:hover{--tw-bg-opacity: 1;background-color:rgb(185 28 28 / var(--tw-bg-opacity, 1))}.hover\:bg-white\/10:hover{background-color:#ffffff1a}.hover\:bg-white\/20:hover{background-color:#fff3}.hover\:bg-white\/5:hover{background-color:#ffffff0d}.hover\:bg-yellow-500\/20:hover{background-color:#eab30833}.hover\:from-\[\#9966dd\]:hover{--tw-gradient-from: #9966dd var(--tw-gradient-from-position);--tw-gradient-to: rgb(153 102 221 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.hover\:from-gray-700\/60:hover{--tw-gradient-from: rgb(55 65 81 / .6) var(--tw-gradient-from-position);--tw-gradient-to: rgb(55 65 81 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.hover\:to-\[\#7744cc\]:hover{--tw-gradient-to: #7744cc var(--tw-gradient-to-position)}.hover\:to-gray-600\/60:hover{--tw-gradient-to: rgb(75 85 99 / .6) var(--tw-gradient-to-position)}.hover\:text-\[\#24A1DE\]:hover{--tw-text-opacity: 1;color:rgb(36 161 222 / var(--tw-text-opacity, 1))}.hover\:text-\[\#FF424D\]:hover{--tw-text-opacity: 1;color:rgb(255 66 77 / var(--tw-text-opacity, 1))}.hover\:text-\[\#bb86fc\]:hover{--tw-text-opacity: 1;color:rgb(187 134 252 / var(--tw-text-opacity, 1))}.hover\:text-blue-300:hover{--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.hover\:text-purple-400:hover{--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.hover\:text-red-400:hover{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.hover\:text-white:hover{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:decoration-white:hover{text-decoration-color:#fff}.hover\:opacity-100:hover{opacity:1}.hover\:opacity-80:hover{opacity:.8}.hover\:shadow-lg:hover{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-\[\#bb86fc\]\/60:hover{--tw-shadow-color: rgb(187 134 252 / .6);--tw-shadow: var(--tw-shadow-colored)}.hover\:shadow-purple-500\/10:hover{--tw-shadow-color: rgb(168 85 247 / .1);--tw-shadow: var(--tw-shadow-colored)}.hover\:shadow-purple-500\/20:hover{--tw-shadow-color: rgb(168 85 247 / .2);--tw-shadow: var(--tw-shadow-colored)}.hover\:shadow-purple-600\/50:hover{--tw-shadow-color: rgb(147 51 234 / .5);--tw-shadow: var(--tw-shadow-colored)}.hover\:brightness-110:hover{--tw-brightness: brightness(1.1);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.hover\:grayscale-0:hover{--tw-grayscale: grayscale(0);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.focus\:border-\[\#bb86fc\]:focus{--tw-border-opacity: 1;border-color:rgb(187 134 252 / var(--tw-border-opacity, 1))}.focus\:border-blue-500:focus{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.focus\:border-gray-600:focus{--tw-border-opacity: 1;border-color:rgb(75 85 99 / var(--tw-border-opacity, 1))}.focus\:border-pink-500:focus{--tw-border-opacity: 1;border-color:rgb(236 72 153 / var(--tw-border-opacity, 1))}.focus\:border-purple-500:focus{--tw-border-opacity: 1;border-color:rgb(168 85 247 / var(--tw-border-opacity, 1))}.focus\:border-purple-500\/50:focus{border-color:#a855f780}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-\[\#bb86fc\]:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(187 134 252 / var(--tw-ring-opacity, 1))}.focus\:ring-\[\#bb86fc\]\/30:focus{--tw-ring-color: rgb(187 134 252 / .3)}.focus\:ring-purple-500\/50:focus{--tw-ring-color: rgb(168 85 247 / .5)}.active\:scale-95:active{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:text-gray-600:disabled{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.disabled\:opacity-50:disabled{opacity:.5}.disabled\:hover\:bg-\[\#1a1a1a\]:hover:disabled{--tw-bg-opacity: 1;background-color:rgb(26 26 26 / var(--tw-bg-opacity, 1))}.group:hover .group-hover\:-translate-x-1{--tw-translate-x: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:rotate-12{--tw-rotate: 12deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:scale-105{--tw-scale-x: 1.05;--tw-scale-y: 1.05;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:scale-110{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:scale-\[1\.08\]{--tw-scale-x: 1.08;--tw-scale-y: 1.08;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:scale-\[1\.10\]{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:border-amber-500\/50{border-color:#f59e0b80}.group:hover .group-hover\:border-purple-500\/50{border-color:#a855f780}.group:hover .group-hover\:bg-\[\#bb86fc\]\/40{background-color:#bb86fc66}.group:hover .group-hover\:bg-blue-500\/20{background-color:#3b82f633}.group:hover .group-hover\:bg-gray-700\/80{background-color:#374151cc}.group:hover .group-hover\:bg-purple-500\/40{background-color:#a855f766}.group:hover .group-hover\:text-\[\#bb86fc\]{--tw-text-opacity: 1;color:rgb(187 134 252 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-purple-400{--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-white\/60{color:#fff9}.group:hover .group-hover\:opacity-100{opacity:1}.group:hover .group-hover\:shadow-\[\#bb86fc\]\/30{--tw-shadow-color: rgb(187 134 252 / .3);--tw-shadow: var(--tw-shadow-colored)}.group:hover .group-hover\:shadow-\[\#bb86fc\]\/60{--tw-shadow-color: rgb(187 134 252 / .6);--tw-shadow: var(--tw-shadow-colored)}.peer:checked~.peer-checked\:bg-\[\#bb86fc\]{--tw-bg-opacity: 1;background-color:rgb(187 134 252 / var(--tw-bg-opacity, 1))}.peer:checked~.peer-checked\:bg-amber-500{--tw-bg-opacity: 1;background-color:rgb(245 158 11 / var(--tw-bg-opacity, 1))}.peer:checked~.peer-checked\:bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.peer:checked~.peer-checked\:bg-cyan-500{--tw-bg-opacity: 1;background-color:rgb(6 182 212 / var(--tw-bg-opacity, 1))}.peer:checked~.peer-checked\:bg-emerald-500{--tw-bg-opacity: 1;background-color:rgb(16 185 129 / var(--tw-bg-opacity, 1))}.peer:checked~.peer-checked\:bg-indigo-500{--tw-bg-opacity: 1;background-color:rgb(99 102 241 / var(--tw-bg-opacity, 1))}.peer:checked~.peer-checked\:bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.peer:checked~.peer-checked\:bg-pink-500{--tw-bg-opacity: 1;background-color:rgb(236 72 153 / var(--tw-bg-opacity, 1))}.peer:checked~.peer-checked\:bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.peer:checked~.peer-checked\:after\:translate-x-full:after{content:var(--tw-content);--tw-translate-x: 100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.peer:checked~.peer-checked\:after\:border-white:after{content:var(--tw-content);--tw-border-opacity: 1;border-color:rgb(255 255 255 / var(--tw-border-opacity, 1))}.peer:focus~.peer-focus\:outline-none{outline:2px solid transparent;outline-offset:2px}.peer:focus~.peer-focus\:ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.peer:focus~.peer-focus\:ring-\[\#bb86fc\]\/30{--tw-ring-color: rgb(187 134 252 / .3)}.peer:focus~.peer-focus\:ring-amber-300{--tw-ring-opacity: 1;--tw-ring-color: rgb(252 211 77 / var(--tw-ring-opacity, 1))}.peer:focus~.peer-focus\:ring-blue-300{--tw-ring-opacity: 1;--tw-ring-color: rgb(147 197 253 / var(--tw-ring-opacity, 1))}.peer:focus~.peer-focus\:ring-cyan-300{--tw-ring-opacity: 1;--tw-ring-color: rgb(103 232 249 / var(--tw-ring-opacity, 1))}.peer:focus~.peer-focus\:ring-emerald-300{--tw-ring-opacity: 1;--tw-ring-color: rgb(110 231 183 / var(--tw-ring-opacity, 1))}.peer:focus~.peer-focus\:ring-indigo-300{--tw-ring-opacity: 1;--tw-ring-color: rgb(165 180 252 / var(--tw-ring-opacity, 1))}.peer:focus~.peer-focus\:ring-orange-300{--tw-ring-opacity: 1;--tw-ring-color: rgb(253 186 116 / var(--tw-ring-opacity, 1))}.peer:focus~.peer-focus\:ring-pink-300{--tw-ring-opacity: 1;--tw-ring-color: rgb(249 168 212 / var(--tw-ring-opacity, 1))}.peer:focus~.peer-focus\:ring-purple-300{--tw-ring-opacity: 1;--tw-ring-color: rgb(216 180 254 / var(--tw-ring-opacity, 1))}.peer:focus~.peer-focus\:ring-red-300{--tw-ring-opacity: 1;--tw-ring-color: rgb(252 165 165 / var(--tw-ring-opacity, 1))}@media (min-width: 640px){.sm\:left-8{left:2rem}.sm\:right-8{right:2rem}.sm\:mx-0{margin-left:0;margin-right:0}.sm\:mb-4{margin-bottom:1rem}.sm\:mb-6{margin-bottom:1.5rem}.sm\:mt-12{margin-top:3rem}.sm\:mt-2{margin-top:.5rem}.sm\:mt-8{margin-top:2rem}.sm\:inline-block{display:inline-block}.sm\:inline{display:inline}.sm\:flex{display:flex}.sm\:hidden{display:none}.sm\:h-10{height:2.5rem}.sm\:h-14{height:3.5rem}.sm\:h-4{height:1rem}.sm\:h-5{height:1.25rem}.sm\:h-6{height:1.5rem}.sm\:w-10{width:2.5rem}.sm\:w-14{width:3.5rem}.sm\:w-4{width:1rem}.sm\:w-5{width:1.25rem}.sm\:w-6{width:1.5rem}.sm\:w-64{width:16rem}.sm\:w-auto{width:auto}.sm\:flex-none{flex:none}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:justify-start{justify-content:flex-start}.sm\:gap-0{gap:0px}.sm\:gap-1{gap:.25rem}.sm\:gap-2{gap:.5rem}.sm\:gap-3{gap:.75rem}.sm\:gap-4{gap:1rem}.sm\:gap-6{gap:1.5rem}.sm\:rounded-lg{border-radius:.5rem}.sm\:p-12{padding:3rem}.sm\:p-2{padding:.5rem}.sm\:p-2\.5{padding:.625rem}.sm\:p-4{padding:1rem}.sm\:p-6{padding:1.5rem}.sm\:px-10{padding-left:2.5rem;padding-right:2.5rem}.sm\:px-2{padding-left:.5rem;padding-right:.5rem}.sm\:px-3{padding-left:.75rem;padding-right:.75rem}.sm\:px-4{padding-left:1rem;padding-right:1rem}.sm\:px-6{padding-left:1.5rem;padding-right:1.5rem}.sm\:py-1{padding-top:.25rem;padding-bottom:.25rem}.sm\:py-2{padding-top:.5rem;padding-bottom:.5rem}.sm\:py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.sm\:py-4{padding-top:1rem;padding-bottom:1rem}.sm\:py-6{padding-top:1.5rem;padding-bottom:1.5rem}.sm\:py-8{padding-top:2rem;padding-bottom:2rem}.sm\:pt-12{padding-top:3rem}.sm\:pt-8{padding-top:2rem}.sm\:text-left{text-align:left}.sm\:text-2xl{font-size:1.5rem;line-height:2rem}.sm\:text-4xl{font-size:2.25rem;line-height:2.5rem}.sm\:text-\[11px\]{font-size:11px}.sm\:text-base{font-size:1rem;line-height:1.5rem}.sm\:text-lg{font-size:1.125rem;line-height:1.75rem}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}.sm\:text-xs{font-size:.75rem;line-height:1rem}.sm\:shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}}@media (min-width: 768px){.md\:absolute{position:absolute}.md\:relative{position:relative}.md\:right-8{right:2rem}.md\:top-0{top:0}.md\:block{display:block}.md\:flex{display:flex}.md\:hidden{display:none}.md\:w-24{width:6rem}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:flex-col{flex-direction:column}.md\:gap-3{gap:.75rem}.md\:border-y-0{border-top-width:0px;border-bottom-width:0px}.md\:p-12{padding:3rem}.md\:px-12{padding-left:3rem;padding-right:3rem}.md\:py-0{padding-top:0;padding-bottom:0}}@media (min-width: 1024px){.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.lg\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}}@media (min-width: 1280px){.xl\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.xl\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.xl\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}}@media (min-width: 1536px){.\32xl\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}}@media (prefers-color-scheme: dark){.dark\:border-gray-600{--tw-border-opacity: 1;border-color:rgb(75 85 99 / var(--tw-border-opacity, 1))}.dark\:bg-gray-700{--tw-bg-opacity: 1;background-color:rgb(55 65 81 / var(--tw-bg-opacity, 1))}.peer:focus~.dark\:peer-focus\:ring-\[\#bb86fc\]\/80{--tw-ring-color: rgb(187 134 252 / .8)}.peer:focus~.dark\:peer-focus\:ring-amber-800{--tw-ring-opacity: 1;--tw-ring-color: rgb(146 64 14 / var(--tw-ring-opacity, 1))}.peer:focus~.dark\:peer-focus\:ring-blue-800{--tw-ring-opacity: 1;--tw-ring-color: rgb(30 64 175 / var(--tw-ring-opacity, 1))}.peer:focus~.dark\:peer-focus\:ring-cyan-800{--tw-ring-opacity: 1;--tw-ring-color: rgb(21 94 117 / var(--tw-ring-opacity, 1))}.peer:focus~.dark\:peer-focus\:ring-emerald-800{--tw-ring-opacity: 1;--tw-ring-color: rgb(6 95 70 / var(--tw-ring-opacity, 1))}.peer:focus~.dark\:peer-focus\:ring-indigo-800{--tw-ring-opacity: 1;--tw-ring-color: rgb(55 48 163 / var(--tw-ring-opacity, 1))}.peer:focus~.dark\:peer-focus\:ring-orange-800{--tw-ring-opacity: 1;--tw-ring-color: rgb(154 52 18 / var(--tw-ring-opacity, 1))}.peer:focus~.dark\:peer-focus\:ring-pink-800{--tw-ring-opacity: 1;--tw-ring-color: rgb(157 23 77 / var(--tw-ring-opacity, 1))}.peer:focus~.dark\:peer-focus\:ring-purple-800{--tw-ring-opacity: 1;--tw-ring-color: rgb(107 33 168 / var(--tw-ring-opacity, 1))}.peer:focus~.dark\:peer-focus\:ring-red-800{--tw-ring-opacity: 1;--tw-ring-color: rgb(153 27 27 / var(--tw-ring-opacity, 1))}} diff --git a/dist/assets/index-DWooO1ag.js b/dist/assets/index-DWooO1ag.js new file mode 100644 index 0000000000000000000000000000000000000000..76b161f59abfd864ed1c882b449c078ebba4c7b3 --- /dev/null +++ b/dist/assets/index-DWooO1ag.js @@ -0,0 +1,3696 @@ +(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var Wu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Kd(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var jb={exports:{}},Qd={},Pb={exports:{}},Qe={};/** + * @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 oc=Symbol.for("react.element"),tN=Symbol.for("react.portal"),nN=Symbol.for("react.fragment"),rN=Symbol.for("react.strict_mode"),sN=Symbol.for("react.profiler"),iN=Symbol.for("react.provider"),oN=Symbol.for("react.context"),aN=Symbol.for("react.forward_ref"),lN=Symbol.for("react.suspense"),cN=Symbol.for("react.memo"),uN=Symbol.for("react.lazy"),Iy=Symbol.iterator;function dN(t){return t===null||typeof t!="object"?null:(t=Iy&&t[Iy]||t["@@iterator"],typeof t=="function"?t:null)}var Rb={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Db=Object.assign,Mb={};function wa(t,e,n){this.props=t,this.context=e,this.refs=Mb,this.updater=n||Rb}wa.prototype.isReactComponent={};wa.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=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,t,e,"setState")};wa.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function Lb(){}Lb.prototype=wa.prototype;function zm(t,e,n){this.props=t,this.context=e,this.refs=Mb,this.updater=n||Rb}var Um=zm.prototype=new Lb;Um.constructor=zm;Db(Um,wa.prototype);Um.isPureReactComponent=!0;var Cy=Array.isArray,Ob=Object.prototype.hasOwnProperty,Bm={current:null},Vb={key:!0,ref:!0,__self:!0,__source:!0};function Fb(t,e,n){var r,s={},i=null,o=null;if(e!=null)for(r in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(i=""+e.key),e)Ob.call(e,r)&&!Vb.hasOwnProperty(r)&&(s[r]=e[r]);var l=arguments.length-2;if(l===1)s.children=n;else if(1>>1,pe=F[ne];if(0>>1;nes(oe,R))les(Ie,oe)?(F[ne]=Ie,F[le]=R,ne=le):(F[ne]=oe,F[Q]=R,ne=Q);else if(les(Ie,R))F[ne]=Ie,F[le]=R,ne=le;else break e}}return K}function s(F,K){var R=F.sortIndex-K.sortIndex;return R!==0?R:F.id-K.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;t.unstable_now=function(){return i.now()}}else{var o=Date,l=o.now();t.unstable_now=function(){return o.now()-l}}var c=[],u=[],f=1,h=null,m=3,p=!1,x=!1,E=!1,C=typeof setTimeout=="function"?setTimeout:null,y=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function _(F){for(var K=n(u);K!==null;){if(K.callback===null)r(u);else if(K.startTime<=F)r(u),K.sortIndex=K.expirationTime,e(c,K);else break;K=n(u)}}function D(F){if(E=!1,_(F),!x)if(n(c)!==null)x=!0,W(M);else{var K=n(u);K!==null&&ee(D,K.startTime-F)}}function M(F,K){x=!1,E&&(E=!1,y(w),w=-1),p=!0;var R=m;try{for(_(K),h=n(c);h!==null&&(!(h.expirationTime>K)||F&&!I());){var ne=h.callback;if(typeof ne=="function"){h.callback=null,m=h.priorityLevel;var pe=ne(h.expirationTime<=K);K=t.unstable_now(),typeof pe=="function"?h.callback=pe:h===n(c)&&r(c),_(K)}else r(c);h=n(c)}if(h!==null)var O=!0;else{var Q=n(u);Q!==null&&ee(D,Q.startTime-K),O=!1}return O}finally{h=null,m=R,p=!1}}var T=!1,S=null,w=-1,N=5,A=-1;function I(){return!(t.unstable_now()-AF||125ne?(F.sortIndex=R,e(u,F),n(c)===null&&F===n(u)&&(E?(y(w),w=-1):E=!0,ee(D,R-ne))):(F.sortIndex=pe,e(c,F),x||p||(x=!0,W(M))),F},t.unstable_shouldYield=I,t.unstable_wrapCallback=function(F){var K=m;return function(){var R=m;m=K;try{return F.apply(this,arguments)}finally{m=R}}}})(Hb);$b.exports=Hb;var _N=$b.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 EN=L,pr=_N;function ae(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),tp=Object.prototype.hasOwnProperty,SN=/^[: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]*$/,jy={},Py={};function TN(t){return tp.call(Py,t)?!0:tp.call(jy,t)?!1:SN.test(t)?Py[t]=!0:(jy[t]=!0,!1)}function NN(t,e,n,r){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function kN(t,e,n,r){if(e===null||typeof e>"u"||NN(t,e,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function zn(t,e,n,r,s,i,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=i,this.removeEmptyString=o}var vn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){vn[t]=new zn(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];vn[e]=new zn(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){vn[t]=new zn(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){vn[t]=new zn(t,2,!1,t,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(t){vn[t]=new zn(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){vn[t]=new zn(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){vn[t]=new zn(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){vn[t]=new zn(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){vn[t]=new zn(t,5,!1,t.toLowerCase(),null,!1,!1)});var Hm=/[\-:]([a-z])/g;function qm(t){return t[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(t){var e=t.replace(Hm,qm);vn[e]=new zn(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(Hm,qm);vn[e]=new zn(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(Hm,qm);vn[e]=new zn(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){vn[t]=new zn(t,1,!1,t.toLowerCase(),null,!1,!1)});vn.xlinkHref=new zn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){vn[t]=new zn(t,1,!1,t.toLowerCase(),null,!0,!0)});function Gm(t,e,n,r){var s=vn.hasOwnProperty(e)?vn[e]:null;(s!==null?s.type!==0:r||!(2l||s[o]!==i[l]){var c=` +`+s[o].replace(" at new "," at ");return t.displayName&&c.includes("")&&(c=c.replace("",t.displayName)),c}while(1<=o&&0<=l);break}}}finally{Qh=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?rl(t):""}function IN(t){switch(t.tag){case 5:return rl(t.type);case 16:return rl("Lazy");case 13:return rl("Suspense");case 19:return rl("SuspenseList");case 0:case 2:case 15:return t=Yh(t.type,!1),t;case 11:return t=Yh(t.type.render,!1),t;case 1:return t=Yh(t.type,!0),t;default:return""}}function ip(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case jo:return"Fragment";case Ao:return"Portal";case np:return"Profiler";case Wm:return"StrictMode";case rp:return"Suspense";case sp:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case Wb:return(t.displayName||"Context")+".Consumer";case Gb:return(t._context.displayName||"Context")+".Provider";case Km:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Qm:return e=t.displayName||null,e!==null?e:ip(t.type)||"Memo";case Gs:e=t._payload,t=t._init;try{return ip(t(e))}catch{}}return null}function CN(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ip(e);case 8:return e===Wm?"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 e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function yi(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Qb(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function AN(t){var e=Qb(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,i=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return s.call(this)},set:function(o){r=""+o,i.call(this,o)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function Wc(t){t._valueTracker||(t._valueTracker=AN(t))}function Yb(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=Qb(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function Ku(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function op(t,e){var n=e.checked;return Mt({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function Dy(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=yi(e.value!=null?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function Xb(t,e){e=e.checked,e!=null&&Gm(t,"checked",e,!1)}function ap(t,e){Xb(t,e);var n=yi(e.value),r=e.type;if(n!=null)r==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?lp(t,e.type,n):e.hasOwnProperty("defaultValue")&&lp(t,e.type,yi(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function My(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function lp(t,e,n){(e!=="number"||Ku(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var sl=Array.isArray;function Ho(t,e,n,r){if(t=t.options,e){e={};for(var s=0;s"+e.valueOf().toString()+"",e=Kc.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Al(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var dl={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},jN=["Webkit","ms","Moz","O"];Object.keys(dl).forEach(function(t){jN.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),dl[e]=dl[t]})});function t1(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||dl.hasOwnProperty(t)&&dl[t]?(""+e).trim():e+"px"}function n1(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=t1(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,s):t[n]=s}}var PN=Mt({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 dp(t,e){if(e){if(PN[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(ae(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(ae(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(ae(61))}if(e.style!=null&&typeof e.style!="object")throw Error(ae(62))}}function hp(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){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 fp=null;function Ym(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var pp=null,qo=null,Go=null;function Vy(t){if(t=cc(t)){if(typeof pp!="function")throw Error(ae(280));var e=t.stateNode;e&&(e=eh(e),pp(t.stateNode,t.type,e))}}function r1(t){qo?Go?Go.push(t):Go=[t]:qo=t}function s1(){if(qo){var t=qo,e=Go;if(Go=qo=null,Vy(t),e)for(t=0;t>>=0,t===0?32:31-($N(t)/HN|0)|0}var Qc=64,Yc=4194304;function il(t){switch(t&-t){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 t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Ju(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,s=t.suspendedLanes,i=t.pingedLanes,o=n&268435455;if(o!==0){var l=o&~s;l!==0?r=il(l):(i&=o,i!==0&&(r=il(i)))}else o=n&~s,o!==0?r=il(o):i!==0&&(r=il(i));if(r===0)return 0;if(e!==0&&e!==r&&!(e&s)&&(s=r&-r,i=e&-e,s>=i||s===16&&(i&4194240)!==0))return e;if(r&4&&(r|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0n;n++)e.push(t);return e}function ac(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Mr(e),t[e]=n}function KN(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var r=t.eventTimes;for(t=t.expirationTimes;0=fl),Wy=" ",Ky=!1;function S1(t,e){switch(t){case"keyup":return _k.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function T1(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Po=!1;function Sk(t,e){switch(t){case"compositionend":return T1(e);case"keypress":return e.which!==32?null:(Ky=!0,Wy);case"textInput":return t=e.data,t===Wy&&Ky?null:t;default:return null}}function Tk(t,e){if(Po)return t==="compositionend"||!sg&&S1(t,e)?(t=_1(),Tu=tg=ei=null,Po=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Jy(n)}}function C1(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?C1(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function A1(){for(var t=window,e=Ku();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=Ku(t.document)}return e}function ig(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function Dk(t){var e=A1(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&C1(n.ownerDocument.documentElement,n)){if(r!==null&&ig(n)){if(e=r.start,t=r.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var s=n.textContent.length,i=Math.min(r.start,s);r=r.end===void 0?i:Math.min(r.end,s),!t.extend&&i>r&&(s=r,r=i,i=s),s=Zy(n,i);var o=Zy(n,r);s&&o&&(t.rangeCount!==1||t.anchorNode!==s.node||t.anchorOffset!==s.offset||t.focusNode!==o.node||t.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(s.node,s.offset),t.removeAllRanges(),i>r?(t.addRange(e),t.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Ro=null,wp=null,ml=null,bp=!1;function ex(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;bp||Ro==null||Ro!==Ku(r)||(r=Ro,"selectionStart"in r&&ig(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),ml&&Ll(ml,r)||(ml=r,r=td(wp,"onSelect"),0Lo||(t.current=kp[Lo],kp[Lo]=null,Lo--)}function St(t,e){Lo++,kp[Lo]=t.current,t.current=e}var xi={},Cn=Ii(xi),Xn=Ii(!1),Xi=xi;function aa(t,e){var n=t.type.contextTypes;if(!n)return xi;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var s={},i;for(i in n)s[i]=e[i];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=s),s}function Jn(t){return t=t.childContextTypes,t!=null}function rd(){Ct(Xn),Ct(Cn)}function ax(t,e,n){if(Cn.current!==xi)throw Error(ae(168));St(Cn,e),St(Xn,n)}function F1(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in e))throw Error(ae(108,CN(t)||"Unknown",s));return Mt({},n,r)}function sd(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||xi,Xi=Cn.current,St(Cn,t),St(Xn,Xn.current),!0}function lx(t,e,n){var r=t.stateNode;if(!r)throw Error(ae(169));n?(t=F1(t,e,Xi),r.__reactInternalMemoizedMergedChildContext=t,Ct(Xn),Ct(Cn),St(Cn,t)):Ct(Xn),St(Xn,n)}var ms=null,th=!1,df=!1;function z1(t){ms===null?ms=[t]:ms.push(t)}function Gk(t){th=!0,z1(t)}function Ci(){if(!df&&ms!==null){df=!0;var t=0,e=ht;try{var n=ms;for(ht=1;t>=o,s-=o,ys=1<<32-Mr(e)+s|n<w?(N=S,S=null):N=S.sibling;var A=m(y,S,_[w],D);if(A===null){S===null&&(S=N);break}t&&S&&A.alternate===null&&e(y,S),v=i(A,v,w),T===null?M=A:T.sibling=A,T=A,S=N}if(w===_.length)return n(y,S),At&&Vi(y,w),M;if(S===null){for(;w<_.length;w++)S=h(y,_[w],D),S!==null&&(v=i(S,v,w),T===null?M=S:T.sibling=S,T=S);return At&&Vi(y,w),M}for(S=r(y,S);w<_.length;w++)N=p(S,y,w,_[w],D),N!==null&&(t&&N.alternate!==null&&S.delete(N.key===null?w:N.key),v=i(N,v,w),T===null?M=N:T.sibling=N,T=N);return t&&S.forEach(function(I){return e(y,I)}),At&&Vi(y,w),M}function E(y,v,_,D){var M=Ha(_);if(typeof M!="function")throw Error(ae(150));if(_=M.call(_),_==null)throw Error(ae(151));for(var T=M=null,S=v,w=v=0,N=null,A=_.next();S!==null&&!A.done;w++,A=_.next()){S.index>w?(N=S,S=null):N=S.sibling;var I=m(y,S,A.value,D);if(I===null){S===null&&(S=N);break}t&&S&&I.alternate===null&&e(y,S),v=i(I,v,w),T===null?M=I:T.sibling=I,T=I,S=N}if(A.done)return n(y,S),At&&Vi(y,w),M;if(S===null){for(;!A.done;w++,A=_.next())A=h(y,A.value,D),A!==null&&(v=i(A,v,w),T===null?M=A:T.sibling=A,T=A);return At&&Vi(y,w),M}for(S=r(y,S);!A.done;w++,A=_.next())A=p(S,y,w,A.value,D),A!==null&&(t&&A.alternate!==null&&S.delete(A.key===null?w:A.key),v=i(A,v,w),T===null?M=A:T.sibling=A,T=A);return t&&S.forEach(function(P){return e(y,P)}),At&&Vi(y,w),M}function C(y,v,_,D){if(typeof _=="object"&&_!==null&&_.type===jo&&_.key===null&&(_=_.props.children),typeof _=="object"&&_!==null){switch(_.$$typeof){case Gc:e:{for(var M=_.key,T=v;T!==null;){if(T.key===M){if(M=_.type,M===jo){if(T.tag===7){n(y,T.sibling),v=s(T,_.props.children),v.return=y,y=v;break e}}else if(T.elementType===M||typeof M=="object"&&M!==null&&M.$$typeof===Gs&&dx(M)===T.type){n(y,T.sibling),v=s(T,_.props),v.ref=Qa(y,T,_),v.return=y,y=v;break e}n(y,T);break}else e(y,T);T=T.sibling}_.type===jo?(v=Wi(_.props.children,y.mode,D,_.key),v.return=y,y=v):(D=Ru(_.type,_.key,_.props,null,y.mode,D),D.ref=Qa(y,v,_),D.return=y,y=D)}return o(y);case Ao:e:{for(T=_.key;v!==null;){if(v.key===T)if(v.tag===4&&v.stateNode.containerInfo===_.containerInfo&&v.stateNode.implementation===_.implementation){n(y,v.sibling),v=s(v,_.children||[]),v.return=y,y=v;break e}else{n(y,v);break}else e(y,v);v=v.sibling}v=vf(_,y.mode,D),v.return=y,y=v}return o(y);case Gs:return T=_._init,C(y,v,T(_._payload),D)}if(sl(_))return x(y,v,_,D);if(Ha(_))return E(y,v,_,D);ru(y,_)}return typeof _=="string"&&_!==""||typeof _=="number"?(_=""+_,v!==null&&v.tag===6?(n(y,v.sibling),v=s(v,_),v.return=y,y=v):(n(y,v),v=xf(_,y.mode,D),v.return=y,y=v),o(y)):n(y,v)}return C}var ca=H1(!0),q1=H1(!1),ad=Ii(null),ld=null,Fo=null,cg=null;function ug(){cg=Fo=ld=null}function dg(t){var e=ad.current;Ct(ad),t._currentValue=e}function Ap(t,e,n){for(;t!==null;){var r=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),t===n)break;t=t.return}}function Ko(t,e){ld=t,cg=Fo=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(Yn=!0),t.firstContext=null)}function Nr(t){var e=t._currentValue;if(cg!==t)if(t={context:t,memoizedValue:e,next:null},Fo===null){if(ld===null)throw Error(ae(308));Fo=t,ld.dependencies={lanes:0,firstContext:t}}else Fo=Fo.next=t;return e}var $i=null;function hg(t){$i===null?$i=[t]:$i.push(t)}function G1(t,e,n,r){var s=e.interleaved;return s===null?(n.next=n,hg(e)):(n.next=s.next,s.next=n),e.interleaved=n,Ns(t,r)}function Ns(t,e){t.lanes|=e;var n=t.alternate;for(n!==null&&(n.lanes|=e),n=t,t=t.return;t!==null;)t.childLanes|=e,n=t.alternate,n!==null&&(n.childLanes|=e),n=t,t=t.return;return n.tag===3?n.stateNode:null}var Ws=!1;function fg(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function W1(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function _s(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function ci(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,rt&2){var s=r.pending;return s===null?e.next=e:(e.next=s.next,s.next=e),r.pending=e,Ns(t,n)}return s=r.interleaved,s===null?(e.next=e,hg(r)):(e.next=s.next,s.next=e),r.interleaved=e,Ns(t,n)}function ku(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,Jm(t,n)}}function hx(t,e){var n=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?s=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?s=i=e:i=i.next=e}else s=i=e;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:r.shared,effects:r.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function cd(t,e,n,r){var s=t.updateQueue;Ws=!1;var i=s.firstBaseUpdate,o=s.lastBaseUpdate,l=s.shared.pending;if(l!==null){s.shared.pending=null;var c=l,u=c.next;c.next=null,o===null?i=u:o.next=u,o=c;var f=t.alternate;f!==null&&(f=f.updateQueue,l=f.lastBaseUpdate,l!==o&&(l===null?f.firstBaseUpdate=u:l.next=u,f.lastBaseUpdate=c))}if(i!==null){var h=s.baseState;o=0,f=u=c=null,l=i;do{var m=l.lane,p=l.eventTime;if((r&m)===m){f!==null&&(f=f.next={eventTime:p,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var x=t,E=l;switch(m=e,p=n,E.tag){case 1:if(x=E.payload,typeof x=="function"){h=x.call(p,h,m);break e}h=x;break e;case 3:x.flags=x.flags&-65537|128;case 0:if(x=E.payload,m=typeof x=="function"?x.call(p,h,m):x,m==null)break e;h=Mt({},h,m);break e;case 2:Ws=!0}}l.callback!==null&&l.lane!==0&&(t.flags|=64,m=s.effects,m===null?s.effects=[l]:m.push(l))}else p={eventTime:p,lane:m,tag:l.tag,payload:l.payload,callback:l.callback,next:null},f===null?(u=f=p,c=h):f=f.next=p,o|=m;if(l=l.next,l===null){if(l=s.shared.pending,l===null)break;m=l,l=m.next,m.next=null,s.lastBaseUpdate=m,s.shared.pending=null}}while(!0);if(f===null&&(c=h),s.baseState=c,s.firstBaseUpdate=u,s.lastBaseUpdate=f,e=s.shared.interleaved,e!==null){s=e;do o|=s.lane,s=s.next;while(s!==e)}else i===null&&(s.shared.lanes=0);eo|=o,t.lanes=o,t.memoizedState=h}}function fx(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;en?n:4,t(!0);var r=ff.transition;ff.transition={};try{t(!1),e()}finally{ht=n,ff.transition=r}}function u_(){return kr().memoizedState}function Yk(t,e,n){var r=di(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},d_(t))h_(e,n);else if(n=G1(t,e,n,r),n!==null){var s=Mn();Lr(n,t,r,s),f_(n,e,r)}}function Xk(t,e,n){var r=di(t),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(d_(t))h_(e,s);else{var i=t.alternate;if(t.lanes===0&&(i===null||i.lanes===0)&&(i=e.lastRenderedReducer,i!==null))try{var o=e.lastRenderedState,l=i(o,n);if(s.hasEagerState=!0,s.eagerState=l,Vr(l,o)){var c=e.interleaved;c===null?(s.next=s,hg(e)):(s.next=c.next,c.next=s),e.interleaved=s;return}}catch{}finally{}n=G1(t,e,s,r),n!==null&&(s=Mn(),Lr(n,t,r,s),f_(n,e,r))}}function d_(t){var e=t.alternate;return t===Rt||e!==null&&e===Rt}function h_(t,e){gl=dd=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function f_(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,Jm(t,n)}}var hd={readContext:Nr,useCallback:En,useContext:En,useEffect:En,useImperativeHandle:En,useInsertionEffect:En,useLayoutEffect:En,useMemo:En,useReducer:En,useRef:En,useState:En,useDebugValue:En,useDeferredValue:En,useTransition:En,useMutableSource:En,useSyncExternalStore:En,useId:En,unstable_isNewReconciler:!1},Jk={readContext:Nr,useCallback:function(t,e){return Hr().memoizedState=[t,e===void 0?null:e],t},useContext:Nr,useEffect:mx,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,Cu(4194308,4,i_.bind(null,e,t),n)},useLayoutEffect:function(t,e){return Cu(4194308,4,t,e)},useInsertionEffect:function(t,e){return Cu(4,2,t,e)},useMemo:function(t,e){var n=Hr();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=Hr();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=Yk.bind(null,Rt,t),[r.memoizedState,t]},useRef:function(t){var e=Hr();return t={current:t},e.memoizedState=t},useState:px,useDebugValue:bg,useDeferredValue:function(t){return Hr().memoizedState=t},useTransition:function(){var t=px(!1),e=t[0];return t=Qk.bind(null,t[1]),Hr().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=Rt,s=Hr();if(At){if(n===void 0)throw Error(ae(407));n=n()}else{if(n=e(),dn===null)throw Error(ae(349));Zi&30||X1(r,e,n)}s.memoizedState=n;var i={value:n,getSnapshot:e};return s.queue=i,mx(Z1.bind(null,r,i,t),[t]),r.flags|=2048,Hl(9,J1.bind(null,r,i,n,e),void 0,null),n},useId:function(){var t=Hr(),e=dn.identifierPrefix;if(At){var n=xs,r=ys;n=(r&~(1<<32-Mr(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=Bl++,0<\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=o.createElement(n,{is:r.is}):(t=o.createElement(n),n==="select"&&(o=t,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):t=o.createElementNS(t,n),t[Qr]=e,t[Fl]=r,E_(t,e,!1,!1),e.stateNode=t;e:{switch(o=hp(n,r),n){case"dialog":It("cancel",t),It("close",t),s=r;break;case"iframe":case"object":case"embed":It("load",t),s=r;break;case"video":case"audio":for(s=0;sha&&(e.flags|=128,r=!0,Ya(i,!1),e.lanes=4194304)}else{if(!r)if(t=ud(o),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),Ya(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!At)return Sn(e),null}else 2*qt()-i.renderingStartTime>ha&&n!==1073741824&&(e.flags|=128,r=!0,Ya(i,!1),e.lanes=4194304);i.isBackwards?(o.sibling=e.child,e.child=o):(n=i.last,n!==null?n.sibling=o:e.child=o,i.last=o)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=qt(),e.sibling=null,n=Pt.current,St(Pt,r?n&1|2:n&1),e):(Sn(e),null);case 22:case 23:return kg(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?ar&1073741824&&(Sn(e),e.subtreeFlags&6&&(e.flags|=8192)):Sn(e),null;case 24:return null;case 25:return null}throw Error(ae(156,e.tag))}function oI(t,e){switch(ag(e),e.tag){case 1:return Jn(e.type)&&rd(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return ua(),Ct(Xn),Ct(Cn),gg(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return mg(e),null;case 13:if(Ct(Pt),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(ae(340));la()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return Ct(Pt),null;case 4:return ua(),null;case 10:return dg(e.type._context),null;case 22:case 23:return kg(),null;case 24:return null;default:return null}}var iu=!1,kn=!1,aI=typeof WeakSet=="function"?WeakSet:Set,ve=null;function zo(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){zt(t,e,r)}else n.current=null}function Fp(t,e,n){try{n()}catch(r){zt(t,e,r)}}var Nx=!1;function lI(t,e){if(_p=Zu,t=A1(),ig(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,l=-1,c=-1,u=0,f=0,h=t,m=null;t:for(;;){for(var p;h!==n||s!==0&&h.nodeType!==3||(l=o+s),h!==i||r!==0&&h.nodeType!==3||(c=o+r),h.nodeType===3&&(o+=h.nodeValue.length),(p=h.firstChild)!==null;)m=h,h=p;for(;;){if(h===t)break t;if(m===n&&++u===s&&(l=o),m===i&&++f===r&&(c=o),(p=h.nextSibling)!==null)break;h=m,m=h.parentNode}h=p}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(Ep={focusedElem:t,selectionRange:n},Zu=!1,ve=e;ve!==null;)if(e=ve,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,ve=t;else for(;ve!==null;){e=ve;try{var x=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(x!==null){var E=x.memoizedProps,C=x.memoizedState,y=e.stateNode,v=y.getSnapshotBeforeUpdate(e.elementType===e.type?E:Cr(e.type,E),C);y.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var _=e.stateNode.containerInfo;_.nodeType===1?_.textContent="":_.nodeType===9&&_.documentElement&&_.removeChild(_.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(ae(163))}}catch(D){zt(e,e.return,D)}if(t=e.sibling,t!==null){t.return=e.return,ve=t;break}ve=e.return}return x=Nx,Nx=!1,x}function yl(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&t)===t){var i=s.destroy;s.destroy=void 0,i!==void 0&&Fp(e,n,i)}s=s.next}while(s!==r)}}function sh(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function zp(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function N_(t){var e=t.alternate;e!==null&&(t.alternate=null,N_(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[Qr],delete e[Fl],delete e[Np],delete e[Hk],delete e[qk])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function k_(t){return t.tag===5||t.tag===3||t.tag===4}function kx(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||k_(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Up(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=nd));else if(r!==4&&(t=t.child,t!==null))for(Up(t,e,n),t=t.sibling;t!==null;)Up(t,e,n),t=t.sibling}function Bp(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(Bp(t,e,n),t=t.sibling;t!==null;)Bp(t,e,n),t=t.sibling}var mn=null,Ar=!1;function $s(t,e,n){for(n=n.child;n!==null;)I_(t,e,n),n=n.sibling}function I_(t,e,n){if(Xr&&typeof Xr.onCommitFiberUnmount=="function")try{Xr.onCommitFiberUnmount(Yd,n)}catch{}switch(n.tag){case 5:kn||zo(n,e);case 6:var r=mn,s=Ar;mn=null,$s(t,e,n),mn=r,Ar=s,mn!==null&&(Ar?(t=mn,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):mn.removeChild(n.stateNode));break;case 18:mn!==null&&(Ar?(t=mn,n=n.stateNode,t.nodeType===8?uf(t.parentNode,n):t.nodeType===1&&uf(t,n),Dl(t)):uf(mn,n.stateNode));break;case 4:r=mn,s=Ar,mn=n.stateNode.containerInfo,Ar=!0,$s(t,e,n),mn=r,Ar=s;break;case 0:case 11:case 14:case 15:if(!kn&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var i=s,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&Fp(n,e,o),s=s.next}while(s!==r)}$s(t,e,n);break;case 1:if(!kn&&(zo(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){zt(n,e,l)}$s(t,e,n);break;case 21:$s(t,e,n);break;case 22:n.mode&1?(kn=(r=kn)||n.memoizedState!==null,$s(t,e,n),kn=r):$s(t,e,n);break;default:$s(t,e,n)}}function Ix(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new aI),e.forEach(function(r){var s=yI.bind(null,t,r);n.has(r)||(n.add(r),r.then(s,s))})}}function Ir(t,e){var n=e.deletions;if(n!==null)for(var r=0;rs&&(s=o),r&=~i}if(r=s,r=qt()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*uI(r/1960))-r,10t?16:t,ti===null)var r=!1;else{if(t=ti,ti=null,md=0,rt&6)throw Error(ae(331));var s=rt;for(rt|=4,ve=t.current;ve!==null;){var i=ve,o=i.child;if(ve.flags&16){var l=i.deletions;if(l!==null){for(var c=0;cqt()-Tg?Gi(t,0):Sg|=n),Zn(t,e)}function L_(t,e){e===0&&(t.mode&1?(e=Yc,Yc<<=1,!(Yc&130023424)&&(Yc=4194304)):e=1);var n=Mn();t=Ns(t,e),t!==null&&(ac(t,e,n),Zn(t,n))}function gI(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),L_(t,n)}function yI(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,s=t.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(ae(314))}r!==null&&r.delete(e),L_(t,n)}var O_;O_=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||Xn.current)Yn=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return Yn=!1,sI(t,e,n);Yn=!!(t.flags&131072)}else Yn=!1,At&&e.flags&1048576&&U1(e,od,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;Au(t,e),t=e.pendingProps;var s=aa(e,Cn.current);Ko(e,n),s=xg(null,e,r,t,s,n);var i=vg();return e.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Jn(r)?(i=!0,sd(e)):i=!1,e.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,fg(e),s.updater=rh,e.stateNode=s,s._reactInternals=e,Pp(e,r,t,n),e=Mp(null,e,r,!0,i,n)):(e.tag=0,At&&i&&og(e),Dn(null,e,s,n),e=e.child),e;case 16:r=e.elementType;e:{switch(Au(t,e),t=e.pendingProps,s=r._init,r=s(r._payload),e.type=r,s=e.tag=vI(r),t=Cr(r,t),s){case 0:e=Dp(null,e,r,t,n);break e;case 1:e=Ex(null,e,r,t,n);break e;case 11:e=bx(null,e,r,t,n);break e;case 14:e=_x(null,e,r,Cr(r.type,t),n);break e}throw Error(ae(306,r,""))}return e;case 0:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:Cr(r,s),Dp(t,e,r,s,n);case 1:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:Cr(r,s),Ex(t,e,r,s,n);case 3:e:{if(w_(e),t===null)throw Error(ae(387));r=e.pendingProps,i=e.memoizedState,s=i.element,W1(t,e),cd(e,r,null,n);var o=e.memoizedState;if(r=o.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=i,e.memoizedState=i,e.flags&256){s=da(Error(ae(423)),e),e=Sx(t,e,r,n,s);break e}else if(r!==s){s=da(Error(ae(424)),e),e=Sx(t,e,r,n,s);break e}else for(cr=li(e.stateNode.containerInfo.firstChild),hr=e,At=!0,jr=null,n=q1(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(la(),r===s){e=ks(t,e,n);break e}Dn(t,e,r,n)}e=e.child}return e;case 5:return K1(e),t===null&&Cp(e),r=e.type,s=e.pendingProps,i=t!==null?t.memoizedProps:null,o=s.children,Sp(r,s)?o=null:i!==null&&Sp(r,i)&&(e.flags|=32),v_(t,e),Dn(t,e,o,n),e.child;case 6:return t===null&&Cp(e),null;case 13:return b_(t,e,n);case 4:return pg(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=ca(e,null,r,n):Dn(t,e,r,n),e.child;case 11:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:Cr(r,s),bx(t,e,r,s,n);case 7:return Dn(t,e,e.pendingProps,n),e.child;case 8:return Dn(t,e,e.pendingProps.children,n),e.child;case 12:return Dn(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,s=e.pendingProps,i=e.memoizedProps,o=s.value,St(ad,r._currentValue),r._currentValue=o,i!==null)if(Vr(i.value,o)){if(i.children===s.children&&!Xn.current){e=ks(t,e,n);break e}}else for(i=e.child,i!==null&&(i.return=e);i!==null;){var l=i.dependencies;if(l!==null){o=i.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(i.tag===1){c=_s(-1,n&-n),c.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var f=u.pending;f===null?c.next=c:(c.next=f.next,f.next=c),u.pending=c}}i.lanes|=n,c=i.alternate,c!==null&&(c.lanes|=n),Ap(i.return,n,e),l.lanes|=n;break}c=c.next}}else if(i.tag===10)o=i.type===e.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(ae(341));o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Ap(o,n,e),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===e){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}Dn(t,e,s.children,n),e=e.child}return e;case 9:return s=e.type,r=e.pendingProps.children,Ko(e,n),s=Nr(s),r=r(s),e.flags|=1,Dn(t,e,r,n),e.child;case 14:return r=e.type,s=Cr(r,e.pendingProps),s=Cr(r.type,s),_x(t,e,r,s,n);case 15:return y_(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:Cr(r,s),Au(t,e),e.tag=1,Jn(r)?(t=!0,sd(e)):t=!1,Ko(e,n),p_(e,r,s),Pp(e,r,s,n),Mp(null,e,r,!0,t,n);case 19:return __(t,e,n);case 22:return x_(t,e,n)}throw Error(ae(156,e.tag))};function V_(t,e){return d1(t,e)}function xI(t,e,n,r){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Er(t,e,n,r){return new xI(t,e,n,r)}function Cg(t){return t=t.prototype,!(!t||!t.isReactComponent)}function vI(t){if(typeof t=="function")return Cg(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Km)return 11;if(t===Qm)return 14}return 2}function hi(t,e){var n=t.alternate;return n===null?(n=Er(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function Ru(t,e,n,r,s,i){var o=2;if(r=t,typeof t=="function")Cg(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case jo:return Wi(n.children,s,i,e);case Wm:o=8,s|=8;break;case np:return t=Er(12,n,e,s|2),t.elementType=np,t.lanes=i,t;case rp:return t=Er(13,n,e,s),t.elementType=rp,t.lanes=i,t;case sp:return t=Er(19,n,e,s),t.elementType=sp,t.lanes=i,t;case Kb:return oh(n,s,i,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case Gb:o=10;break e;case Wb:o=9;break e;case Km:o=11;break e;case Qm:o=14;break e;case Gs:o=16,r=null;break e}throw Error(ae(130,t==null?t:typeof t,""))}return e=Er(o,n,e,s),e.elementType=t,e.type=r,e.lanes=i,e}function Wi(t,e,n,r){return t=Er(7,t,r,e),t.lanes=n,t}function oh(t,e,n,r){return t=Er(22,t,r,e),t.elementType=Kb,t.lanes=n,t.stateNode={isHidden:!1},t}function xf(t,e,n){return t=Er(6,t,null,e),t.lanes=n,t}function vf(t,e,n){return e=Er(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function wI(t,e,n,r,s){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Jh(0),this.expirationTimes=Jh(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Jh(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function Ag(t,e,n,r,s,i,o,l,c){return t=new wI(t,e,n,l,c),e===1?(e=1,i===!0&&(e|=8)):e=0,i=Er(3,null,null,e),t.current=i,i.stateNode=t,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},fg(i),t}function bI(t,e,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(B_)}catch(t){console.error(t)}}B_(),Bb.exports=gr;var $_=Bb.exports;const NI=Kd($_);var H_,Lx=$_;H_=Lx.createRoot,Lx.hydrateRoot;/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */var kI={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"};/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const II=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),Te=(t,e)=>{const n=L.forwardRef(({color:r="currentColor",size:s=24,strokeWidth:i=2,absoluteStrokeWidth:o,className:l="",children:c,...u},f)=>L.createElement("svg",{ref:f,...kI,width:s,height:s,stroke:r,strokeWidth:o?Number(i)*24/Number(s):i,className:["lucide",`lucide-${II(t)}`,l].join(" "),...u},[...e.map(([h,m])=>L.createElement(h,m)),...Array.isArray(c)?c:[c]]));return n.displayName=`${t}`,n};/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const CI=Te("AlertCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const AI=Te("AlertTriangle",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z",key:"c3ski4"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Is=Te("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ox=Te("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const jI=Te("ArrowUpDown",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Vx=Te("BookMarked",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H20v20H6.5a2.5 2.5 0 0 1 0-5H20",key:"t4utmx"}],["polyline",{points:"10 2 10 10 13 7 16 10 16 2",key:"13o6vz"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const fa=Te("BookOpen",[["path",{d:"M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z",key:"vv98re"}],["path",{d:"M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z",key:"1cyq3y"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const PI=Te("Book",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H20v20H6.5a2.5 2.5 0 0 1 0-5H20",key:"t4utmx"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const dc=Te("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const RI=Te("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const dh=Te("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const hc=Te("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const q_=Te("ChevronsLeft",[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const G_=Te("ChevronsRight",[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const DI=Te("ChevronsUpDown",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const MI=Te("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const W_=Te("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ja=Te("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Fx=Te("Eraser",[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Dg=Te("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Wp=Te("Eye",[["path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z",key:"rwhkz3"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Za=Te("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const K_=Te("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const zx=Te("FolderInput",[["path",{d:"M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1",key:"fm4g5t"}],["path",{d:"M2 13h10",key:"pgb2dq"}],["path",{d:"m9 16 3-3-3-3",key:"6m91ic"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Q_=Te("FolderPlus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const xr=Te("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Kp=Te("Grid2x2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M12 3v18",key:"108xh3"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Qp=Te("Grid3x3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ux=Te("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const LI=Te("ImagePlus",[["path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7",key:"31hg93"}],["line",{x1:"16",x2:"22",y1:"5",y2:"5",key:"ez7e4s"}],["line",{x1:"19",x2:"19",y1:"2",y2:"8",key:"1gkr8c"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Yp=Te("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Y_=Te("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Wr=Te("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const xd=Te("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Bx=Te("Loader2",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const X_=Te("Megaphone",[["path",{d:"m3 11 18-5v12L3 14v-3z",key:"n962bs"}],["path",{d:"M11.6 16.8a3 3 0 1 1-5.8-1.6",key:"1yl0tm"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const OI=Te("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const VI=Te("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Yo=Te("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z",key:"ymcmye"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const J_=Te("Pen",[["path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z",key:"5qss01"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Kr=Te("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const FI=Te("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Mg=Te("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Xp=Te("Rows2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 12h18",key:"1i2n21"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ea=Te("Save",[["path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z",key:"1owoqh"}],["polyline",{points:"17 21 17 13 7 13 7 21",key:"1md35c"}],["polyline",{points:"7 3 7 8 15 8",key:"8nz8an"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const no=Te("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const zI=Te("Send",[["path",{d:"m22 2-7 20-4-9-9-4Z",key:"1q3vgg"}],["path",{d:"M22 2 11 13",key:"nzbqef"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const $x=Te("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Z_=Te("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const vd=Te("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const UI=Te("Timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const tn=Te("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Lg=Te("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const gt=Te("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Og=Te("ZoomIn",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Vg=Te("ZoomOut",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]),wf=new Set;function un({src:t,alt:e,className:n="",imgClassName:r="",objectFit:s="contain",aspectRatio:i,loading:o,draggable:l,showControls:c=!1}){const u=wf.has(t),[f,h]=L.useState(u),[m,p]=L.useState(!1),[x,E]=L.useState(0);L.useEffect(()=>{wf.has(t)?(h(!0),p(!1)):(h(!1),p(!1)),E(0)},[t]);const C=()=>{p(!1),h(!1),E(D=>D+1)},y=()=>{h(!0),p(!1),wf.add(t)},v=x>0?`${t}${t.includes("?")?"&":"?"}retry=${x}`:t,_=v.includes("format=mp4")||v.toLowerCase().endsWith(".mp4")||v.toLowerCase().endsWith(".webm");return a.jsxs("div",{className:`relative w-full h-full overflow-hidden ${m?"bg-[#1a1a1a]/50 rounded-lg min-h-[300px]":""} ${n}`,style:i&&i!=="auto"?{aspectRatio:i}:void 0,children:[a.jsx("div",{className:`absolute inset-0 flex items-center justify-center transition-opacity duration-500 ${f?"opacity-0 pointer-events-none":"opacity-100"}`,children:m?a.jsxs("div",{className:"flex flex-col items-center justify-center p-6 text-center max-w-sm w-full h-full",children:[a.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center mb-3",children:a.jsx(CI,{className:"w-6 h-6 text-red-500"})}),a.jsx("p",{className:"text-sm text-gray-400 mb-4",children:"La imagen no cargó. El servidor podría tener problemas."}),a.jsxs("button",{onClick:C,className:"flex items-center justify-center gap-2 px-4 py-2 bg-gray-800 hover:bg-gray-700 text-white rounded-lg transition-colors border border-gray-700 w-full max-w-[200px]",children:[a.jsx(Mg,{className:"w-4 h-4"}),a.jsxs("span",{children:["Reintentar (",x,")"]})]})]}):a.jsx("div",{className:"w-8 h-8 border-2 border-[#bb86fc] border-t-transparent rounded-full animate-spin"})}),!m&&(_?a.jsx("video",{src:v,autoPlay:!c,loop:!c,muted:!c,playsInline:!0,controls:c,className:`w-full h-full object-${s} transition-all duration-1000 ease-linear ${r} ${f?"opacity-100":"opacity-0"}`,onLoadedData:y,onError:()=>{p(!0),h(!1)}}):a.jsx("img",{src:v,alt:e,loading:o,draggable:l,className:`w-full h-full object-${s} transition-all duration-1000 ease-linear ${r} ${f?"opacity-100":"opacity-0"}`,onLoad:y,onError:()=>{p(!0),h(!1)}}))]})}function eE({images:t,initialIndex:e,onClose:n}){const[r,s]=L.useState(e),[i,o]=L.useState(!1),[l,c]=L.useState(0),[u,f]=L.useState(1),[h,m]=L.useState({x:0,y:0}),[p,x]=L.useState(!1),[E,C]=L.useState({x:0,y:0}),[y,v]=L.useState(null),[_,D]=L.useState(1),M=L.useRef(null);L.useEffect(()=>(document.body.style.overflow="hidden",()=>{document.body.style.overflow="unset"}),[]);const T=Q=>{const oe=t.length;return(Q%oe+oe)%oe},S=Q=>Math.hypot(Q[0].clientX-Q[1].clientX,Q[0].clientY-Q[1].clientY),w=(Q,oe)=>{const le=window.innerWidth,Ie=window.innerHeight,te=(le*oe-le)/2,it=(Ie*oe-Ie)/2;return{x:Math.min(Math.max(Q.x,-te),te),y:Math.min(Math.max(Q.y,-it),it)}},N=i?2:1,A=()=>{s(Q=>T(Q-N)),c(0),f(1),m({x:0,y:0})},I=()=>{s(Q=>T(Q+N)),c(0),f(1),m({x:0,y:0})},P=(Q,oe)=>{x(!0),C({x:Q,y:oe})},k=(Q,oe)=>{if(p)if(u>1){const le=Q-E.x,Ie=oe-E.y;m(te=>({x:te.x+le,y:te.y+Ie})),C({x:Q,y:oe})}else{const le=Q-E.x;c(le)}},B=()=>{var le;if(x(!1),v(null),u>1)return;const oe=(((le=M.current)==null?void 0:le.clientWidth)||window.innerWidth)*.25;Math.abs(l)>oe?l>0?A():I():c(0)},z=Q=>{Q.preventDefault(),P(Q.clientX,Q.clientY)},W=Q=>{Q.preventDefault(),k(Q.clientX,Q.clientY)},ee=()=>B(),F=Q=>{if(Q.touches.length===2){const oe=S(Q.touches);v(oe),D(u),x(!1)}else Q.touches.length===1&&P(Q.touches[0].clientX,Q.touches[0].clientY)},K=Q=>{if(Q.touches.length===2&&y!==null){const le=S(Q.touches)/y,Ie=Math.min(Math.max(_*le,1),4);f(Ie),m(te=>w(te,Ie))}else Q.touches.length===1&&k(Q.touches[0].clientX,Q.touches[0].clientY)},R=Q=>{if(y!==null&&Q.touches.length<2){v(null);return}B()};L.useEffect(()=>{function Q(oe){oe.key==="Escape"?n():oe.key==="ArrowLeft"?A():oe.key==="ArrowRight"?I():oe.key==="+"||oe.key==="="?f(le=>{const Ie=Math.min(le+.5,4);return m(te=>w(te,Ie)),Ie}):oe.key==="-"&&f(le=>{const Ie=Math.max(le-.5,1);return m(te=>w(te,Ie)),Ie})}return window.addEventListener("keydown",Q),()=>window.removeEventListener("keydown",Q)},[u,i]);let ne=`translateX(calc(-33.333333% + ${l}px))`,pe=p?"none":"transform 0.1s ease-out";l===0&&(pe="none");const O=Q=>{const oe=T(Q);if(i){const le=T(Q+1);return a.jsxs("div",{className:"flex w-full h-full items-center justify-center px-2 sm:px-10",children:[a.jsx("div",{className:"flex-1 h-full flex items-center justify-end",children:a.jsx(un,{src:t[oe],alt:`Página ${oe+1}`,aspectRatio:"auto",objectFit:"contain",loading:"lazy",draggable:!1,imgClassName:"max-w-full max-h-screen object-contain select-none shadow-lg origin-right object-right transition-none",showControls:!0})}),a.jsx("div",{className:"flex-1 h-full flex items-center justify-start",children:a.jsx(un,{src:t[le],alt:`Página ${le+1}`,aspectRatio:"auto",objectFit:"contain",loading:"lazy",draggable:!1,imgClassName:"max-w-full max-h-screen object-contain select-none shadow-lg origin-left object-left transition-none",showControls:!0})})]})}else return a.jsx(un,{src:t[oe],alt:`Página ${oe+1}`,aspectRatio:"auto",objectFit:"contain",loading:"lazy",draggable:!1,imgClassName:"max-w-full max-h-screen object-contain select-none shadow-2xl transition-none",showControls:!0})};return a.jsxs("div",{className:"fixed inset-0 bg-black/95 flex items-center justify-center z-50 select-none touch-none overflow-hidden",style:{touchAction:"none"},ref:M,onWheel:Q=>{Q.stopPropagation();const oe=Q.deltaY<0?.5:-.5;f(le=>{const Ie=Math.min(Math.max(le+oe,1),4);return m(te=>w(te,Ie)),Ie})},onMouseDown:z,onMouseMove:W,onMouseUp:ee,onMouseLeave:()=>{x(!1),u===1&&c(0)},onTouchStart:F,onTouchMove:K,onTouchEnd:R,children:[a.jsxs("div",{className:"absolute top-6 right-6 flex items-center gap-4 z-50",children:[a.jsxs("div",{className:"flex items-center gap-2 bg-black/50 rounded-lg p-1",children:[a.jsx("button",{onClick:()=>o(!i),className:`p-2 transition-colors ${i?"text-[#bb86fc]":"text-white hover:text-[#bb86fc]"}`,title:i?"Vista Individual":"Vista de Libro",children:i?a.jsx(fa,{className:"w-5 h-5"}):a.jsx(PI,{className:"w-5 h-5"})}),a.jsx("div",{className:"w-px h-4 bg-white/20 mx-1"}),a.jsx("button",{onClick:()=>f(Q=>{const oe=Math.max(Q-.5,1);return m(le=>w(le,oe)),oe}),className:"p-2 text-white hover:text-[#bb86fc] transition-colors",children:a.jsx(Vg,{className:"w-5 h-5"})}),a.jsxs("span",{className:"text-white text-sm min-w-[3ch] text-center",children:[Math.round(u*100),"%"]}),a.jsx("button",{onClick:()=>f(Q=>{const oe=Math.min(Q+.5,4);return m(le=>w(le,oe)),oe}),className:"p-2 text-white hover:text-[#bb86fc] transition-colors",children:a.jsx(Og,{className:"w-5 h-5"})})]}),a.jsx("button",{onClick:n,className:"p-2 rounded-lg bg-white/10 hover:bg-white/20 text-white transition-all duration-200",children:a.jsx(gt,{className:"w-6 h-6"})})]}),a.jsxs("div",{className:"flex h-full w-[300%] absolute top-0 left-0",style:{transform:ne,transition:pe},children:[a.jsx("div",{className:"w-1/3 h-full flex items-center justify-center relative",children:O(r-N)}),a.jsx("div",{className:"w-1/3 h-full flex items-center justify-center relative",children:a.jsx("div",{className:"relative flex items-center justify-center w-full h-full",style:{transform:`translate(${h.x}px, ${h.y}px) scale(${u})`,transition:p?"none":"transform 0.1s ease-out",cursor:u>1?p?"grabbing":"grab":"default"},onDoubleClick:Q=>{Q.stopPropagation(),f(oe=>oe>1?1:2.5),m({x:0,y:0})},children:O(r)})}),a.jsx("div",{className:"w-1/3 h-full flex items-center justify-center relative",children:O(r+N)})]}),u===1&&a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:Q=>{Q.stopPropagation(),A()},className:"absolute left-4 sm:left-8 top-1/2 -translate-y-1/2 p-3 sm:p-4 rounded-lg text-white opacity-40 hover:opacity-100 transition-opacity duration-200 z-40",children:a.jsx(dh,{className:"w-8 h-8 sm:w-10 sm:h-10"})}),a.jsx("button",{onClick:Q=>{Q.stopPropagation(),I()},className:"absolute right-4 sm:right-8 top-1/2 -translate-y-1/2 p-3 sm:p-4 rounded-lg text-white opacity-40 hover:opacity-100 transition-opacity duration-200 z-40",children:a.jsx(hc,{className:"w-8 h-8 sm:w-10 sm:h-10"})})]}),a.jsx("div",{className:"absolute bottom-6 left-1/2 -translate-x-1/2 bg-black/60 text-white px-4 py-2 rounded-lg text-sm font-medium z-40 pointer-events-none",children:i?`${r+1}-${Math.min(r+2,t.length)} / ${t.length}`:`${r+1} / ${t.length}`})]})}function hh({isAdmin:t,onOpenTrash:e}){return a.jsxs("footer",{className:"py-6 border-t border-gray-800/50 flex flex-col md:flex-row items-center justify-between gap-4 text-gray-400 text-sm mt-auto w-full px-8 relative",children:[a.jsxs("div",{className:"flex flex-wrap justify-center gap-6 mx-auto",children:[a.jsxs("a",{href:"https://t.me/twistedbrody",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 hover:text-[#bb86fc] transition-colors",children:[a.jsx("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"currentColor",children:a.jsx("path",{d:"M12 0C5.373 0 0 5.373 0 12s5.373 12 12 12 12-5.373 12-12S18.627 0 12 0zm5.894 8.221l-1.97 9.28c-.145.658-.537.818-1.084.508l-3-2.21-1.446 1.394c-.16.16-.295.295-.605.295l.213-3.054 5.56-5.022c.242-.213-.054-.333-.373-.121l-6.869 4.326-2.96-.924c-.64-.203-.658-.64.135-.954l11.566-4.458c.538-.196 1.006.128.832.941z"})}),"Twisted Brody"]}),a.jsxs("a",{href:"https://t.me/+CmmZFHM9hpViYzMx",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 hover:text-[#bb86fc] transition-colors",children:[a.jsx("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"currentColor",children:a.jsx("path",{d:"M12 0C5.373 0 0 5.373 0 12s5.373 12 12 12 12-5.373 12-12S18.627 0 12 0zm5.894 8.221l-1.97 9.28c-.145.658-.537.818-1.084.508l-3-2.21-1.446 1.394c-.16.16-.295.295-.605.295l.213-3.054 5.56-5.022c.242-.213-.054-.333-.373-.121l-6.869 4.326-2.96-.924c-.64-.203-.658-.64.135-.954l11.566-4.458c.538-.196 1.006.128.832.941z"})}),"Canal Hub"]}),a.jsxs("a",{href:"https://x.com/TwistedBrody",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 hover:text-[#bb86fc] transition-colors",children:[a.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:a.jsx("path",{d:"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"})}),"X"]}),a.jsxs("a",{href:"https://www.patreon.com/cw/Twistedbrody",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 hover:text-[#bb86fc] transition-colors",children:[a.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:a.jsx("path",{d:"M0 .48v23.04h4.22V.48zm15.385 0c-4.764 0-8.641 3.88-8.641 8.65 0 4.755 3.877 8.623 8.641 8.623 4.75 0 8.615-3.868 8.615-8.623C24 4.36 20.136.48 15.385.48z"})}),"Patreon"]}),a.jsxs("button",{onClick:()=>{window.location.hash="info"},className:"flex items-center gap-2 hover:text-[#bb86fc] transition-colors",children:[a.jsx(Y_,{className:"w-4 h-4"}),a.jsx("span",{children:"Info"})]}),t&&e&&a.jsxs("button",{onClick:e,className:"flex items-center gap-2 text-gray-400 hover:text-red-400 transition-colors",children:[a.jsx(tn,{className:"w-4 h-4"}),a.jsx("span",{children:"Papelera"})]})]}),a.jsxs("div",{className:"md:absolute md:right-8 text-xs opacity-50",children:["Twisted Brody MangaFlow © ",new Date().getFullYear()]})]})}function tE({children:t,rootMargin:e="150% 0px 150% 0px",minHeight:n,className:r=""}){const s=L.useRef(null),[i,o]=L.useState(!1);return L.useEffect(()=>{if(i)return;const l=new IntersectionObserver(c=>{const[u]=c;u.isIntersecting&&o(!0)},{rootMargin:e});return s.current&&l.observe(s.current),()=>{l.disconnect()}},[i,e]),a.jsx("div",{ref:s,style:n?{minHeight:n}:void 0,className:`w-full flex items-center justify-center ${r}`,children:i?t(!0):null})}function BI({manga:t,onBack:e}){const n=t.chapters&&t.chapters.length>0?t.chapters[0]:null,r=n?n.original_pages&&n.original_pages.length>0?n.original_pages:n.pages:[],[s,i]=L.useState("vertical"),[o,l]=L.useState(1),[c,u]=L.useState(!1),[f,h]=L.useState(0);if(!r||r.length===0)return a.jsxs("div",{className:"min-h-screen bg-[#121212] flex flex-col items-center justify-center",children:[a.jsx("button",{onClick:e,className:"absolute top-6 left-6 p-2 hover:bg-[#333] rounded-lg transition-colors text-white",children:a.jsx(Is,{className:"w-6 h-6"})}),a.jsx("div",{className:"text-gray-400 text-lg",children:"No hay páginas disponibles"})]});const m=()=>l(E=>Math.min(E+.25,3)),p=()=>l(E=>Math.max(E-.25,.5)),x=()=>l(1);return a.jsxs("div",{className:"min-h-screen flex flex-col bg-[#121212]",children:[a.jsxs("header",{className:"sticky top-0 z-50 bg-[#121212]/90 backdrop-blur-md border-b border-gray-800 px-4 py-3 flex items-center justify-between gap-4",children:[a.jsx("div",{className:"flex items-center gap-2 flex-shrink-0",children:a.jsxs("button",{onClick:e,className:"p-2 hover:bg-[#333] rounded-lg transition-colors text-white flex items-center gap-2",children:[a.jsx(Is,{className:"w-5 h-5"}),a.jsx("span",{className:"font-semibold text-sm hidden sm:inline",children:"Volver"})]})}),a.jsx("div",{className:"flex-1 flex justify-center min-w-0",children:a.jsxs("h1",{className:"text-white font-bold truncate text-center max-w-full",children:[t.title," ",a.jsx("span",{className:"text-[#bb86fc] text-xs ml-2 border border-[#bb86fc] px-1 rounded",children:"HD"})]})}),a.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[a.jsxs("div",{className:"flex items-center gap-1 bg-[#0a0a0a] border border-gray-800 rounded-lg p-1 hidden md:flex",children:[a.jsx("button",{onClick:()=>i("vertical"),className:`p-2 rounded-md transition-all duration-200 ${s==="vertical"?"bg-[#bb86fc] text-white":"text-gray-400 hover:text-white"}`,title:"Vertical",children:a.jsx(Xp,{className:"w-4 h-4"})}),a.jsx("button",{onClick:()=>i("gallery"),className:`p-2 rounded-md transition-all duration-200 ${s==="gallery"?"bg-[#bb86fc] text-white":"text-gray-400 hover:text-white"}`,title:"Galería",children:a.jsx(Kp,{className:"w-4 h-4"})}),a.jsx("button",{onClick:()=>i("grid"),className:`p-2 rounded-md transition-all duration-200 ${s==="grid"?"bg-[#bb86fc] text-white":"text-gray-400 hover:text-white"}`,title:"Cuadrícula",children:a.jsx(Qp,{className:"w-4 h-4"})})]}),s==="vertical"&&a.jsxs("div",{className:"flex items-center gap-1 bg-[#0a0a0a] border border-gray-800 rounded-lg p-1",children:[a.jsx("button",{onClick:p,className:"p-2 text-gray-400 hover:text-white hover:bg-[#333] rounded",children:a.jsx(Vg,{className:"w-4 h-4"})}),a.jsxs("span",{className:"text-xs text-gray-300 w-8 text-center",children:[Math.round(o*100),"%"]}),a.jsx("button",{onClick:m,className:"p-2 text-gray-400 hover:text-white hover:bg-[#333] rounded",children:a.jsx(Og,{className:"w-4 h-4"})}),a.jsx("button",{onClick:x,className:"p-2 text-gray-400 hover:text-white hover:bg-[#333] rounded",title:"Reset",children:a.jsx(Mg,{className:"w-3 h-3"})})]})]})]}),a.jsx("div",{className:"md:hidden px-4 py-2 border-b border-gray-800 bg-[#121212] flex justify-center",children:a.jsxs("div",{className:"flex items-center gap-1 bg-[#0a0a0a] border border-gray-800 rounded-lg p-1",children:[a.jsxs("button",{onClick:()=>i("vertical"),className:`px-3 py-1.5 rounded-md flex items-center gap-2 text-xs font-medium ${s==="vertical"?"bg-[#bb86fc] text-white":"text-gray-400"}`,children:[a.jsx(Xp,{className:"w-3 h-3"})," Vertical"]}),a.jsxs("button",{onClick:()=>i("gallery"),className:`px-3 py-1.5 rounded-md flex items-center gap-2 text-xs font-medium ${s==="gallery"?"bg-[#bb86fc] text-white":"text-gray-400"}`,children:[a.jsx(Kp,{className:"w-3 h-3"})," Galería"]}),a.jsxs("button",{onClick:()=>i("grid"),className:`px-3 py-1.5 rounded-md flex items-center gap-2 text-xs font-medium ${s==="grid"?"bg-[#bb86fc] text-white":"text-gray-400"}`,children:[a.jsx(Qp,{className:"w-3 h-3"})," Cuadrícula"]})]})}),a.jsx("main",{className:"flex-1 w-full max-w-[1920px] mx-auto px-0 sm:px-4 py-0 sm:py-6",children:a.jsx("div",{className:` + bg-[#050505] min-h-screen transition-all duration-150 ease-out + ${s==="vertical"?"flex flex-col items-center gap-0 sm:gap-1":""} + ${s==="gallery"?"masonry-container p-2":""} + ${s==="grid"?"grid grid-cols-3 md:grid-cols-5 gap-2 p-2":""} + `,children:r.map((E,C)=>{const y=E;return s==="vertical"?a.jsx("div",{className:"relative transition-all duration-200",style:{width:o===1?"100%":`${100*o}%`,maxWidth:o>1?"none":"80rem"},children:a.jsx("div",{className:`mx-auto ${o<=1?"max-w-5xl":""}`,children:a.jsx(tE,{minHeight:"50vh",children:()=>a.jsx(un,{src:y,alt:`Página ${C+1}`,aspectRatio:"auto",objectFit:"contain",loading:"eager",className:"w-full h-auto",imgClassName:"w-full h-auto block",showControls:!0})})})},C):a.jsx("div",{className:` + group cursor-pointer relative bg-black rounded-lg shadow-lg overflow-hidden transition-transform duration-300 hover:scale-[1.02] + ${s==="gallery"?"masonry-item":""} + `,onClick:()=>{h(C),u(!0)},children:a.jsx(un,{src:y,alt:`Página ${C+1}`,aspectRatio:s==="grid"?"1/1":"auto",objectFit:s==="grid"?"cover":"contain",loading:C<5?"eager":"lazy",className:"w-full h-auto rounded-lg",imgClassName:"group-hover:scale-110"})},C)})})}),a.jsx(hh,{}),c&&a.jsx(eE,{images:r,initialIndex:f,onClose:()=>u(!1)})]})}async function $I(t,e,n){const r=await HI(t),s=qI(t);try{const i=await fetch("/api/process-image",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({image:r,name:t.name,index:e,total:n})});if(!i.ok)throw new Error(`Server processing failed: ${i.statusText}`);const o=await i.json();if(!o.success||!o.data)throw new Error("Invalid response from processing server");return{thumbnail:o.data.thumbnail,original:r,webpDisplay:o.data.webp,webpCover:o.data.webp,originalFormat:s,originalBase64:r,originalUnmodified:r}}catch(i){throw console.error("Error processing image on server, falling back to local:",i),i}}async function HI(t){return new Promise((e,n)=>{const r=new FileReader;r.onload=s=>{var i;return e((i=s.target)==null?void 0:i.result)},r.onerror=()=>n(new Error("Failed to read file")),r.readAsDataURL(t)})}function qI(t){var r;const e=t.type;if(e==="image/png")return"png";if(e==="image/jpeg")return"jpg";if(e==="image/gif")return"gif";if(e==="image/webp")return"webp";const n=(r=t.name.split(".").pop())==null?void 0:r.toLowerCase();return n&&["png","jpg","jpeg","gif","webp"].includes(n)?n==="jpeg"?"jpg":n:"jpg"}async function GI(t){return new Promise((e,n)=>{const r=new Image;r.crossOrigin="anonymous",r.onload=()=>{const s=r.width/r.height;s<.9?e("portrait"):s>1.1?e("landscape"):e("square")},r.onerror=()=>n(new Error("Failed to load image")),r.src=t})}const nE="imageBatchSize",Hx=10;function lu(t){if(t<0)throw new Error("El tamaño del lote no puede ser negativo");localStorage.setItem(nE,t.toString())}function rE(){const t=localStorage.getItem(nE);if(!t)return Hx;const e=parseInt(t,10);return isNaN(e)||e<0?Hx:e>=999999?0:e}const WI="https://codebydante-brodyfilestreambot.hf.space/upload";function KI(t,e){const n=t.split(","),r=n[0].match(/:(.*?);/),s=r?r[1]:"image/jpeg",i=atob(n[n.length-1]);let o=i.length;const l=new Uint8Array(o);for(;o--;)l[o]=i.charCodeAt(o);return new File([l],e,{type:s})}const Jp=t=>new Promise(e=>setTimeout(e,t));async function Zp(t,e,n=3){var l,c,u;const r=e?`${e}.jpg`:"image.jpg",s=KI(t,r),i=new FormData;i.append("file",s);let o=0;for(;of.abort(),6e4);try{const m=await fetch(WI,{method:"POST",body:i,signal:f.signal});if(clearTimeout(h),!m.ok){const x=await m.text();if(m.status>=500&&o=n)throw m}}throw new Error("No se pudo subir la imagen tras varios intentos.")}async function cu(t,e,n){const r=rE()||5,s=[];for(let i=0;i{const h=i+f,m=e?`${e}_${h+1}`:void 0;return Zp(u,m)}),c=await Promise.all(l);s.push(...c),n&&n(Math.min(i+r,t.length),t.length),i+r{};var qx={};/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const sE=function(t){const e=[];let n=0;for(let r=0;r>6|192,e[n++]=s&63|128):(s&64512)===55296&&r+1>18|240,e[n++]=s>>12&63|128,e[n++]=s>>6&63|128,e[n++]=s&63|128):(e[n++]=s>>12|224,e[n++]=s>>6&63|128,e[n++]=s&63|128)}return e},YI=function(t){const e=[];let n=0,r=0;for(;n191&&s<224){const i=t[n++];e[r++]=String.fromCharCode((s&31)<<6|i&63)}else if(s>239&&s<365){const i=t[n++],o=t[n++],l=t[n++],c=((s&7)<<18|(i&63)<<12|(o&63)<<6|l&63)-65536;e[r++]=String.fromCharCode(55296+(c>>10)),e[r++]=String.fromCharCode(56320+(c&1023))}else{const i=t[n++],o=t[n++];e[r++]=String.fromCharCode((s&15)<<12|(i&63)<<6|o&63)}}return e.join("")},iE={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let s=0;s>2,h=(i&3)<<4|l>>4;let m=(l&15)<<2|u>>6,p=u&63;c||(p=64,o||(m=64)),r.push(n[f],n[h],n[m],n[p])}return r.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(sE(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):YI(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();const n=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let s=0;s>4;if(r.push(m),u!==64){const p=l<<4&240|u>>2;if(r.push(p),h!==64){const x=u<<6&192|h;r.push(x)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let t=0;t=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}};class XI extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const JI=function(t){const e=sE(t);return iE.encodeByteArray(e,!0)},wd=function(t){return JI(t).replace(/\./g,"")},oE=function(t){try{return iE.decodeString(t,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};/** + * @license + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function ZI(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}/** + * @license + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const eC=()=>ZI().__FIREBASE_DEFAULTS__,tC=()=>{if(typeof process>"u"||typeof qx>"u")return;const t=qx.__FIREBASE_DEFAULTS__;if(t)return JSON.parse(t)},nC=()=>{if(typeof document>"u")return;let t;try{t=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const e=t&&oE(t[1]);return e&&JSON.parse(e)},fh=()=>{try{return QI()||eC()||tC()||nC()}catch(t){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${t}`);return}},aE=t=>{var e,n;return(n=(e=fh())==null?void 0:e.emulatorHosts)==null?void 0:n[t]},lE=t=>{const e=aE(t);if(!e)return;const n=e.lastIndexOf(":");if(n<=0||n+1===e.length)throw new Error(`Invalid host ${e} with no separate hostname and port!`);const r=parseInt(e.substring(n+1),10);return e[0]==="["?[e.substring(1,n-1),r]:[e.substring(0,n),r]},cE=()=>{var t;return(t=fh())==null?void 0:t.config},uE=t=>{var e;return(e=fh())==null?void 0:e[`_${t}`]};/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class rC{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}wrapCallback(e){return(n,r)=>{n?this.reject(n):this.resolve(r),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(n):e(n,r))}}}/** + * @license + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function dE(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const n={alg:"none",type:"JWT"},r=e||"demo-project",s=t.iat||0,i=t.sub||t.user_id;if(!i)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const o={iss:`https://securetoken.google.com/${r}`,aud:r,iat:s,exp:s+3600,auth_time:s,sub:i,user_id:i,firebase:{sign_in_provider:"custom",identities:{}},...t};return[wd(JSON.stringify(n)),wd(JSON.stringify(o)),""].join(".")}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function An(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function sC(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(An())}function iC(){var e;const t=(e=fh())==null?void 0:e.forceEnvironment;if(t==="node")return!0;if(t==="browser")return!1;try{return Object.prototype.toString.call(global.process)==="[object process]"}catch{return!1}}function oC(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function aC(){const t=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof t=="object"&&t.id!==void 0}function lC(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function cC(){const t=An();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0}function uC(){return!iC()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}function dC(){try{return typeof indexedDB=="object"}catch{return!1}}function hC(){return new Promise((t,e)=>{try{let n=!0;const r="validate-browser-context-for-indexeddb-analytics-module",s=self.indexedDB.open(r);s.onsuccess=()=>{s.result.close(),n||self.indexedDB.deleteDatabase(r),t(!0)},s.onupgradeneeded=()=>{n=!1},s.onerror=()=>{var i;e(((i=s.error)==null?void 0:i.message)||"")}}catch(n){e(n)}})}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const fC="FirebaseError";class cs extends Error{constructor(e,n,r){super(n),this.code=e,this.customData=r,this.name=fC,Object.setPrototypeOf(this,cs.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,fc.prototype.create)}}class fc{constructor(e,n,r){this.service=e,this.serviceName=n,this.errors=r}create(e,...n){const r=n[0]||{},s=`${this.service}/${e}`,i=this.errors[e],o=i?pC(i,r):"Error",l=`${this.serviceName}: ${o} (${s}).`;return new cs(s,l,r)}}function pC(t,e){return t.replace(mC,(n,r)=>{const s=e[r];return s!=null?String(s):`<${r}?>`})}const mC=/\{\$([^}]+)}/g;function gC(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}function ro(t,e){if(t===e)return!0;const n=Object.keys(t),r=Object.keys(e);for(const s of n){if(!r.includes(s))return!1;const i=t[s],o=e[s];if(Gx(i)&&Gx(o)){if(!ro(i,o))return!1}else if(i!==o)return!1}for(const s of r)if(!n.includes(s))return!1;return!0}function Gx(t){return t!==null&&typeof t=="object"}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function pc(t){const e=[];for(const[n,r]of Object.entries(t))Array.isArray(r)?r.forEach(s=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(s))}):e.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return e.length?"&"+e.join("&"):""}function yC(t,e){const n=new xC(t,e);return n.subscribe.bind(n)}class xC{constructor(e,n){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=n,this.task.then(()=>{e(this)}).catch(r=>{this.error(r)})}next(e){this.forEachObserver(n=>{n.next(e)})}error(e){this.forEachObserver(n=>{n.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,n,r){let s;if(e===void 0&&n===void 0&&r===void 0)throw new Error("Missing Observer.");vC(e,["next","error","complete"])?s=e:s={next:e,error:n,complete:r},s.next===void 0&&(s.next=bf),s.error===void 0&&(s.error=bf),s.complete===void 0&&(s.complete=bf);const i=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?s.error(this.finalError):s.complete()}catch{}}),this.observers.push(s),i}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let n=0;n{if(this.observers!==void 0&&this.observers[e]!==void 0)try{n(this.observers[e])}catch(r){typeof console<"u"&&console.error&&console.error(r)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}}function vC(t,e){if(typeof t!="object"||t===null)return!1;for(const n of e)if(n in t&&typeof t[n]=="function")return!0;return!1}function bf(){}/** + * @license + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function sn(t){return t&&t._delegate?t._delegate:t}/** + * @license + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Sa(t){try{return(t.startsWith("http://")||t.startsWith("https://")?new URL(t).hostname:t).endsWith(".cloudworkstations.dev")}catch{return!1}}async function Fg(t){return(await fetch(t,{credentials:"include"})).ok}class vi{constructor(e,n,r){this.name=e,this.instanceFactory=n,this.type=r,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const zi="[DEFAULT]";/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class wC{constructor(e,n){this.name=e,this.container=n,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){const n=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(n)){const r=new rC;if(this.instancesDeferred.set(n,r),this.isInitialized(n)||this.shouldAutoInitialize())try{const s=this.getOrInitializeService({instanceIdentifier:n});s&&r.resolve(s)}catch{}}return this.instancesDeferred.get(n).promise}getImmediate(e){const n=this.normalizeInstanceIdentifier(e==null?void 0:e.identifier),r=(e==null?void 0:e.optional)??!1;if(this.isInitialized(n)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:n})}catch(s){if(r)return null;throw s}else{if(r)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,!!this.shouldAutoInitialize()){if(_C(e))try{this.getOrInitializeService({instanceIdentifier:zi})}catch{}for(const[n,r]of this.instancesDeferred.entries()){const s=this.normalizeInstanceIdentifier(n);try{const i=this.getOrInitializeService({instanceIdentifier:s});r.resolve(i)}catch{}}}}clearInstance(e=zi){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){const e=Array.from(this.instances.values());await Promise.all([...e.filter(n=>"INTERNAL"in n).map(n=>n.INTERNAL.delete()),...e.filter(n=>"_delete"in n).map(n=>n._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=zi){return this.instances.has(e)}getOptions(e=zi){return this.instancesOptions.get(e)||{}}initialize(e={}){const{options:n={}}=e,r=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(r))throw Error(`${this.name}(${r}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const s=this.getOrInitializeService({instanceIdentifier:r,options:n});for(const[i,o]of this.instancesDeferred.entries()){const l=this.normalizeInstanceIdentifier(i);r===l&&o.resolve(s)}return s}onInit(e,n){const r=this.normalizeInstanceIdentifier(n),s=this.onInitCallbacks.get(r)??new Set;s.add(e),this.onInitCallbacks.set(r,s);const i=this.instances.get(r);return i&&e(i,r),()=>{s.delete(e)}}invokeOnInitCallbacks(e,n){const r=this.onInitCallbacks.get(n);if(r)for(const s of r)try{s(e,n)}catch{}}getOrInitializeService({instanceIdentifier:e,options:n={}}){let r=this.instances.get(e);if(!r&&this.component&&(r=this.component.instanceFactory(this.container,{instanceIdentifier:bC(e),options:n}),this.instances.set(e,r),this.instancesOptions.set(e,n),this.invokeOnInitCallbacks(r,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,r)}catch{}return r||null}normalizeInstanceIdentifier(e=zi){return this.component?this.component.multipleInstances?e:zi:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function bC(t){return t===zi?void 0:t}function _C(t){return t.instantiationMode==="EAGER"}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class EC{constructor(e){this.name=e,this.providers=new Map}addComponent(e){const n=this.getProvider(e.name);if(n.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);n.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);const n=new wC(e,this);return this.providers.set(e,n),n}getProviders(){return Array.from(this.providers.values())}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */var Ye;(function(t){t[t.DEBUG=0]="DEBUG",t[t.VERBOSE=1]="VERBOSE",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.SILENT=5]="SILENT"})(Ye||(Ye={}));const SC={debug:Ye.DEBUG,verbose:Ye.VERBOSE,info:Ye.INFO,warn:Ye.WARN,error:Ye.ERROR,silent:Ye.SILENT},TC=Ye.INFO,NC={[Ye.DEBUG]:"log",[Ye.VERBOSE]:"log",[Ye.INFO]:"info",[Ye.WARN]:"warn",[Ye.ERROR]:"error"},kC=(t,e,...n)=>{if(ee.some(n=>t instanceof n);let Wx,Kx;function CC(){return Wx||(Wx=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function AC(){return Kx||(Kx=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const hE=new WeakMap,em=new WeakMap,fE=new WeakMap,_f=new WeakMap,Ug=new WeakMap;function jC(t){const e=new Promise((n,r)=>{const s=()=>{t.removeEventListener("success",i),t.removeEventListener("error",o)},i=()=>{n(fi(t.result)),s()},o=()=>{r(t.error),s()};t.addEventListener("success",i),t.addEventListener("error",o)});return e.then(n=>{n instanceof IDBCursor&&hE.set(n,t)}).catch(()=>{}),Ug.set(e,t),e}function PC(t){if(em.has(t))return;const e=new Promise((n,r)=>{const s=()=>{t.removeEventListener("complete",i),t.removeEventListener("error",o),t.removeEventListener("abort",o)},i=()=>{n(),s()},o=()=>{r(t.error||new DOMException("AbortError","AbortError")),s()};t.addEventListener("complete",i),t.addEventListener("error",o),t.addEventListener("abort",o)});em.set(t,e)}let tm={get(t,e,n){if(t instanceof IDBTransaction){if(e==="done")return em.get(t);if(e==="objectStoreNames")return t.objectStoreNames||fE.get(t);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return fi(t[e])},set(t,e,n){return t[e]=n,!0},has(t,e){return t instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in t}};function RC(t){tm=t(tm)}function DC(t){return t===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...n){const r=t.call(Ef(this),e,...n);return fE.set(r,e.sort?e.sort():[e]),fi(r)}:AC().includes(t)?function(...e){return t.apply(Ef(this),e),fi(hE.get(this))}:function(...e){return fi(t.apply(Ef(this),e))}}function MC(t){return typeof t=="function"?DC(t):(t instanceof IDBTransaction&&PC(t),IC(t,CC())?new Proxy(t,tm):t)}function fi(t){if(t instanceof IDBRequest)return jC(t);if(_f.has(t))return _f.get(t);const e=MC(t);return e!==t&&(_f.set(t,e),Ug.set(e,t)),e}const Ef=t=>Ug.get(t);function LC(t,e,{blocked:n,upgrade:r,blocking:s,terminated:i}={}){const o=indexedDB.open(t,e),l=fi(o);return r&&o.addEventListener("upgradeneeded",c=>{r(fi(o.result),c.oldVersion,c.newVersion,fi(o.transaction),c)}),n&&o.addEventListener("blocked",c=>n(c.oldVersion,c.newVersion,c)),l.then(c=>{i&&c.addEventListener("close",()=>i()),s&&c.addEventListener("versionchange",u=>s(u.oldVersion,u.newVersion,u))}).catch(()=>{}),l}const OC=["get","getKey","getAll","getAllKeys","count"],VC=["put","add","delete","clear"],Sf=new Map;function Qx(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(Sf.get(e))return Sf.get(e);const n=e.replace(/FromIndex$/,""),r=e!==n,s=VC.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(s||OC.includes(n)))return;const i=async function(o,...l){const c=this.transaction(o,s?"readwrite":"readonly");let u=c.store;return r&&(u=u.index(l.shift())),(await Promise.all([u[n](...l),s&&c.done]))[0]};return Sf.set(e,i),i}RC(t=>({...t,get:(e,n,r)=>Qx(e,n)||t.get(e,n,r),has:(e,n)=>!!Qx(e,n)||t.has(e,n)}));/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class FC{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(zC(n)){const r=n.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(n=>n).join(" ")}}function zC(t){const e=t.getComponent();return(e==null?void 0:e.type)==="VERSION"}const nm="@firebase/app",Yx="0.14.10";/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Cs=new zg("@firebase/app"),UC="@firebase/app-compat",BC="@firebase/analytics-compat",$C="@firebase/analytics",HC="@firebase/app-check-compat",qC="@firebase/app-check",GC="@firebase/auth",WC="@firebase/auth-compat",KC="@firebase/database",QC="@firebase/data-connect",YC="@firebase/database-compat",XC="@firebase/functions",JC="@firebase/functions-compat",ZC="@firebase/installations",eA="@firebase/installations-compat",tA="@firebase/messaging",nA="@firebase/messaging-compat",rA="@firebase/performance",sA="@firebase/performance-compat",iA="@firebase/remote-config",oA="@firebase/remote-config-compat",aA="@firebase/storage",lA="@firebase/storage-compat",cA="@firebase/firestore",uA="@firebase/ai",dA="@firebase/firestore-compat",hA="firebase",fA="12.11.0";/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const rm="[DEFAULT]",pA={[nm]:"fire-core",[UC]:"fire-core-compat",[$C]:"fire-analytics",[BC]:"fire-analytics-compat",[qC]:"fire-app-check",[HC]:"fire-app-check-compat",[GC]:"fire-auth",[WC]:"fire-auth-compat",[KC]:"fire-rtdb",[QC]:"fire-data-connect",[YC]:"fire-rtdb-compat",[XC]:"fire-fn",[JC]:"fire-fn-compat",[ZC]:"fire-iid",[eA]:"fire-iid-compat",[tA]:"fire-fcm",[nA]:"fire-fcm-compat",[rA]:"fire-perf",[sA]:"fire-perf-compat",[iA]:"fire-rc",[oA]:"fire-rc-compat",[aA]:"fire-gcs",[lA]:"fire-gcs-compat",[cA]:"fire-fst",[dA]:"fire-fst-compat",[uA]:"fire-vertex","fire-js":"fire-js",[hA]:"fire-js-all"};/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const bd=new Map,mA=new Map,sm=new Map;function Xx(t,e){try{t.container.addComponent(e)}catch(n){Cs.debug(`Component ${e.name} failed to register with FirebaseApp ${t.name}`,n)}}function so(t){const e=t.name;if(sm.has(e))return Cs.debug(`There were multiple attempts to register component ${e}.`),!1;sm.set(e,t);for(const n of bd.values())Xx(n,t);for(const n of mA.values())Xx(n,t);return!0}function ph(t,e){const n=t.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),t.container.getProvider(e)}function Pr(t){return t==null?!1:t.settings!==void 0}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const gA={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},pi=new fc("app","Firebase",gA);/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class yA{constructor(e,n,r){this._isDeleted=!1,this._options={...e},this._config={...n},this._name=n.name,this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new vi("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw pi.create("app-deleted",{appName:this._name})}}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const po=fA;function pE(t,e={}){let n=t;typeof e!="object"&&(e={name:e});const r={name:rm,automaticDataCollectionEnabled:!0,...e},s=r.name;if(typeof s!="string"||!s)throw pi.create("bad-app-name",{appName:String(s)});if(n||(n=cE()),!n)throw pi.create("no-options");const i=bd.get(s);if(i){if(ro(n,i.options)&&ro(r,i.config))return i;throw pi.create("duplicate-app",{appName:s})}const o=new EC(s);for(const c of sm.values())o.addComponent(c);const l=new yA(n,r,o);return bd.set(s,l),l}function Bg(t=rm){const e=bd.get(t);if(!e&&t===rm&&cE())return pE();if(!e)throw pi.create("no-app",{appName:t});return e}function Zr(t,e,n){let r=pA[t]??t;n&&(r+=`-${n}`);const s=r.match(/\s|\//),i=e.match(/\s|\//);if(s||i){const o=[`Unable to register library "${r}" with version "${e}":`];s&&o.push(`library name "${r}" contains illegal characters (whitespace or "/")`),s&&i&&o.push("and"),i&&o.push(`version name "${e}" contains illegal characters (whitespace or "/")`),Cs.warn(o.join(" "));return}so(new vi(`${r}-version`,()=>({library:r,version:e}),"VERSION"))}/** + * @license + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const xA="firebase-heartbeat-database",vA=1,Gl="firebase-heartbeat-store";let Tf=null;function mE(){return Tf||(Tf=LC(xA,vA,{upgrade:(t,e)=>{switch(e){case 0:try{t.createObjectStore(Gl)}catch(n){console.warn(n)}}}}).catch(t=>{throw pi.create("idb-open",{originalErrorMessage:t.message})})),Tf}async function wA(t){try{const n=(await mE()).transaction(Gl),r=await n.objectStore(Gl).get(gE(t));return await n.done,r}catch(e){if(e instanceof cs)Cs.warn(e.message);else{const n=pi.create("idb-get",{originalErrorMessage:e==null?void 0:e.message});Cs.warn(n.message)}}}async function Jx(t,e){try{const r=(await mE()).transaction(Gl,"readwrite");await r.objectStore(Gl).put(e,gE(t)),await r.done}catch(n){if(n instanceof cs)Cs.warn(n.message);else{const r=pi.create("idb-set",{originalErrorMessage:n==null?void 0:n.message});Cs.warn(r.message)}}}function gE(t){return`${t.name}!${t.options.appId}`}/** + * @license + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const bA=1024,_A=30;class EA{constructor(e){this.container=e,this._heartbeatsCache=null;const n=this.container.getProvider("app").getImmediate();this._storage=new TA(n),this._heartbeatsCachePromise=this._storage.read().then(r=>(this._heartbeatsCache=r,r))}async triggerHeartbeat(){var e,n;try{const s=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),i=Zx();if(((e=this._heartbeatsCache)==null?void 0:e.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((n=this._heartbeatsCache)==null?void 0:n.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===i||this._heartbeatsCache.heartbeats.some(o=>o.date===i))return;if(this._heartbeatsCache.heartbeats.push({date:i,agent:s}),this._heartbeatsCache.heartbeats.length>_A){const o=NA(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(o,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(r){Cs.warn(r)}}async getHeartbeatsHeader(){var e;try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((e=this._heartbeatsCache)==null?void 0:e.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";const n=Zx(),{heartbeatsToSend:r,unsentEntries:s}=SA(this._heartbeatsCache.heartbeats),i=wd(JSON.stringify({version:2,heartbeats:r}));return this._heartbeatsCache.lastSentHeartbeatDate=n,s.length>0?(this._heartbeatsCache.heartbeats=s,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),i}catch(n){return Cs.warn(n),""}}}function Zx(){return new Date().toISOString().substring(0,10)}function SA(t,e=bA){const n=[];let r=t.slice();for(const s of t){const i=n.find(o=>o.agent===s.agent);if(i){if(i.dates.push(s.date),ev(n)>e){i.dates.pop();break}}else if(n.push({agent:s.agent,dates:[s.date]}),ev(n)>e){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}class TA{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return dC()?hC().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const n=await wA(this.app);return n!=null&&n.heartbeats?n:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){if(await this._canUseIndexedDBPromise){const r=await this.read();return Jx(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){if(await this._canUseIndexedDBPromise){const r=await this.read();return Jx(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:[...r.heartbeats,...e.heartbeats]})}else return}}function ev(t){return wd(JSON.stringify({version:2,heartbeats:t})).length}function NA(t){if(t.length===0)return-1;let e=0,n=t[0].date;for(let r=1;rnew FC(e),"PRIVATE")),so(new vi("heartbeat",e=>new EA(e),"PRIVATE")),Zr(nm,Yx,t),Zr(nm,Yx,"esm2020"),Zr("fire-js","")}kA("");var IA="firebase",CA="12.11.0";/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */Zr(IA,CA,"app");var tv=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/** @license +Copyright The Closure Library Authors. +SPDX-License-Identifier: Apache-2.0 +*/var mi,yE;(function(){var t;/** @license + + Copyright The Closure Library Authors. + SPDX-License-Identifier: Apache-2.0 +*/function e(S,w){function N(){}N.prototype=w.prototype,S.F=w.prototype,S.prototype=new N,S.prototype.constructor=S,S.D=function(A,I,P){for(var k=Array(arguments.length-2),B=2;B>>25),k=P+(I^w&(N^I))+A[1]+3905402710&4294967295,P=w+(k<<12&4294967295|k>>>20),k=I+(N^P&(w^N))+A[2]+606105819&4294967295,I=P+(k<<17&4294967295|k>>>15),k=N+(w^I&(P^w))+A[3]+3250441966&4294967295,N=I+(k<<22&4294967295|k>>>10),k=w+(P^N&(I^P))+A[4]+4118548399&4294967295,w=N+(k<<7&4294967295|k>>>25),k=P+(I^w&(N^I))+A[5]+1200080426&4294967295,P=w+(k<<12&4294967295|k>>>20),k=I+(N^P&(w^N))+A[6]+2821735955&4294967295,I=P+(k<<17&4294967295|k>>>15),k=N+(w^I&(P^w))+A[7]+4249261313&4294967295,N=I+(k<<22&4294967295|k>>>10),k=w+(P^N&(I^P))+A[8]+1770035416&4294967295,w=N+(k<<7&4294967295|k>>>25),k=P+(I^w&(N^I))+A[9]+2336552879&4294967295,P=w+(k<<12&4294967295|k>>>20),k=I+(N^P&(w^N))+A[10]+4294925233&4294967295,I=P+(k<<17&4294967295|k>>>15),k=N+(w^I&(P^w))+A[11]+2304563134&4294967295,N=I+(k<<22&4294967295|k>>>10),k=w+(P^N&(I^P))+A[12]+1804603682&4294967295,w=N+(k<<7&4294967295|k>>>25),k=P+(I^w&(N^I))+A[13]+4254626195&4294967295,P=w+(k<<12&4294967295|k>>>20),k=I+(N^P&(w^N))+A[14]+2792965006&4294967295,I=P+(k<<17&4294967295|k>>>15),k=N+(w^I&(P^w))+A[15]+1236535329&4294967295,N=I+(k<<22&4294967295|k>>>10),k=w+(I^P&(N^I))+A[1]+4129170786&4294967295,w=N+(k<<5&4294967295|k>>>27),k=P+(N^I&(w^N))+A[6]+3225465664&4294967295,P=w+(k<<9&4294967295|k>>>23),k=I+(w^N&(P^w))+A[11]+643717713&4294967295,I=P+(k<<14&4294967295|k>>>18),k=N+(P^w&(I^P))+A[0]+3921069994&4294967295,N=I+(k<<20&4294967295|k>>>12),k=w+(I^P&(N^I))+A[5]+3593408605&4294967295,w=N+(k<<5&4294967295|k>>>27),k=P+(N^I&(w^N))+A[10]+38016083&4294967295,P=w+(k<<9&4294967295|k>>>23),k=I+(w^N&(P^w))+A[15]+3634488961&4294967295,I=P+(k<<14&4294967295|k>>>18),k=N+(P^w&(I^P))+A[4]+3889429448&4294967295,N=I+(k<<20&4294967295|k>>>12),k=w+(I^P&(N^I))+A[9]+568446438&4294967295,w=N+(k<<5&4294967295|k>>>27),k=P+(N^I&(w^N))+A[14]+3275163606&4294967295,P=w+(k<<9&4294967295|k>>>23),k=I+(w^N&(P^w))+A[3]+4107603335&4294967295,I=P+(k<<14&4294967295|k>>>18),k=N+(P^w&(I^P))+A[8]+1163531501&4294967295,N=I+(k<<20&4294967295|k>>>12),k=w+(I^P&(N^I))+A[13]+2850285829&4294967295,w=N+(k<<5&4294967295|k>>>27),k=P+(N^I&(w^N))+A[2]+4243563512&4294967295,P=w+(k<<9&4294967295|k>>>23),k=I+(w^N&(P^w))+A[7]+1735328473&4294967295,I=P+(k<<14&4294967295|k>>>18),k=N+(P^w&(I^P))+A[12]+2368359562&4294967295,N=I+(k<<20&4294967295|k>>>12),k=w+(N^I^P)+A[5]+4294588738&4294967295,w=N+(k<<4&4294967295|k>>>28),k=P+(w^N^I)+A[8]+2272392833&4294967295,P=w+(k<<11&4294967295|k>>>21),k=I+(P^w^N)+A[11]+1839030562&4294967295,I=P+(k<<16&4294967295|k>>>16),k=N+(I^P^w)+A[14]+4259657740&4294967295,N=I+(k<<23&4294967295|k>>>9),k=w+(N^I^P)+A[1]+2763975236&4294967295,w=N+(k<<4&4294967295|k>>>28),k=P+(w^N^I)+A[4]+1272893353&4294967295,P=w+(k<<11&4294967295|k>>>21),k=I+(P^w^N)+A[7]+4139469664&4294967295,I=P+(k<<16&4294967295|k>>>16),k=N+(I^P^w)+A[10]+3200236656&4294967295,N=I+(k<<23&4294967295|k>>>9),k=w+(N^I^P)+A[13]+681279174&4294967295,w=N+(k<<4&4294967295|k>>>28),k=P+(w^N^I)+A[0]+3936430074&4294967295,P=w+(k<<11&4294967295|k>>>21),k=I+(P^w^N)+A[3]+3572445317&4294967295,I=P+(k<<16&4294967295|k>>>16),k=N+(I^P^w)+A[6]+76029189&4294967295,N=I+(k<<23&4294967295|k>>>9),k=w+(N^I^P)+A[9]+3654602809&4294967295,w=N+(k<<4&4294967295|k>>>28),k=P+(w^N^I)+A[12]+3873151461&4294967295,P=w+(k<<11&4294967295|k>>>21),k=I+(P^w^N)+A[15]+530742520&4294967295,I=P+(k<<16&4294967295|k>>>16),k=N+(I^P^w)+A[2]+3299628645&4294967295,N=I+(k<<23&4294967295|k>>>9),k=w+(I^(N|~P))+A[0]+4096336452&4294967295,w=N+(k<<6&4294967295|k>>>26),k=P+(N^(w|~I))+A[7]+1126891415&4294967295,P=w+(k<<10&4294967295|k>>>22),k=I+(w^(P|~N))+A[14]+2878612391&4294967295,I=P+(k<<15&4294967295|k>>>17),k=N+(P^(I|~w))+A[5]+4237533241&4294967295,N=I+(k<<21&4294967295|k>>>11),k=w+(I^(N|~P))+A[12]+1700485571&4294967295,w=N+(k<<6&4294967295|k>>>26),k=P+(N^(w|~I))+A[3]+2399980690&4294967295,P=w+(k<<10&4294967295|k>>>22),k=I+(w^(P|~N))+A[10]+4293915773&4294967295,I=P+(k<<15&4294967295|k>>>17),k=N+(P^(I|~w))+A[1]+2240044497&4294967295,N=I+(k<<21&4294967295|k>>>11),k=w+(I^(N|~P))+A[8]+1873313359&4294967295,w=N+(k<<6&4294967295|k>>>26),k=P+(N^(w|~I))+A[15]+4264355552&4294967295,P=w+(k<<10&4294967295|k>>>22),k=I+(w^(P|~N))+A[6]+2734768916&4294967295,I=P+(k<<15&4294967295|k>>>17),k=N+(P^(I|~w))+A[13]+1309151649&4294967295,N=I+(k<<21&4294967295|k>>>11),k=w+(I^(N|~P))+A[4]+4149444226&4294967295,w=N+(k<<6&4294967295|k>>>26),k=P+(N^(w|~I))+A[11]+3174756917&4294967295,P=w+(k<<10&4294967295|k>>>22),k=I+(w^(P|~N))+A[2]+718787259&4294967295,I=P+(k<<15&4294967295|k>>>17),k=N+(P^(I|~w))+A[9]+3951481745&4294967295,S.g[0]=S.g[0]+w&4294967295,S.g[1]=S.g[1]+(I+(k<<21&4294967295|k>>>11))&4294967295,S.g[2]=S.g[2]+I&4294967295,S.g[3]=S.g[3]+P&4294967295}r.prototype.v=function(S,w){w===void 0&&(w=S.length);const N=w-this.blockSize,A=this.C;let I=this.h,P=0;for(;P>>A&255;return S};function i(S,w){var N=l;return Object.prototype.hasOwnProperty.call(N,S)?N[S]:N[S]=w(S)}function o(S,w){this.h=w;const N=[];let A=!0;for(let I=S.length-1;I>=0;I--){const P=S[I]|0;A&&P==w||(N[I]=P,A=!1)}this.g=N}var l={};function c(S){return-128<=S&&S<128?i(S,function(w){return new o([w|0],w<0?-1:0)}):new o([S|0],S<0?-1:0)}function u(S){if(isNaN(S)||!isFinite(S))return h;if(S<0)return C(u(-S));const w=[];let N=1;for(let A=0;S>=N;A++)w[A]=S/N|0,N*=4294967296;return new o(w,0)}function f(S,w){if(S.length==0)throw Error("number format error: empty string");if(w=w||10,w<2||36=0)throw Error('number format error: interior "-" character');const N=u(Math.pow(w,8));let A=h;for(let P=0;P=0?A:4294967296+A)*w,w*=4294967296}return S},t.toString=function(S){if(S=S||10,S<2||360?N.g[0]:N.h)>>>0).toString(S);if(N=I,x(N))return P+A;for(;P.length<6;)P="0"+P;A=P+A}},t.i=function(S){return S<0?0:S>>16)+(this.i(I)>>>16)+(S.i(I)>>>16);A=k>>>16,P&=65535,k&=65535,N[I]=k<<16|P}return new o(N,N[N.length-1]&-2147483648?-1:0)};function y(S,w){return S.add(C(w))}t.j=function(S){if(x(this)||x(S))return h;if(E(this))return E(S)?C(this).j(C(S)):C(C(this).j(S));if(E(S))return C(this.j(C(S)));if(this.l(p)<0&&S.l(p)<0)return u(this.m()*S.m());const w=this.g.length+S.g.length,N=[];for(var A=0;A<2*w;A++)N[A]=0;for(A=0;A>>16,k=this.i(A)&65535,B=S.i(I)>>>16,z=S.i(I)&65535;N[2*A+2*I]+=k*z,v(N,2*A+2*I),N[2*A+2*I+1]+=P*z,v(N,2*A+2*I+1),N[2*A+2*I+1]+=k*B,v(N,2*A+2*I+1),N[2*A+2*I+2]+=P*B,v(N,2*A+2*I+2)}for(S=0;S>>16,S[w]&=65535,w++}function _(S,w){this.g=S,this.h=w}function D(S,w){if(x(w))throw Error("division by zero");if(x(S))return new _(h,h);if(E(S))return w=D(C(S),w),new _(C(w.g),C(w.h));if(E(w))return w=D(S,C(w)),new _(C(w.g),w.h);if(S.g.length>30){if(E(S)||E(w))throw Error("slowDivide_ only works with positive integers.");for(var N=m,A=w;A.l(S)<=0;)N=M(N),A=M(A);var I=T(N,1),P=T(A,1);for(A=T(A,2),N=T(N,2);!x(A);){var k=P.add(A);k.l(S)<=0&&(I=I.add(N),P=k),A=T(A,1),N=T(N,1)}return w=y(S,I.j(w)),new _(I,w)}for(I=h;S.l(w)>=0;){for(N=Math.max(1,Math.floor(S.m()/w.m())),A=Math.ceil(Math.log(N)/Math.LN2),A=A<=48?1:Math.pow(2,A-48),P=u(N),k=P.j(w);E(k)||k.l(S)>0;)N-=A,P=u(N),k=P.j(w);x(P)&&(P=m),I=I.add(P),S=y(S,k)}return new _(I,S)}t.B=function(S){return D(this,S).h},t.and=function(S){const w=Math.max(this.g.length,S.g.length),N=[];for(let A=0;A>>31;return new o(N,S.h)}function T(S,w){const N=w>>5;w%=32;const A=S.g.length-N,I=[];for(let P=0;P0?S.i(P+N)>>>w|S.i(P+N+1)<<32-w:S.i(P+N);return new o(I,S.h)}r.prototype.digest=r.prototype.A,r.prototype.reset=r.prototype.u,r.prototype.update=r.prototype.v,yE=r,o.prototype.add=o.prototype.add,o.prototype.multiply=o.prototype.j,o.prototype.modulo=o.prototype.B,o.prototype.compare=o.prototype.l,o.prototype.toNumber=o.prototype.m,o.prototype.toString=o.prototype.toString,o.prototype.getBits=o.prototype.i,o.fromNumber=u,o.fromString=f,mi=o}).apply(typeof tv<"u"?tv:typeof self<"u"?self:typeof window<"u"?window:{});var uu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/** @license +Copyright The Closure Library Authors. +SPDX-License-Identifier: Apache-2.0 +*/var xE,al,vE,Du,im,wE,bE,_E;(function(){var t,e=Object.defineProperty;function n(d){d=[typeof globalThis=="object"&&globalThis,d,typeof window=="object"&&window,typeof self=="object"&&self,typeof uu=="object"&&uu];for(var g=0;gd&&AsyncContext.Snapshot.wrap(d):d=>d;function p(d){const g=d.length;if(g>0){const b=Array(g);for(let j=0;j0?(this.h--,g=this.g,this.g=g.next,g.next=null):g=this.i(),g}}function C(d){o.setTimeout(()=>{throw d},0)}function y(){var d=S;let g=null;return d.g&&(g=d.g,d.g=d.g.next,d.g||(d.h=null),g.next=null),g}class v{constructor(){this.h=this.g=null}add(g,b){const j=_.get();j.set(g,b),this.h?this.h.next=j:this.g=j,this.h=j}}var _=new E(()=>new D,d=>d.reset());class D{constructor(){this.next=this.g=this.h=null}set(g,b){this.h=g,this.g=b,this.next=null}reset(){this.next=this.g=this.h=null}}let M,T=!1,S=new v,w=()=>{const d=Promise.resolve(void 0);M=()=>{d.then(N)}};function N(){for(var d;d=y();){try{d.h.call(d.g)}catch(b){C(b)}var g=_;g.j(d),g.h<100&&(g.h++,d.next=g.g,g.g=d)}T=!1}function A(){this.u=this.u,this.C=this.C}A.prototype.u=!1,A.prototype.dispose=function(){this.u||(this.u=!0,this.N())},A.prototype[Symbol.dispose]=function(){this.dispose()},A.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()};function I(d,g){this.type=d,this.g=this.target=g,this.defaultPrevented=!1}I.prototype.h=function(){this.defaultPrevented=!0};var P=function(){if(!o.addEventListener||!Object.defineProperty)return!1;var d=!1,g=Object.defineProperty({},"passive",{get:function(){d=!0}});try{const b=()=>{};o.addEventListener("test",b,g),o.removeEventListener("test",b,g)}catch{}return d}();function k(d){return/^[\s\xa0]*$/.test(d)}function B(d,g){I.call(this,d?d.type:""),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType="",this.i=null,d&&this.init(d,g)}h(B,I),B.prototype.init=function(d,g){const b=this.type=d.type,j=d.changedTouches&&d.changedTouches.length?d.changedTouches[0]:null;this.target=d.target||d.srcElement,this.g=g,g=d.relatedTarget,g||(b=="mouseover"?g=d.fromElement:b=="mouseout"&&(g=d.toElement)),this.relatedTarget=g,j?(this.clientX=j.clientX!==void 0?j.clientX:j.pageX,this.clientY=j.clientY!==void 0?j.clientY:j.pageY,this.screenX=j.screenX||0,this.screenY=j.screenY||0):(this.clientX=d.clientX!==void 0?d.clientX:d.pageX,this.clientY=d.clientY!==void 0?d.clientY:d.pageY,this.screenX=d.screenX||0,this.screenY=d.screenY||0),this.button=d.button,this.key=d.key||"",this.ctrlKey=d.ctrlKey,this.altKey=d.altKey,this.shiftKey=d.shiftKey,this.metaKey=d.metaKey,this.pointerId=d.pointerId||0,this.pointerType=d.pointerType,this.state=d.state,this.i=d,d.defaultPrevented&&B.Z.h.call(this)},B.prototype.h=function(){B.Z.h.call(this);const d=this.i;d.preventDefault?d.preventDefault():d.returnValue=!1};var z="closure_listenable_"+(Math.random()*1e6|0),W=0;function ee(d,g,b,j,U){this.listener=d,this.proxy=null,this.src=g,this.type=b,this.capture=!!j,this.ha=U,this.key=++W,this.da=this.fa=!1}function F(d){d.da=!0,d.listener=null,d.proxy=null,d.src=null,d.ha=null}function K(d,g,b){for(const j in d)g.call(b,d[j],j,d)}function R(d,g){for(const b in d)g.call(void 0,d[b],b,d)}function ne(d){const g={};for(const b in d)g[b]=d[b];return g}const pe="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function O(d,g){let b,j;for(let U=1;U-1?(g=d[he],b||(g.fa=!1)):(g=new ee(g,this.src,q,!!j,U),g.fa=b,d.push(g)),g};function oe(d,g){const b=g.type;if(b in d.g){var j=d.g[b],U=Array.prototype.indexOf.call(j,g,void 0),q;(q=U>=0)&&Array.prototype.splice.call(j,U,1),q&&(F(g),d.g[b].length==0&&(delete d.g[b],d.h--))}}function le(d,g,b,j){for(let U=0;U-1&&(F(g[b]),Array.prototype.splice.call(g,b,1),g.length==0&&(delete d.g[q],d.h--)))):d&&(d=xt(d))&&(g=d.g[g.toString()],d=-1,g&&(d=le(g,b,j,U)),(b=d>-1?g[d]:null)&&yt(b))}function yt(d){if(typeof d!="number"&&d&&!d.da){var g=d.src;if(g&&g[z])oe(g.i,d);else{var b=d.type,j=d.proxy;g.removeEventListener?g.removeEventListener(b,j,d.capture):g.detachEvent?g.detachEvent(Vt(b),j):g.addListener&&g.removeListener&&g.removeListener(j),(b=xt(g))?(oe(b,d),b.h==0&&(b.src=null,g[Ie]=null)):F(d)}}}function Vt(d){return d in te?te[d]:te[d]="on"+d}function _n(d,g){if(d.da)d=!0;else{g=new B(g,this);const b=d.listener,j=d.ha||d.src;d.fa&&yt(d),d=b.call(j,g)}return d}function xt(d){return d=d[Ie],d instanceof Q?d:null}var tt="__closure_events_fn_"+(Math.random()*1e9>>>0);function Bn(d){return typeof d=="function"?d:(d[tt]||(d[tt]=function(g){return d.handleEvent(g)}),d[tt])}function Ue(){A.call(this),this.i=new Q(this),this.M=this,this.G=null}h(Ue,A),Ue.prototype[z]=!0,Ue.prototype.removeEventListener=function(d,g,b,j){st(this,d,g,b,j)};function vt(d,g){var b,j=d.G;if(j)for(b=[];j;j=j.G)b.push(j);if(d=d.M,j=g.type||g,typeof g=="string")g=new I(g,d);else if(g instanceof I)g.target=g.target||d;else{var U=g;g=new I(j,d),O(g,U)}U=!0;let q,he;if(b)for(he=b.length-1;he>=0;he--)q=g.g=b[he],U=Pn(q,j,!0,g)&&U;if(q=g.g=d,U=Pn(q,j,!0,g)&&U,U=Pn(q,j,!1,g)&&U,b)for(he=0;he2147483647?-1:o.setTimeout(d,g||0)}function on(d){d.g=jt(()=>{d.g=null,d.i&&(d.i=!1,on(d))},d.l);const g=d.h;d.h=null,d.m.apply(null,g)}class fn extends A{constructor(g,b){super(),this.m=g,this.l=b,this.h=null,this.i=!1,this.g=null}j(g){this.h=arguments,this.g?this.i=!0:on(this)}N(){super.N(),this.g&&(o.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function wt(d){A.call(this),this.h=d,this.g={}}h(wt,A);var G=[];function ie(d){K(d.g,function(g,b){this.g.hasOwnProperty(b)&&yt(g)},d),d.g={}}wt.prototype.N=function(){wt.Z.N.call(this),ie(this)},wt.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var _e=o.JSON.stringify,Se=o.JSON.parse,H=class{stringify(d){return o.JSON.stringify(d,void 0)}parse(d){return o.JSON.parse(d,void 0)}};function X(){}function se(){}var de={OPEN:"a",hb:"b",ERROR:"c",tb:"d"};function Le(){I.call(this,"d")}h(Le,I);function $(){I.call(this,"c")}h($,I);var J={},me=null;function ge(){return me=me||new Ue}J.Ia="serverreachability";function Ee(d){I.call(this,J.Ia,d)}h(Ee,I);function Ve(d){const g=ge();vt(g,new Ee(g))}J.STAT_EVENT="statevent";function Be(d,g){I.call(this,J.STAT_EVENT,d),this.stat=g}h(Be,I);function De(d){const g=ge();vt(g,new Be(g,d))}J.Ja="timingevent";function $n(d,g){I.call(this,J.Ja,d),this.size=g}h($n,I);function we(d,g){if(typeof d!="function")throw Error("Fn must not be null and must be a function");return o.setTimeout(function(){d()},g)}function Ze(){this.g=!0}Ze.prototype.ua=function(){this.g=!1};function ot(d,g,b,j,U,q){d.info(function(){if(d.g)if(q){var he="",ze=q.split("&");for(let mt=0;mt1){const an=Zt[0];Zt=Zt[1];const Ur=an.split("_");he=Ur.length>=2&&Ur[1]=="type"?he+(an+"="+Zt+"&"):he+(an+"=redacted&")}}}else he=null;else he=q;return"XMLHTTP REQ ("+j+") [attempt "+U+"]: "+g+` +`+b+` +`+he})}function $e(d,g,b,j,U,q,he){d.info(function(){return"XMLHTTP RESP ("+j+") [ attempt "+U+"]: "+g+` +`+b+` +`+q+" "+he})}function He(d,g,b,j){d.info(function(){return"XMLHTTP TEXT ("+g+"): "+bt(d,b)+(j?" "+j:"")})}function ft(d,g){d.info(function(){return"TIMEOUT: "+g})}Ze.prototype.info=function(){};function bt(d,g){if(!d.g)return g;if(!g)return null;try{const q=JSON.parse(g);if(q){for(d=0;d0&&d.length;)b.push(d.shift()),g--;return d.length&&b.push(d.join(":")),b}function zr(d,g,b,j){this.j=d,this.i=g,this.l=b,this.S=j||1,this.V=new wt(this),this.H=45e3,this.J=null,this.o=!1,this.u=this.B=this.A=this.M=this.F=this.T=this.D=null,this.G=[],this.g=null,this.C=0,this.m=this.v=null,this.X=-1,this.K=!1,this.P=0,this.O=null,this.W=this.L=this.U=this.R=!1,this.h=new $t}function $t(){this.i=null,this.g="",this.h=!1}var kt={},Ra={};function Da(d,g,b){d.M=1,d.A=rr(ke(g)),d.u=b,d.R=!0,ds(d,null)}function ds(d,g){d.F=Date.now(),vo(d),d.B=ke(d.A);var b=d.B,j=d.S;Array.isArray(j)||(j=[String(j)]),oy(b.i,"t",j),d.C=0,b=d.j.L,d.h=new $t,d.g=Sy(d.j,b?g:null,!d.u),d.P>0&&(d.O=new fn(u(d.Y,d,d.g),d.P)),g=d.V,b=d.g,j=d.ba;var U="readystatechange";Array.isArray(U)||(U&&(G[0]=U.toString()),U=G);for(let q=0;q0&&!this.W){this.W=!0;var he=this.j;he.g==this&&he.aa&&!he.P&&(he.j.info("Great, no buffering proxy detected. Bytes received: "+b.length),qh(he),he.P=!0,De(11))}}else He(this.i,this.l,b,null),La(this,b);ze==4&&Jt(this),this.o&&!this.K&&(ze==4?wy(this.j,this):(this.o=!1,vo(this)))}else ZT(this.g),g==400&&b.indexOf("Unknown SID")>0?(this.m=3,De(12)):(this.m=0,De(13)),Jt(this),Os(this)}}}catch{}finally{}};function Ma(d){if(!jc(d))return d.g.la();const g=fy(d.g);if(g==="")return"";let b="";const j=g.length,U=zs(d.g)==4;if(!d.h.i){if(typeof TextDecoder>"u")return Jt(d),Os(d),"";d.h.i=new o.TextDecoder}for(let q=0;qg.length?Ra:(g=g.slice(j,j+b),d.C=j+b,g)))}zr.prototype.cancel=function(){this.K=!0,Jt(this)};function vo(d){d.T=Date.now()+d.H,Rc(d,d.H)}function Rc(d,g){if(d.D!=null)throw Error("WatchDog timer not null");d.D=we(u(d.aa,d),g)}function wo(d){d.D&&(o.clearTimeout(d.D),d.D=null)}zr.prototype.aa=function(){this.D=null;const d=Date.now();d-this.T>=0?(ft(this.i,this.B),this.M!=2&&(Ve(),De(17)),Jt(this),this.m=2,Os(this)):Rc(this,this.T-d)};function Os(d){d.j.I==0||d.K||wy(d.j,d)}function Jt(d){wo(d);var g=d.O;g&&typeof g.dispose=="function"&&g.dispose(),d.O=null,ie(d.V),d.g&&(g=d.g,d.g=null,g.abort(),g.dispose())}function La(d,g){try{var b=d.j;if(b.I!=0&&(b.g==d||Oa(b.h,d))){if(!d.L&&Oa(b.h,d)&&b.I==3){try{var j=b.Ba.g.parse(g)}catch{j=null}if(Array.isArray(j)&&j.length==3){var U=j;if(U[0]==0){e:if(!b.v){if(b.g)if(b.g.F+3e30&&(j=1.5*Us,b.O=j,b.j.info("backChannelRequestTimeoutMs_="+j)),j=b;const Bs=d.g;if(Bs){const Hc=Bs.g?Bs.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(Hc){var q=j.h;q.g||Hc.indexOf("spdy")==-1&&Hc.indexOf("quic")==-1&&Hc.indexOf("h2")==-1||(q.j=q.l,q.g=new Set,q.h&&(V(q,q.h),q.h=null))}if(j.G){const Gh=Bs.g?Bs.g.getResponseHeader("X-HTTP-Session-Id"):null;Gh&&(j.wa=Gh,nt(j.J,j.G,Gh))}}b.I=3,b.l&&b.l.ra(),b.aa&&(b.T=Date.now()-d.F,b.j.info("Handshake RTT: "+b.T+"ms")),j=b;var he=d;if(j.na=Ey(j,j.L?j.ba:null,j.W),he.L){ue(j.h,he);var ze=he,Zt=j.O;Zt&&(ze.H=Zt),ze.D&&(wo(ze),vo(ze)),j.g=he}else xy(j);b.i.length>0&&Uc(b)}else mt[0]!="stop"&&mt[0]!="close"||Li(b,7);else b.I==3&&(mt[0]=="stop"||mt[0]=="close"?mt[0]=="stop"?Li(b,7):$h(b):mt[0]!="noop"&&b.l&&b.l.qa(mt),b.A=0)}}Ve(4)}catch{}}var Dc=class{constructor(d,g){this.g=d,this.map=g}};function Mc(d){this.l=d||10,o.PerformanceNavigationTiming?(d=o.performance.getEntriesByType("navigation"),d=d.length>0&&(d[0].nextHopProtocol=="hq"||d[0].nextHopProtocol=="h2")):d=!!(o.chrome&&o.chrome.loadTimes&&o.chrome.loadTimes()&&o.chrome.loadTimes().wasFetchedViaSpdy),this.j=d?this.l:1,this.g=null,this.j>1&&(this.g=new Set),this.h=null,this.i=[]}function Lc(d){return d.h?!0:d.g?d.g.size>=d.j:!1}function Oc(d){return d.h?1:d.g?d.g.size:0}function Oa(d,g){return d.h?d.h==g:d.g?d.g.has(g):!1}function V(d,g){d.g?d.g.add(g):d.h=g}function ue(d,g){d.h&&d.h==g?d.h=null:d.g&&d.g.has(g)&&d.g.delete(g)}Mc.prototype.cancel=function(){if(this.i=xe(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&this.g.size!==0){for(const d of this.g.values())d.cancel();this.g.clear()}};function xe(d){if(d.h!=null)return d.i.concat(d.h.G);if(d.g!=null&&d.g.size!==0){let g=d.i;for(const b of d.g.values())g=g.concat(b.G);return g}return p(d.i)}var je=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function dt(d,g){if(d){d=d.split("&");for(let b=0;b=0?(U=d[b].substring(0,j),q=d[b].substring(j+1)):U=d[b],g(U,q?decodeURIComponent(q.replace(/\+/g," ")):"")}}}function at(d){this.g=this.o=this.j="",this.u=null,this.m=this.h="",this.l=!1;let g;d instanceof at?(this.l=d.l,We(this,d.j),this.o=d.o,this.g=d.g,qe(this,d.u),this.h=d.h,Hn(this,ay(d.i)),this.m=d.m):d&&(g=String(d).match(je))?(this.l=!1,We(this,g[1]||"",!0),this.o=sr(g[2]||""),this.g=sr(g[3]||"",!0),qe(this,g[4]),this.h=sr(g[5]||"",!0),Hn(this,g[6]||"",!0),this.m=sr(g[7]||"")):(this.l=!1,this.i=new Fa(null,this.l))}at.prototype.toString=function(){const d=[];var g=this.j;g&&d.push(hs(g,Vs,!0),":");var b=this.g;return(b||g=="file")&&(d.push("//"),(g=this.o)&&d.push(hs(g,Vs,!0),"@"),d.push(Rn(b).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),b=this.u,b!=null&&d.push(":",String(b))),(b=this.h)&&(this.g&&b.charAt(0)!="/"&&d.push("/"),d.push(hs(b,b.charAt(0)=="/"?HT:$T,!0))),(b=this.i.toString())&&d.push("?",b),(b=this.m)&&d.push("#",hs(b,GT)),d.join("")},at.prototype.resolve=function(d){const g=ke(this);let b=!!d.j;b?We(g,d.j):b=!!d.o,b?g.o=d.o:b=!!d.g,b?g.g=d.g:b=d.u!=null;var j=d.h;if(b)qe(g,d.u);else if(b=!!d.h){if(j.charAt(0)!="/")if(this.g&&!this.h)j="/"+j;else{var U=g.h.lastIndexOf("/");U!=-1&&(j=g.h.slice(0,U+1)+j)}if(U=j,U==".."||U==".")j="";else if(U.indexOf("./")!=-1||U.indexOf("/.")!=-1){j=U.lastIndexOf("/",0)==0,U=U.split("/");const q=[];for(let he=0;he1||q.length==1&&q[0]!="")&&q.pop(),j&&he==U.length&&q.push("")):(q.push(ze),j=!0)}j=q.join("/")}else j=U}return b?g.h=j:b=d.i.toString()!=="",b?Hn(g,ay(d.i)):b=!!d.m,b&&(g.m=d.m),g};function ke(d){return new at(d)}function We(d,g,b){d.j=b?sr(g,!0):g,d.j&&(d.j=d.j.replace(/:$/,""))}function qe(d,g){if(g){if(g=Number(g),isNaN(g)||g<0)throw Error("Bad port number "+g);d.u=g}else d.u=null}function Hn(d,g,b){g instanceof Fa?(d.i=g,WT(d.i,d.l)):(b||(g=hs(g,qT)),d.i=new Fa(g,d.l))}function nt(d,g,b){d.i.set(g,b)}function rr(d){return nt(d,"zx",Math.floor(Math.random()*2147483648).toString(36)+Math.abs(Math.floor(Math.random()*2147483648)^Date.now()).toString(36)),d}function sr(d,g){return d?g?decodeURI(d.replace(/%25/g,"%2525")):decodeURIComponent(d):""}function hs(d,g,b){return typeof d=="string"?(d=encodeURI(d).replace(g,Va),b&&(d=d.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),d):null}function Va(d){return d=d.charCodeAt(0),"%"+(d>>4&15).toString(16)+(d&15).toString(16)}var Vs=/[#\/\?@]/g,$T=/[#\?:]/g,HT=/[#\?]/g,qT=/[#\?@]/g,GT=/#/g;function Fa(d,g){this.h=this.g=null,this.i=d||null,this.j=!!g}function Mi(d){d.g||(d.g=new Map,d.h=0,d.i&&dt(d.i,function(g,b){d.add(decodeURIComponent(g.replace(/\+/g," ")),b)}))}t=Fa.prototype,t.add=function(d,g){Mi(this),this.i=null,d=bo(this,d);let b=this.g.get(d);return b||this.g.set(d,b=[]),b.push(g),this.h+=1,this};function ry(d,g){Mi(d),g=bo(d,g),d.g.has(g)&&(d.i=null,d.h-=d.g.get(g).length,d.g.delete(g))}function sy(d,g){return Mi(d),g=bo(d,g),d.g.has(g)}t.forEach=function(d,g){Mi(this),this.g.forEach(function(b,j){b.forEach(function(U){d.call(g,U,j,this)},this)},this)};function iy(d,g){Mi(d);let b=[];if(typeof g=="string")sy(d,g)&&(b=b.concat(d.g.get(bo(d,g))));else for(d=Array.from(d.g.values()),g=0;g0?String(d[0]):g):g};function oy(d,g,b){ry(d,g),b.length>0&&(d.i=null,d.g.set(bo(d,g),p(b)),d.h+=b.length)}t.toString=function(){if(this.i)return this.i;if(!this.g)return"";const d=[],g=Array.from(this.g.keys());for(let j=0;j{j.abort(),Fs(b,"TestPingServer: timeout",!1,g)},1e4);fetch(d,{signal:j.signal}).then(q=>{clearTimeout(U),q.ok?Fs(b,"TestPingServer: ok",!0,g):Fs(b,"TestPingServer: server error",!1,g)}).catch(()=>{clearTimeout(U),Fs(b,"TestPingServer: error",!1,g)})}function Fs(d,g,b,j,U){try{U&&(U.onload=null,U.onerror=null,U.onabort=null,U.ontimeout=null),j(b)}catch{}}function YT(){this.g=new H}function Uh(d){this.i=d.Sb||null,this.h=d.ab||!1}h(Uh,X),Uh.prototype.g=function(){return new Vc(this.i,this.h)};function Vc(d,g){Ue.call(this),this.H=d,this.o=g,this.m=void 0,this.status=this.readyState=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.A=new Headers,this.h=null,this.F="GET",this.D="",this.g=!1,this.B=this.j=this.l=null,this.v=new AbortController}h(Vc,Ue),t=Vc.prototype,t.open=function(d,g){if(this.readyState!=0)throw this.abort(),Error("Error reopening a connection");this.F=d,this.D=g,this.readyState=1,Ua(this)},t.send=function(d){if(this.readyState!=1)throw this.abort(),Error("need to call open() first. ");if(this.v.signal.aborted)throw this.abort(),Error("Request was aborted.");this.g=!0;const g={headers:this.A,method:this.F,credentials:this.m,cache:void 0,signal:this.v.signal};d&&(g.body=d),(this.H||o).fetch(new Request(this.D,g)).then(this.Pa.bind(this),this.ga.bind(this))},t.abort=function(){this.response=this.responseText="",this.A=new Headers,this.status=0,this.v.abort(),this.j&&this.j.cancel("Request was aborted.").catch(()=>{}),this.readyState>=1&&this.g&&this.readyState!=4&&(this.g=!1,za(this)),this.readyState=0},t.Pa=function(d){if(this.g&&(this.l=d,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=d.headers,this.readyState=2,Ua(this)),this.g&&(this.readyState=3,Ua(this),this.g)))if(this.responseType==="arraybuffer")d.arrayBuffer().then(this.Na.bind(this),this.ga.bind(this));else if(typeof o.ReadableStream<"u"&&"body"in d){if(this.j=d.body.getReader(),this.o){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.B=new TextDecoder;ly(this)}else d.text().then(this.Oa.bind(this),this.ga.bind(this))};function ly(d){d.j.read().then(d.Ma.bind(d)).catch(d.ga.bind(d))}t.Ma=function(d){if(this.g){if(this.o&&d.value)this.response.push(d.value);else if(!this.o){var g=d.value?d.value:new Uint8Array(0);(g=this.B.decode(g,{stream:!d.done}))&&(this.response=this.responseText+=g)}d.done?za(this):Ua(this),this.readyState==3&&ly(this)}},t.Oa=function(d){this.g&&(this.response=this.responseText=d,za(this))},t.Na=function(d){this.g&&(this.response=d,za(this))},t.ga=function(){this.g&&za(this)};function za(d){d.readyState=4,d.l=null,d.j=null,d.B=null,Ua(d)}t.setRequestHeader=function(d,g){this.A.append(d,g)},t.getResponseHeader=function(d){return this.h&&this.h.get(d.toLowerCase())||""},t.getAllResponseHeaders=function(){if(!this.h)return"";const d=[],g=this.h.entries();for(var b=g.next();!b.done;)b=b.value,d.push(b[0]+": "+b[1]),b=g.next();return d.join(`\r +`)};function Ua(d){d.onreadystatechange&&d.onreadystatechange.call(d)}Object.defineProperty(Vc.prototype,"withCredentials",{get:function(){return this.m==="include"},set:function(d){this.m=d?"include":"same-origin"}});function cy(d){let g="";return K(d,function(b,j){g+=j,g+=":",g+=b,g+=`\r +`}),g}function Bh(d,g,b){e:{for(j in b){var j=!1;break e}j=!0}j||(b=cy(b),typeof d=="string"?b!=null&&Rn(b):nt(d,g,b))}function Ft(d){Ue.call(this),this.headers=new Map,this.L=d||null,this.h=!1,this.g=null,this.D="",this.o=0,this.l="",this.j=this.B=this.v=this.A=!1,this.m=null,this.F="",this.H=!1}h(Ft,Ue);var XT=/^https?$/i,JT=["POST","PUT"];t=Ft.prototype,t.Fa=function(d){this.H=d},t.ea=function(d,g,b,j){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+d);g=g?g.toUpperCase():"GET",this.D=d,this.l="",this.o=0,this.A=!1,this.h=!0,this.g=this.L?this.L.g():Bt.g(),this.g.onreadystatechange=m(u(this.Ca,this));try{this.B=!0,this.g.open(g,String(d),!0),this.B=!1}catch(q){uy(this,q);return}if(d=b||"",b=new Map(this.headers),j)if(Object.getPrototypeOf(j)===Object.prototype)for(var U in j)b.set(U,j[U]);else if(typeof j.keys=="function"&&typeof j.get=="function")for(const q of j.keys())b.set(q,j.get(q));else throw Error("Unknown input type for opt_headers: "+String(j));j=Array.from(b.keys()).find(q=>q.toLowerCase()=="content-type"),U=o.FormData&&d instanceof o.FormData,!(Array.prototype.indexOf.call(JT,g,void 0)>=0)||j||U||b.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(const[q,he]of b)this.g.setRequestHeader(q,he);this.F&&(this.g.responseType=this.F),"withCredentials"in this.g&&this.g.withCredentials!==this.H&&(this.g.withCredentials=this.H);try{this.m&&(clearTimeout(this.m),this.m=null),this.v=!0,this.g.send(d),this.v=!1}catch(q){uy(this,q)}};function uy(d,g){d.h=!1,d.g&&(d.j=!0,d.g.abort(),d.j=!1),d.l=g,d.o=5,dy(d),Fc(d)}function dy(d){d.A||(d.A=!0,vt(d,"complete"),vt(d,"error"))}t.abort=function(d){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.o=d||7,vt(this,"complete"),vt(this,"abort"),Fc(this))},t.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),Fc(this,!0)),Ft.Z.N.call(this)},t.Ca=function(){this.u||(this.B||this.v||this.j?hy(this):this.Xa())},t.Xa=function(){hy(this)};function hy(d){if(d.h&&typeof i<"u"){if(d.v&&zs(d)==4)setTimeout(d.Ca.bind(d),0);else if(vt(d,"readystatechange"),zs(d)==4){d.h=!1;try{const q=d.ca();e:switch(q){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var g=!0;break e;default:g=!1}var b;if(!(b=g)){var j;if(j=q===0){let he=String(d.D).match(je)[1]||null;!he&&o.self&&o.self.location&&(he=o.self.location.protocol.slice(0,-1)),j=!XT.test(he?he.toLowerCase():"")}b=j}if(b)vt(d,"complete"),vt(d,"success");else{d.o=6;try{var U=zs(d)>2?d.g.statusText:""}catch{U=""}d.l=U+" ["+d.ca()+"]",dy(d)}}finally{Fc(d)}}}}function Fc(d,g){if(d.g){d.m&&(clearTimeout(d.m),d.m=null);const b=d.g;d.g=null,g||vt(d,"ready");try{b.onreadystatechange=null}catch{}}}t.isActive=function(){return!!this.g};function zs(d){return d.g?d.g.readyState:0}t.ca=function(){try{return zs(this)>2?this.g.status:-1}catch{return-1}},t.la=function(){try{return this.g?this.g.responseText:""}catch{return""}},t.La=function(d){if(this.g){var g=this.g.responseText;return d&&g.indexOf(d)==0&&(g=g.substring(d.length)),Se(g)}};function fy(d){try{if(!d.g)return null;if("response"in d.g)return d.g.response;switch(d.F){case"":case"text":return d.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in d.g)return d.g.mozResponseArrayBuffer}return null}catch{return null}}function ZT(d){const g={};d=(d.g&&zs(d)>=2&&d.g.getAllResponseHeaders()||"").split(`\r +`);for(let j=0;j0&&(this.ia=d.longPollingTimeout),this.ta=void 0,this.T=0,this.P=!1,this.ja=this.B=null}t=py.prototype,t.ka=8,t.I=1,t.connect=function(d,g,b,j){De(0),this.W=d,this.H=g||{},b&&j!==void 0&&(this.H.OSID=b,this.H.OAID=j),this.F=this.X,this.J=Ey(this,null,this.W),Uc(this)};function $h(d){if(my(d),d.I==3){var g=d.V++,b=ke(d.J);if(nt(b,"SID",d.M),nt(b,"RID",g),nt(b,"TYPE","terminate"),$a(d,b),g=new zr(d,d.j,g),g.M=2,g.A=rr(ke(b)),b=!1,o.navigator&&o.navigator.sendBeacon)try{b=o.navigator.sendBeacon(g.A.toString(),"")}catch{}!b&&o.Image&&(new Image().src=g.A,b=!0),b||(g.g=Sy(g.j,null),g.g.ea(g.A)),g.F=Date.now(),vo(g)}_y(d)}function zc(d){d.g&&(qh(d),d.g.cancel(),d.g=null)}function my(d){zc(d),d.v&&(o.clearTimeout(d.v),d.v=null),Bc(d),d.h.cancel(),d.m&&(typeof d.m=="number"&&o.clearTimeout(d.m),d.m=null)}function Uc(d){if(!Lc(d.h)&&!d.m){d.m=!0;var g=d.Ea;M||w(),T||(M(),T=!0),S.add(g,d),d.D=0}}function eN(d,g){return Oc(d.h)>=d.h.j-(d.m?1:0)?!1:d.m?(d.i=g.G.concat(d.i),!0):d.I==1||d.I==2||d.D>=(d.Sa?0:d.Ta)?!1:(d.m=we(u(d.Ea,d,g),by(d,d.D)),d.D++,!0)}t.Ea=function(d){if(this.m)if(this.m=null,this.I==1){if(!d){this.V=Math.floor(Math.random()*1e5),d=this.V++;const U=new zr(this,this.j,d);let q=this.o;if(this.U&&(q?(q=ne(q),O(q,this.U)):q=this.U),this.u!==null||this.R||(U.J=q,q=null),this.S)e:{for(var g=0,b=0;b4096){g=b;break e}if(g===4096||b===this.i.length-1){g=b+1;break e}}g=1e3}else g=1e3;g=yy(this,U,g),b=ke(this.J),nt(b,"RID",d),nt(b,"CVER",22),this.G&&nt(b,"X-HTTP-Session-Id",this.G),$a(this,b),q&&(this.R?g="headers="+Rn(cy(q))+"&"+g:this.u&&Bh(b,this.u,q)),V(this.h,U),this.Ra&&nt(b,"TYPE","init"),this.S?(nt(b,"$req",g),nt(b,"SID","null"),U.U=!0,Da(U,b,null)):Da(U,b,g),this.I=2}}else this.I==3&&(d?gy(this,d):this.i.length==0||Lc(this.h)||gy(this))};function gy(d,g){var b;g?b=g.l:b=d.V++;const j=ke(d.J);nt(j,"SID",d.M),nt(j,"RID",b),nt(j,"AID",d.K),$a(d,j),d.u&&d.o&&Bh(j,d.u,d.o),b=new zr(d,d.j,b,d.D+1),d.u===null&&(b.J=d.o),g&&(d.i=g.G.concat(d.i)),g=yy(d,b,1e3),b.H=Math.round(d.va*.5)+Math.round(d.va*.5*Math.random()),V(d.h,b),Da(b,j,g)}function $a(d,g){d.H&&K(d.H,function(b,j){nt(g,j,b)}),d.l&&K({},function(b,j){nt(g,j,b)})}function yy(d,g,b){b=Math.min(d.i.length,b);const j=d.l?u(d.l.Ka,d.l,d):null;e:{var U=d.i;let ze=-1;for(;;){const Zt=["count="+b];ze==-1?b>0?(ze=U[0].g,Zt.push("ofs="+ze)):ze=0:Zt.push("ofs="+ze);let mt=!0;for(let an=0;an=3?!1:(d.Y++,d.v=we(u(d.Da,d),by(d,d.A)),d.A++,!0)}t.Da=function(){if(this.v=null,vy(this),this.aa&&!(this.P||this.g==null||this.T<=0)){var d=4*this.T;this.j.info("BP detection timer enabled: "+d),this.B=we(u(this.Wa,this),d)}},t.Wa=function(){this.B&&(this.B=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.F=!1,this.P=!0,De(10),zc(this),vy(this))};function qh(d){d.B!=null&&(o.clearTimeout(d.B),d.B=null)}function vy(d){d.g=new zr(d,d.j,"rpc",d.Y),d.u===null&&(d.g.J=d.o),d.g.P=0;var g=ke(d.na);nt(g,"RID","rpc"),nt(g,"SID",d.M),nt(g,"AID",d.K),nt(g,"CI",d.F?"0":"1"),!d.F&&d.ia&&nt(g,"TO",d.ia),nt(g,"TYPE","xmlhttp"),$a(d,g),d.u&&d.o&&Bh(g,d.u,d.o),d.O&&(d.g.H=d.O);var b=d.g;d=d.ba,b.M=1,b.A=rr(ke(g)),b.u=null,b.R=!0,ds(b,d)}t.Va=function(){this.C!=null&&(this.C=null,zc(this),Hh(this),De(19))};function Bc(d){d.C!=null&&(o.clearTimeout(d.C),d.C=null)}function wy(d,g){var b=null;if(d.g==g){Bc(d),qh(d),d.g=null;var j=2}else if(Oa(d.h,g))b=g.G,ue(d.h,g),j=1;else return;if(d.I!=0){if(g.o)if(j==1){b=g.u?g.u.length:0,g=Date.now()-g.F;var U=d.D;j=ge(),vt(j,new $n(j,b)),Uc(d)}else xy(d);else if(U=g.m,U==3||U==0&&g.X>0||!(j==1&&eN(d,g)||j==2&&Hh(d)))switch(b&&b.length>0&&(g=d.h,g.i=g.i.concat(b)),U){case 1:Li(d,5);break;case 4:Li(d,10);break;case 3:Li(d,6);break;default:Li(d,2)}}}function by(d,g){let b=d.Qa+Math.floor(Math.random()*d.Za);return d.isActive()||(b*=2),b*g}function Li(d,g){if(d.j.info("Error code "+g),g==2){var b=u(d.bb,d),j=d.Ua;const U=!j;j=new at(j||"//www.google.com/images/cleardot.gif"),o.location&&o.location.protocol=="http"||We(j,"https"),rr(j),U?KT(j.toString(),b):QT(j.toString(),b)}else De(2);d.I=0,d.l&&d.l.pa(g),_y(d),my(d)}t.bb=function(d){d?(this.j.info("Successfully pinged google.com"),De(2)):(this.j.info("Failed to ping google.com"),De(1))};function _y(d){if(d.I=0,d.ja=[],d.l){const g=xe(d.h);(g.length!=0||d.i.length!=0)&&(x(d.ja,g),x(d.ja,d.i),d.h.i.length=0,p(d.i),d.i.length=0),d.l.oa()}}function Ey(d,g,b){var j=b instanceof at?ke(b):new at(b);if(j.g!="")g&&(j.g=g+"."+j.g),qe(j,j.u);else{var U=o.location;j=U.protocol,g=g?g+"."+U.hostname:U.hostname,U=+U.port;const q=new at(null);j&&We(q,j),g&&(q.g=g),U&&qe(q,U),b&&(q.h=b),j=q}return b=d.G,g=d.wa,b&&g&&nt(j,b,g),nt(j,"VER",d.ka),$a(d,j),j}function Sy(d,g,b){if(g&&!d.L)throw Error("Can't create secondary domain capable XhrIo object.");return g=d.Aa&&!d.ma?new Ft(new Uh({ab:b})):new Ft(d.ma),g.Fa(d.L),g}t.isActive=function(){return!!this.l&&this.l.isActive(this)};function Ty(){}t=Ty.prototype,t.ra=function(){},t.qa=function(){},t.pa=function(){},t.oa=function(){},t.isActive=function(){return!0},t.Ka=function(){};function $c(){}$c.prototype.g=function(d,g){return new ir(d,g)};function ir(d,g){Ue.call(this),this.g=new py(g),this.l=d,this.h=g&&g.messageUrlParams||null,d=g&&g.messageHeaders||null,g&&g.clientProtocolHeaderRequired&&(d?d["X-Client-Protocol"]="webchannel":d={"X-Client-Protocol":"webchannel"}),this.g.o=d,d=g&&g.initMessageHeaders||null,g&&g.messageContentType&&(d?d["X-WebChannel-Content-Type"]=g.messageContentType:d={"X-WebChannel-Content-Type":g.messageContentType}),g&&g.sa&&(d?d["X-WebChannel-Client-Profile"]=g.sa:d={"X-WebChannel-Client-Profile":g.sa}),this.g.U=d,(d=g&&g.Qb)&&!k(d)&&(this.g.u=d),this.A=g&&g.supportsCrossDomainXhr||!1,this.v=g&&g.sendRawJson||!1,(g=g&&g.httpSessionIdParam)&&!k(g)&&(this.g.G=g,d=this.h,d!==null&&g in d&&(d=this.h,g in d&&delete d[g])),this.j=new _o(this)}h(ir,Ue),ir.prototype.m=function(){this.g.l=this.j,this.A&&(this.g.L=!0),this.g.connect(this.l,this.h||void 0)},ir.prototype.close=function(){$h(this.g)},ir.prototype.o=function(d){var g=this.g;if(typeof d=="string"){var b={};b.__data__=d,d=b}else this.v&&(b={},b.__data__=_e(d),d=b);g.i.push(new Dc(g.Ya++,d)),g.I==3&&Uc(g)},ir.prototype.N=function(){this.g.l=null,delete this.j,$h(this.g),delete this.g,ir.Z.N.call(this)};function Ny(d){Le.call(this),d.__headers__&&(this.headers=d.__headers__,this.statusCode=d.__status__,delete d.__headers__,delete d.__status__);var g=d.__sm__;if(g){e:{for(const b in g){d=b;break e}d=void 0}(this.i=d)&&(d=this.i,g=g!==null&&d in g?g[d]:void 0),this.data=g}else this.data=d}h(Ny,Le);function ky(){$.call(this),this.status=1}h(ky,$);function _o(d){this.g=d}h(_o,Ty),_o.prototype.ra=function(){vt(this.g,"a")},_o.prototype.qa=function(d){vt(this.g,new Ny(d))},_o.prototype.pa=function(d){vt(this.g,new ky)},_o.prototype.oa=function(){vt(this.g,"b")},$c.prototype.createWebChannel=$c.prototype.g,ir.prototype.send=ir.prototype.o,ir.prototype.open=ir.prototype.m,ir.prototype.close=ir.prototype.close,_E=function(){return new $c},bE=function(){return ge()},wE=J,im={jb:0,mb:1,nb:2,Hb:3,Mb:4,Jb:5,Kb:6,Ib:7,Gb:8,Lb:9,PROXY:10,NOPROXY:11,Eb:12,Ab:13,Bb:14,zb:15,Cb:16,Db:17,fb:18,eb:19,gb:20},ct.NO_ERROR=0,ct.TIMEOUT=8,ct.HTTP_ERROR=6,Du=ct,Ge.COMPLETE="complete",vE=Ge,se.EventType=de,de.OPEN="a",de.CLOSE="b",de.ERROR="c",de.MESSAGE="d",Ue.prototype.listen=Ue.prototype.J,al=se,Ft.prototype.listenOnce=Ft.prototype.K,Ft.prototype.getLastError=Ft.prototype.Ha,Ft.prototype.getLastErrorCode=Ft.prototype.ya,Ft.prototype.getStatus=Ft.prototype.ca,Ft.prototype.getResponseJson=Ft.prototype.La,Ft.prototype.getResponseText=Ft.prototype.la,Ft.prototype.send=Ft.prototype.ea,Ft.prototype.setWithCredentials=Ft.prototype.Fa,xE=Ft}).apply(typeof uu<"u"?uu:typeof self<"u"?self:typeof window<"u"?window:{});/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Nn{constructor(e){this.uid=e}isAuthenticated(){return this.uid!=null}toKey(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}isEqual(e){return e.uid===this.uid}}Nn.UNAUTHENTICATED=new Nn(null),Nn.GOOGLE_CREDENTIALS=new Nn("google-credentials-uid"),Nn.FIRST_PARTY=new Nn("first-party-uid"),Nn.MOCK_USER=new Nn("mock-user");/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */let Ta="12.11.0";function AA(t){Ta=t}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *//** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const io=new zg("@firebase/firestore");function No(){return io.logLevel}function ye(t,...e){if(io.logLevel<=Ye.DEBUG){const n=e.map($g);io.debug(`Firestore (${Ta}): ${t}`,...n)}}function As(t,...e){if(io.logLevel<=Ye.ERROR){const n=e.map($g);io.error(`Firestore (${Ta}): ${t}`,...n)}}function oo(t,...e){if(io.logLevel<=Ye.WARN){const n=e.map($g);io.warn(`Firestore (${Ta}): ${t}`,...n)}}function $g(t){if(typeof t=="string")return t;try{return function(n){return JSON.stringify(n)}(t)}catch{return t}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Ce(t,e,n){let r="Unexpected state";typeof e=="string"?r=e:n=e,EE(t,r,n)}function EE(t,e,n){let r=`FIRESTORE (${Ta}) INTERNAL ASSERTION FAILED: ${e} (ID: ${t.toString(16)})`;if(n!==void 0)try{r+=" CONTEXT: "+JSON.stringify(n)}catch{r+=" CONTEXT: "+n}throw As(r),new Error(r)}function ut(t,e,n,r){let s="Unexpected state";typeof n=="string"?s=n:r=n,t||EE(e,s,r)}function Oe(t,e){return t}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Y={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENTED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"};class fe extends cs{constructor(e,n){super(e,n),this.code=e,this.message=n,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Es{constructor(){this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class SE{constructor(e,n){this.user=n,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}}class jA{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,n){e.enqueueRetryable(()=>n(Nn.UNAUTHENTICATED))}shutdown(){}}class PA{constructor(e){this.token=e,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(e,n){this.changeListener=n,e.enqueueRetryable(()=>n(this.token.user))}shutdown(){this.changeListener=null}}class RA{constructor(e){this.t=e,this.currentUser=Nn.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,n){ut(this.o===void 0,42304);let r=this.i;const s=c=>this.i!==r?(r=this.i,n(c)):Promise.resolve();let i=new Es;this.o=()=>{this.i++,this.currentUser=this.u(),i.resolve(),i=new Es,e.enqueueRetryable(()=>s(this.currentUser))};const o=()=>{const c=i;e.enqueueRetryable(async()=>{await c.promise,await s(this.currentUser)})},l=c=>{ye("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=c,this.o&&(this.auth.addAuthTokenListener(this.o),o())};this.t.onInit(c=>l(c)),setTimeout(()=>{if(!this.auth){const c=this.t.getImmediate({optional:!0});c?l(c):(ye("FirebaseAuthCredentialsProvider","Auth not yet detected"),i.resolve(),i=new Es)}},0),o()}getToken(){const e=this.i,n=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(n).then(r=>this.i!==e?(ye("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):r?(ut(typeof r.accessToken=="string",31837,{l:r}),new SE(r.accessToken,this.currentUser)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.o&&this.auth.removeAuthTokenListener(this.o),this.o=void 0}u(){const e=this.auth&&this.auth.getUid();return ut(e===null||typeof e=="string",2055,{h:e}),new Nn(e)}}class DA{constructor(e,n,r){this.P=e,this.T=n,this.I=r,this.type="FirstParty",this.user=Nn.FIRST_PARTY,this.R=new Map}A(){return this.I?this.I():null}get headers(){this.R.set("X-Goog-AuthUser",this.P);const e=this.A();return e&&this.R.set("Authorization",e),this.T&&this.R.set("X-Goog-Iam-Authorization-Token",this.T),this.R}}class MA{constructor(e,n,r){this.P=e,this.T=n,this.I=r}getToken(){return Promise.resolve(new DA(this.P,this.T,this.I))}start(e,n){e.enqueueRetryable(()=>n(Nn.FIRST_PARTY))}shutdown(){}invalidateToken(){}}class nv{constructor(e){this.value=e,this.type="AppCheck",this.headers=new Map,e&&e.length>0&&this.headers.set("x-firebase-appcheck",this.value)}}class LA{constructor(e,n){this.V=n,this.forceRefresh=!1,this.appCheck=null,this.m=null,this.p=null,Pr(e)&&e.settings.appCheckToken&&(this.p=e.settings.appCheckToken)}start(e,n){ut(this.o===void 0,3512);const r=i=>{i.error!=null&&ye("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${i.error.message}`);const o=i.token!==this.m;return this.m=i.token,ye("FirebaseAppCheckTokenProvider",`Received ${o?"new":"existing"} token.`),o?n(i.token):Promise.resolve()};this.o=i=>{e.enqueueRetryable(()=>r(i))};const s=i=>{ye("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=i,this.o&&this.appCheck.addTokenListener(this.o)};this.V.onInit(i=>s(i)),setTimeout(()=>{if(!this.appCheck){const i=this.V.getImmediate({optional:!0});i?s(i):ye("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}},0)}getToken(){if(this.p)return Promise.resolve(new nv(this.p));const e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then(n=>n?(ut(typeof n.token=="string",44558,{tokenResult:n}),this.m=n.token,new nv(n.token)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.o&&this.appCheck.removeTokenListener(this.o),this.o=void 0}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function OA(t){const e=typeof self<"u"&&(self.crypto||self.msCrypto),n=new Uint8Array(t);if(e&&typeof e.getRandomValues=="function")e.getRandomValues(n);else for(let r=0;re?1:0}function om(t,e){const n=Math.min(t.length,e.length);for(let r=0;r=VA&&e<=FA}function pa(t,e,n){return t.length===e.length&&t.every((r,s)=>n(r,e[s]))}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const rv="__name__";class Gr{constructor(e,n,r){n===void 0?n=0:n>e.length&&Ce(637,{offset:n,range:e.length}),r===void 0?r=e.length-n:r>e.length-n&&Ce(1746,{length:r,range:e.length-n}),this.segments=e,this.offset=n,this.len=r}get length(){return this.len}isEqual(e){return Gr.comparator(this,e)===0}child(e){const n=this.segments.slice(this.offset,this.limit());return e instanceof Gr?e.forEach(r=>{n.push(r)}):n.push(e),this.construct(n)}limit(){return this.offset+this.length}popFirst(e){return e=e===void 0?1:e,this.construct(this.segments,this.offset+e,this.length-e)}popLast(){return this.construct(this.segments,this.offset,this.length-1)}firstSegment(){return this.segments[this.offset]}lastSegment(){return this.get(this.length-1)}get(e){return this.segments[this.offset+e]}isEmpty(){return this.length===0}isPrefixOf(e){if(e.length=0)throw new fe(Y.INVALID_ARGUMENT,`Invalid segment (${r}). Paths must not contain // in them.`);n.push(...r.split("/").filter(s=>s.length>0))}return new Et(n)}static emptyPath(){return new Et([])}}const zA=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class yn extends Gr{construct(e,n,r){return new yn(e,n,r)}static isValidIdentifier(e){return zA.test(e)}canonicalString(){return this.toArray().map(e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),yn.isValidIdentifier(e)||(e="`"+e+"`"),e)).join(".")}toString(){return this.canonicalString()}isKeyField(){return this.length===1&&this.get(0)===rv}static keyField(){return new yn([rv])}static fromServerFormat(e){const n=[];let r="",s=0;const i=()=>{if(r.length===0)throw new fe(Y.INVALID_ARGUMENT,`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);n.push(r),r=""};let o=!1;for(;s=2&&this.path.get(this.path.length-2)===e}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(e){return e!==null&&Et.comparator(this.path,e.path)===0}toString(){return this.path.toString()}static comparator(e,n){return Et.comparator(e.path,n.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new Ne(new Et(e.slice()))}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function TE(t,e,n){if(!n)throw new fe(Y.INVALID_ARGUMENT,`Function ${t}() cannot be called with an empty ${e}.`)}function UA(t,e,n,r){if(e===!0&&r===!0)throw new fe(Y.INVALID_ARGUMENT,`${t} and ${n} cannot be used together.`)}function sv(t){if(!Ne.isDocumentKey(t))throw new fe(Y.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`)}function iv(t){if(Ne.isDocumentKey(t))throw new fe(Y.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`)}function NE(t){return typeof t=="object"&&t!==null&&(Object.getPrototypeOf(t)===Object.prototype||Object.getPrototypeOf(t)===null)}function mh(t){if(t===void 0)return"undefined";if(t===null)return"null";if(typeof t=="string")return t.length>20&&(t=`${t.substring(0,20)}...`),JSON.stringify(t);if(typeof t=="number"||typeof t=="boolean")return""+t;if(typeof t=="object"){if(t instanceof Array)return"an array";{const e=function(r){return r.constructor?r.constructor.name:null}(t);return e?`a custom ${e} object`:"an object"}}return typeof t=="function"?"a function":Ce(12329,{type:typeof t})}function Ln(t,e){if("_delegate"in t&&(t=t._delegate),!(t instanceof e)){if(e.name===t.constructor.name)throw new fe(Y.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const n=mh(t);throw new fe(Y.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${n}`)}}return t}/** + * @license + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Xt(t,e){const n={typeString:t};return e&&(n.value=e),n}function mc(t,e){if(!NE(t))throw new fe(Y.INVALID_ARGUMENT,"JSON must be an object");let n;for(const r in e)if(e[r]){const s=e[r].typeString,i="value"in e[r]?{value:e[r].value}:void 0;if(!(r in t)){n=`JSON missing required field: '${r}'`;break}const o=t[r];if(s&&typeof o!==s){n=`JSON field '${r}' must be a ${s}.`;break}if(i!==void 0&&o!==i.value){n=`Expected '${r}' field to equal '${i.value}'`;break}}if(n)throw new fe(Y.INVALID_ARGUMENT,n);return!0}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const ov=-62135596800,av=1e6;class Ke{static now(){return Ke.fromMillis(Date.now())}static fromDate(e){return Ke.fromMillis(e.getTime())}static fromMillis(e){const n=Math.floor(e/1e3),r=Math.floor((e-1e3*n)*av);return new Ke(n,r)}constructor(e,n){if(this.seconds=e,this.nanoseconds=n,n<0)throw new fe(Y.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+n);if(n>=1e9)throw new fe(Y.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+n);if(e=253402300800)throw new fe(Y.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/av}_compareTo(e){return this.seconds===e.seconds?Xe(this.nanoseconds,e.nanoseconds):Xe(this.seconds,e.seconds)}isEqual(e){return e.seconds===this.seconds&&e.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{type:Ke._jsonSchemaVersion,seconds:this.seconds,nanoseconds:this.nanoseconds}}static fromJSON(e){if(mc(e,Ke._jsonSchema))return new Ke(e.seconds,e.nanoseconds)}valueOf(){const e=this.seconds-ov;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}Ke._jsonSchemaVersion="firestore/timestamp/1.0",Ke._jsonSchema={type:Xt("string",Ke._jsonSchemaVersion),seconds:Xt("number"),nanoseconds:Xt("number")};/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Me{static fromTimestamp(e){return new Me(e)}static min(){return new Me(new Ke(0,0))}static max(){return new Me(new Ke(253402300799,999999999))}constructor(e){this.timestamp=e}compareTo(e){return this.timestamp._compareTo(e.timestamp)}isEqual(e){return this.timestamp.isEqual(e.timestamp)}toMicroseconds(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}toString(){return"SnapshotVersion("+this.timestamp.toString()+")"}toTimestamp(){return this.timestamp}}/** + * @license + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Wl=-1;function BA(t,e){const n=t.toTimestamp().seconds,r=t.toTimestamp().nanoseconds+1,s=Me.fromTimestamp(r===1e9?new Ke(n+1,0):new Ke(n,r));return new wi(s,Ne.empty(),e)}function $A(t){return new wi(t.readTime,t.key,Wl)}class wi{constructor(e,n,r){this.readTime=e,this.documentKey=n,this.largestBatchId=r}static min(){return new wi(Me.min(),Ne.empty(),Wl)}static max(){return new wi(Me.max(),Ne.empty(),Wl)}}function HA(t,e){let n=t.readTime.compareTo(e.readTime);return n!==0?n:(n=Ne.comparator(t.documentKey,e.documentKey),n!==0?n:Xe(t.largestBatchId,e.largestBatchId))}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const qA="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.";class GA{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach(e=>e())}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function Na(t){if(t.code!==Y.FAILED_PRECONDITION||t.message!==qA)throw t;ye("LocalStore","Unexpectedly lost primary lease")}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Z{constructor(e){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,e(n=>{this.isDone=!0,this.result=n,this.nextCallback&&this.nextCallback(n)},n=>{this.isDone=!0,this.error=n,this.catchCallback&&this.catchCallback(n)})}catch(e){return this.next(void 0,e)}next(e,n){return this.callbackAttached&&Ce(59440),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(n,this.error):this.wrapSuccess(e,this.result):new Z((r,s)=>{this.nextCallback=i=>{this.wrapSuccess(e,i).next(r,s)},this.catchCallback=i=>{this.wrapFailure(n,i).next(r,s)}})}toPromise(){return new Promise((e,n)=>{this.next(e,n)})}wrapUserFunction(e){try{const n=e();return n instanceof Z?n:Z.resolve(n)}catch(n){return Z.reject(n)}}wrapSuccess(e,n){return e?this.wrapUserFunction(()=>e(n)):Z.resolve(n)}wrapFailure(e,n){return e?this.wrapUserFunction(()=>e(n)):Z.reject(n)}static resolve(e){return new Z((n,r)=>{n(e)})}static reject(e){return new Z((n,r)=>{r(e)})}static waitFor(e){return new Z((n,r)=>{let s=0,i=0,o=!1;e.forEach(l=>{++s,l.next(()=>{++i,o&&i===s&&n()},c=>r(c))}),o=!0,i===s&&n()})}static or(e){let n=Z.resolve(!1);for(const r of e)n=n.next(s=>s?Z.resolve(s):r());return n}static forEach(e,n){const r=[];return e.forEach((s,i)=>{r.push(n.call(this,s,i))}),this.waitFor(r)}static mapArray(e,n){return new Z((r,s)=>{const i=e.length,o=new Array(i);let l=0;for(let c=0;c{o[u]=f,++l,l===i&&r(o)},f=>s(f))}})}static doWhile(e,n){return new Z((r,s)=>{const i=()=>{e()===!0?n().next(()=>{i()},s):r()};i()})}}function WA(t){const e=t.match(/Android ([\d.]+)/i),n=e?e[1].split(".").slice(0,2).join("."):"-1";return Number(n)}function ka(t){return t.name==="IndexedDbTransactionError"}/** + * @license + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class gh{constructor(e,n){this.previousValue=e,n&&(n.sequenceNumberHandler=r=>this.ae(r),this.ue=r=>n.writeSequenceNumber(r))}ae(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){const e=++this.previousValue;return this.ue&&this.ue(e),e}}gh.ce=-1;/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const qg=-1;function yh(t){return t==null}function _d(t){return t===0&&1/t==-1/0}function KA(t){return typeof t=="number"&&Number.isInteger(t)&&!_d(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const kE="";function QA(t){let e="";for(let n=0;n0&&(e=lv(e)),e=YA(t.get(n),e);return lv(e)}function YA(t,e){let n=e;const r=t.length;for(let s=0;s0&&(n=n.right)}return null}indexOf(e){let n=0,r=this.root;for(;!r.isEmpty();){const s=this.comparator(e,r.key);if(s===0)return n+r.left.size;s<0?r=r.left:(n+=r.left.size+1,r=r.right)}return-1}isEmpty(){return this.root.isEmpty()}get size(){return this.root.size}minKey(){return this.root.minKey()}maxKey(){return this.root.maxKey()}inorderTraversal(e){return this.root.inorderTraversal(e)}forEach(e){this.inorderTraversal((n,r)=>(e(n,r),!1))}toString(){const e=[];return this.inorderTraversal((n,r)=>(e.push(`${n}:${r}`),!1)),`{${e.join(", ")}}`}reverseTraversal(e){return this.root.reverseTraversal(e)}getIterator(){return new du(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new du(this.root,e,this.comparator,!1)}getReverseIterator(){return new du(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new du(this.root,e,this.comparator,!0)}}class du{constructor(e,n,r,s){this.isReverse=s,this.nodeStack=[];let i=1;for(;!e.isEmpty();)if(i=n?r(e.key,n):1,n&&s&&(i*=-1),i<0)e=this.isReverse?e.left:e.right;else{if(i===0){this.nodeStack.push(e);break}this.nodeStack.push(e),e=this.isReverse?e.right:e.left}}getNext(){let e=this.nodeStack.pop();const n={key:e.key,value:e.value};if(this.isReverse)for(e=e.left;!e.isEmpty();)this.nodeStack.push(e),e=e.right;else for(e=e.right;!e.isEmpty();)this.nodeStack.push(e),e=e.left;return n}hasNext(){return this.nodeStack.length>0}peek(){if(this.nodeStack.length===0)return null;const e=this.nodeStack[this.nodeStack.length-1];return{key:e.key,value:e.value}}}class gn{constructor(e,n,r,s,i){this.key=e,this.value=n,this.color=r??gn.RED,this.left=s??gn.EMPTY,this.right=i??gn.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,n,r,s,i){return new gn(e??this.key,n??this.value,r??this.color,s??this.left,i??this.right)}isEmpty(){return!1}inorderTraversal(e){return this.left.inorderTraversal(e)||e(this.key,this.value)||this.right.inorderTraversal(e)}reverseTraversal(e){return this.right.reverseTraversal(e)||e(this.key,this.value)||this.left.reverseTraversal(e)}min(){return this.left.isEmpty()?this:this.left.min()}minKey(){return this.min().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(e,n,r){let s=this;const i=r(e,s.key);return s=i<0?s.copy(null,null,null,s.left.insert(e,n,r),null):i===0?s.copy(null,n,null,null,null):s.copy(null,null,null,null,s.right.insert(e,n,r)),s.fixUp()}removeMin(){if(this.left.isEmpty())return gn.EMPTY;let e=this;return e.left.isRed()||e.left.left.isRed()||(e=e.moveRedLeft()),e=e.copy(null,null,null,e.left.removeMin(),null),e.fixUp()}remove(e,n){let r,s=this;if(n(e,s.key)<0)s.left.isEmpty()||s.left.isRed()||s.left.left.isRed()||(s=s.moveRedLeft()),s=s.copy(null,null,null,s.left.remove(e,n),null);else{if(s.left.isRed()&&(s=s.rotateRight()),s.right.isEmpty()||s.right.isRed()||s.right.left.isRed()||(s=s.moveRedRight()),n(e,s.key)===0){if(s.right.isEmpty())return gn.EMPTY;r=s.right.min(),s=s.copy(r.key,r.value,null,null,s.right.removeMin())}s=s.copy(null,null,null,null,s.right.remove(e,n))}return s.fixUp()}isRed(){return this.color}fixUp(){let e=this;return e.right.isRed()&&!e.left.isRed()&&(e=e.rotateLeft()),e.left.isRed()&&e.left.left.isRed()&&(e=e.rotateRight()),e.left.isRed()&&e.right.isRed()&&(e=e.colorFlip()),e}moveRedLeft(){let e=this.colorFlip();return e.right.left.isRed()&&(e=e.copy(null,null,null,null,e.right.rotateRight()),e=e.rotateLeft(),e=e.colorFlip()),e}moveRedRight(){let e=this.colorFlip();return e.left.left.isRed()&&(e=e.rotateRight(),e=e.colorFlip()),e}rotateLeft(){const e=this.copy(null,null,gn.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){const e=this.copy(null,null,gn.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)}colorFlip(){const e=this.left.copy(null,null,!this.left.color,null,null),n=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,n)}checkMaxDepth(){const e=this.check();return Math.pow(2,e)<=this.size+1}check(){if(this.isRed()&&this.left.isRed())throw Ce(43730,{key:this.key,value:this.value});if(this.right.isRed())throw Ce(14113,{key:this.key,value:this.value});const e=this.left.check();if(e!==this.right.check())throw Ce(27949);return e+(this.isRed()?0:1)}}gn.EMPTY=null,gn.RED=!0,gn.BLACK=!1;gn.EMPTY=new class{constructor(){this.size=0}get key(){throw Ce(57766)}get value(){throw Ce(16141)}get color(){throw Ce(16727)}get left(){throw Ce(29726)}get right(){throw Ce(36894)}copy(e,n,r,s,i){return this}insert(e,n,r){return new gn(e,n)}remove(e,n){return this}isEmpty(){return!0}inorderTraversal(e){return!1}reverseTraversal(e){return!1}minKey(){return null}maxKey(){return null}isRed(){return!1}checkMaxDepth(){return!0}check(){return 0}};/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class rn{constructor(e){this.comparator=e,this.data=new Lt(this.comparator)}has(e){return this.data.get(e)!==null}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(e){return this.data.indexOf(e)}forEach(e){this.data.inorderTraversal((n,r)=>(e(n),!1))}forEachInRange(e,n){const r=this.data.getIteratorFrom(e[0]);for(;r.hasNext();){const s=r.getNext();if(this.comparator(s.key,e[1])>=0)return;n(s.key)}}forEachWhile(e,n){let r;for(r=n!==void 0?this.data.getIteratorFrom(n):this.data.getIterator();r.hasNext();)if(!e(r.getNext().key))return}firstAfterOrEqual(e){const n=this.data.getIteratorFrom(e);return n.hasNext()?n.getNext().key:null}getIterator(){return new uv(this.data.getIterator())}getIteratorFrom(e){return new uv(this.data.getIteratorFrom(e))}add(e){return this.copy(this.data.remove(e).insert(e,!0))}delete(e){return this.has(e)?this.copy(this.data.remove(e)):this}isEmpty(){return this.data.isEmpty()}unionWith(e){let n=this;return n.size{n=n.add(r)}),n}isEqual(e){if(!(e instanceof rn)||this.size!==e.size)return!1;const n=this.data.getIterator(),r=e.data.getIterator();for(;n.hasNext();){const s=n.getNext().key,i=r.getNext().key;if(this.comparator(s,i)!==0)return!1}return!0}toArray(){const e=[];return this.forEach(n=>{e.push(n)}),e}toString(){const e=[];return this.forEach(n=>e.push(n)),"SortedSet("+e.toString()+")"}copy(e){const n=new rn(this.comparator);return n.data=e,n}}class uv{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class ur{constructor(e){this.fields=e,e.sort(yn.comparator)}static empty(){return new ur([])}unionWith(e){let n=new rn(yn.comparator);for(const r of this.fields)n=n.add(r);for(const r of e)n=n.add(r);return new ur(n.toArray())}covers(e){for(const n of this.fields)if(n.isPrefixOf(e))return!0;return!1}isEqual(e){return pa(this.fields,e.fields,(n,r)=>n.isEqual(r))}}/** + * @license + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class CE extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class wn{constructor(e){this.binaryString=e}static fromBase64String(e){const n=function(s){try{return atob(s)}catch(i){throw typeof DOMException<"u"&&i instanceof DOMException?new CE("Invalid base64 string: "+i):i}}(e);return new wn(n)}static fromUint8Array(e){const n=function(s){let i="";for(let o=0;oeis(n,e))!==void 0}function ma(t,e){if(t===e)return 0;const n=Ei(t),r=Ei(e);if(n!==r)return Xe(n,r);switch(n){case 0:case 9007199254740991:return 0;case 1:return Xe(t.booleanValue,e.booleanValue);case 2:return function(i,o){const l=Ht(i.integerValue||i.doubleValue),c=Ht(o.integerValue||o.doubleValue);return lc?1:l===c?0:isNaN(l)?isNaN(c)?0:-1:1}(t,e);case 3:return dv(t.timestampValue,e.timestampValue);case 4:return dv(Kl(t),Kl(e));case 5:return om(t.stringValue,e.stringValue);case 6:return function(i,o){const l=_i(i),c=_i(o);return l.compareTo(c)}(t.bytesValue,e.bytesValue);case 7:return function(i,o){const l=i.split("/"),c=o.split("/");for(let u=0;us+Mu(i),0)}(t.arrayValue);case 10:case 11:return function(r){let s=0;return Ai(r.fields,(i,o)=>{s+=i.length+Mu(o)}),s}(t.mapValue);default:throw Ce(13486,{value:t})}}function fv(t,e){return{referenceValue:`projects/${t.projectId}/databases/${t.database}/documents/${e.path.canonicalString()}`}}function lm(t){return!!t&&"integerValue"in t}function Wg(t){return!!t&&"arrayValue"in t}function pv(t){return!!t&&"nullValue"in t}function mv(t){return!!t&&"doubleValue"in t&&isNaN(Number(t.doubleValue))}function Lu(t){return!!t&&"mapValue"in t}function tj(t){var n,r;return((r=(((n=t==null?void 0:t.mapValue)==null?void 0:n.fields)||{})[DE])==null?void 0:r.stringValue)===ME}function wl(t){if(t.geoPointValue)return{geoPointValue:{...t.geoPointValue}};if(t.timestampValue&&typeof t.timestampValue=="object")return{timestampValue:{...t.timestampValue}};if(t.mapValue){const e={mapValue:{fields:{}}};return Ai(t.mapValue.fields,(n,r)=>e.mapValue.fields[n]=wl(r)),e}if(t.arrayValue){const e={arrayValue:{values:[]}};for(let n=0;n<(t.arrayValue.values||[]).length;++n)e.arrayValue.values[n]=wl(t.arrayValue.values[n]);return e}return{...t}}function nj(t){return(((t.mapValue||{}).fields||{}).__type__||{}).stringValue===ej}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Qn{constructor(e){this.value=e}static empty(){return new Qn({mapValue:{}})}field(e){if(e.isEmpty())return this.value;{let n=this.value;for(let r=0;r{if(!n.isImmediateParentOf(l)){const c=this.getFieldsMap(n);this.applyChanges(c,r,s),r={},s=[],n=l.popLast()}o?r[l.lastSegment()]=wl(o):s.push(l.lastSegment())});const i=this.getFieldsMap(n);this.applyChanges(i,r,s)}delete(e){const n=this.field(e.popLast());Lu(n)&&n.mapValue.fields&&delete n.mapValue.fields[e.lastSegment()]}isEqual(e){return is(this.value,e.value)}getFieldsMap(e){let n=this.value;n.mapValue.fields||(n.mapValue={fields:{}});for(let r=0;re[s]=i);for(const s of r)delete e[s]}clone(){return new Qn(wl(this.value))}}function LE(t){const e=[];return Ai(t.fields,(n,r)=>{const s=new yn([n]);if(Lu(r)){const i=LE(r.mapValue).fields;if(i.length===0)e.push(s);else for(const o of i)e.push(s.child(o))}else e.push(s)}),new ur(e)}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class In{constructor(e,n,r,s,i,o,l){this.key=e,this.documentType=n,this.version=r,this.readTime=s,this.createTime=i,this.data=o,this.documentState=l}static newInvalidDocument(e){return new In(e,0,Me.min(),Me.min(),Me.min(),Qn.empty(),0)}static newFoundDocument(e,n,r,s){return new In(e,1,n,Me.min(),r,s,0)}static newNoDocument(e,n){return new In(e,2,n,Me.min(),Me.min(),Qn.empty(),0)}static newUnknownDocument(e,n){return new In(e,3,n,Me.min(),Me.min(),Qn.empty(),2)}convertToFoundDocument(e,n){return!this.createTime.isEqual(Me.min())||this.documentType!==2&&this.documentType!==0||(this.createTime=e),this.version=e,this.documentType=1,this.data=n,this.documentState=0,this}convertToNoDocument(e){return this.version=e,this.documentType=2,this.data=Qn.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=Qn.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=Me.min(),this}setReadTime(e){return this.readTime=e,this}get hasLocalMutations(){return this.documentState===1}get hasCommittedMutations(){return this.documentState===2}get hasPendingWrites(){return this.hasLocalMutations||this.hasCommittedMutations}isValidDocument(){return this.documentType!==0}isFoundDocument(){return this.documentType===1}isNoDocument(){return this.documentType===2}isUnknownDocument(){return this.documentType===3}isEqual(e){return e instanceof In&&this.key.isEqual(e.key)&&this.version.isEqual(e.version)&&this.documentType===e.documentType&&this.documentState===e.documentState&&this.data.isEqual(e.data)}mutableCopy(){return new In(this.key,this.documentType,this.version,this.readTime,this.createTime,this.data.clone(),this.documentState)}toString(){return`Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {createTime: ${this.createTime}}), {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`}}/** + * @license + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Td{constructor(e,n){this.position=e,this.inclusive=n}}function gv(t,e,n){let r=0;for(let s=0;s":return e>0;case">=":return e>=0;default:return Ce(47266,{operator:this.op})}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}}class Fr extends OE{constructor(e,n){super(),this.filters=e,this.op=n,this.Pe=null}static create(e,n){return new Fr(e,n)}matches(e){return VE(this)?this.filters.find(n=>!n.matches(e))===void 0:this.filters.find(n=>n.matches(e))!==void 0}getFlattenedFilters(){return this.Pe!==null||(this.Pe=this.filters.reduce((e,n)=>e.concat(n.getFlattenedFilters()),[])),this.Pe}getFilters(){return Object.assign([],this.filters)}}function VE(t){return t.op==="and"}function FE(t){return sj(t)&&VE(t)}function sj(t){for(const e of t.filters)if(e instanceof Fr)return!1;return!0}function cm(t){if(t instanceof Yt)return t.field.canonicalString()+t.op.toString()+ga(t.value);if(FE(t))return t.filters.map(e=>cm(e)).join(",");{const e=t.filters.map(n=>cm(n)).join(",");return`${t.op}(${e})`}}function zE(t,e){return t instanceof Yt?function(r,s){return s instanceof Yt&&r.op===s.op&&r.field.isEqual(s.field)&&is(r.value,s.value)}(t,e):t instanceof Fr?function(r,s){return s instanceof Fr&&r.op===s.op&&r.filters.length===s.filters.length?r.filters.reduce((i,o,l)=>i&&zE(o,s.filters[l]),!0):!1}(t,e):void Ce(19439)}function UE(t){return t instanceof Yt?function(n){return`${n.field.canonicalString()} ${n.op} ${ga(n.value)}`}(t):t instanceof Fr?function(n){return n.op.toString()+" {"+n.getFilters().map(UE).join(" ,")+"}"}(t):"Filter"}class ij extends Yt{constructor(e,n,r){super(e,n,r),this.key=Ne.fromName(r.referenceValue)}matches(e){const n=Ne.comparator(e.key,this.key);return this.matchesComparison(n)}}class oj extends Yt{constructor(e,n){super(e,"in",n),this.keys=BE("in",n)}matches(e){return this.keys.some(n=>n.isEqual(e.key))}}class aj extends Yt{constructor(e,n){super(e,"not-in",n),this.keys=BE("not-in",n)}matches(e){return!this.keys.some(n=>n.isEqual(e.key))}}function BE(t,e){var n;return(((n=e.arrayValue)==null?void 0:n.values)||[]).map(r=>Ne.fromName(r.referenceValue))}class lj extends Yt{constructor(e,n){super(e,"array-contains",n)}matches(e){const n=e.data.field(this.field);return Wg(n)&&Yl(n.arrayValue,this.value)}}class cj extends Yt{constructor(e,n){super(e,"in",n)}matches(e){const n=e.data.field(this.field);return n!==null&&Yl(this.value.arrayValue,n)}}class uj extends Yt{constructor(e,n){super(e,"not-in",n)}matches(e){if(Yl(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const n=e.data.field(this.field);return n!==null&&n.nullValue===void 0&&!Yl(this.value.arrayValue,n)}}class dj extends Yt{constructor(e,n){super(e,"array-contains-any",n)}matches(e){const n=e.data.field(this.field);return!(!Wg(n)||!n.arrayValue.values)&&n.arrayValue.values.some(r=>Yl(this.value.arrayValue,r))}}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class hj{constructor(e,n=null,r=[],s=[],i=null,o=null,l=null){this.path=e,this.collectionGroup=n,this.orderBy=r,this.filters=s,this.limit=i,this.startAt=o,this.endAt=l,this.Te=null}}function xv(t,e=null,n=[],r=[],s=null,i=null,o=null){return new hj(t,e,n,r,s,i,o)}function Kg(t){const e=Oe(t);if(e.Te===null){let n=e.path.canonicalString();e.collectionGroup!==null&&(n+="|cg:"+e.collectionGroup),n+="|f:",n+=e.filters.map(r=>cm(r)).join(","),n+="|ob:",n+=e.orderBy.map(r=>function(i){return i.field.canonicalString()+i.dir}(r)).join(","),yh(e.limit)||(n+="|l:",n+=e.limit),e.startAt&&(n+="|lb:",n+=e.startAt.inclusive?"b:":"a:",n+=e.startAt.position.map(r=>ga(r)).join(",")),e.endAt&&(n+="|ub:",n+=e.endAt.inclusive?"a:":"b:",n+=e.endAt.position.map(r=>ga(r)).join(",")),e.Te=n}return e.Te}function Qg(t,e){if(t.limit!==e.limit||t.orderBy.length!==e.orderBy.length)return!1;for(let n=0;n0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc";(function(o){let l=new rn(yn.comparator);return o.filters.forEach(c=>{c.getFlattenedFilters().forEach(u=>{u.isInequality()&&(l=l.add(u.field))})}),l})(e).forEach(i=>{n.has(i.canonicalString())||i.isKeyField()||e.Ee.push(new Xl(i,r))}),n.has(yn.keyField().canonicalString())||e.Ee.push(new Xl(yn.keyField(),r))}return e.Ee}function es(t){const e=Oe(t);return e.Ie||(e.Ie=mj(e,bl(t))),e.Ie}function mj(t,e){if(t.limitType==="F")return xv(t.path,t.collectionGroup,e,t.filters,t.limit,t.startAt,t.endAt);{e=e.map(s=>{const i=s.dir==="desc"?"asc":"desc";return new Xl(s.field,i)});const n=t.endAt?new Td(t.endAt.position,t.endAt.inclusive):null,r=t.startAt?new Td(t.startAt.position,t.startAt.inclusive):null;return xv(t.path,t.collectionGroup,e,t.filters,t.limit,n,r)}}function dm(t,e){const n=t.filters.concat([e]);return new Ia(t.path,t.collectionGroup,t.explicitOrderBy.slice(),n,t.limit,t.limitType,t.startAt,t.endAt)}function gj(t,e){const n=t.explicitOrderBy.concat([e]);return new Ia(t.path,t.collectionGroup,n,t.filters.slice(),t.limit,t.limitType,t.startAt,t.endAt)}function hm(t,e,n){return new Ia(t.path,t.collectionGroup,t.explicitOrderBy.slice(),t.filters.slice(),e,n,t.startAt,t.endAt)}function wh(t,e){return Qg(es(t),es(e))&&t.limitType===e.limitType}function HE(t){return`${Kg(es(t))}|lt:${t.limitType}`}function ko(t){return`Query(target=${function(n){let r=n.path.canonicalString();return n.collectionGroup!==null&&(r+=" collectionGroup="+n.collectionGroup),n.filters.length>0&&(r+=`, filters: [${n.filters.map(s=>UE(s)).join(", ")}]`),yh(n.limit)||(r+=", limit: "+n.limit),n.orderBy.length>0&&(r+=`, orderBy: [${n.orderBy.map(s=>function(o){return`${o.field.canonicalString()} (${o.dir})`}(s)).join(", ")}]`),n.startAt&&(r+=", startAt: ",r+=n.startAt.inclusive?"b:":"a:",r+=n.startAt.position.map(s=>ga(s)).join(",")),n.endAt&&(r+=", endAt: ",r+=n.endAt.inclusive?"a:":"b:",r+=n.endAt.position.map(s=>ga(s)).join(",")),`Target(${r})`}(es(t))}; limitType=${t.limitType})`}function bh(t,e){return e.isFoundDocument()&&function(r,s){const i=s.key.path;return r.collectionGroup!==null?s.key.hasCollectionId(r.collectionGroup)&&r.path.isPrefixOf(i):Ne.isDocumentKey(r.path)?r.path.isEqual(i):r.path.isImmediateParentOf(i)}(t,e)&&function(r,s){for(const i of bl(r))if(!i.field.isKeyField()&&s.data.field(i.field)===null)return!1;return!0}(t,e)&&function(r,s){for(const i of r.filters)if(!i.matches(s))return!1;return!0}(t,e)&&function(r,s){return!(r.startAt&&!function(o,l,c){const u=gv(o,l,c);return o.inclusive?u<=0:u<0}(r.startAt,bl(r),s)||r.endAt&&!function(o,l,c){const u=gv(o,l,c);return o.inclusive?u>=0:u>0}(r.endAt,bl(r),s))}(t,e)}function yj(t){return t.collectionGroup||(t.path.length%2==1?t.path.lastSegment():t.path.get(t.path.length-2))}function qE(t){return(e,n)=>{let r=!1;for(const s of bl(t)){const i=xj(s,e,n);if(i!==0)return i;r=r||s.field.isKeyField()}return 0}}function xj(t,e,n){const r=t.field.isKeyField()?Ne.comparator(e.key,n.key):function(i,o,l){const c=o.data.field(i),u=l.data.field(i);return c!==null&&u!==null?ma(c,u):Ce(42886)}(t.field,e,n);switch(t.dir){case"asc":return r;case"desc":return-1*r;default:return Ce(19790,{direction:t.dir})}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class mo{constructor(e,n){this.mapKeyFn=e,this.equalsFn=n,this.inner={},this.innerSize=0}get(e){const n=this.mapKeyFn(e),r=this.inner[n];if(r!==void 0){for(const[s,i]of r)if(this.equalsFn(s,e))return i}}has(e){return this.get(e)!==void 0}set(e,n){const r=this.mapKeyFn(e),s=this.inner[r];if(s===void 0)return this.inner[r]=[[e,n]],void this.innerSize++;for(let i=0;i{for(const[s,i]of r)e(s,i)})}isEmpty(){return IE(this.inner)}size(){return this.innerSize}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const vj=new Lt(Ne.comparator);function js(){return vj}const GE=new Lt(Ne.comparator);function ll(...t){let e=GE;for(const n of t)e=e.insert(n.key,n);return e}function WE(t){let e=GE;return t.forEach((n,r)=>e=e.insert(n,r.overlayedDocument)),e}function qi(){return _l()}function KE(){return _l()}function _l(){return new mo(t=>t.toString(),(t,e)=>t.isEqual(e))}const wj=new Lt(Ne.comparator),bj=new rn(Ne.comparator);function Je(...t){let e=bj;for(const n of t)e=e.add(n);return e}const _j=new rn(Xe);function Ej(){return _j}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Yg(t,e){if(t.useProto3Json){if(isNaN(e))return{doubleValue:"NaN"};if(e===1/0)return{doubleValue:"Infinity"};if(e===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:_d(e)?"-0":e}}function QE(t){return{integerValue:""+t}}function YE(t,e){return KA(e)?QE(e):Yg(t,e)}/** + * @license + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class _h{constructor(){this._=void 0}}function Sj(t,e,n){return t instanceof Nd?function(s,i){const o={fields:{[jE]:{stringValue:AE},[RE]:{timestampValue:{seconds:s.seconds,nanos:s.nanoseconds}}}};return i&&Gg(i)&&(i=xh(i)),i&&(o.fields[PE]=i),{mapValue:o}}(n,e):t instanceof Jl?JE(t,e):t instanceof Zl?ZE(t,e):function(s,i){const o=XE(s,i),l=wv(o)+wv(s.Ae);return lm(o)&&lm(s.Ae)?QE(l):Yg(s.serializer,l)}(t,e)}function Tj(t,e,n){return t instanceof Jl?JE(t,e):t instanceof Zl?ZE(t,e):n}function XE(t,e){return t instanceof ec?function(r){return lm(r)||function(i){return!!i&&"doubleValue"in i}(r)}(e)?e:{integerValue:0}:null}class Nd extends _h{}class Jl extends _h{constructor(e){super(),this.elements=e}}function JE(t,e){const n=eS(e);for(const r of t.elements)n.some(s=>is(s,r))||n.push(r);return{arrayValue:{values:n}}}class Zl extends _h{constructor(e){super(),this.elements=e}}function ZE(t,e){let n=eS(e);for(const r of t.elements)n=n.filter(s=>!is(s,r));return{arrayValue:{values:n}}}class ec extends _h{constructor(e,n){super(),this.serializer=e,this.Ae=n}}function wv(t){return Ht(t.integerValue||t.doubleValue)}function eS(t){return Wg(t)&&t.arrayValue.values?t.arrayValue.values.slice():[]}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Nj{constructor(e,n){this.field=e,this.transform=n}}function kj(t,e){return t.field.isEqual(e.field)&&function(r,s){return r instanceof Jl&&s instanceof Jl||r instanceof Zl&&s instanceof Zl?pa(r.elements,s.elements,is):r instanceof ec&&s instanceof ec?is(r.Ae,s.Ae):r instanceof Nd&&s instanceof Nd}(t.transform,e.transform)}class Ij{constructor(e,n){this.version=e,this.transformResults=n}}class On{constructor(e,n){this.updateTime=e,this.exists=n}static none(){return new On}static exists(e){return new On(void 0,e)}static updateTime(e){return new On(e)}get isNone(){return this.updateTime===void 0&&this.exists===void 0}isEqual(e){return this.exists===e.exists&&(this.updateTime?!!e.updateTime&&this.updateTime.isEqual(e.updateTime):!e.updateTime)}}function Ou(t,e){return t.updateTime!==void 0?e.isFoundDocument()&&e.version.isEqual(t.updateTime):t.exists===void 0||t.exists===e.isFoundDocument()}class Eh{}function tS(t,e){if(!t.hasLocalMutations||e&&e.fields.length===0)return null;if(e===null)return t.isNoDocument()?new Sh(t.key,On.none()):new gc(t.key,t.data,On.none());{const n=t.data,r=Qn.empty();let s=new rn(yn.comparator);for(let i of e.fields)if(!s.has(i)){let o=n.field(i);o===null&&i.length>1&&(i=i.popLast(),o=n.field(i)),o===null?r.delete(i):r.set(i,o),s=s.add(i)}return new ji(t.key,r,new ur(s.toArray()),On.none())}}function Cj(t,e,n){t instanceof gc?function(s,i,o){const l=s.value.clone(),c=_v(s.fieldTransforms,i,o.transformResults);l.setAll(c),i.convertToFoundDocument(o.version,l).setHasCommittedMutations()}(t,e,n):t instanceof ji?function(s,i,o){if(!Ou(s.precondition,i))return void i.convertToUnknownDocument(o.version);const l=_v(s.fieldTransforms,i,o.transformResults),c=i.data;c.setAll(nS(s)),c.setAll(l),i.convertToFoundDocument(o.version,c).setHasCommittedMutations()}(t,e,n):function(s,i,o){i.convertToNoDocument(o.version).setHasCommittedMutations()}(0,e,n)}function El(t,e,n,r){return t instanceof gc?function(i,o,l,c){if(!Ou(i.precondition,o))return l;const u=i.value.clone(),f=Ev(i.fieldTransforms,c,o);return u.setAll(f),o.convertToFoundDocument(o.version,u).setHasLocalMutations(),null}(t,e,n,r):t instanceof ji?function(i,o,l,c){if(!Ou(i.precondition,o))return l;const u=Ev(i.fieldTransforms,c,o),f=o.data;return f.setAll(nS(i)),f.setAll(u),o.convertToFoundDocument(o.version,f).setHasLocalMutations(),l===null?null:l.unionWith(i.fieldMask.fields).unionWith(i.fieldTransforms.map(h=>h.field))}(t,e,n,r):function(i,o,l){return Ou(i.precondition,o)?(o.convertToNoDocument(o.version).setHasLocalMutations(),null):l}(t,e,n)}function Aj(t,e){let n=null;for(const r of t.fieldTransforms){const s=e.data.field(r.field),i=XE(r.transform,s||null);i!=null&&(n===null&&(n=Qn.empty()),n.set(r.field,i))}return n||null}function bv(t,e){return t.type===e.type&&!!t.key.isEqual(e.key)&&!!t.precondition.isEqual(e.precondition)&&!!function(r,s){return r===void 0&&s===void 0||!(!r||!s)&&pa(r,s,(i,o)=>kj(i,o))}(t.fieldTransforms,e.fieldTransforms)&&(t.type===0?t.value.isEqual(e.value):t.type!==1||t.data.isEqual(e.data)&&t.fieldMask.isEqual(e.fieldMask))}class gc extends Eh{constructor(e,n,r,s=[]){super(),this.key=e,this.value=n,this.precondition=r,this.fieldTransforms=s,this.type=0}getFieldMask(){return null}}class ji extends Eh{constructor(e,n,r,s,i=[]){super(),this.key=e,this.data=n,this.fieldMask=r,this.precondition=s,this.fieldTransforms=i,this.type=1}getFieldMask(){return this.fieldMask}}function nS(t){const e=new Map;return t.fieldMask.fields.forEach(n=>{if(!n.isEmpty()){const r=t.data.field(n);e.set(n,r)}}),e}function _v(t,e,n){const r=new Map;ut(t.length===n.length,32656,{Ve:n.length,de:t.length});for(let s=0;s{const i=e.get(s.key),o=i.overlayedDocument;let l=this.applyToLocalView(o,i.mutatedFields);l=n.has(s.key)?null:l;const c=tS(o,l);c!==null&&r.set(s.key,c),o.isValidDocument()||o.convertToNoDocument(Me.min())}),r}keys(){return this.mutations.reduce((e,n)=>e.add(n.key),Je())}isEqual(e){return this.batchId===e.batchId&&pa(this.mutations,e.mutations,(n,r)=>bv(n,r))&&pa(this.baseMutations,e.baseMutations,(n,r)=>bv(n,r))}}class Xg{constructor(e,n,r,s){this.batch=e,this.commitVersion=n,this.mutationResults=r,this.docVersions=s}static from(e,n,r){ut(e.mutations.length===r.length,58842,{me:e.mutations.length,fe:r.length});let s=function(){return wj}();const i=e.mutations;for(let o=0;o=8)throw new cl(`Invalid padding: ${n}`);if(r<0)throw new cl(`Invalid hash count: ${r}`);if(e.length>0&&this.hashCount===0)throw new cl(`Invalid hash count: ${r}`);if(e.length===0&&n!==0)throw new cl(`Invalid padding when bitmap length is 0: ${n}`);this.ge=8*e.length-n,this.pe=mi.fromNumber(this.ge)}ye(e,n,r){let s=e.add(n.multiply(mi.fromNumber(r)));return s.compare(Oj)===1&&(s=new mi([s.getBits(0),s.getBits(1)],0)),s.modulo(this.pe).toNumber()}we(e){return!!(this.bitmap[Math.floor(e/8)]&1<o.insert(l)),o}insert(e){if(this.ge===0)return;const n=Sv(e),[r,s]=Tv(n);for(let i=0;i0&&(this.Oe=!0,this.Me=e)}ke(){let e=Je(),n=Je(),r=Je();return this.Fe.forEach((s,i)=>{switch(i){case 0:e=e.add(s);break;case 2:n=n.add(s);break;case 1:r=r.add(s);break;default:Ce(38017,{changeType:i})}}),new yc(this.Me,this.xe,e,n,r)}qe(){this.Oe=!1,this.Fe=kv()}Ke(e,n){this.Oe=!0,this.Fe=this.Fe.insert(e,n)}Ue(e){this.Oe=!0,this.Fe=this.Fe.remove(e)}$e(){this.ve+=1}We(){this.ve-=1,ut(this.ve>=0,3241,{ve:this.ve})}Qe(){this.Oe=!0,this.xe=!0}}class Vj{constructor(e){this.Ge=e,this.ze=new Map,this.je=js(),this.Je=fu(),this.He=fu(),this.Ze=new Lt(Xe)}Xe(e){for(const n of e.be)e.De&&e.De.isFoundDocument()?this.Ye(n,e.De):this.et(n,e.key,e.De);for(const n of e.removedTargetIds)this.et(n,e.key,e.De)}tt(e){this.forEachTarget(e,n=>{const r=this.nt(n);switch(e.state){case 0:this.rt(n)&&r.Le(e.resumeToken);break;case 1:r.We(),r.Ne||r.qe(),r.Le(e.resumeToken);break;case 2:r.We(),r.Ne||this.removeTarget(n);break;case 3:this.rt(n)&&(r.Qe(),r.Le(e.resumeToken));break;case 4:this.rt(n)&&(this.it(n),r.Le(e.resumeToken));break;default:Ce(56790,{state:e.state})}})}forEachTarget(e,n){e.targetIds.length>0?e.targetIds.forEach(n):this.ze.forEach((r,s)=>{this.rt(s)&&n(s)})}st(e){const n=e.targetId,r=e.Ce.count,s=this.ot(n);if(s){const i=s.target;if(um(i))if(r===0){const o=new Ne(i.path);this.et(n,o,In.newNoDocument(o,Me.min()))}else ut(r===1,20013,{expectedCount:r});else{const o=this._t(n);if(o!==r){const l=this.ut(e),c=l?this.ct(l,e,o):1;if(c!==0){this.it(n);const u=c===2?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.Ze=this.Ze.insert(n,u)}}}}}ut(e){const n=e.Ce.unchangedNames;if(!n||!n.bits)return null;const{bits:{bitmap:r="",padding:s=0},hashCount:i=0}=n;let o,l;try{o=_i(r).toUint8Array()}catch(c){if(c instanceof CE)return oo("Decoding the base64 bloom filter in existence filter failed ("+c.message+"); ignoring the bloom filter and falling back to full re-query."),null;throw c}try{l=new Jg(o,s,i)}catch(c){return oo(c instanceof cl?"BloomFilter error: ":"Applying bloom filter failed: ",c),null}return l.ge===0?null:l}ct(e,n,r){return n.Ce.count===r-this.Pt(e,n.targetId)?0:2}Pt(e,n){const r=this.Ge.getRemoteKeysForTarget(n);let s=0;return r.forEach(i=>{const o=this.Ge.ht(),l=`projects/${o.projectId}/databases/${o.database}/documents/${i.path.canonicalString()}`;e.mightContain(l)||(this.et(n,i,null),s++)}),s}Tt(e){const n=new Map;this.ze.forEach((i,o)=>{const l=this.ot(o);if(l){if(i.current&&um(l.target)){const c=new Ne(l.target.path);this.Et(c).has(o)||this.It(o,c)||this.et(o,c,In.newNoDocument(c,e))}i.Be&&(n.set(o,i.ke()),i.qe())}});let r=Je();this.He.forEach((i,o)=>{let l=!0;o.forEachWhile(c=>{const u=this.ot(c);return!u||u.purpose==="TargetPurposeLimboResolution"||(l=!1,!1)}),l&&(r=r.add(i))}),this.je.forEach((i,o)=>o.setReadTime(e));const s=new Th(e,n,this.Ze,this.je,r);return this.je=js(),this.Je=fu(),this.He=fu(),this.Ze=new Lt(Xe),s}Ye(e,n){if(!this.rt(e))return;const r=this.It(e,n.key)?2:0;this.nt(e).Ke(n.key,r),this.je=this.je.insert(n.key,n),this.Je=this.Je.insert(n.key,this.Et(n.key).add(e)),this.He=this.He.insert(n.key,this.Rt(n.key).add(e))}et(e,n,r){if(!this.rt(e))return;const s=this.nt(e);this.It(e,n)?s.Ke(n,1):s.Ue(n),this.He=this.He.insert(n,this.Rt(n).delete(e)),this.He=this.He.insert(n,this.Rt(n).add(e)),r&&(this.je=this.je.insert(n,r))}removeTarget(e){this.ze.delete(e)}_t(e){const n=this.nt(e).ke();return this.Ge.getRemoteKeysForTarget(e).size+n.addedDocuments.size-n.removedDocuments.size}$e(e){this.nt(e).$e()}nt(e){let n=this.ze.get(e);return n||(n=new Nv,this.ze.set(e,n)),n}Rt(e){let n=this.He.get(e);return n||(n=new rn(Xe),this.He=this.He.insert(e,n)),n}Et(e){let n=this.Je.get(e);return n||(n=new rn(Xe),this.Je=this.Je.insert(e,n)),n}rt(e){const n=this.ot(e)!==null;return n||ye("WatchChangeAggregator","Detected inactive target",e),n}ot(e){const n=this.ze.get(e);return n&&n.Ne?null:this.Ge.At(e)}it(e){this.ze.set(e,new Nv),this.Ge.getRemoteKeysForTarget(e).forEach(n=>{this.et(e,n,null)})}It(e,n){return this.Ge.getRemoteKeysForTarget(e).has(n)}}function fu(){return new Lt(Ne.comparator)}function kv(){return new Lt(Ne.comparator)}const Fj={asc:"ASCENDING",desc:"DESCENDING"},zj={"<":"LESS_THAN","<=":"LESS_THAN_OR_EQUAL",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","!=":"NOT_EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","not-in":"NOT_IN","array-contains-any":"ARRAY_CONTAINS_ANY"},Uj={and:"AND",or:"OR"};class Bj{constructor(e,n){this.databaseId=e,this.useProto3Json=n}}function fm(t,e){return t.useProto3Json||yh(e)?e:{value:e}}function kd(t,e){return t.useProto3Json?`${new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+e.nanoseconds).slice(-9)}Z`:{seconds:""+e.seconds,nanos:e.nanoseconds}}function oS(t,e){return t.useProto3Json?e.toBase64():e.toUint8Array()}function $j(t,e){return kd(t,e.toTimestamp())}function ts(t){return ut(!!t,49232),Me.fromTimestamp(function(n){const r=bi(n);return new Ke(r.seconds,r.nanos)}(t))}function Zg(t,e){return pm(t,e).canonicalString()}function pm(t,e){const n=function(s){return new Et(["projects",s.projectId,"databases",s.database])}(t).child("documents");return e===void 0?n:n.child(e)}function aS(t){const e=Et.fromString(t);return ut(hS(e),10190,{key:e.toString()}),e}function mm(t,e){return Zg(t.databaseId,e.path)}function kf(t,e){const n=aS(e);if(n.get(1)!==t.databaseId.projectId)throw new fe(Y.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+n.get(1)+" vs "+t.databaseId.projectId);if(n.get(3)!==t.databaseId.database)throw new fe(Y.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+t.databaseId.database);return new Ne(cS(n))}function lS(t,e){return Zg(t.databaseId,e)}function Hj(t){const e=aS(t);return e.length===4?Et.emptyPath():cS(e)}function gm(t){return new Et(["projects",t.databaseId.projectId,"databases",t.databaseId.database]).canonicalString()}function cS(t){return ut(t.length>4&&t.get(4)==="documents",29091,{key:t.toString()}),t.popFirst(5)}function Iv(t,e,n){return{name:mm(t,e),fields:n.value.mapValue.fields}}function qj(t,e){let n;if("targetChange"in e){e.targetChange;const r=function(u){return u==="NO_CHANGE"?0:u==="ADD"?1:u==="REMOVE"?2:u==="CURRENT"?3:u==="RESET"?4:Ce(39313,{state:u})}(e.targetChange.targetChangeType||"NO_CHANGE"),s=e.targetChange.targetIds||[],i=function(u,f){return u.useProto3Json?(ut(f===void 0||typeof f=="string",58123),wn.fromBase64String(f||"")):(ut(f===void 0||f instanceof Buffer||f instanceof Uint8Array,16193),wn.fromUint8Array(f||new Uint8Array))}(t,e.targetChange.resumeToken),o=e.targetChange.cause,l=o&&function(u){const f=u.code===void 0?Y.UNKNOWN:rS(u.code);return new fe(f,u.message||"")}(o);n=new iS(r,s,i,l||null)}else if("documentChange"in e){e.documentChange;const r=e.documentChange;r.document,r.document.name,r.document.updateTime;const s=kf(t,r.document.name),i=ts(r.document.updateTime),o=r.document.createTime?ts(r.document.createTime):Me.min(),l=new Qn({mapValue:{fields:r.document.fields}}),c=In.newFoundDocument(s,i,o,l),u=r.targetIds||[],f=r.removedTargetIds||[];n=new Vu(u,f,c.key,c)}else if("documentDelete"in e){e.documentDelete;const r=e.documentDelete;r.document;const s=kf(t,r.document),i=r.readTime?ts(r.readTime):Me.min(),o=In.newNoDocument(s,i),l=r.removedTargetIds||[];n=new Vu([],l,o.key,o)}else if("documentRemove"in e){e.documentRemove;const r=e.documentRemove;r.document;const s=kf(t,r.document),i=r.removedTargetIds||[];n=new Vu([],i,s,null)}else{if(!("filter"in e))return Ce(11601,{Vt:e});{e.filter;const r=e.filter;r.targetId;const{count:s=0,unchangedNames:i}=r,o=new Dj(s,i),l=r.targetId;n=new sS(l,o)}}return n}function Gj(t,e){let n;if(e instanceof gc)n={update:Iv(t,e.key,e.value)};else if(e instanceof Sh)n={delete:mm(t,e.key)};else if(e instanceof ji)n={update:Iv(t,e.key,e.data),updateMask:tP(e.fieldMask)};else{if(!(e instanceof jj))return Ce(16599,{dt:e.type});n={verify:mm(t,e.key)}}return e.fieldTransforms.length>0&&(n.updateTransforms=e.fieldTransforms.map(r=>function(i,o){const l=o.transform;if(l instanceof Nd)return{fieldPath:o.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(l instanceof Jl)return{fieldPath:o.field.canonicalString(),appendMissingElements:{values:l.elements}};if(l instanceof Zl)return{fieldPath:o.field.canonicalString(),removeAllFromArray:{values:l.elements}};if(l instanceof ec)return{fieldPath:o.field.canonicalString(),increment:l.Ae};throw Ce(20930,{transform:o.transform})}(0,r))),e.precondition.isNone||(n.currentDocument=function(s,i){return i.updateTime!==void 0?{updateTime:$j(s,i.updateTime)}:i.exists!==void 0?{exists:i.exists}:Ce(27497)}(t,e.precondition)),n}function Wj(t,e){return t&&t.length>0?(ut(e!==void 0,14353),t.map(n=>function(s,i){let o=s.updateTime?ts(s.updateTime):ts(i);return o.isEqual(Me.min())&&(o=ts(i)),new Ij(o,s.transformResults||[])}(n,e))):[]}function Kj(t,e){return{documents:[lS(t,e.path)]}}function Qj(t,e){const n={structuredQuery:{}},r=e.path;let s;e.collectionGroup!==null?(s=r,n.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(s=r.popLast(),n.structuredQuery.from=[{collectionId:r.lastSegment()}]),n.parent=lS(t,s);const i=function(u){if(u.length!==0)return dS(Fr.create(u,"and"))}(e.filters);i&&(n.structuredQuery.where=i);const o=function(u){if(u.length!==0)return u.map(f=>function(m){return{field:Io(m.field),direction:Jj(m.dir)}}(f))}(e.orderBy);o&&(n.structuredQuery.orderBy=o);const l=fm(t,e.limit);return l!==null&&(n.structuredQuery.limit=l),e.startAt&&(n.structuredQuery.startAt=function(u){return{before:u.inclusive,values:u.position}}(e.startAt)),e.endAt&&(n.structuredQuery.endAt=function(u){return{before:!u.inclusive,values:u.position}}(e.endAt)),{ft:n,parent:s}}function Yj(t){let e=Hj(t.parent);const n=t.structuredQuery,r=n.from?n.from.length:0;let s=null;if(r>0){ut(r===1,65062);const f=n.from[0];f.allDescendants?s=f.collectionId:e=e.child(f.collectionId)}let i=[];n.where&&(i=function(h){const m=uS(h);return m instanceof Fr&&FE(m)?m.getFilters():[m]}(n.where));let o=[];n.orderBy&&(o=function(h){return h.map(m=>function(x){return new Xl(Co(x.field),function(C){switch(C){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(x.direction))}(m))}(n.orderBy));let l=null;n.limit&&(l=function(h){let m;return m=typeof h=="object"?h.value:h,yh(m)?null:m}(n.limit));let c=null;n.startAt&&(c=function(h){const m=!!h.before,p=h.values||[];return new Td(p,m)}(n.startAt));let u=null;return n.endAt&&(u=function(h){const m=!h.before,p=h.values||[];return new Td(p,m)}(n.endAt)),fj(e,s,o,i,l,"F",c,u)}function Xj(t,e){const n=function(s){switch(s){case"TargetPurposeListen":return null;case"TargetPurposeExistenceFilterMismatch":return"existence-filter-mismatch";case"TargetPurposeExistenceFilterMismatchBloom":return"existence-filter-mismatch-bloom";case"TargetPurposeLimboResolution":return"limbo-document";default:return Ce(28987,{purpose:s})}}(e.purpose);return n==null?null:{"goog-listen-tags":n}}function uS(t){return t.unaryFilter!==void 0?function(n){switch(n.unaryFilter.op){case"IS_NAN":const r=Co(n.unaryFilter.field);return Yt.create(r,"==",{doubleValue:NaN});case"IS_NULL":const s=Co(n.unaryFilter.field);return Yt.create(s,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const i=Co(n.unaryFilter.field);return Yt.create(i,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const o=Co(n.unaryFilter.field);return Yt.create(o,"!=",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":return Ce(61313);default:return Ce(60726)}}(t):t.fieldFilter!==void 0?function(n){return Yt.create(Co(n.fieldFilter.field),function(s){switch(s){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";case"OPERATOR_UNSPECIFIED":return Ce(58110);default:return Ce(50506)}}(n.fieldFilter.op),n.fieldFilter.value)}(t):t.compositeFilter!==void 0?function(n){return Fr.create(n.compositeFilter.filters.map(r=>uS(r)),function(s){switch(s){case"AND":return"and";case"OR":return"or";default:return Ce(1026)}}(n.compositeFilter.op))}(t):Ce(30097,{filter:t})}function Jj(t){return Fj[t]}function Zj(t){return zj[t]}function eP(t){return Uj[t]}function Io(t){return{fieldPath:t.canonicalString()}}function Co(t){return yn.fromServerFormat(t.fieldPath)}function dS(t){return t instanceof Yt?function(n){if(n.op==="=="){if(mv(n.value))return{unaryFilter:{field:Io(n.field),op:"IS_NAN"}};if(pv(n.value))return{unaryFilter:{field:Io(n.field),op:"IS_NULL"}}}else if(n.op==="!="){if(mv(n.value))return{unaryFilter:{field:Io(n.field),op:"IS_NOT_NAN"}};if(pv(n.value))return{unaryFilter:{field:Io(n.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:Io(n.field),op:Zj(n.op),value:n.value}}}(t):t instanceof Fr?function(n){const r=n.getFilters().map(s=>dS(s));return r.length===1?r[0]:{compositeFilter:{op:eP(n.op),filters:r}}}(t):Ce(54877,{filter:t})}function tP(t){const e=[];return t.fields.forEach(n=>e.push(n.canonicalString())),{fieldPaths:e}}function hS(t){return t.length>=4&&t.get(0)==="projects"&&t.get(2)==="databases"}function fS(t){return!!t&&typeof t._toProto=="function"&&t._protoValueType==="ProtoValue"}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class ni{constructor(e,n,r,s,i=Me.min(),o=Me.min(),l=wn.EMPTY_BYTE_STRING,c=null){this.target=e,this.targetId=n,this.purpose=r,this.sequenceNumber=s,this.snapshotVersion=i,this.lastLimboFreeSnapshotVersion=o,this.resumeToken=l,this.expectedCount=c}withSequenceNumber(e){return new ni(this.target,this.targetId,this.purpose,e,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(e,n){return new ni(this.target,this.targetId,this.purpose,this.sequenceNumber,n,this.lastLimboFreeSnapshotVersion,e,null)}withExpectedCount(e){return new ni(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,e)}withLastLimboFreeSnapshotVersion(e){return new ni(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,e,this.resumeToken,this.expectedCount)}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class nP{constructor(e){this.yt=e}}function rP(t){const e=Yj({parent:t.parent,structuredQuery:t.structuredQuery});return t.limitType==="LAST"?hm(e,e.limit,"L"):e}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class sP{constructor(){this.bn=new iP}addToCollectionParentIndex(e,n){return this.bn.add(n),Z.resolve()}getCollectionParents(e,n){return Z.resolve(this.bn.getEntries(n))}addFieldIndex(e,n){return Z.resolve()}deleteFieldIndex(e,n){return Z.resolve()}deleteAllFieldIndexes(e){return Z.resolve()}createTargetIndexes(e,n){return Z.resolve()}getDocumentsMatchingTarget(e,n){return Z.resolve(null)}getIndexType(e,n){return Z.resolve(0)}getFieldIndexes(e,n){return Z.resolve([])}getNextCollectionGroupToUpdate(e){return Z.resolve(null)}getMinOffset(e,n){return Z.resolve(wi.min())}getMinOffsetFromCollectionGroup(e,n){return Z.resolve(wi.min())}updateCollectionGroup(e,n,r){return Z.resolve()}updateIndexEntries(e,n){return Z.resolve()}}class iP{constructor(){this.index={}}add(e){const n=e.lastSegment(),r=e.popLast(),s=this.index[n]||new rn(Et.comparator),i=!s.has(r);return this.index[n]=s.add(r),i}has(e){const n=e.lastSegment(),r=e.popLast(),s=this.index[n];return s&&s.has(r)}getEntries(e){return(this.index[e]||new rn(Et.comparator)).toArray()}}/** + * @license + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Cv={didRun:!1,sequenceNumbersCollected:0,targetsRemoved:0,documentsRemoved:0},pS=41943040;class Wn{static withCacheSize(e){return new Wn(e,Wn.DEFAULT_COLLECTION_PERCENTILE,Wn.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}constructor(e,n,r){this.cacheSizeCollectionThreshold=e,this.percentileToCollect=n,this.maximumSequenceNumbersToCollect=r}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */Wn.DEFAULT_COLLECTION_PERCENTILE=10,Wn.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,Wn.DEFAULT=new Wn(pS,Wn.DEFAULT_COLLECTION_PERCENTILE,Wn.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),Wn.DISABLED=new Wn(-1,0,0);/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class ya{constructor(e){this.sr=e}next(){return this.sr+=2,this.sr}static _r(){return new ya(0)}static ar(){return new ya(-1)}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Av="LruGarbageCollector",oP=1048576;function jv([t,e],[n,r]){const s=Xe(t,n);return s===0?Xe(e,r):s}class aP{constructor(e){this.Pr=e,this.buffer=new rn(jv),this.Tr=0}Er(){return++this.Tr}Ir(e){const n=[e,this.Er()];if(this.buffer.size{this.Rr=null;try{await this.localStore.collectGarbage(this.garbageCollector)}catch(n){ka(n)?ye(Av,"Ignoring IndexedDB error during garbage collection: ",n):await Na(n)}await this.Ar(3e5)})}}class cP{constructor(e,n){this.Vr=e,this.params=n}calculateTargetCount(e,n){return this.Vr.dr(e).next(r=>Math.floor(n/100*r))}nthSequenceNumber(e,n){if(n===0)return Z.resolve(gh.ce);const r=new aP(n);return this.Vr.forEachTarget(e,s=>r.Ir(s.sequenceNumber)).next(()=>this.Vr.mr(e,s=>r.Ir(s))).next(()=>r.maxValue)}removeTargets(e,n,r){return this.Vr.removeTargets(e,n,r)}removeOrphanedDocuments(e,n){return this.Vr.removeOrphanedDocuments(e,n)}collect(e,n){return this.params.cacheSizeCollectionThreshold===-1?(ye("LruGarbageCollector","Garbage collection skipped; disabled"),Z.resolve(Cv)):this.getCacheSize(e).next(r=>r(h>this.params.maximumSequenceNumbersToCollect?(ye("LruGarbageCollector",`Capping sequence numbers to collect down to the maximum of ${this.params.maximumSequenceNumbersToCollect} from ${h}`),s=this.params.maximumSequenceNumbersToCollect):s=h,o=Date.now(),this.nthSequenceNumber(e,s))).next(h=>(r=h,l=Date.now(),this.removeTargets(e,r,n))).next(h=>(i=h,c=Date.now(),this.removeOrphanedDocuments(e,r))).next(h=>(u=Date.now(),No()<=Ye.DEBUG&&ye("LruGarbageCollector",`LRU Garbage Collection + Counted targets in ${o-f}ms + Determined least recently used ${s} in `+(l-o)+`ms + Removed ${i} targets in `+(c-l)+`ms + Removed ${h} documents in `+(u-c)+`ms +Total Duration: ${u-f}ms`),Z.resolve({didRun:!0,sequenceNumbersCollected:s,targetsRemoved:i,documentsRemoved:h})))}}function uP(t,e){return new cP(t,e)}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class dP{constructor(){this.changes=new mo(e=>e.toString(),(e,n)=>e.isEqual(n)),this.changesApplied=!1}addEntry(e){this.assertNotApplied(),this.changes.set(e.key,e)}removeEntry(e,n){this.assertNotApplied(),this.changes.set(e,In.newInvalidDocument(e).setReadTime(n))}getEntry(e,n){this.assertNotApplied();const r=this.changes.get(n);return r!==void 0?Z.resolve(r):this.getFromCache(e,n)}getEntries(e,n){return this.getAllFromCache(e,n)}apply(e){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(e)}assertNotApplied(){}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *//** + * @license + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class hP{constructor(e,n){this.overlayedDocument=e,this.mutatedFields=n}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class fP{constructor(e,n,r,s){this.remoteDocumentCache=e,this.mutationQueue=n,this.documentOverlayCache=r,this.indexManager=s}getDocument(e,n){let r=null;return this.documentOverlayCache.getOverlay(e,n).next(s=>(r=s,this.remoteDocumentCache.getEntry(e,n))).next(s=>(r!==null&&El(r.mutation,s,ur.empty(),Ke.now()),s))}getDocuments(e,n){return this.remoteDocumentCache.getEntries(e,n).next(r=>this.getLocalViewOfDocuments(e,r,Je()).next(()=>r))}getLocalViewOfDocuments(e,n,r=Je()){const s=qi();return this.populateOverlays(e,s,n).next(()=>this.computeViews(e,n,s,r).next(i=>{let o=ll();return i.forEach((l,c)=>{o=o.insert(l,c.overlayedDocument)}),o}))}getOverlayedDocuments(e,n){const r=qi();return this.populateOverlays(e,r,n).next(()=>this.computeViews(e,n,r,Je()))}populateOverlays(e,n,r){const s=[];return r.forEach(i=>{n.has(i)||s.push(i)}),this.documentOverlayCache.getOverlays(e,s).next(i=>{i.forEach((o,l)=>{n.set(o,l)})})}computeViews(e,n,r,s){let i=js();const o=_l(),l=function(){return _l()}();return n.forEach((c,u)=>{const f=r.get(u.key);s.has(u.key)&&(f===void 0||f.mutation instanceof ji)?i=i.insert(u.key,u):f!==void 0?(o.set(u.key,f.mutation.getFieldMask()),El(f.mutation,u,f.mutation.getFieldMask(),Ke.now())):o.set(u.key,ur.empty())}),this.recalculateAndSaveOverlays(e,i).next(c=>(c.forEach((u,f)=>o.set(u,f)),n.forEach((u,f)=>l.set(u,new hP(f,o.get(u)??null))),l))}recalculateAndSaveOverlays(e,n){const r=_l();let s=new Lt((o,l)=>o-l),i=Je();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,n).next(o=>{for(const l of o)l.keys().forEach(c=>{const u=n.get(c);if(u===null)return;let f=r.get(c)||ur.empty();f=l.applyToLocalView(u,f),r.set(c,f);const h=(s.get(l.batchId)||Je()).add(c);s=s.insert(l.batchId,h)})}).next(()=>{const o=[],l=s.getReverseIterator();for(;l.hasNext();){const c=l.getNext(),u=c.key,f=c.value,h=KE();f.forEach(m=>{if(!i.has(m)){const p=tS(n.get(m),r.get(m));p!==null&&h.set(m,p),i=i.add(m)}}),o.push(this.documentOverlayCache.saveOverlays(e,u,h))}return Z.waitFor(o)}).next(()=>r)}recalculateAndSaveOverlaysForDocumentKeys(e,n){return this.remoteDocumentCache.getEntries(e,n).next(r=>this.recalculateAndSaveOverlays(e,r))}getDocumentsMatchingQuery(e,n,r,s){return pj(n)?this.getDocumentsMatchingDocumentQuery(e,n.path):$E(n)?this.getDocumentsMatchingCollectionGroupQuery(e,n,r,s):this.getDocumentsMatchingCollectionQuery(e,n,r,s)}getNextDocuments(e,n,r,s){return this.remoteDocumentCache.getAllFromCollectionGroup(e,n,r,s).next(i=>{const o=s-i.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,n,r.largestBatchId,s-i.size):Z.resolve(qi());let l=Wl,c=i;return o.next(u=>Z.forEach(u,(f,h)=>(l{c=c.insert(f,m)}))).next(()=>this.populateOverlays(e,u,i)).next(()=>this.computeViews(e,c,u,Je())).next(f=>({batchId:l,changes:WE(f)})))})}getDocumentsMatchingDocumentQuery(e,n){return this.getDocument(e,new Ne(n)).next(r=>{let s=ll();return r.isFoundDocument()&&(s=s.insert(r.key,r)),s})}getDocumentsMatchingCollectionGroupQuery(e,n,r,s){const i=n.collectionGroup;let o=ll();return this.indexManager.getCollectionParents(e,i).next(l=>Z.forEach(l,c=>{const u=function(h,m){return new Ia(m,null,h.explicitOrderBy.slice(),h.filters.slice(),h.limit,h.limitType,h.startAt,h.endAt)}(n,c.child(i));return this.getDocumentsMatchingCollectionQuery(e,u,r,s).next(f=>{f.forEach((h,m)=>{o=o.insert(h,m)})})}).next(()=>o))}getDocumentsMatchingCollectionQuery(e,n,r,s){let i;return this.documentOverlayCache.getOverlaysForCollection(e,n.path,r.largestBatchId).next(o=>(i=o,this.remoteDocumentCache.getDocumentsMatchingQuery(e,n,r,i,s))).next(o=>{i.forEach((c,u)=>{const f=u.getKey();o.get(f)===null&&(o=o.insert(f,In.newInvalidDocument(f)))});let l=ll();return o.forEach((c,u)=>{const f=i.get(c);f!==void 0&&El(f.mutation,u,ur.empty(),Ke.now()),bh(n,u)&&(l=l.insert(c,u))}),l})}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class pP{constructor(e){this.serializer=e,this.Nr=new Map,this.Br=new Map}getBundleMetadata(e,n){return Z.resolve(this.Nr.get(n))}saveBundleMetadata(e,n){return this.Nr.set(n.id,function(s){return{id:s.id,version:s.version,createTime:ts(s.createTime)}}(n)),Z.resolve()}getNamedQuery(e,n){return Z.resolve(this.Br.get(n))}saveNamedQuery(e,n){return this.Br.set(n.name,function(s){return{name:s.name,query:rP(s.bundledQuery),readTime:ts(s.readTime)}}(n)),Z.resolve()}}/** + * @license + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class mP{constructor(){this.overlays=new Lt(Ne.comparator),this.Lr=new Map}getOverlay(e,n){return Z.resolve(this.overlays.get(n))}getOverlays(e,n){const r=qi();return Z.forEach(n,s=>this.getOverlay(e,s).next(i=>{i!==null&&r.set(s,i)})).next(()=>r)}saveOverlays(e,n,r){return r.forEach((s,i)=>{this.St(e,n,i)}),Z.resolve()}removeOverlaysForBatchId(e,n,r){const s=this.Lr.get(r);return s!==void 0&&(s.forEach(i=>this.overlays=this.overlays.remove(i)),this.Lr.delete(r)),Z.resolve()}getOverlaysForCollection(e,n,r){const s=qi(),i=n.length+1,o=new Ne(n.child("")),l=this.overlays.getIteratorFrom(o);for(;l.hasNext();){const c=l.getNext().value,u=c.getKey();if(!n.isPrefixOf(u.path))break;u.path.length===i&&c.largestBatchId>r&&s.set(c.getKey(),c)}return Z.resolve(s)}getOverlaysForCollectionGroup(e,n,r,s){let i=new Lt((u,f)=>u-f);const o=this.overlays.getIterator();for(;o.hasNext();){const u=o.getNext().value;if(u.getKey().getCollectionGroup()===n&&u.largestBatchId>r){let f=i.get(u.largestBatchId);f===null&&(f=qi(),i=i.insert(u.largestBatchId,f)),f.set(u.getKey(),u)}}const l=qi(),c=i.getIterator();for(;c.hasNext()&&(c.getNext().value.forEach((u,f)=>l.set(u,f)),!(l.size()>=s)););return Z.resolve(l)}St(e,n,r){const s=this.overlays.get(r.key);if(s!==null){const o=this.Lr.get(s.largestBatchId).delete(r.key);this.Lr.set(s.largestBatchId,o)}this.overlays=this.overlays.insert(r.key,new Rj(n,r));let i=this.Lr.get(n);i===void 0&&(i=Je(),this.Lr.set(n,i)),this.Lr.set(n,i.add(r.key))}}/** + * @license + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class gP{constructor(){this.sessionToken=wn.EMPTY_BYTE_STRING}getSessionToken(e){return Z.resolve(this.sessionToken)}setSessionToken(e,n){return this.sessionToken=n,Z.resolve()}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class e0{constructor(){this.kr=new rn(ln.qr),this.Kr=new rn(ln.Ur)}isEmpty(){return this.kr.isEmpty()}addReference(e,n){const r=new ln(e,n);this.kr=this.kr.add(r),this.Kr=this.Kr.add(r)}$r(e,n){e.forEach(r=>this.addReference(r,n))}removeReference(e,n){this.Wr(new ln(e,n))}Qr(e,n){e.forEach(r=>this.removeReference(r,n))}Gr(e){const n=new Ne(new Et([])),r=new ln(n,e),s=new ln(n,e+1),i=[];return this.Kr.forEachInRange([r,s],o=>{this.Wr(o),i.push(o.key)}),i}zr(){this.kr.forEach(e=>this.Wr(e))}Wr(e){this.kr=this.kr.delete(e),this.Kr=this.Kr.delete(e)}jr(e){const n=new Ne(new Et([])),r=new ln(n,e),s=new ln(n,e+1);let i=Je();return this.Kr.forEachInRange([r,s],o=>{i=i.add(o.key)}),i}containsKey(e){const n=new ln(e,0),r=this.kr.firstAfterOrEqual(n);return r!==null&&e.isEqual(r.key)}}class ln{constructor(e,n){this.key=e,this.Jr=n}static qr(e,n){return Ne.comparator(e.key,n.key)||Xe(e.Jr,n.Jr)}static Ur(e,n){return Xe(e.Jr,n.Jr)||Ne.comparator(e.key,n.key)}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class yP{constructor(e,n){this.indexManager=e,this.referenceDelegate=n,this.mutationQueue=[],this.Yn=1,this.Hr=new rn(ln.qr)}checkEmpty(e){return Z.resolve(this.mutationQueue.length===0)}addMutationBatch(e,n,r,s){const i=this.Yn;this.Yn++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const o=new Pj(i,n,r,s);this.mutationQueue.push(o);for(const l of s)this.Hr=this.Hr.add(new ln(l.key,i)),this.indexManager.addToCollectionParentIndex(e,l.key.path.popLast());return Z.resolve(o)}lookupMutationBatch(e,n){return Z.resolve(this.Zr(n))}getNextMutationBatchAfterBatchId(e,n){const r=n+1,s=this.Xr(r),i=s<0?0:s;return Z.resolve(this.mutationQueue.length>i?this.mutationQueue[i]:null)}getHighestUnacknowledgedBatchId(){return Z.resolve(this.mutationQueue.length===0?qg:this.Yn-1)}getAllMutationBatches(e){return Z.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,n){const r=new ln(n,0),s=new ln(n,Number.POSITIVE_INFINITY),i=[];return this.Hr.forEachInRange([r,s],o=>{const l=this.Zr(o.Jr);i.push(l)}),Z.resolve(i)}getAllMutationBatchesAffectingDocumentKeys(e,n){let r=new rn(Xe);return n.forEach(s=>{const i=new ln(s,0),o=new ln(s,Number.POSITIVE_INFINITY);this.Hr.forEachInRange([i,o],l=>{r=r.add(l.Jr)})}),Z.resolve(this.Yr(r))}getAllMutationBatchesAffectingQuery(e,n){const r=n.path,s=r.length+1;let i=r;Ne.isDocumentKey(i)||(i=i.child(""));const o=new ln(new Ne(i),0);let l=new rn(Xe);return this.Hr.forEachWhile(c=>{const u=c.key.path;return!!r.isPrefixOf(u)&&(u.length===s&&(l=l.add(c.Jr)),!0)},o),Z.resolve(this.Yr(l))}Yr(e){const n=[];return e.forEach(r=>{const s=this.Zr(r);s!==null&&n.push(s)}),n}removeMutationBatch(e,n){ut(this.ei(n.batchId,"removed")===0,55003),this.mutationQueue.shift();let r=this.Hr;return Z.forEach(n.mutations,s=>{const i=new ln(s.key,n.batchId);return r=r.delete(i),this.referenceDelegate.markPotentiallyOrphaned(e,s.key)}).next(()=>{this.Hr=r})}nr(e){}containsKey(e,n){const r=new ln(n,0),s=this.Hr.firstAfterOrEqual(r);return Z.resolve(n.isEqual(s&&s.key))}performConsistencyCheck(e){return this.mutationQueue.length,Z.resolve()}ei(e,n){return this.Xr(e)}Xr(e){return this.mutationQueue.length===0?0:e-this.mutationQueue[0].batchId}Zr(e){const n=this.Xr(e);return n<0||n>=this.mutationQueue.length?null:this.mutationQueue[n]}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class xP{constructor(e){this.ti=e,this.docs=function(){return new Lt(Ne.comparator)}(),this.size=0}setIndexManager(e){this.indexManager=e}addEntry(e,n){const r=n.key,s=this.docs.get(r),i=s?s.size:0,o=this.ti(n);return this.docs=this.docs.insert(r,{document:n.mutableCopy(),size:o}),this.size+=o-i,this.indexManager.addToCollectionParentIndex(e,r.path.popLast())}removeEntry(e){const n=this.docs.get(e);n&&(this.docs=this.docs.remove(e),this.size-=n.size)}getEntry(e,n){const r=this.docs.get(n);return Z.resolve(r?r.document.mutableCopy():In.newInvalidDocument(n))}getEntries(e,n){let r=js();return n.forEach(s=>{const i=this.docs.get(s);r=r.insert(s,i?i.document.mutableCopy():In.newInvalidDocument(s))}),Z.resolve(r)}getDocumentsMatchingQuery(e,n,r,s){let i=js();const o=n.path,l=new Ne(o.child("__id-9223372036854775808__")),c=this.docs.getIteratorFrom(l);for(;c.hasNext();){const{key:u,value:{document:f}}=c.getNext();if(!o.isPrefixOf(u.path))break;u.path.length>o.length+1||HA($A(f),r)<=0||(s.has(f.key)||bh(n,f))&&(i=i.insert(f.key,f.mutableCopy()))}return Z.resolve(i)}getAllFromCollectionGroup(e,n,r,s){Ce(9500)}ni(e,n){return Z.forEach(this.docs,r=>n(r))}newChangeBuffer(e){return new vP(this)}getSize(e){return Z.resolve(this.size)}}class vP extends dP{constructor(e){super(),this.Mr=e}applyChanges(e){const n=[];return this.changes.forEach((r,s)=>{s.isValidDocument()?n.push(this.Mr.addEntry(e,s)):this.Mr.removeEntry(r)}),Z.waitFor(n)}getFromCache(e,n){return this.Mr.getEntry(e,n)}getAllFromCache(e,n){return this.Mr.getEntries(e,n)}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class wP{constructor(e){this.persistence=e,this.ri=new mo(n=>Kg(n),Qg),this.lastRemoteSnapshotVersion=Me.min(),this.highestTargetId=0,this.ii=0,this.si=new e0,this.targetCount=0,this.oi=ya._r()}forEachTarget(e,n){return this.ri.forEach((r,s)=>n(s)),Z.resolve()}getLastRemoteSnapshotVersion(e){return Z.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return Z.resolve(this.ii)}allocateTargetId(e){return this.highestTargetId=this.oi.next(),Z.resolve(this.highestTargetId)}setTargetsMetadata(e,n,r){return r&&(this.lastRemoteSnapshotVersion=r),n>this.ii&&(this.ii=n),Z.resolve()}lr(e){this.ri.set(e.target,e);const n=e.targetId;n>this.highestTargetId&&(this.oi=new ya(n),this.highestTargetId=n),e.sequenceNumber>this.ii&&(this.ii=e.sequenceNumber)}addTargetData(e,n){return this.lr(n),this.targetCount+=1,Z.resolve()}updateTargetData(e,n){return this.lr(n),Z.resolve()}removeTargetData(e,n){return this.ri.delete(n.target),this.si.Gr(n.targetId),this.targetCount-=1,Z.resolve()}removeTargets(e,n,r){let s=0;const i=[];return this.ri.forEach((o,l)=>{l.sequenceNumber<=n&&r.get(l.targetId)===null&&(this.ri.delete(o),i.push(this.removeMatchingKeysForTargetId(e,l.targetId)),s++)}),Z.waitFor(i).next(()=>s)}getTargetCount(e){return Z.resolve(this.targetCount)}getTargetData(e,n){const r=this.ri.get(n)||null;return Z.resolve(r)}addMatchingKeys(e,n,r){return this.si.$r(n,r),Z.resolve()}removeMatchingKeys(e,n,r){this.si.Qr(n,r);const s=this.persistence.referenceDelegate,i=[];return s&&n.forEach(o=>{i.push(s.markPotentiallyOrphaned(e,o))}),Z.waitFor(i)}removeMatchingKeysForTargetId(e,n){return this.si.Gr(n),Z.resolve()}getMatchingKeysForTargetId(e,n){const r=this.si.jr(n);return Z.resolve(r)}containsKey(e,n){return Z.resolve(this.si.containsKey(n))}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class mS{constructor(e,n){this._i={},this.overlays={},this.ai=new gh(0),this.ui=!1,this.ui=!0,this.ci=new gP,this.referenceDelegate=e(this),this.li=new wP(this),this.indexManager=new sP,this.remoteDocumentCache=function(s){return new xP(s)}(r=>this.referenceDelegate.hi(r)),this.serializer=new nP(n),this.Pi=new pP(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.ui=!1,Promise.resolve()}get started(){return this.ui}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let n=this.overlays[e.toKey()];return n||(n=new mP,this.overlays[e.toKey()]=n),n}getMutationQueue(e,n){let r=this._i[e.toKey()];return r||(r=new yP(n,this.referenceDelegate),this._i[e.toKey()]=r),r}getGlobalsCache(){return this.ci}getTargetCache(){return this.li}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.Pi}runTransaction(e,n,r){ye("MemoryPersistence","Starting transaction:",e);const s=new bP(this.ai.next());return this.referenceDelegate.Ti(),r(s).next(i=>this.referenceDelegate.Ei(s).next(()=>i)).toPromise().then(i=>(s.raiseOnCommittedEvent(),i))}Ii(e,n){return Z.or(Object.values(this._i).map(r=>()=>r.containsKey(e,n)))}}class bP extends GA{constructor(e){super(),this.currentSequenceNumber=e}}class t0{constructor(e){this.persistence=e,this.Ri=new e0,this.Ai=null}static Vi(e){return new t0(e)}get di(){if(this.Ai)return this.Ai;throw Ce(60996)}addReference(e,n,r){return this.Ri.addReference(r,n),this.di.delete(r.toString()),Z.resolve()}removeReference(e,n,r){return this.Ri.removeReference(r,n),this.di.add(r.toString()),Z.resolve()}markPotentiallyOrphaned(e,n){return this.di.add(n.toString()),Z.resolve()}removeTarget(e,n){this.Ri.Gr(n.targetId).forEach(s=>this.di.add(s.toString()));const r=this.persistence.getTargetCache();return r.getMatchingKeysForTargetId(e,n.targetId).next(s=>{s.forEach(i=>this.di.add(i.toString()))}).next(()=>r.removeTargetData(e,n))}Ti(){this.Ai=new Set}Ei(e){const n=this.persistence.getRemoteDocumentCache().newChangeBuffer();return Z.forEach(this.di,r=>{const s=Ne.fromPath(r);return this.mi(e,s).next(i=>{i||n.removeEntry(s,Me.min())})}).next(()=>(this.Ai=null,n.apply(e)))}updateLimboDocument(e,n){return this.mi(e,n).next(r=>{r?this.di.delete(n.toString()):this.di.add(n.toString())})}hi(e){return 0}mi(e,n){return Z.or([()=>Z.resolve(this.Ri.containsKey(n)),()=>this.persistence.getTargetCache().containsKey(e,n),()=>this.persistence.Ii(e,n)])}}class Id{constructor(e,n){this.persistence=e,this.fi=new mo(r=>QA(r.path),(r,s)=>r.isEqual(s)),this.garbageCollector=uP(this,n)}static Vi(e,n){return new Id(e,n)}Ti(){}Ei(e){return Z.resolve()}forEachTarget(e,n){return this.persistence.getTargetCache().forEachTarget(e,n)}dr(e){const n=this.pr(e);return this.persistence.getTargetCache().getTargetCount(e).next(r=>n.next(s=>r+s))}pr(e){let n=0;return this.mr(e,r=>{n++}).next(()=>n)}mr(e,n){return Z.forEach(this.fi,(r,s)=>this.wr(e,r,s).next(i=>i?Z.resolve():n(s)))}removeTargets(e,n,r){return this.persistence.getTargetCache().removeTargets(e,n,r)}removeOrphanedDocuments(e,n){let r=0;const s=this.persistence.getRemoteDocumentCache(),i=s.newChangeBuffer();return s.ni(e,o=>this.wr(e,o,n).next(l=>{l||(r++,i.removeEntry(o,Me.min()))})).next(()=>i.apply(e)).next(()=>r)}markPotentiallyOrphaned(e,n){return this.fi.set(n,e.currentSequenceNumber),Z.resolve()}removeTarget(e,n){const r=n.withSequenceNumber(e.currentSequenceNumber);return this.persistence.getTargetCache().updateTargetData(e,r)}addReference(e,n,r){return this.fi.set(r,e.currentSequenceNumber),Z.resolve()}removeReference(e,n,r){return this.fi.set(r,e.currentSequenceNumber),Z.resolve()}updateLimboDocument(e,n){return this.fi.set(n,e.currentSequenceNumber),Z.resolve()}hi(e){let n=e.key.toString().length;return e.isFoundDocument()&&(n+=Mu(e.data.value)),n}wr(e,n,r){return Z.or([()=>this.persistence.Ii(e,n),()=>this.persistence.getTargetCache().containsKey(e,n),()=>{const s=this.fi.get(n);return Z.resolve(s!==void 0&&s>r)}])}getCacheSize(e){return this.persistence.getRemoteDocumentCache().getSize(e)}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class n0{constructor(e,n,r,s){this.targetId=e,this.fromCache=n,this.Ts=r,this.Es=s}static Is(e,n){let r=Je(),s=Je();for(const i of n.docChanges)switch(i.type){case 0:r=r.add(i.doc.key);break;case 1:s=s.add(i.doc.key)}return new n0(e,n.fromCache,r,s)}}/** + * @license + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class _P{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class EP{constructor(){this.Rs=!1,this.As=!1,this.Vs=100,this.ds=function(){return uC()?8:WA(An())>0?6:4}()}initialize(e,n){this.fs=e,this.indexManager=n,this.Rs=!0}getDocumentsMatchingQuery(e,n,r,s){const i={result:null};return this.gs(e,n).next(o=>{i.result=o}).next(()=>{if(!i.result)return this.ps(e,n,s,r).next(o=>{i.result=o})}).next(()=>{if(i.result)return;const o=new _P;return this.ys(e,n,o).next(l=>{if(i.result=l,this.As)return this.ws(e,n,o,l.size)})}).next(()=>i.result)}ws(e,n,r,s){return r.documentReadCountthis.ds*s?(No()<=Ye.DEBUG&&ye("QueryEngine","The SDK decides to create cache indexes for query:",ko(n),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(e,es(n))):Z.resolve())}gs(e,n){if(vv(n))return Z.resolve(null);let r=es(n);return this.indexManager.getIndexType(e,r).next(s=>s===0?null:(n.limit!==null&&s===1&&(n=hm(n,null,"F"),r=es(n)),this.indexManager.getDocumentsMatchingTarget(e,r).next(i=>{const o=Je(...i);return this.fs.getDocuments(e,o).next(l=>this.indexManager.getMinOffset(e,r).next(c=>{const u=this.Ss(n,l);return this.bs(n,u,o,c.readTime)?this.gs(e,hm(n,null,"F")):this.Ds(e,u,n,c)}))})))}ps(e,n,r,s){return vv(n)||s.isEqual(Me.min())?Z.resolve(null):this.fs.getDocuments(e,r).next(i=>{const o=this.Ss(n,i);return this.bs(n,o,r,s)?Z.resolve(null):(No()<=Ye.DEBUG&&ye("QueryEngine","Re-using previous result from %s to execute query: %s",s.toString(),ko(n)),this.Ds(e,o,n,BA(s,Wl)).next(l=>l))})}Ss(e,n){let r=new rn(qE(e));return n.forEach((s,i)=>{bh(e,i)&&(r=r.add(i))}),r}bs(e,n,r,s){if(e.limit===null)return!1;if(r.size!==n.size)return!0;const i=e.limitType==="F"?n.last():n.first();return!!i&&(i.hasPendingWrites||i.version.compareTo(s)>0)}ys(e,n,r){return No()<=Ye.DEBUG&&ye("QueryEngine","Using full collection scan to execute query:",ko(n)),this.fs.getDocumentsMatchingQuery(e,n,wi.min(),r)}Ds(e,n,r,s){return this.fs.getDocumentsMatchingQuery(e,r,s).next(i=>(n.forEach(o=>{i=i.insert(o.key,o)}),i))}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const r0="LocalStore",SP=3e8;class TP{constructor(e,n,r,s){this.persistence=e,this.Cs=n,this.serializer=s,this.vs=new Lt(Xe),this.Fs=new mo(i=>Kg(i),Qg),this.Ms=new Map,this.xs=e.getRemoteDocumentCache(),this.li=e.getTargetCache(),this.Pi=e.getBundleCache(),this.Os(r)}Os(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new fP(this.xs,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.xs.setIndexManager(this.indexManager),this.Cs.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction("Collect garbage","readwrite-primary",n=>e.collect(n,this.vs))}}function NP(t,e,n,r){return new TP(t,e,n,r)}async function gS(t,e){const n=Oe(t);return await n.persistence.runTransaction("Handle user change","readonly",r=>{let s;return n.mutationQueue.getAllMutationBatches(r).next(i=>(s=i,n.Os(e),n.mutationQueue.getAllMutationBatches(r))).next(i=>{const o=[],l=[];let c=Je();for(const u of s){o.push(u.batchId);for(const f of u.mutations)c=c.add(f.key)}for(const u of i){l.push(u.batchId);for(const f of u.mutations)c=c.add(f.key)}return n.localDocuments.getDocuments(r,c).next(u=>({Ns:u,removedBatchIds:o,addedBatchIds:l}))})})}function kP(t,e){const n=Oe(t);return n.persistence.runTransaction("Acknowledge batch","readwrite-primary",r=>{const s=e.batch.keys(),i=n.xs.newChangeBuffer({trackRemovals:!0});return function(l,c,u,f){const h=u.batch,m=h.keys();let p=Z.resolve();return m.forEach(x=>{p=p.next(()=>f.getEntry(c,x)).next(E=>{const C=u.docVersions.get(x);ut(C!==null,48541),E.version.compareTo(C)<0&&(h.applyToRemoteDocument(E,u),E.isValidDocument()&&(E.setReadTime(u.commitVersion),f.addEntry(E)))})}),p.next(()=>l.mutationQueue.removeMutationBatch(c,h))}(n,r,e,i).next(()=>i.apply(r)).next(()=>n.mutationQueue.performConsistencyCheck(r)).next(()=>n.documentOverlayCache.removeOverlaysForBatchId(r,s,e.batch.batchId)).next(()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(r,function(l){let c=Je();for(let u=0;u0&&(c=c.add(l.batch.mutations[u].key));return c}(e))).next(()=>n.localDocuments.getDocuments(r,s))})}function yS(t){const e=Oe(t);return e.persistence.runTransaction("Get last remote snapshot version","readonly",n=>e.li.getLastRemoteSnapshotVersion(n))}function IP(t,e){const n=Oe(t),r=e.snapshotVersion;let s=n.vs;return n.persistence.runTransaction("Apply remote event","readwrite-primary",i=>{const o=n.xs.newChangeBuffer({trackRemovals:!0});s=n.vs;const l=[];e.targetChanges.forEach((f,h)=>{const m=s.get(h);if(!m)return;l.push(n.li.removeMatchingKeys(i,f.removedDocuments,h).next(()=>n.li.addMatchingKeys(i,f.addedDocuments,h)));let p=m.withSequenceNumber(i.currentSequenceNumber);e.targetMismatches.get(h)!==null?p=p.withResumeToken(wn.EMPTY_BYTE_STRING,Me.min()).withLastLimboFreeSnapshotVersion(Me.min()):f.resumeToken.approximateByteSize()>0&&(p=p.withResumeToken(f.resumeToken,r)),s=s.insert(h,p),function(E,C,y){return E.resumeToken.approximateByteSize()===0||C.snapshotVersion.toMicroseconds()-E.snapshotVersion.toMicroseconds()>=SP?!0:y.addedDocuments.size+y.modifiedDocuments.size+y.removedDocuments.size>0}(m,p,f)&&l.push(n.li.updateTargetData(i,p))});let c=js(),u=Je();if(e.documentUpdates.forEach(f=>{e.resolvedLimboDocuments.has(f)&&l.push(n.persistence.referenceDelegate.updateLimboDocument(i,f))}),l.push(CP(i,o,e.documentUpdates).next(f=>{c=f.Bs,u=f.Ls})),!r.isEqual(Me.min())){const f=n.li.getLastRemoteSnapshotVersion(i).next(h=>n.li.setTargetsMetadata(i,i.currentSequenceNumber,r));l.push(f)}return Z.waitFor(l).next(()=>o.apply(i)).next(()=>n.localDocuments.getLocalViewOfDocuments(i,c,u)).next(()=>c)}).then(i=>(n.vs=s,i))}function CP(t,e,n){let r=Je(),s=Je();return n.forEach(i=>r=r.add(i)),e.getEntries(t,r).next(i=>{let o=js();return n.forEach((l,c)=>{const u=i.get(l);c.isFoundDocument()!==u.isFoundDocument()&&(s=s.add(l)),c.isNoDocument()&&c.version.isEqual(Me.min())?(e.removeEntry(l,c.readTime),o=o.insert(l,c)):!u.isValidDocument()||c.version.compareTo(u.version)>0||c.version.compareTo(u.version)===0&&u.hasPendingWrites?(e.addEntry(c),o=o.insert(l,c)):ye(r0,"Ignoring outdated watch update for ",l,". Current version:",u.version," Watch version:",c.version)}),{Bs:o,Ls:s}})}function AP(t,e){const n=Oe(t);return n.persistence.runTransaction("Get next mutation batch","readonly",r=>(e===void 0&&(e=qg),n.mutationQueue.getNextMutationBatchAfterBatchId(r,e)))}function jP(t,e){const n=Oe(t);return n.persistence.runTransaction("Allocate target","readwrite",r=>{let s;return n.li.getTargetData(r,e).next(i=>i?(s=i,Z.resolve(s)):n.li.allocateTargetId(r).next(o=>(s=new ni(e,o,"TargetPurposeListen",r.currentSequenceNumber),n.li.addTargetData(r,s).next(()=>s))))}).then(r=>{const s=n.vs.get(r.targetId);return(s===null||r.snapshotVersion.compareTo(s.snapshotVersion)>0)&&(n.vs=n.vs.insert(r.targetId,r),n.Fs.set(e,r.targetId)),r})}async function ym(t,e,n){const r=Oe(t),s=r.vs.get(e),i=n?"readwrite":"readwrite-primary";try{n||await r.persistence.runTransaction("Release target",i,o=>r.persistence.referenceDelegate.removeTarget(o,s))}catch(o){if(!ka(o))throw o;ye(r0,`Failed to update sequence numbers for target ${e}: ${o}`)}r.vs=r.vs.remove(e),r.Fs.delete(s.target)}function Pv(t,e,n){const r=Oe(t);let s=Me.min(),i=Je();return r.persistence.runTransaction("Execute query","readwrite",o=>function(c,u,f){const h=Oe(c),m=h.Fs.get(f);return m!==void 0?Z.resolve(h.vs.get(m)):h.li.getTargetData(u,f)}(r,o,es(e)).next(l=>{if(l)return s=l.lastLimboFreeSnapshotVersion,r.li.getMatchingKeysForTargetId(o,l.targetId).next(c=>{i=c})}).next(()=>r.Cs.getDocumentsMatchingQuery(o,e,n?s:Me.min(),n?i:Je())).next(l=>(PP(r,yj(e),l),{documents:l,ks:i})))}function PP(t,e,n){let r=t.Ms.get(e)||Me.min();n.forEach((s,i)=>{i.readTime.compareTo(r)>0&&(r=i.readTime)}),t.Ms.set(e,r)}class Rv{constructor(){this.activeTargetIds=Ej()}Qs(e){this.activeTargetIds=this.activeTargetIds.add(e)}Gs(e){this.activeTargetIds=this.activeTargetIds.delete(e)}Ws(){const e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)}}class RP{constructor(){this.vo=new Rv,this.Fo={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,n,r){}addLocalQueryTarget(e,n=!0){return n&&this.vo.Qs(e),this.Fo[e]||"not-current"}updateQueryState(e,n,r){this.Fo[e]=n}removeLocalQueryTarget(e){this.vo.Gs(e)}isLocalQueryTarget(e){return this.vo.activeTargetIds.has(e)}clearQueryState(e){delete this.Fo[e]}getAllActiveQueryTargets(){return this.vo.activeTargetIds}isActiveQueryTarget(e){return this.vo.activeTargetIds.has(e)}start(){return this.vo=new Rv,Promise.resolve()}handleUserChange(e,n,r){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class DP{Mo(e){}shutdown(){}}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Dv="ConnectivityMonitor";class Mv{constructor(){this.xo=()=>this.Oo(),this.No=()=>this.Bo(),this.Lo=[],this.ko()}Mo(e){this.Lo.push(e)}shutdown(){window.removeEventListener("online",this.xo),window.removeEventListener("offline",this.No)}ko(){window.addEventListener("online",this.xo),window.addEventListener("offline",this.No)}Oo(){ye(Dv,"Network connectivity changed: AVAILABLE");for(const e of this.Lo)e(0)}Bo(){ye(Dv,"Network connectivity changed: UNAVAILABLE");for(const e of this.Lo)e(1)}static v(){return typeof window<"u"&&window.addEventListener!==void 0&&window.removeEventListener!==void 0}}/** + * @license + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */let pu=null;function xm(){return pu===null?pu=function(){return 268435456+Math.round(2147483648*Math.random())}():pu++,"0x"+pu.toString(16)}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const If="RestConnection",MP={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery",ExecutePipeline:"executePipeline"};class LP{get qo(){return!1}constructor(e){this.databaseInfo=e,this.databaseId=e.databaseId;const n=e.ssl?"https":"http",r=encodeURIComponent(this.databaseId.projectId),s=encodeURIComponent(this.databaseId.database);this.Ko=n+"://"+e.host,this.Uo=`projects/${r}/databases/${s}`,this.$o=this.databaseId.database===Ed?`project_id=${r}`:`project_id=${r}&database_id=${s}`}Wo(e,n,r,s,i){const o=xm(),l=this.Qo(e,n.toUriEncodedString());ye(If,`Sending RPC '${e}' ${o}:`,l,r);const c={"google-cloud-resource-prefix":this.Uo,"x-goog-request-params":this.$o};this.Go(c,s,i);const{host:u}=new URL(l),f=Sa(u);return this.zo(e,l,c,r,f).then(h=>(ye(If,`Received RPC '${e}' ${o}: `,h),h),h=>{throw oo(If,`RPC '${e}' ${o} failed with error: `,h,"url: ",l,"request:",r),h})}jo(e,n,r,s,i,o){return this.Wo(e,n,r,s,i)}Go(e,n,r){e["X-Goog-Api-Client"]=function(){return"gl-js/ fire/"+Ta}(),e["Content-Type"]="text/plain",this.databaseInfo.appId&&(e["X-Firebase-GMPID"]=this.databaseInfo.appId),n&&n.headers.forEach((s,i)=>e[i]=s),r&&r.headers.forEach((s,i)=>e[i]=s)}Qo(e,n){const r=MP[e];let s=`${this.Ko}/v1/${n}:${r}`;return this.databaseInfo.apiKey&&(s=`${s}?key=${encodeURIComponent(this.databaseInfo.apiKey)}`),s}terminate(){}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class OP{constructor(e){this.Jo=e.Jo,this.Ho=e.Ho}Zo(e){this.Xo=e}Yo(e){this.e_=e}t_(e){this.n_=e}onMessage(e){this.r_=e}close(){this.Ho()}send(e){this.Jo(e)}i_(){this.Xo()}s_(){this.e_()}o_(e){this.n_(e)}__(e){this.r_(e)}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Tn="WebChannelConnection",el=(t,e,n)=>{t.listen(e,r=>{try{n(r)}catch(s){setTimeout(()=>{throw s},0)}})};class Xo extends LP{constructor(e){super(e),this.a_=[],this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}static u_(){if(!Xo.c_){const e=bE();el(e,wE.STAT_EVENT,n=>{n.stat===im.PROXY?ye(Tn,"STAT_EVENT: detected buffering proxy"):n.stat===im.NOPROXY&&ye(Tn,"STAT_EVENT: detected no buffering proxy")}),Xo.c_=!0}}zo(e,n,r,s,i){const o=xm();return new Promise((l,c)=>{const u=new xE;u.setWithCredentials(!0),u.listenOnce(vE.COMPLETE,()=>{try{switch(u.getLastErrorCode()){case Du.NO_ERROR:const h=u.getResponseJson();ye(Tn,`XHR for RPC '${e}' ${o} received:`,JSON.stringify(h)),l(h);break;case Du.TIMEOUT:ye(Tn,`RPC '${e}' ${o} timed out`),c(new fe(Y.DEADLINE_EXCEEDED,"Request time out"));break;case Du.HTTP_ERROR:const m=u.getStatus();if(ye(Tn,`RPC '${e}' ${o} failed with status:`,m,"response text:",u.getResponseText()),m>0){let p=u.getResponseJson();Array.isArray(p)&&(p=p[0]);const x=p==null?void 0:p.error;if(x&&x.status&&x.message){const E=function(y){const v=y.toLowerCase().replace(/_/g,"-");return Object.values(Y).indexOf(v)>=0?v:Y.UNKNOWN}(x.status);c(new fe(E,x.message))}else c(new fe(Y.UNKNOWN,"Server responded with status "+u.getStatus()))}else c(new fe(Y.UNAVAILABLE,"Connection failed."));break;default:Ce(9055,{l_:e,streamId:o,h_:u.getLastErrorCode(),P_:u.getLastError()})}}finally{ye(Tn,`RPC '${e}' ${o} completed.`)}});const f=JSON.stringify(s);ye(Tn,`RPC '${e}' ${o} sending request:`,s),u.send(n,"POST",f,r,15)})}T_(e,n,r){const s=xm(),i=[this.Ko,"/","google.firestore.v1.Firestore","/",e,"/channel"],o=this.createWebChannelTransport(),l={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:`projects/${this.databaseId.projectId}/databases/${this.databaseId.database}`},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling},c=this.longPollingOptions.timeoutSeconds;c!==void 0&&(l.longPollingTimeout=Math.round(1e3*c)),this.useFetchStreams&&(l.useFetchStreams=!0),this.Go(l.initMessageHeaders,n,r),l.encodeInitMessageHeaders=!0;const u=i.join("");ye(Tn,`Creating RPC '${e}' stream ${s}: ${u}`,l);const f=o.createWebChannel(u,l);this.E_(f);let h=!1,m=!1;const p=new OP({Jo:x=>{m?ye(Tn,`Not sending because RPC '${e}' stream ${s} is closed:`,x):(h||(ye(Tn,`Opening RPC '${e}' stream ${s} transport.`),f.open(),h=!0),ye(Tn,`RPC '${e}' stream ${s} sending:`,x),f.send(x))},Ho:()=>f.close()});return el(f,al.EventType.OPEN,()=>{m||(ye(Tn,`RPC '${e}' stream ${s} transport opened.`),p.i_())}),el(f,al.EventType.CLOSE,()=>{m||(m=!0,ye(Tn,`RPC '${e}' stream ${s} transport closed`),p.o_(),this.I_(f))}),el(f,al.EventType.ERROR,x=>{m||(m=!0,oo(Tn,`RPC '${e}' stream ${s} transport errored. Name:`,x.name,"Message:",x.message),p.o_(new fe(Y.UNAVAILABLE,"The operation could not be completed")))}),el(f,al.EventType.MESSAGE,x=>{var E;if(!m){const C=x.data[0];ut(!!C,16349);const y=C,v=(y==null?void 0:y.error)||((E=y[0])==null?void 0:E.error);if(v){ye(Tn,`RPC '${e}' stream ${s} received error:`,v);const _=v.status;let D=function(S){const w=Wt[S];if(w!==void 0)return rS(w)}(_),M=v.message;_==="NOT_FOUND"&&M.includes("database")&&M.includes("does not exist")&&M.includes(this.databaseId.database)&&oo(`Database '${this.databaseId.database}' not found. Please check your project configuration.`),D===void 0&&(D=Y.INTERNAL,M="Unknown error status: "+_+" with message "+v.message),m=!0,p.o_(new fe(D,M)),f.close()}else ye(Tn,`RPC '${e}' stream ${s} received:`,C),p.__(C)}}),Xo.u_(),setTimeout(()=>{p.s_()},0),p}terminate(){this.a_.forEach(e=>e.close()),this.a_=[]}E_(e){this.a_.push(e)}I_(e){this.a_=this.a_.filter(n=>n===e)}Go(e,n,r){super.Go(e,n,r),this.databaseInfo.apiKey&&(e["x-goog-api-key"]=this.databaseInfo.apiKey)}createWebChannelTransport(){return _E()}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function VP(t){return new Xo(t)}function Cf(){return typeof document<"u"?document:null}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Nh(t){return new Bj(t,!0)}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */Xo.c_=!1;class xS{constructor(e,n,r=1e3,s=1.5,i=6e4){this.Ci=e,this.timerId=n,this.R_=r,this.A_=s,this.V_=i,this.d_=0,this.m_=null,this.f_=Date.now(),this.reset()}reset(){this.d_=0}g_(){this.d_=this.V_}p_(e){this.cancel();const n=Math.floor(this.d_+this.y_()),r=Math.max(0,Date.now()-this.f_),s=Math.max(0,n-r);s>0&&ye("ExponentialBackoff",`Backing off for ${s} ms (base delay: ${this.d_} ms, delay with jitter: ${n} ms, last attempt: ${r} ms ago)`),this.m_=this.Ci.enqueueAfterDelay(this.timerId,s,()=>(this.f_=Date.now(),e())),this.d_*=this.A_,this.d_this.V_&&(this.d_=this.V_)}w_(){this.m_!==null&&(this.m_.skipDelay(),this.m_=null)}cancel(){this.m_!==null&&(this.m_.cancel(),this.m_=null)}y_(){return(Math.random()-.5)*this.d_}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Lv="PersistentStream";class vS{constructor(e,n,r,s,i,o,l,c){this.Ci=e,this.S_=r,this.b_=s,this.connection=i,this.authCredentialsProvider=o,this.appCheckCredentialsProvider=l,this.listener=c,this.state=0,this.D_=0,this.C_=null,this.v_=null,this.stream=null,this.F_=0,this.M_=new xS(e,n)}x_(){return this.state===1||this.state===5||this.O_()}O_(){return this.state===2||this.state===3}start(){this.F_=0,this.state!==4?this.auth():this.N_()}async stop(){this.x_()&&await this.close(0)}B_(){this.state=0,this.M_.reset()}L_(){this.O_()&&this.C_===null&&(this.C_=this.Ci.enqueueAfterDelay(this.S_,6e4,()=>this.k_()))}q_(e){this.K_(),this.stream.send(e)}async k_(){if(this.O_())return this.close(0)}K_(){this.C_&&(this.C_.cancel(),this.C_=null)}U_(){this.v_&&(this.v_.cancel(),this.v_=null)}async close(e,n){this.K_(),this.U_(),this.M_.cancel(),this.D_++,e!==4?this.M_.reset():n&&n.code===Y.RESOURCE_EXHAUSTED?(As(n.toString()),As("Using maximum backoff delay to prevent overloading the backend."),this.M_.g_()):n&&n.code===Y.UNAUTHENTICATED&&this.state!==3&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),this.stream!==null&&(this.W_(),this.stream.close(),this.stream=null),this.state=e,await this.listener.t_(n)}W_(){}auth(){this.state=1;const e=this.Q_(this.D_),n=this.D_;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then(([r,s])=>{this.D_===n&&this.G_(r,s)},r=>{e(()=>{const s=new fe(Y.UNKNOWN,"Fetching auth token failed: "+r.message);return this.z_(s)})})}G_(e,n){const r=this.Q_(this.D_);this.stream=this.j_(e,n),this.stream.Zo(()=>{r(()=>this.listener.Zo())}),this.stream.Yo(()=>{r(()=>(this.state=2,this.v_=this.Ci.enqueueAfterDelay(this.b_,1e4,()=>(this.O_()&&(this.state=3),Promise.resolve())),this.listener.Yo()))}),this.stream.t_(s=>{r(()=>this.z_(s))}),this.stream.onMessage(s=>{r(()=>++this.F_==1?this.J_(s):this.onNext(s))})}N_(){this.state=5,this.M_.p_(async()=>{this.state=0,this.start()})}z_(e){return ye(Lv,`close with error: ${e}`),this.stream=null,this.close(4,e)}Q_(e){return n=>{this.Ci.enqueueAndForget(()=>this.D_===e?n():(ye(Lv,"stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve()))}}}class FP extends vS{constructor(e,n,r,s,i,o){super(e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",n,r,s,o),this.serializer=i}j_(e,n){return this.connection.T_("Listen",e,n)}J_(e){return this.onNext(e)}onNext(e){this.M_.reset();const n=qj(this.serializer,e),r=function(i){if(!("targetChange"in i))return Me.min();const o=i.targetChange;return o.targetIds&&o.targetIds.length?Me.min():o.readTime?ts(o.readTime):Me.min()}(e);return this.listener.H_(n,r)}Z_(e){const n={};n.database=gm(this.serializer),n.addTarget=function(i,o){let l;const c=o.target;if(l=um(c)?{documents:Kj(i,c)}:{query:Qj(i,c).ft},l.targetId=o.targetId,o.resumeToken.approximateByteSize()>0){l.resumeToken=oS(i,o.resumeToken);const u=fm(i,o.expectedCount);u!==null&&(l.expectedCount=u)}else if(o.snapshotVersion.compareTo(Me.min())>0){l.readTime=kd(i,o.snapshotVersion.toTimestamp());const u=fm(i,o.expectedCount);u!==null&&(l.expectedCount=u)}return l}(this.serializer,e);const r=Xj(this.serializer,e);r&&(n.labels=r),this.q_(n)}X_(e){const n={};n.database=gm(this.serializer),n.removeTarget=e,this.q_(n)}}class zP extends vS{constructor(e,n,r,s,i,o){super(e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",n,r,s,o),this.serializer=i}get Y_(){return this.F_>0}start(){this.lastStreamToken=void 0,super.start()}W_(){this.Y_&&this.ea([])}j_(e,n){return this.connection.T_("Write",e,n)}J_(e){return ut(!!e.streamToken,31322),this.lastStreamToken=e.streamToken,ut(!e.writeResults||e.writeResults.length===0,55816),this.listener.ta()}onNext(e){ut(!!e.streamToken,12678),this.lastStreamToken=e.streamToken,this.M_.reset();const n=Wj(e.writeResults,e.commitTime),r=ts(e.commitTime);return this.listener.na(r,n)}ra(){const e={};e.database=gm(this.serializer),this.q_(e)}ea(e){const n={streamToken:this.lastStreamToken,writes:e.map(r=>Gj(this.serializer,r))};this.q_(n)}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class UP{}class BP extends UP{constructor(e,n,r,s){super(),this.authCredentials=e,this.appCheckCredentials=n,this.connection=r,this.serializer=s,this.ia=!1}sa(){if(this.ia)throw new fe(Y.FAILED_PRECONDITION,"The client has already been terminated.")}Wo(e,n,r,s){return this.sa(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([i,o])=>this.connection.Wo(e,pm(n,r),s,i,o)).catch(i=>{throw i.name==="FirebaseError"?(i.code===Y.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),i):new fe(Y.UNKNOWN,i.toString())})}jo(e,n,r,s,i){return this.sa(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([o,l])=>this.connection.jo(e,pm(n,r),s,o,l,i)).catch(o=>{throw o.name==="FirebaseError"?(o.code===Y.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),o):new fe(Y.UNKNOWN,o.toString())})}terminate(){this.ia=!0,this.connection.terminate()}}function $P(t,e,n,r){return new BP(t,e,n,r)}class HP{constructor(e,n){this.asyncQueue=e,this.onlineStateHandler=n,this.state="Unknown",this.oa=0,this._a=null,this.aa=!0}ua(){this.oa===0&&(this.ca("Unknown"),this._a=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,()=>(this._a=null,this.la("Backend didn't respond within 10 seconds."),this.ca("Offline"),Promise.resolve())))}ha(e){this.state==="Online"?this.ca("Unknown"):(this.oa++,this.oa>=1&&(this.Pa(),this.la(`Connection failed 1 times. Most recent error: ${e.toString()}`),this.ca("Offline")))}set(e){this.Pa(),this.oa=0,e==="Online"&&(this.aa=!1),this.ca(e)}ca(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}la(e){const n=`Could not reach Cloud Firestore backend. ${e} +This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.`;this.aa?(As(n),this.aa=!1):ye("OnlineStateTracker",n)}Pa(){this._a!==null&&(this._a.cancel(),this._a=null)}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const ao="RemoteStore";class qP{constructor(e,n,r,s,i){this.localStore=e,this.datastore=n,this.asyncQueue=r,this.remoteSyncer={},this.Ta=[],this.Ea=new Map,this.Ia=new Set,this.Ra=[],this.Aa=i,this.Aa.Mo(o=>{r.enqueueAndForget(async()=>{go(this)&&(ye(ao,"Restarting streams for network reachability change."),await async function(c){const u=Oe(c);u.Ia.add(4),await xc(u),u.Va.set("Unknown"),u.Ia.delete(4),await kh(u)}(this))})}),this.Va=new HP(r,s)}}async function kh(t){if(go(t))for(const e of t.Ra)await e(!0)}async function xc(t){for(const e of t.Ra)await e(!1)}function wS(t,e){const n=Oe(t);n.Ea.has(e.targetId)||(n.Ea.set(e.targetId,e),a0(n)?o0(n):Ca(n).O_()&&i0(n,e))}function s0(t,e){const n=Oe(t),r=Ca(n);n.Ea.delete(e),r.O_()&&bS(n,e),n.Ea.size===0&&(r.O_()?r.L_():go(n)&&n.Va.set("Unknown"))}function i0(t,e){if(t.da.$e(e.targetId),e.resumeToken.approximateByteSize()>0||e.snapshotVersion.compareTo(Me.min())>0){const n=t.remoteSyncer.getRemoteKeysForTarget(e.targetId).size;e=e.withExpectedCount(n)}Ca(t).Z_(e)}function bS(t,e){t.da.$e(e),Ca(t).X_(e)}function o0(t){t.da=new Vj({getRemoteKeysForTarget:e=>t.remoteSyncer.getRemoteKeysForTarget(e),At:e=>t.Ea.get(e)||null,ht:()=>t.datastore.serializer.databaseId}),Ca(t).start(),t.Va.ua()}function a0(t){return go(t)&&!Ca(t).x_()&&t.Ea.size>0}function go(t){return Oe(t).Ia.size===0}function _S(t){t.da=void 0}async function GP(t){t.Va.set("Online")}async function WP(t){t.Ea.forEach((e,n)=>{i0(t,e)})}async function KP(t,e){_S(t),a0(t)?(t.Va.ha(e),o0(t)):t.Va.set("Unknown")}async function QP(t,e,n){if(t.Va.set("Online"),e instanceof iS&&e.state===2&&e.cause)try{await async function(s,i){const o=i.cause;for(const l of i.targetIds)s.Ea.has(l)&&(await s.remoteSyncer.rejectListen(l,o),s.Ea.delete(l),s.da.removeTarget(l))}(t,e)}catch(r){ye(ao,"Failed to remove targets %s: %s ",e.targetIds.join(","),r),await Cd(t,r)}else if(e instanceof Vu?t.da.Xe(e):e instanceof sS?t.da.st(e):t.da.tt(e),!n.isEqual(Me.min()))try{const r=await yS(t.localStore);n.compareTo(r)>=0&&await function(i,o){const l=i.da.Tt(o);return l.targetChanges.forEach((c,u)=>{if(c.resumeToken.approximateByteSize()>0){const f=i.Ea.get(u);f&&i.Ea.set(u,f.withResumeToken(c.resumeToken,o))}}),l.targetMismatches.forEach((c,u)=>{const f=i.Ea.get(c);if(!f)return;i.Ea.set(c,f.withResumeToken(wn.EMPTY_BYTE_STRING,f.snapshotVersion)),bS(i,c);const h=new ni(f.target,c,u,f.sequenceNumber);i0(i,h)}),i.remoteSyncer.applyRemoteEvent(l)}(t,n)}catch(r){ye(ao,"Failed to raise snapshot:",r),await Cd(t,r)}}async function Cd(t,e,n){if(!ka(e))throw e;t.Ia.add(1),await xc(t),t.Va.set("Offline"),n||(n=()=>yS(t.localStore)),t.asyncQueue.enqueueRetryable(async()=>{ye(ao,"Retrying IndexedDB access"),await n(),t.Ia.delete(1),await kh(t)})}function ES(t,e){return e().catch(n=>Cd(t,n,e))}async function Ih(t){const e=Oe(t),n=Si(e);let r=e.Ta.length>0?e.Ta[e.Ta.length-1].batchId:qg;for(;YP(e);)try{const s=await AP(e.localStore,r);if(s===null){e.Ta.length===0&&n.L_();break}r=s.batchId,XP(e,s)}catch(s){await Cd(e,s)}SS(e)&&TS(e)}function YP(t){return go(t)&&t.Ta.length<10}function XP(t,e){t.Ta.push(e);const n=Si(t);n.O_()&&n.Y_&&n.ea(e.mutations)}function SS(t){return go(t)&&!Si(t).x_()&&t.Ta.length>0}function TS(t){Si(t).start()}async function JP(t){Si(t).ra()}async function ZP(t){const e=Si(t);for(const n of t.Ta)e.ea(n.mutations)}async function eR(t,e,n){const r=t.Ta.shift(),s=Xg.from(r,e,n);await ES(t,()=>t.remoteSyncer.applySuccessfulWrite(s)),await Ih(t)}async function tR(t,e){e&&Si(t).Y_&&await async function(r,s){if(function(o){return Mj(o)&&o!==Y.ABORTED}(s.code)){const i=r.Ta.shift();Si(r).B_(),await ES(r,()=>r.remoteSyncer.rejectFailedWrite(i.batchId,s)),await Ih(r)}}(t,e),SS(t)&&TS(t)}async function Ov(t,e){const n=Oe(t);n.asyncQueue.verifyOperationInProgress(),ye(ao,"RemoteStore received new credentials");const r=go(n);n.Ia.add(3),await xc(n),r&&n.Va.set("Unknown"),await n.remoteSyncer.handleCredentialChange(e),n.Ia.delete(3),await kh(n)}async function nR(t,e){const n=Oe(t);e?(n.Ia.delete(2),await kh(n)):e||(n.Ia.add(2),await xc(n),n.Va.set("Unknown"))}function Ca(t){return t.ma||(t.ma=function(n,r,s){const i=Oe(n);return i.sa(),new FP(r,i.connection,i.authCredentials,i.appCheckCredentials,i.serializer,s)}(t.datastore,t.asyncQueue,{Zo:GP.bind(null,t),Yo:WP.bind(null,t),t_:KP.bind(null,t),H_:QP.bind(null,t)}),t.Ra.push(async e=>{e?(t.ma.B_(),a0(t)?o0(t):t.Va.set("Unknown")):(await t.ma.stop(),_S(t))})),t.ma}function Si(t){return t.fa||(t.fa=function(n,r,s){const i=Oe(n);return i.sa(),new zP(r,i.connection,i.authCredentials,i.appCheckCredentials,i.serializer,s)}(t.datastore,t.asyncQueue,{Zo:()=>Promise.resolve(),Yo:JP.bind(null,t),t_:tR.bind(null,t),ta:ZP.bind(null,t),na:eR.bind(null,t)}),t.Ra.push(async e=>{e?(t.fa.B_(),await Ih(t)):(await t.fa.stop(),t.Ta.length>0&&(ye(ao,`Stopping write stream with ${t.Ta.length} pending writes`),t.Ta=[]))})),t.fa}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class l0{constructor(e,n,r,s,i){this.asyncQueue=e,this.timerId=n,this.targetTimeMs=r,this.op=s,this.removalCallback=i,this.deferred=new Es,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch(o=>{})}get promise(){return this.deferred.promise}static createAndSchedule(e,n,r,s,i){const o=Date.now()+r,l=new l0(e,n,o,s,i);return l.start(r),l}start(e){this.timerHandle=setTimeout(()=>this.handleDelayElapsed(),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){this.timerHandle!==null&&(this.clearTimeout(),this.deferred.reject(new fe(Y.CANCELLED,"Operation cancelled"+(e?": "+e:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget(()=>this.timerHandle!==null?(this.clearTimeout(),this.op().then(e=>this.deferred.resolve(e))):Promise.resolve())}clearTimeout(){this.timerHandle!==null&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}}function c0(t,e){if(As("AsyncQueue",`${e}: ${t}`),ka(t))return new fe(Y.UNAVAILABLE,`${e}: ${t}`);throw t}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Jo{static emptySet(e){return new Jo(e.comparator)}constructor(e){this.comparator=e?(n,r)=>e(n,r)||Ne.comparator(n.key,r.key):(n,r)=>Ne.comparator(n.key,r.key),this.keyedMap=ll(),this.sortedSet=new Lt(this.comparator)}has(e){return this.keyedMap.get(e)!=null}get(e){return this.keyedMap.get(e)}first(){return this.sortedSet.minKey()}last(){return this.sortedSet.maxKey()}isEmpty(){return this.sortedSet.isEmpty()}indexOf(e){const n=this.keyedMap.get(e);return n?this.sortedSet.indexOf(n):-1}get size(){return this.sortedSet.size}forEach(e){this.sortedSet.inorderTraversal((n,r)=>(e(n),!1))}add(e){const n=this.delete(e.key);return n.copy(n.keyedMap.insert(e.key,e),n.sortedSet.insert(e,null))}delete(e){const n=this.get(e);return n?this.copy(this.keyedMap.remove(e),this.sortedSet.remove(n)):this}isEqual(e){if(!(e instanceof Jo)||this.size!==e.size)return!1;const n=this.sortedSet.getIterator(),r=e.sortedSet.getIterator();for(;n.hasNext();){const s=n.getNext().key,i=r.getNext().key;if(!s.isEqual(i))return!1}return!0}toString(){const e=[];return this.forEach(n=>{e.push(n.toString())}),e.length===0?"DocumentSet ()":`DocumentSet ( + `+e.join(` +`)+` +)`}copy(e,n){const r=new Jo;return r.comparator=this.comparator,r.keyedMap=e,r.sortedSet=n,r}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Vv{constructor(){this.ga=new Lt(Ne.comparator)}track(e){const n=e.doc.key,r=this.ga.get(n);r?e.type!==0&&r.type===3?this.ga=this.ga.insert(n,e):e.type===3&&r.type!==1?this.ga=this.ga.insert(n,{type:r.type,doc:e.doc}):e.type===2&&r.type===2?this.ga=this.ga.insert(n,{type:2,doc:e.doc}):e.type===2&&r.type===0?this.ga=this.ga.insert(n,{type:0,doc:e.doc}):e.type===1&&r.type===0?this.ga=this.ga.remove(n):e.type===1&&r.type===2?this.ga=this.ga.insert(n,{type:1,doc:r.doc}):e.type===0&&r.type===1?this.ga=this.ga.insert(n,{type:2,doc:e.doc}):Ce(63341,{Vt:e,pa:r}):this.ga=this.ga.insert(n,e)}ya(){const e=[];return this.ga.inorderTraversal((n,r)=>{e.push(r)}),e}}class xa{constructor(e,n,r,s,i,o,l,c,u){this.query=e,this.docs=n,this.oldDocs=r,this.docChanges=s,this.mutatedKeys=i,this.fromCache=o,this.syncStateChanged=l,this.excludesMetadataChanges=c,this.hasCachedResults=u}static fromInitialDocuments(e,n,r,s,i){const o=[];return n.forEach(l=>{o.push({type:0,doc:l})}),new xa(e,n,Jo.emptySet(n),o,r,s,!0,!1,i)}get hasPendingWrites(){return!this.mutatedKeys.isEmpty()}isEqual(e){if(!(this.fromCache===e.fromCache&&this.hasCachedResults===e.hasCachedResults&&this.syncStateChanged===e.syncStateChanged&&this.mutatedKeys.isEqual(e.mutatedKeys)&&wh(this.query,e.query)&&this.docs.isEqual(e.docs)&&this.oldDocs.isEqual(e.oldDocs)))return!1;const n=this.docChanges,r=e.docChanges;if(n.length!==r.length)return!1;for(let s=0;se.Da())}}class sR{constructor(){this.queries=Fv(),this.onlineState="Unknown",this.Ca=new Set}terminate(){(function(n,r){const s=Oe(n),i=s.queries;s.queries=Fv(),i.forEach((o,l)=>{for(const c of l.Sa)c.onError(r)})})(this,new fe(Y.ABORTED,"Firestore shutting down"))}}function Fv(){return new mo(t=>HE(t),wh)}async function u0(t,e){const n=Oe(t);let r=3;const s=e.query;let i=n.queries.get(s);i?!i.ba()&&e.Da()&&(r=2):(i=new rR,r=e.Da()?0:1);try{switch(r){case 0:i.wa=await n.onListen(s,!0);break;case 1:i.wa=await n.onListen(s,!1);break;case 2:await n.onFirstRemoteStoreListen(s)}}catch(o){const l=c0(o,`Initialization of query '${ko(e.query)}' failed`);return void e.onError(l)}n.queries.set(s,i),i.Sa.push(e),e.va(n.onlineState),i.wa&&e.Fa(i.wa)&&h0(n)}async function d0(t,e){const n=Oe(t),r=e.query;let s=3;const i=n.queries.get(r);if(i){const o=i.Sa.indexOf(e);o>=0&&(i.Sa.splice(o,1),i.Sa.length===0?s=e.Da()?0:1:!i.ba()&&e.Da()&&(s=2))}switch(s){case 0:return n.queries.delete(r),n.onUnlisten(r,!0);case 1:return n.queries.delete(r),n.onUnlisten(r,!1);case 2:return n.onLastRemoteStoreUnlisten(r);default:return}}function iR(t,e){const n=Oe(t);let r=!1;for(const s of e){const i=s.query,o=n.queries.get(i);if(o){for(const l of o.Sa)l.Fa(s)&&(r=!0);o.wa=s}}r&&h0(n)}function oR(t,e,n){const r=Oe(t),s=r.queries.get(e);if(s)for(const i of s.Sa)i.onError(n);r.queries.delete(e)}function h0(t){t.Ca.forEach(e=>{e.next()})}var vm,zv;(zv=vm||(vm={})).Ma="default",zv.Cache="cache";class f0{constructor(e,n,r){this.query=e,this.xa=n,this.Oa=!1,this.Na=null,this.onlineState="Unknown",this.options=r||{}}Fa(e){if(!this.options.includeMetadataChanges){const r=[];for(const s of e.docChanges)s.type!==3&&r.push(s);e=new xa(e.query,e.docs,e.oldDocs,r,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let n=!1;return this.Oa?this.Ba(e)&&(this.xa.next(e),n=!0):this.La(e,this.onlineState)&&(this.ka(e),n=!0),this.Na=e,n}onError(e){this.xa.error(e)}va(e){this.onlineState=e;let n=!1;return this.Na&&!this.Oa&&this.La(this.Na,e)&&(this.ka(this.Na),n=!0),n}La(e,n){if(!e.fromCache||!this.Da())return!0;const r=n!=="Offline";return(!this.options.qa||!r)&&(!e.docs.isEmpty()||e.hasCachedResults||n==="Offline")}Ba(e){if(e.docChanges.length>0)return!0;const n=this.Na&&this.Na.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!n)&&this.options.includeMetadataChanges===!0}ka(e){e=xa.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.Oa=!0,this.xa.next(e)}Da(){return this.options.source!==vm.Cache}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class NS{constructor(e){this.key=e}}class kS{constructor(e){this.key=e}}class aR{constructor(e,n){this.query=e,this.Za=n,this.Xa=null,this.hasCachedResults=!1,this.current=!1,this.Ya=Je(),this.mutatedKeys=Je(),this.eu=qE(e),this.tu=new Jo(this.eu)}get nu(){return this.Za}ru(e,n){const r=n?n.iu:new Vv,s=n?n.tu:this.tu;let i=n?n.mutatedKeys:this.mutatedKeys,o=s,l=!1;const c=this.query.limitType==="F"&&s.size===this.query.limit?s.last():null,u=this.query.limitType==="L"&&s.size===this.query.limit?s.first():null;if(e.inorderTraversal((f,h)=>{const m=s.get(f),p=bh(this.query,h)?h:null,x=!!m&&this.mutatedKeys.has(m.key),E=!!p&&(p.hasLocalMutations||this.mutatedKeys.has(p.key)&&p.hasCommittedMutations);let C=!1;m&&p?m.data.isEqual(p.data)?x!==E&&(r.track({type:3,doc:p}),C=!0):this.su(m,p)||(r.track({type:2,doc:p}),C=!0,(c&&this.eu(p,c)>0||u&&this.eu(p,u)<0)&&(l=!0)):!m&&p?(r.track({type:0,doc:p}),C=!0):m&&!p&&(r.track({type:1,doc:m}),C=!0,(c||u)&&(l=!0)),C&&(p?(o=o.add(p),i=E?i.add(f):i.delete(f)):(o=o.delete(f),i=i.delete(f)))}),this.query.limit!==null)for(;o.size>this.query.limit;){const f=this.query.limitType==="F"?o.last():o.first();o=o.delete(f.key),i=i.delete(f.key),r.track({type:1,doc:f})}return{tu:o,iu:r,bs:l,mutatedKeys:i}}su(e,n){return e.hasLocalMutations&&n.hasCommittedMutations&&!n.hasLocalMutations}applyChanges(e,n,r,s){const i=this.tu;this.tu=e.tu,this.mutatedKeys=e.mutatedKeys;const o=e.iu.ya();o.sort((f,h)=>function(p,x){const E=C=>{switch(C){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return Ce(20277,{Vt:C})}};return E(p)-E(x)}(f.type,h.type)||this.eu(f.doc,h.doc)),this.ou(r),s=s??!1;const l=n&&!s?this._u():[],c=this.Ya.size===0&&this.current&&!s?1:0,u=c!==this.Xa;return this.Xa=c,o.length!==0||u?{snapshot:new xa(this.query,e.tu,i,o,e.mutatedKeys,c===0,u,!1,!!r&&r.resumeToken.approximateByteSize()>0),au:l}:{au:l}}va(e){return this.current&&e==="Offline"?(this.current=!1,this.applyChanges({tu:this.tu,iu:new Vv,mutatedKeys:this.mutatedKeys,bs:!1},!1)):{au:[]}}uu(e){return!this.Za.has(e)&&!!this.tu.has(e)&&!this.tu.get(e).hasLocalMutations}ou(e){e&&(e.addedDocuments.forEach(n=>this.Za=this.Za.add(n)),e.modifiedDocuments.forEach(n=>{}),e.removedDocuments.forEach(n=>this.Za=this.Za.delete(n)),this.current=e.current)}_u(){if(!this.current)return[];const e=this.Ya;this.Ya=Je(),this.tu.forEach(r=>{this.uu(r.key)&&(this.Ya=this.Ya.add(r.key))});const n=[];return e.forEach(r=>{this.Ya.has(r)||n.push(new kS(r))}),this.Ya.forEach(r=>{e.has(r)||n.push(new NS(r))}),n}cu(e){this.Za=e.ks,this.Ya=Je();const n=this.ru(e.documents);return this.applyChanges(n,!0)}lu(){return xa.fromInitialDocuments(this.query,this.tu,this.mutatedKeys,this.Xa===0,this.hasCachedResults)}}const p0="SyncEngine";class lR{constructor(e,n,r){this.query=e,this.targetId=n,this.view=r}}class cR{constructor(e){this.key=e,this.hu=!1}}class uR{constructor(e,n,r,s,i,o){this.localStore=e,this.remoteStore=n,this.eventManager=r,this.sharedClientState=s,this.currentUser=i,this.maxConcurrentLimboResolutions=o,this.Pu={},this.Tu=new mo(l=>HE(l),wh),this.Eu=new Map,this.Iu=new Set,this.Ru=new Lt(Ne.comparator),this.Au=new Map,this.Vu=new e0,this.du={},this.mu=new Map,this.fu=ya.ar(),this.onlineState="Unknown",this.gu=void 0}get isPrimaryClient(){return this.gu===!0}}async function dR(t,e,n=!0){const r=RS(t);let s;const i=r.Tu.get(e);return i?(r.sharedClientState.addLocalQueryTarget(i.targetId),s=i.view.lu()):s=await IS(r,e,n,!0),s}async function hR(t,e){const n=RS(t);await IS(n,e,!0,!1)}async function IS(t,e,n,r){const s=await jP(t.localStore,es(e)),i=s.targetId,o=t.sharedClientState.addLocalQueryTarget(i,n);let l;return r&&(l=await fR(t,e,i,o==="current",s.resumeToken)),t.isPrimaryClient&&n&&wS(t.remoteStore,s),l}async function fR(t,e,n,r,s){t.pu=(h,m,p)=>async function(E,C,y,v){let _=C.view.ru(y);_.bs&&(_=await Pv(E.localStore,C.query,!1).then(({documents:S})=>C.view.ru(S,_)));const D=v&&v.targetChanges.get(C.targetId),M=v&&v.targetMismatches.get(C.targetId)!=null,T=C.view.applyChanges(_,E.isPrimaryClient,D,M);return Bv(E,C.targetId,T.au),T.snapshot}(t,h,m,p);const i=await Pv(t.localStore,e,!0),o=new aR(e,i.ks),l=o.ru(i.documents),c=yc.createSynthesizedTargetChangeForCurrentChange(n,r&&t.onlineState!=="Offline",s),u=o.applyChanges(l,t.isPrimaryClient,c);Bv(t,n,u.au);const f=new lR(e,n,o);return t.Tu.set(e,f),t.Eu.has(n)?t.Eu.get(n).push(e):t.Eu.set(n,[e]),u.snapshot}async function pR(t,e,n){const r=Oe(t),s=r.Tu.get(e),i=r.Eu.get(s.targetId);if(i.length>1)return r.Eu.set(s.targetId,i.filter(o=>!wh(o,e))),void r.Tu.delete(e);r.isPrimaryClient?(r.sharedClientState.removeLocalQueryTarget(s.targetId),r.sharedClientState.isActiveQueryTarget(s.targetId)||await ym(r.localStore,s.targetId,!1).then(()=>{r.sharedClientState.clearQueryState(s.targetId),n&&s0(r.remoteStore,s.targetId),wm(r,s.targetId)}).catch(Na)):(wm(r,s.targetId),await ym(r.localStore,s.targetId,!0))}async function mR(t,e){const n=Oe(t),r=n.Tu.get(e),s=n.Eu.get(r.targetId);n.isPrimaryClient&&s.length===1&&(n.sharedClientState.removeLocalQueryTarget(r.targetId),s0(n.remoteStore,r.targetId))}async function gR(t,e,n){const r=ER(t);try{const s=await function(o,l){const c=Oe(o),u=Ke.now(),f=l.reduce((p,x)=>p.add(x.key),Je());let h,m;return c.persistence.runTransaction("Locally write mutations","readwrite",p=>{let x=js(),E=Je();return c.xs.getEntries(p,f).next(C=>{x=C,x.forEach((y,v)=>{v.isValidDocument()||(E=E.add(y))})}).next(()=>c.localDocuments.getOverlayedDocuments(p,x)).next(C=>{h=C;const y=[];for(const v of l){const _=Aj(v,h.get(v.key).overlayedDocument);_!=null&&y.push(new ji(v.key,_,LE(_.value.mapValue),On.exists(!0)))}return c.mutationQueue.addMutationBatch(p,u,y,l)}).next(C=>{m=C;const y=C.applyToLocalDocumentSet(h,E);return c.documentOverlayCache.saveOverlays(p,C.batchId,y)})}).then(()=>({batchId:m.batchId,changes:WE(h)}))}(r.localStore,e);r.sharedClientState.addPendingMutation(s.batchId),function(o,l,c){let u=o.du[o.currentUser.toKey()];u||(u=new Lt(Xe)),u=u.insert(l,c),o.du[o.currentUser.toKey()]=u}(r,s.batchId,n),await vc(r,s.changes),await Ih(r.remoteStore)}catch(s){const i=c0(s,"Failed to persist write");n.reject(i)}}async function CS(t,e){const n=Oe(t);try{const r=await IP(n.localStore,e);e.targetChanges.forEach((s,i)=>{const o=n.Au.get(i);o&&(ut(s.addedDocuments.size+s.modifiedDocuments.size+s.removedDocuments.size<=1,22616),s.addedDocuments.size>0?o.hu=!0:s.modifiedDocuments.size>0?ut(o.hu,14607):s.removedDocuments.size>0&&(ut(o.hu,42227),o.hu=!1))}),await vc(n,r,e)}catch(r){await Na(r)}}function Uv(t,e,n){const r=Oe(t);if(r.isPrimaryClient&&n===0||!r.isPrimaryClient&&n===1){const s=[];r.Tu.forEach((i,o)=>{const l=o.view.va(e);l.snapshot&&s.push(l.snapshot)}),function(o,l){const c=Oe(o);c.onlineState=l;let u=!1;c.queries.forEach((f,h)=>{for(const m of h.Sa)m.va(l)&&(u=!0)}),u&&h0(c)}(r.eventManager,e),s.length&&r.Pu.H_(s),r.onlineState=e,r.isPrimaryClient&&r.sharedClientState.setOnlineState(e)}}async function yR(t,e,n){const r=Oe(t);r.sharedClientState.updateQueryState(e,"rejected",n);const s=r.Au.get(e),i=s&&s.key;if(i){let o=new Lt(Ne.comparator);o=o.insert(i,In.newNoDocument(i,Me.min()));const l=Je().add(i),c=new Th(Me.min(),new Map,new Lt(Xe),o,l);await CS(r,c),r.Ru=r.Ru.remove(i),r.Au.delete(e),m0(r)}else await ym(r.localStore,e,!1).then(()=>wm(r,e,n)).catch(Na)}async function xR(t,e){const n=Oe(t),r=e.batch.batchId;try{const s=await kP(n.localStore,e);jS(n,r,null),AS(n,r),n.sharedClientState.updateMutationState(r,"acknowledged"),await vc(n,s)}catch(s){await Na(s)}}async function vR(t,e,n){const r=Oe(t);try{const s=await function(o,l){const c=Oe(o);return c.persistence.runTransaction("Reject batch","readwrite-primary",u=>{let f;return c.mutationQueue.lookupMutationBatch(u,l).next(h=>(ut(h!==null,37113),f=h.keys(),c.mutationQueue.removeMutationBatch(u,h))).next(()=>c.mutationQueue.performConsistencyCheck(u)).next(()=>c.documentOverlayCache.removeOverlaysForBatchId(u,f,l)).next(()=>c.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(u,f)).next(()=>c.localDocuments.getDocuments(u,f))})}(r.localStore,e);jS(r,e,n),AS(r,e),r.sharedClientState.updateMutationState(e,"rejected",n),await vc(r,s)}catch(s){await Na(s)}}function AS(t,e){(t.mu.get(e)||[]).forEach(n=>{n.resolve()}),t.mu.delete(e)}function jS(t,e,n){const r=Oe(t);let s=r.du[r.currentUser.toKey()];if(s){const i=s.get(e);i&&(n?i.reject(n):i.resolve(),s=s.remove(e)),r.du[r.currentUser.toKey()]=s}}function wm(t,e,n=null){t.sharedClientState.removeLocalQueryTarget(e);for(const r of t.Eu.get(e))t.Tu.delete(r),n&&t.Pu.yu(r,n);t.Eu.delete(e),t.isPrimaryClient&&t.Vu.Gr(e).forEach(r=>{t.Vu.containsKey(r)||PS(t,r)})}function PS(t,e){t.Iu.delete(e.path.canonicalString());const n=t.Ru.get(e);n!==null&&(s0(t.remoteStore,n),t.Ru=t.Ru.remove(e),t.Au.delete(n),m0(t))}function Bv(t,e,n){for(const r of n)r instanceof NS?(t.Vu.addReference(r.key,e),wR(t,r)):r instanceof kS?(ye(p0,"Document no longer in limbo: "+r.key),t.Vu.removeReference(r.key,e),t.Vu.containsKey(r.key)||PS(t,r.key)):Ce(19791,{wu:r})}function wR(t,e){const n=e.key,r=n.path.canonicalString();t.Ru.get(n)||t.Iu.has(r)||(ye(p0,"New document in limbo: "+n),t.Iu.add(r),m0(t))}function m0(t){for(;t.Iu.size>0&&t.Ru.size{o.push(r.pu(c,e,n).then(u=>{var f;if((u||n)&&r.isPrimaryClient){const h=u?!u.fromCache:(f=n==null?void 0:n.targetChanges.get(c.targetId))==null?void 0:f.current;r.sharedClientState.updateQueryState(c.targetId,h?"current":"not-current")}if(u){s.push(u);const h=n0.Is(c.targetId,u);i.push(h)}}))}),await Promise.all(o),r.Pu.H_(s),await async function(c,u){const f=Oe(c);try{await f.persistence.runTransaction("notifyLocalViewChanges","readwrite",h=>Z.forEach(u,m=>Z.forEach(m.Ts,p=>f.persistence.referenceDelegate.addReference(h,m.targetId,p)).next(()=>Z.forEach(m.Es,p=>f.persistence.referenceDelegate.removeReference(h,m.targetId,p)))))}catch(h){if(!ka(h))throw h;ye(r0,"Failed to update sequence numbers: "+h)}for(const h of u){const m=h.targetId;if(!h.fromCache){const p=f.vs.get(m),x=p.snapshotVersion,E=p.withLastLimboFreeSnapshotVersion(x);f.vs=f.vs.insert(m,E)}}}(r.localStore,i))}async function bR(t,e){const n=Oe(t);if(!n.currentUser.isEqual(e)){ye(p0,"User change. New user:",e.toKey());const r=await gS(n.localStore,e);n.currentUser=e,function(i,o){i.mu.forEach(l=>{l.forEach(c=>{c.reject(new fe(Y.CANCELLED,o))})}),i.mu.clear()}(n,"'waitForPendingWrites' promise is rejected due to a user change."),n.sharedClientState.handleUserChange(e,r.removedBatchIds,r.addedBatchIds),await vc(n,r.Ns)}}function _R(t,e){const n=Oe(t),r=n.Au.get(e);if(r&&r.hu)return Je().add(r.key);{let s=Je();const i=n.Eu.get(e);if(!i)return s;for(const o of i){const l=n.Tu.get(o);s=s.unionWith(l.view.nu)}return s}}function RS(t){const e=Oe(t);return e.remoteStore.remoteSyncer.applyRemoteEvent=CS.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=_R.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=yR.bind(null,e),e.Pu.H_=iR.bind(null,e.eventManager),e.Pu.yu=oR.bind(null,e.eventManager),e}function ER(t){const e=Oe(t);return e.remoteStore.remoteSyncer.applySuccessfulWrite=xR.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=vR.bind(null,e),e}class Ad{constructor(){this.kind="memory",this.synchronizeTabs=!1}async initialize(e){this.serializer=Nh(e.databaseInfo.databaseId),this.sharedClientState=this.Du(e),this.persistence=this.Cu(e),await this.persistence.start(),this.localStore=this.vu(e),this.gcScheduler=this.Fu(e,this.localStore),this.indexBackfillerScheduler=this.Mu(e,this.localStore)}Fu(e,n){return null}Mu(e,n){return null}vu(e){return NP(this.persistence,new EP,e.initialUser,this.serializer)}Cu(e){return new mS(t0.Vi,this.serializer)}Du(e){return new RP}async terminate(){var e,n;(e=this.gcScheduler)==null||e.stop(),(n=this.indexBackfillerScheduler)==null||n.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}}Ad.provider={build:()=>new Ad};class SR extends Ad{constructor(e){super(),this.cacheSizeBytes=e}Fu(e,n){ut(this.persistence.referenceDelegate instanceof Id,46915);const r=this.persistence.referenceDelegate.garbageCollector;return new lP(r,e.asyncQueue,n)}Cu(e){const n=this.cacheSizeBytes!==void 0?Wn.withCacheSize(this.cacheSizeBytes):Wn.DEFAULT;return new mS(r=>Id.Vi(r,n),this.serializer)}}class bm{async initialize(e,n){this.localStore||(this.localStore=e.localStore,this.sharedClientState=e.sharedClientState,this.datastore=this.createDatastore(n),this.remoteStore=this.createRemoteStore(n),this.eventManager=this.createEventManager(n),this.syncEngine=this.createSyncEngine(n,!e.synchronizeTabs),this.sharedClientState.onlineStateHandler=r=>Uv(this.syncEngine,r,1),this.remoteStore.remoteSyncer.handleCredentialChange=bR.bind(null,this.syncEngine),await nR(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return function(){return new sR}()}createDatastore(e){const n=Nh(e.databaseInfo.databaseId),r=VP(e.databaseInfo);return $P(e.authCredentials,e.appCheckCredentials,r,n)}createRemoteStore(e){return function(r,s,i,o,l){return new qP(r,s,i,o,l)}(this.localStore,this.datastore,e.asyncQueue,n=>Uv(this.syncEngine,n,0),function(){return Mv.v()?new Mv:new DP}())}createSyncEngine(e,n){return function(s,i,o,l,c,u,f){const h=new uR(s,i,o,l,c,u);return f&&(h.gu=!0),h}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,n)}async terminate(){var e,n;await async function(s){const i=Oe(s);ye(ao,"RemoteStore shutting down."),i.Ia.add(5),await xc(i),i.Aa.shutdown(),i.Va.set("Unknown")}(this.remoteStore),(e=this.datastore)==null||e.terminate(),(n=this.eventManager)==null||n.terminate()}}bm.provider={build:()=>new bm};/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *//** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class g0{constructor(e){this.observer=e,this.muted=!1}next(e){this.muted||this.observer.next&&this.Ou(this.observer.next,e)}error(e){this.muted||(this.observer.error?this.Ou(this.observer.error,e):As("Uncaught Error in snapshot listener:",e.toString()))}Nu(){this.muted=!0}Ou(e,n){setTimeout(()=>{this.muted||e(n)},0)}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Ti="FirestoreClient";class TR{constructor(e,n,r,s,i){this.authCredentials=e,this.appCheckCredentials=n,this.asyncQueue=r,this._databaseInfo=s,this.user=Nn.UNAUTHENTICATED,this.clientId=Hg.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=i,this.authCredentials.start(r,async o=>{ye(Ti,"Received user=",o.uid),await this.authCredentialListener(o),this.user=o}),this.appCheckCredentials.start(r,o=>(ye(Ti,"Received new app check token=",o),this.appCheckCredentialListener(o,this.user)))}get configuration(){return{asyncQueue:this.asyncQueue,databaseInfo:this._databaseInfo,clientId:this.clientId,authCredentials:this.authCredentials,appCheckCredentials:this.appCheckCredentials,initialUser:this.user,maxConcurrentLimboResolutions:100}}setCredentialChangeListener(e){this.authCredentialListener=e}setAppCheckTokenChangeListener(e){this.appCheckCredentialListener=e}terminate(){this.asyncQueue.enterRestrictedMode();const e=new Es;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted(async()=>{try{this._onlineComponents&&await this._onlineComponents.terminate(),this._offlineComponents&&await this._offlineComponents.terminate(),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),e.resolve()}catch(n){const r=c0(n,"Failed to shutdown persistence");e.reject(r)}}),e.promise}}async function Af(t,e){t.asyncQueue.verifyOperationInProgress(),ye(Ti,"Initializing OfflineComponentProvider");const n=t.configuration;await e.initialize(n);let r=n.initialUser;t.setCredentialChangeListener(async s=>{r.isEqual(s)||(await gS(e.localStore,s),r=s)}),e.persistence.setDatabaseDeletedListener(()=>t.terminate()),t._offlineComponents=e}async function $v(t,e){t.asyncQueue.verifyOperationInProgress();const n=await NR(t);ye(Ti,"Initializing OnlineComponentProvider"),await e.initialize(n,t.configuration),t.setCredentialChangeListener(r=>Ov(e.remoteStore,r)),t.setAppCheckTokenChangeListener((r,s)=>Ov(e.remoteStore,s)),t._onlineComponents=e}async function NR(t){if(!t._offlineComponents)if(t._uninitializedComponentsProvider){ye(Ti,"Using user provided OfflineComponentProvider");try{await Af(t,t._uninitializedComponentsProvider._offline)}catch(e){const n=e;if(!function(s){return s.name==="FirebaseError"?s.code===Y.FAILED_PRECONDITION||s.code===Y.UNIMPLEMENTED:!(typeof DOMException<"u"&&s instanceof DOMException)||s.code===22||s.code===20||s.code===11}(n))throw n;oo("Error using user provided cache. Falling back to memory cache: "+n),await Af(t,new Ad)}}else ye(Ti,"Using default OfflineComponentProvider"),await Af(t,new SR(void 0));return t._offlineComponents}async function DS(t){return t._onlineComponents||(t._uninitializedComponentsProvider?(ye(Ti,"Using user provided OnlineComponentProvider"),await $v(t,t._uninitializedComponentsProvider._online)):(ye(Ti,"Using default OnlineComponentProvider"),await $v(t,new bm))),t._onlineComponents}function kR(t){return DS(t).then(e=>e.syncEngine)}async function jd(t){const e=await DS(t),n=e.eventManager;return n.onListen=dR.bind(null,e.syncEngine),n.onUnlisten=pR.bind(null,e.syncEngine),n.onFirstRemoteStoreListen=hR.bind(null,e.syncEngine),n.onLastRemoteStoreUnlisten=mR.bind(null,e.syncEngine),n}function IR(t,e,n,r){const s=new g0(r),i=new f0(e,s,n);return t.asyncQueue.enqueueAndForget(async()=>u0(await jd(t),i)),()=>{s.Nu(),t.asyncQueue.enqueueAndForget(async()=>d0(await jd(t),i))}}function CR(t,e,n={}){const r=new Es;return t.asyncQueue.enqueueAndForget(async()=>function(i,o,l,c,u){const f=new g0({next:m=>{f.Nu(),o.enqueueAndForget(()=>d0(i,h));const p=m.docs.has(l);!p&&m.fromCache?u.reject(new fe(Y.UNAVAILABLE,"Failed to get document because the client is offline.")):p&&m.fromCache&&c&&c.source==="server"?u.reject(new fe(Y.UNAVAILABLE,'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')):u.resolve(m)},error:m=>u.reject(m)}),h=new f0(vh(l.path),f,{includeMetadataChanges:!0,qa:!0});return u0(i,h)}(await jd(t),t.asyncQueue,e,n,r)),r.promise}function AR(t,e,n={}){const r=new Es;return t.asyncQueue.enqueueAndForget(async()=>function(i,o,l,c,u){const f=new g0({next:m=>{f.Nu(),o.enqueueAndForget(()=>d0(i,h)),m.fromCache&&c.source==="server"?u.reject(new fe(Y.UNAVAILABLE,'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')):u.resolve(m)},error:m=>u.reject(m)}),h=new f0(l,f,{includeMetadataChanges:!0,qa:!0});return u0(i,h)}(await jd(t),t.asyncQueue,e,n,r)),r.promise}function jR(t,e){const n=new Es;return t.asyncQueue.enqueueAndForget(async()=>gR(await kR(t),e,n)),n.promise}/** + * @license + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function MS(t){const e={};return t.timeoutSeconds!==void 0&&(e.timeoutSeconds=t.timeoutSeconds),e}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const PR="ComponentProvider",Hv=new Map;function RR(t,e,n,r,s){return new JA(t,e,n,s.host,s.ssl,s.experimentalForceLongPolling,s.experimentalAutoDetectLongPolling,MS(s.experimentalLongPollingOptions),s.useFetchStreams,s.isUsingEmulator,r)}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const LS="firestore.googleapis.com",qv=!0;class Gv{constructor(e){if(e.host===void 0){if(e.ssl!==void 0)throw new fe(Y.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host=LS,this.ssl=qv}else this.host=e.host,this.ssl=e.ssl??qv;if(this.isUsingEmulator=e.emulatorOptions!==void 0,this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,this.localCache=e.localCache,e.cacheSizeBytes===void 0)this.cacheSizeBytes=pS;else{if(e.cacheSizeBytes!==-1&&e.cacheSizeBytes30)throw new fe(Y.INVALID_ARGUMENT,`invalid long polling timeout: ${r.timeoutSeconds} (maximum allowed value is 30)`)}}(this.experimentalLongPollingOptions),this.useFetchStreams=!!e.useFetchStreams}isEqual(e){return this.host===e.host&&this.ssl===e.ssl&&this.credentials===e.credentials&&this.cacheSizeBytes===e.cacheSizeBytes&&this.experimentalForceLongPolling===e.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===e.experimentalAutoDetectLongPolling&&function(r,s){return r.timeoutSeconds===s.timeoutSeconds}(this.experimentalLongPollingOptions,e.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}}class Ch{constructor(e,n,r,s){this._authCredentials=e,this._appCheckCredentials=n,this._databaseId=r,this._app=s,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new Gv({}),this._settingsFrozen=!1,this._emulatorOptions={},this._terminateTask="notTerminated"}get app(){if(!this._app)throw new fe(Y.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}get _initialized(){return this._settingsFrozen}get _terminated(){return this._terminateTask!=="notTerminated"}_setSettings(e){if(this._settingsFrozen)throw new fe(Y.FAILED_PRECONDITION,"Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");this._settings=new Gv(e),this._emulatorOptions=e.emulatorOptions||{},e.credentials!==void 0&&(this._authCredentials=function(r){if(!r)return new jA;switch(r.type){case"firstParty":return new MA(r.sessionIndex||"0",r.iamToken||null,r.authTokenFactory||null);case"provider":return r.client;default:throw new fe(Y.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}}(e.credentials))}_getSettings(){return this._settings}_getEmulatorOptions(){return this._emulatorOptions}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return this._terminateTask==="notTerminated"&&(this._terminateTask=this._terminate()),this._terminateTask}async _restart(){this._terminateTask==="notTerminated"?await this._terminate():this._terminateTask="notTerminated"}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(n){const r=Hv.get(n);r&&(ye(PR,"Removing Datastore"),Hv.delete(n),r.terminate())}(this),Promise.resolve()}}function DR(t,e,n,r={}){var u;t=Ln(t,Ch);const s=Sa(e),i=t._getSettings(),o={...i,emulatorOptions:t._getEmulatorOptions()},l=`${e}:${n}`;s&&Fg(`https://${l}`),i.host!==LS&&i.host!==l&&oo("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used.");const c={...i,host:l,ssl:s,emulatorOptions:r};if(!ro(c,o)&&(t._setSettings(c),r.mockUserToken)){let f,h;if(typeof r.mockUserToken=="string")f=r.mockUserToken,h=Nn.MOCK_USER;else{f=dE(r.mockUserToken,(u=t._app)==null?void 0:u.options.projectId);const m=r.mockUserToken.sub||r.mockUserToken.user_id;if(!m)throw new fe(Y.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");h=new Nn(m)}t._authCredentials=new PA(new SE(f,h))}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Pi{constructor(e,n,r){this.converter=n,this._query=r,this.type="query",this.firestore=e}withConverter(e){return new Pi(this.firestore,e,this._query)}}class Ut{constructor(e,n,r){this.converter=n,this._key=r,this.type="document",this.firestore=e}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new gi(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new Ut(this.firestore,e,this._key)}toJSON(){return{type:Ut._jsonSchemaVersion,referencePath:this._key.toString()}}static fromJSON(e,n,r){if(mc(n,Ut._jsonSchema))return new Ut(e,r||null,new Ne(Et.fromString(n.referencePath)))}}Ut._jsonSchemaVersion="firestore/documentReference/1.0",Ut._jsonSchema={type:Xt("string",Ut._jsonSchemaVersion),referencePath:Xt("string")};class gi extends Pi{constructor(e,n,r){super(e,n,vh(r)),this._path=r,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const e=this._path.popLast();return e.isEmpty()?null:new Ut(this.firestore,null,new Ne(e))}withConverter(e){return new gi(this.firestore,e,this._path)}}function Dt(t,e,...n){if(t=sn(t),TE("collection","path",e),t instanceof Ch){const r=Et.fromString(e,...n);return iv(r),new gi(t,null,r)}{if(!(t instanceof Ut||t instanceof gi))throw new fe(Y.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(Et.fromString(e,...n));return iv(r),new gi(t.firestore,null,r)}}function Nt(t,e,...n){if(t=sn(t),arguments.length===1&&(e=Hg.newId()),TE("doc","path",e),t instanceof Ch){const r=Et.fromString(e,...n);return sv(r),new Ut(t,null,new Ne(r))}{if(!(t instanceof Ut||t instanceof gi))throw new fe(Y.INVALID_ARGUMENT,"Expected first argument to doc() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(Et.fromString(e,...n));return sv(r),new Ut(t.firestore,t instanceof gi?t.converter:null,new Ne(r))}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Wv="AsyncQueue";class Kv{constructor(e=Promise.resolve()){this.Yu=[],this.ec=!1,this.tc=[],this.nc=null,this.rc=!1,this.sc=!1,this.oc=[],this.M_=new xS(this,"async_queue_retry"),this._c=()=>{const r=Cf();r&&ye(Wv,"Visibility state changed to "+r.visibilityState),this.M_.w_()},this.ac=e;const n=Cf();n&&typeof n.addEventListener=="function"&&n.addEventListener("visibilitychange",this._c)}get isShuttingDown(){return this.ec}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.uc(),this.cc(e)}enterRestrictedMode(e){if(!this.ec){this.ec=!0,this.sc=e||!1;const n=Cf();n&&typeof n.removeEventListener=="function"&&n.removeEventListener("visibilitychange",this._c)}}enqueue(e){if(this.uc(),this.ec)return new Promise(()=>{});const n=new Es;return this.cc(()=>this.ec&&this.sc?Promise.resolve():(e().then(n.resolve,n.reject),n.promise)).then(()=>n.promise)}enqueueRetryable(e){this.enqueueAndForget(()=>(this.Yu.push(e),this.lc()))}async lc(){if(this.Yu.length!==0){try{await this.Yu[0](),this.Yu.shift(),this.M_.reset()}catch(e){if(!ka(e))throw e;ye(Wv,"Operation failed with retryable error: "+e)}this.Yu.length>0&&this.M_.p_(()=>this.lc())}}cc(e){const n=this.ac.then(()=>(this.rc=!0,e().catch(r=>{throw this.nc=r,this.rc=!1,As("INTERNAL UNHANDLED ERROR: ",Qv(r)),r}).then(r=>(this.rc=!1,r))));return this.ac=n,n}enqueueAfterDelay(e,n,r){this.uc(),this.oc.indexOf(e)>-1&&(n=0);const s=l0.createAndSchedule(this,e,n,r,i=>this.hc(i));return this.tc.push(s),s}uc(){this.nc&&Ce(47125,{Pc:Qv(this.nc)})}verifyOperationInProgress(){}async Tc(){let e;do e=this.ac,await e;while(e!==this.ac)}Ec(e){for(const n of this.tc)if(n.timerId===e)return!0;return!1}Ic(e){return this.Tc().then(()=>{this.tc.sort((n,r)=>n.targetTimeMs-r.targetTimeMs);for(const n of this.tc)if(n.skipDelay(),e!=="all"&&n.timerId===e)break;return this.Tc()})}Rc(e){this.oc.push(e)}hc(e){const n=this.tc.indexOf(e);this.tc.splice(n,1)}}function Qv(t){let e=t.message||"";return t.stack&&(e=t.stack.includes(t.message)?t.stack:t.message+` +`+t.stack),e}class os extends Ch{constructor(e,n,r,s){super(e,n,r,s),this.type="firestore",this._queue=new Kv,this._persistenceKey=(s==null?void 0:s.name)||"[DEFAULT]"}async _terminate(){if(this._firestoreClient){const e=this._firestoreClient.terminate();this._queue=new Kv(e),this._firestoreClient=void 0,await e}}}function MR(t,e){const n=typeof t=="object"?t:Bg(),r=typeof t=="string"?t:Ed,s=ph(n,"firestore").getImmediate({identifier:r});if(!s._initialized){const i=lE("firestore");i&&DR(s,...i)}return s}function wc(t){if(t._terminated)throw new fe(Y.FAILED_PRECONDITION,"The client has already been terminated.");return t._firestoreClient||LR(t),t._firestoreClient}function LR(t){var r,s,i,o;const e=t._freezeSettings(),n=RR(t._databaseId,((r=t._app)==null?void 0:r.options.appId)||"",t._persistenceKey,(s=t._app)==null?void 0:s.options.apiKey,e);t._componentsProvider||(i=e.localCache)!=null&&i._offlineComponentProvider&&((o=e.localCache)!=null&&o._onlineComponentProvider)&&(t._componentsProvider={_offline:e.localCache._offlineComponentProvider,_online:e.localCache._onlineComponentProvider}),t._firestoreClient=new TR(t._authCredentials,t._appCheckCredentials,t._queue,n,t._componentsProvider&&function(c){const u=c==null?void 0:c._online.build();return{_offline:c==null?void 0:c._offline.build(u),_online:u}}(t._componentsProvider))}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class _r{constructor(e){this._byteString=e}static fromBase64String(e){try{return new _r(wn.fromBase64String(e))}catch(n){throw new fe(Y.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+n)}}static fromUint8Array(e){return new _r(wn.fromUint8Array(e))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return"Bytes(base64: "+this.toBase64()+")"}isEqual(e){return this._byteString.isEqual(e._byteString)}toJSON(){return{type:_r._jsonSchemaVersion,bytes:this.toBase64()}}static fromJSON(e){if(mc(e,_r._jsonSchema))return _r.fromBase64String(e.bytes)}}_r._jsonSchemaVersion="firestore/bytes/1.0",_r._jsonSchema={type:Xt("string",_r._jsonSchemaVersion),bytes:Xt("string")};/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Ah{constructor(...e){for(let n=0;n90)throw new fe(Y.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(n)||n<-180||n>180)throw new fe(Y.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+n);this._lat=e,this._long=n}get latitude(){return this._lat}get longitude(){return this._long}isEqual(e){return this._lat===e._lat&&this._long===e._long}_compareTo(e){return Xe(this._lat,e._lat)||Xe(this._long,e._long)}toJSON(){return{latitude:this._lat,longitude:this._long,type:ns._jsonSchemaVersion}}static fromJSON(e){if(mc(e,ns._jsonSchema))return new ns(e.latitude,e.longitude)}}ns._jsonSchemaVersion="firestore/geoPoint/1.0",ns._jsonSchema={type:Xt("string",ns._jsonSchemaVersion),latitude:Xt("number"),longitude:Xt("number")};/** + * @license + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Or{constructor(e){this._values=(e||[]).map(n=>n)}toArray(){return this._values.map(e=>e)}isEqual(e){return function(r,s){if(r.length!==s.length)return!1;for(let i=0;itypeof n=="number"))return new Or(e.vectorValues);throw new fe(Y.INVALID_ARGUMENT,"Expected 'vectorValues' field to be a number array")}}}Or._jsonSchemaVersion="firestore/vectorValue/1.0",Or._jsonSchema={type:Xt("string",Or._jsonSchemaVersion),vectorValues:Xt("object")};/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const OR=/^__.*__$/;class VR{constructor(e,n,r){this.data=e,this.fieldMask=n,this.fieldTransforms=r}toMutation(e,n){return this.fieldMask!==null?new ji(e,this.data,this.fieldMask,n,this.fieldTransforms):new gc(e,this.data,n,this.fieldTransforms)}}class OS{constructor(e,n,r){this.data=e,this.fieldMask=n,this.fieldTransforms=r}toMutation(e,n){return new ji(e,this.data,this.fieldMask,n,this.fieldTransforms)}}function VS(t){switch(t){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw Ce(40011,{dataSource:t})}}class y0{constructor(e,n,r,s,i,o){this.settings=e,this.databaseId=n,this.serializer=r,this.ignoreUndefinedProperties=s,i===void 0&&this.Ac(),this.fieldTransforms=i||[],this.fieldMask=o||[]}get path(){return this.settings.path}get dataSource(){return this.settings.dataSource}i(e){return new y0({...this.settings,...e},this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}dc(e){var s;const n=(s=this.path)==null?void 0:s.child(e),r=this.i({path:n,arrayElement:!1});return r.mc(e),r}fc(e){var s;const n=(s=this.path)==null?void 0:s.child(e),r=this.i({path:n,arrayElement:!1});return r.Ac(),r}gc(e){return this.i({path:void 0,arrayElement:!0})}yc(e){return Pd(e,this.settings.methodName,this.settings.hasConverter||!1,this.path,this.settings.targetDoc)}contains(e){return this.fieldMask.find(n=>e.isPrefixOf(n))!==void 0||this.fieldTransforms.find(n=>e.isPrefixOf(n.field))!==void 0}Ac(){if(this.path)for(let e=0;ec.covers(h.field))}else c=null,u=o.fieldTransforms;return new VR(new Qn(l),c,u)}class _c extends jh{_toFieldTransform(e){if(e.dataSource!==2)throw e.dataSource===1?e.yc(`${this._methodName}() can only appear at the top level of your update data`):e.yc(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);return e.fieldMask.push(e.path),null}isEqual(e){return e instanceof _c}}class v0 extends jh{constructor(e,n){super(e),this.bc=n}_toFieldTransform(e){const n=new ec(e.serializer,YE(e.serializer,this.bc));return new Nj(e.path,n)}isEqual(e){return e instanceof v0&&this.bc===e.bc}}function FS(t,e,n,r){const s=t.A(1,e,n);w0("Data must be an object, but it was:",s,r);const i=[],o=Qn.empty();Ai(r,(c,u)=>{const f=$S(e,c,n);u=sn(u);const h=s.fc(f);if(u instanceof _c)i.push(f);else{const m=Ec(u,h);m!=null&&(i.push(f),o.set(f,m))}});const l=new ur(i);return new OS(o,l,s.fieldTransforms)}function zS(t,e,n,r,s,i){const o=t.A(1,e,n),l=[lo(e,r,n)],c=[s];if(i.length%2!=0)throw new fe(Y.INVALID_ARGUMENT,`Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);for(let m=0;m=0;--m)if(!HS(u,l[m])){const p=l[m];let x=c[m];x=sn(x);const E=o.fc(p);if(x instanceof _c)u.push(p);else{const C=Ec(x,E);C!=null&&(u.push(p),f.set(p,C))}}const h=new ur(u);return new OS(f,h,o.fieldTransforms)}function zR(t,e,n,r=!1){return Ec(n,t.A(r?4:3,e))}function Ec(t,e){if(BS(t=sn(t)))return w0("Unsupported field value:",e,t),US(t,e);if(t instanceof jh)return function(r,s){if(!VS(s.dataSource))throw s.yc(`${r._methodName}() can only be used with update() and set()`);if(!s.path)throw s.yc(`${r._methodName}() is not currently supported inside arrays`);const i=r._toFieldTransform(s);i&&s.fieldTransforms.push(i)}(t,e),null;if(t===void 0&&e.ignoreUndefinedProperties)return null;if(e.path&&e.fieldMask.push(e.path),t instanceof Array){if(e.settings.arrayElement&&e.dataSource!==4)throw e.yc("Nested arrays are not supported");return function(r,s){const i=[];let o=0;for(const l of r){let c=Ec(l,s.gc(o));c==null&&(c={nullValue:"NULL_VALUE"}),i.push(c),o++}return{arrayValue:{values:i}}}(t,e)}return function(r,s){if((r=sn(r))===null)return{nullValue:"NULL_VALUE"};if(typeof r=="number")return YE(s.serializer,r);if(typeof r=="boolean")return{booleanValue:r};if(typeof r=="string")return{stringValue:r};if(r instanceof Date){const i=Ke.fromDate(r);return{timestampValue:kd(s.serializer,i)}}if(r instanceof Ke){const i=new Ke(r.seconds,1e3*Math.floor(r.nanoseconds/1e3));return{timestampValue:kd(s.serializer,i)}}if(r instanceof ns)return{geoPointValue:{latitude:r.latitude,longitude:r.longitude}};if(r instanceof _r)return{bytesValue:oS(s.serializer,r._byteString)};if(r instanceof Ut){const i=s.databaseId,o=r.firestore._databaseId;if(!o.isEqual(i))throw s.yc(`Document reference is for database ${o.projectId}/${o.database} but should be for database ${i.projectId}/${i.database}`);return{referenceValue:Zg(r.firestore._databaseId||s.databaseId,r._key.path)}}if(r instanceof Or)return function(o,l){const c=o instanceof Or?o.toArray():o;return{mapValue:{fields:{[DE]:{stringValue:ME},[Sd]:{arrayValue:{values:c.map(f=>{if(typeof f!="number")throw l.yc("VectorValues must only contain numeric values.");return Yg(l.serializer,f)})}}}}}}(r,s);if(fS(r))return r._toProto(s.serializer);throw s.yc(`Unsupported field value: ${mh(r)}`)}(t,e)}function US(t,e){const n={};return IE(t)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):Ai(t,(r,s)=>{const i=Ec(s,e.dc(r));i!=null&&(n[r]=i)}),{mapValue:{fields:n}}}function BS(t){return!(typeof t!="object"||t===null||t instanceof Array||t instanceof Date||t instanceof Ke||t instanceof ns||t instanceof _r||t instanceof Ut||t instanceof jh||t instanceof Or||fS(t))}function w0(t,e,n){if(!BS(n)||!NE(n)){const r=mh(n);throw r==="an object"?e.yc(t+" a custom object"):e.yc(t+" "+r)}}function lo(t,e,n){if((e=sn(e))instanceof Ah)return e._internalPath;if(typeof e=="string")return $S(t,e);throw Pd("Field path arguments must be of type string or ",t,!1,void 0,n)}const UR=new RegExp("[~\\*/\\[\\]]");function $S(t,e,n){if(e.search(UR)>=0)throw Pd(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,t,!1,void 0,n);try{return new Ah(...e.split("."))._internalPath}catch{throw Pd(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,t,!1,void 0,n)}}function Pd(t,e,n,r,s){const i=r&&!r.isEmpty(),o=s!==void 0;let l=`Function ${e}() called with invalid data`;n&&(l+=" (via `toFirestore()`)"),l+=". ";let c="";return(i||o)&&(c+=" (found",i&&(c+=` in field ${r}`),o&&(c+=` in document ${s}`),c+=")"),new fe(Y.INVALID_ARGUMENT,l+t+c)}function HS(t,e){return t.some(n=>n.isEqual(e))}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class BR{convertValue(e,n="none"){switch(Ei(e)){case 0:return null;case 1:return e.booleanValue;case 2:return Ht(e.integerValue||e.doubleValue);case 3:return this.convertTimestamp(e.timestampValue);case 4:return this.convertServerTimestamp(e,n);case 5:return e.stringValue;case 6:return this.convertBytes(_i(e.bytesValue));case 7:return this.convertReference(e.referenceValue);case 8:return this.convertGeoPoint(e.geoPointValue);case 9:return this.convertArray(e.arrayValue,n);case 11:return this.convertObject(e.mapValue,n);case 10:return this.convertVectorValue(e.mapValue);default:throw Ce(62114,{value:e})}}convertObject(e,n){return this.convertObjectMap(e.fields,n)}convertObjectMap(e,n="none"){const r={};return Ai(e,(s,i)=>{r[s]=this.convertValue(i,n)}),r}convertVectorValue(e){var r,s,i;const n=(i=(s=(r=e.fields)==null?void 0:r[Sd].arrayValue)==null?void 0:s.values)==null?void 0:i.map(o=>Ht(o.doubleValue));return new Or(n)}convertGeoPoint(e){return new ns(Ht(e.latitude),Ht(e.longitude))}convertArray(e,n){return(e.values||[]).map(r=>this.convertValue(r,n))}convertServerTimestamp(e,n){switch(n){case"previous":const r=xh(e);return r==null?null:this.convertValue(r,n);case"estimate":return this.convertTimestamp(Kl(e));default:return null}}convertTimestamp(e){const n=bi(e);return new Ke(n.seconds,n.nanos)}convertDocumentKey(e,n){const r=Et.fromString(e);ut(hS(r),9688,{name:e});const s=new Ql(r.get(1),r.get(3)),i=new Ne(r.popFirst(5));return s.isEqual(n)||As(`Document ${i} contains a document reference within a different database (${s.projectId}/${s.database}) which is not supported. It will be treated as a reference in the current database (${n.projectId}/${n.database}) instead.`),i}}/** + * @license + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class b0 extends BR{constructor(e){super(),this.firestore=e}convertBytes(e){return new _r(e)}convertReference(e){const n=this.convertDocumentKey(e,this.firestore._databaseId);return new Ut(this.firestore,null,n)}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function $R(){return new _c("deleteField")}function HR(t){return new v0("increment",t)}const Yv="@firebase/firestore",Xv="4.13.0";/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Jv(t){return function(n,r){if(typeof n!="object"||n===null)return!1;const s=n;for(const i of r)if(i in s&&typeof s[i]=="function")return!0;return!1}(t,["next","error","complete"])}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class qS{constructor(e,n,r,s,i){this._firestore=e,this._userDataWriter=n,this._key=r,this._document=s,this._converter=i}get id(){return this._key.path.lastSegment()}get ref(){return new Ut(this._firestore,this._converter,this._key)}exists(){return this._document!==null}data(){if(this._document){if(this._converter){const e=new qR(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(e)}return this._userDataWriter.convertValue(this._document.data.value)}}_fieldsProto(){var e;return((e=this._document)==null?void 0:e.data.clone().value.mapValue.fields)??void 0}get(e){if(this._document){const n=this._document.data.field(lo("DocumentSnapshot.get",e));if(n!==null)return this._userDataWriter.convertValue(n)}}}class qR extends qS{data(){return super.data()}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function GS(t){if(t.limitType==="L"&&t.explicitOrderBy.length===0)throw new fe(Y.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class _0{}class WS extends _0{}function Vn(t,e,...n){let r=[];e instanceof _0&&r.push(e),r=r.concat(n),function(i){const o=i.filter(c=>c instanceof E0).length,l=i.filter(c=>c instanceof Ph).length;if(o>1||o>0&&l>0)throw new fe(Y.INVALID_ARGUMENT,"InvalidQuery. When using composite filters, you cannot use more than one filter at the top level. Consider nesting the multiple filters within an `and(...)` statement. For example: change `query(query, where(...), or(...))` to `query(query, and(where(...), or(...)))`.")}(r);for(const s of r)t=s._apply(t);return t}class Ph extends WS{constructor(e,n,r){super(),this._field=e,this._op=n,this._value=r,this.type="where"}static _create(e,n,r){return new Ph(e,n,r)}_apply(e){const n=this._parse(e);return KS(e._query,n),new Pi(e.firestore,e.converter,dm(e._query,n))}_parse(e){const n=bc(e.firestore);return function(i,o,l,c,u,f,h){let m;if(u.isKeyField()){if(f==="array-contains"||f==="array-contains-any")throw new fe(Y.INVALID_ARGUMENT,`Invalid Query. You can't perform '${f}' queries on documentId().`);if(f==="in"||f==="not-in"){ew(h,f);const x=[];for(const E of h)x.push(Zv(c,i,E));m={arrayValue:{values:x}}}else m=Zv(c,i,h)}else f!=="in"&&f!=="not-in"&&f!=="array-contains-any"||ew(h,f),m=zR(l,o,h,f==="in"||f==="not-in");return Yt.create(u,f,m)}(e._query,"where",n,e.firestore._databaseId,this._field,this._op,this._value)}}function mr(t,e,n){const r=e,s=lo("where",t);return Ph._create(s,r,n)}class E0 extends _0{constructor(e,n){super(),this.type=e,this._queryConstraints=n}static _create(e,n){return new E0(e,n)}_parse(e){const n=this._queryConstraints.map(r=>r._parse(e)).filter(r=>r.getFilters().length>0);return n.length===1?n[0]:Fr.create(n,this._getOperator())}_apply(e){const n=this._parse(e);return n.getFilters().length===0?e:(function(s,i){let o=s;const l=i.getFlattenedFilters();for(const c of l)KS(o,c),o=dm(o,c)}(e._query,n),new Pi(e.firestore,e.converter,dm(e._query,n)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return this.type==="and"?"and":"or"}}class S0 extends WS{constructor(e,n){super(),this._field=e,this._direction=n,this.type="orderBy"}static _create(e,n){return new S0(e,n)}_apply(e){const n=function(s,i,o){if(s.startAt!==null)throw new fe(Y.INVALID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(s.endAt!==null)throw new fe(Y.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");return new Xl(i,o)}(e._query,this._field,this._direction);return new Pi(e.firestore,e.converter,gj(e._query,n))}}function GR(t,e="asc"){const n=e,r=lo("orderBy",t);return S0._create(r,n)}function Zv(t,e,n){if(typeof(n=sn(n))=="string"){if(n==="")throw new fe(Y.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!$E(e)&&n.indexOf("/")!==-1)throw new fe(Y.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);const r=e.path.child(Et.fromString(n));if(!Ne.isDocumentKey(r))throw new fe(Y.INVALID_ARGUMENT,`Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${r}' is not because it has an odd number of segments (${r.length}).`);return fv(t,new Ne(r))}if(n instanceof Ut)return fv(t,n._key);throw new fe(Y.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${mh(n)}.`)}function ew(t,e){if(!Array.isArray(t)||t.length===0)throw new fe(Y.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`)}function KS(t,e){const n=function(s,i){for(const o of s)for(const l of o.getFlattenedFilters())if(i.indexOf(l.op)>=0)return l.op;return null}(t.filters,function(s){switch(s){case"!=":return["!=","not-in"];case"array-contains-any":case"in":return["not-in"];case"not-in":return["array-contains-any","in","not-in","!="];default:return[]}}(e.op));if(n!==null)throw n===e.op?new fe(Y.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}' filter.`):new fe(Y.INVALID_ARGUMENT,`Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`)}function T0(t,e,n){let r;return r=t?n&&(n.merge||n.mergeFields)?t.toFirestore(e,n):t.toFirestore(e):e,r}class ul{constructor(e,n){this.hasPendingWrites=e,this.fromCache=n}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}class Ki extends qS{constructor(e,n,r,s,i,o){super(e,n,r,s,o),this._firestore=e,this._firestoreImpl=e,this.metadata=i}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){const n=new Fu(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(n,e)}return this._userDataWriter.convertValue(this._document.data.value,e.serverTimestamps)}}get(e,n={}){if(this._document){const r=this._document.data.field(lo("DocumentSnapshot.get",e));if(r!==null)return this._userDataWriter.convertValue(r,n.serverTimestamps)}}toJSON(){if(this.metadata.hasPendingWrites)throw new fe(Y.FAILED_PRECONDITION,"DocumentSnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const e=this._document,n={};return n.type=Ki._jsonSchemaVersion,n.bundle="",n.bundleSource="DocumentSnapshot",n.bundleName=this._key.toString(),!e||!e.isValidDocument()||!e.isFoundDocument()?n:(this._userDataWriter.convertObjectMap(e.data.value.mapValue.fields,"previous"),n.bundle=(this._firestore,this.ref.path,"NOT SUPPORTED"),n)}}Ki._jsonSchemaVersion="firestore/documentSnapshot/1.0",Ki._jsonSchema={type:Xt("string",Ki._jsonSchemaVersion),bundleSource:Xt("string","DocumentSnapshot"),bundleName:Xt("string"),bundle:Xt("string")};class Fu extends Ki{data(e={}){return super.data(e)}}class Qi{constructor(e,n,r,s){this._firestore=e,this._userDataWriter=n,this._snapshot=s,this.metadata=new ul(s.hasPendingWrites,s.fromCache),this.query=r}get docs(){const e=[];return this.forEach(n=>e.push(n)),e}get size(){return this._snapshot.docs.size}get empty(){return this.size===0}forEach(e,n){this._snapshot.docs.forEach(r=>{e.call(n,new Fu(this._firestore,this._userDataWriter,r.key,r,new ul(this._snapshot.mutatedKeys.has(r.key),this._snapshot.fromCache),this.query.converter))})}docChanges(e={}){const n=!!e.includeMetadataChanges;if(n&&this._snapshot.excludesMetadataChanges)throw new fe(Y.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===n||(this._cachedChanges=function(s,i){if(s._snapshot.oldDocs.isEmpty()){let o=0;return s._snapshot.docChanges.map(l=>{const c=new Fu(s._firestore,s._userDataWriter,l.doc.key,l.doc,new ul(s._snapshot.mutatedKeys.has(l.doc.key),s._snapshot.fromCache),s.query.converter);return l.doc,{type:"added",doc:c,oldIndex:-1,newIndex:o++}})}{let o=s._snapshot.oldDocs;return s._snapshot.docChanges.filter(l=>i||l.type!==3).map(l=>{const c=new Fu(s._firestore,s._userDataWriter,l.doc.key,l.doc,new ul(s._snapshot.mutatedKeys.has(l.doc.key),s._snapshot.fromCache),s.query.converter);let u=-1,f=-1;return l.type!==0&&(u=o.indexOf(l.doc.key),o=o.delete(l.doc.key)),l.type!==1&&(o=o.add(l.doc),f=o.indexOf(l.doc.key)),{type:WR(l.type),doc:c,oldIndex:u,newIndex:f}})}}(this,n),this._cachedChangesIncludeMetadataChanges=n),this._cachedChanges}toJSON(){if(this.metadata.hasPendingWrites)throw new fe(Y.FAILED_PRECONDITION,"QuerySnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const e={};e.type=Qi._jsonSchemaVersion,e.bundleSource="QuerySnapshot",e.bundleName=Hg.newId(),this._firestore._databaseId.database,this._firestore._databaseId.projectId;const n=[],r=[],s=[];return this.docs.forEach(i=>{i._document!==null&&(n.push(i._document),r.push(this._userDataWriter.convertObjectMap(i._document.data.value.mapValue.fields,"previous")),s.push(i.ref.path))}),e.bundle=(this._firestore,this.query._query,e.bundleName,"NOT SUPPORTED"),e}}function WR(t){switch(t){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return Ce(61501,{type:t})}}/** + * @license + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */Qi._jsonSchemaVersion="firestore/querySnapshot/1.0",Qi._jsonSchema={type:Xt("string",Qi._jsonSchemaVersion),bundleSource:Xt("string","QuerySnapshot"),bundleName:Xt("string"),bundle:Xt("string")};/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class KR{constructor(e,n){this._firestore=e,this._commitHandler=n,this._mutations=[],this._committed=!1,this._dataReader=bc(e)}set(e,n,r){this._verifyNotCommitted();const s=jf(e,this._firestore),i=T0(s.converter,n,r),o=x0(this._dataReader,"WriteBatch.set",s._key,i,s.converter!==null,r);return this._mutations.push(o.toMutation(s._key,On.none())),this}update(e,n,r,...s){this._verifyNotCommitted();const i=jf(e,this._firestore);let o;return o=typeof(n=sn(n))=="string"||n instanceof Ah?zS(this._dataReader,"WriteBatch.update",i._key,n,r,s):FS(this._dataReader,"WriteBatch.update",i._key,n),this._mutations.push(o.toMutation(i._key,On.exists(!0))),this}delete(e){this._verifyNotCommitted();const n=jf(e,this._firestore);return this._mutations=this._mutations.concat(new Sh(n._key,On.none())),this}commit(){return this._verifyNotCommitted(),this._committed=!0,this._mutations.length>0?this._commitHandler(this._mutations):Promise.resolve()}_verifyNotCommitted(){if(this._committed)throw new fe(Y.FAILED_PRECONDITION,"A write batch can no longer be used after commit() has been called.")}}function jf(t,e){if((t=sn(t)).firestore!==e)throw new fe(Y.INVALID_ARGUMENT,"Provided document reference is from a different Firestore instance.");return t}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Ps(t){t=Ln(t,Ut);const e=Ln(t.firestore,os),n=wc(e);return CR(n,t._key).then(r=>YS(e,t,r))}function hn(t){t=Ln(t,Pi);const e=Ln(t.firestore,os),n=wc(e),r=new b0(e);return GS(t._query),AR(n,t._query).then(s=>new Qi(e,r,t,s))}function QS(t,e,n){t=Ln(t,Ut);const r=Ln(t.firestore,os),s=T0(t.converter,e,n),i=bc(r);return Tc(r,[x0(i,"setDoc",t._key,s,t.converter!==null,n).toMutation(t._key,On.none())])}function tr(t,e,n,...r){t=Ln(t,Ut);const s=Ln(t.firestore,os),i=bc(s);let o;return o=typeof(e=sn(e))=="string"||e instanceof Ah?zS(i,"updateDoc",t._key,e,n,r):FS(i,"updateDoc",t._key,e),Tc(s,[o.toMutation(t._key,On.exists(!0))])}function tc(t){return Tc(Ln(t.firestore,os),[new Sh(t._key,On.none())])}function Sc(t,e){const n=Ln(t.firestore,os),r=Nt(t),s=T0(t.converter,e),i=bc(t.firestore);return Tc(n,[x0(i,"addDoc",r._key,s,t.converter!==null,{}).toMutation(r._key,On.exists(!1))]).then(()=>r)}function N0(t,...e){var u,f,h;t=sn(t);let n={includeMetadataChanges:!1,source:"default"},r=0;typeof e[r]!="object"||Jv(e[r])||(n=e[r++]);const s={includeMetadataChanges:n.includeMetadataChanges,source:n.source};if(Jv(e[r])){const m=e[r];e[r]=(u=m.next)==null?void 0:u.bind(m),e[r+1]=(f=m.error)==null?void 0:f.bind(m),e[r+2]=(h=m.complete)==null?void 0:h.bind(m)}let i,o,l;if(t instanceof Ut)o=Ln(t.firestore,os),l=vh(t._key.path),i={next:m=>{e[r]&&e[r](YS(o,t,m))},error:e[r+1],complete:e[r+2]};else{const m=Ln(t,Pi);o=Ln(m.firestore,os),l=m._query;const p=new b0(o);i={next:x=>{e[r]&&e[r](new Qi(o,p,m,x))},error:e[r+1],complete:e[r+2]},GS(t._query)}const c=wc(o);return IR(c,l,s,i)}function Tc(t,e){const n=wc(t);return jR(n,e)}function YS(t,e,n){const r=n.docs.get(e._key),s=new b0(t);return new Ki(t,s,e._key,r,new ul(n.hasPendingWrites,n.fromCache),e.converter)}function QR(t){return t=Ln(t,os),wc(t),new KR(t,e=>Tc(t,e))}(function(e,n=!0){AA(po),so(new vi("firestore",(r,{instanceIdentifier:s,options:i})=>{const o=r.getProvider("app").getImmediate(),l=new os(new RA(r.getProvider("auth-internal")),new LA(o,r.getProvider("app-check-internal")),ZA(o,s),o);return i={useFetchStreams:n,...i},l._setSettings(i),l},"PUBLIC").setMultipleInstances(!0)),Zr(Yv,Xv,e),Zr(Yv,Xv,"esm2020")})();/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const XS="firebasestorage.googleapis.com",YR="storageBucket",XR=2*60*1e3,JR=10*60*1e3;/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class us extends cs{constructor(e,n,r=0){super(Pf(e),`Firebase Storage: ${n} (${Pf(e)})`),this.status_=r,this.customData={serverResponse:null},this._baseMessage=this.message,Object.setPrototypeOf(this,us.prototype)}get status(){return this.status_}set status(e){this.status_=e}_codeEquals(e){return Pf(e)===this.code}get serverResponse(){return this.customData.serverResponse}set serverResponse(e){this.customData.serverResponse=e,this.customData.serverResponse?this.message=`${this._baseMessage} +${this.customData.serverResponse}`:this.message=this._baseMessage}}var as;(function(t){t.UNKNOWN="unknown",t.OBJECT_NOT_FOUND="object-not-found",t.BUCKET_NOT_FOUND="bucket-not-found",t.PROJECT_NOT_FOUND="project-not-found",t.QUOTA_EXCEEDED="quota-exceeded",t.UNAUTHENTICATED="unauthenticated",t.UNAUTHORIZED="unauthorized",t.UNAUTHORIZED_APP="unauthorized-app",t.RETRY_LIMIT_EXCEEDED="retry-limit-exceeded",t.INVALID_CHECKSUM="invalid-checksum",t.CANCELED="canceled",t.INVALID_EVENT_NAME="invalid-event-name",t.INVALID_URL="invalid-url",t.INVALID_DEFAULT_BUCKET="invalid-default-bucket",t.NO_DEFAULT_BUCKET="no-default-bucket",t.CANNOT_SLICE_BLOB="cannot-slice-blob",t.SERVER_FILE_WRONG_SIZE="server-file-wrong-size",t.NO_DOWNLOAD_URL="no-download-url",t.INVALID_ARGUMENT="invalid-argument",t.INVALID_ARGUMENT_COUNT="invalid-argument-count",t.APP_DELETED="app-deleted",t.INVALID_ROOT_OPERATION="invalid-root-operation",t.INVALID_FORMAT="invalid-format",t.INTERNAL_ERROR="internal-error",t.UNSUPPORTED_ENVIRONMENT="unsupported-environment"})(as||(as={}));function Pf(t){return"storage/"+t}function ZR(){const t="An unknown error occurred, please check the error payload for server response.";return new us(as.UNKNOWN,t)}function e4(){return new us(as.RETRY_LIMIT_EXCEEDED,"Max retry time for operation exceeded, please try again.")}function t4(){return new us(as.CANCELED,"User canceled the upload/download.")}function n4(t){return new us(as.INVALID_URL,"Invalid URL '"+t+"'.")}function r4(t){return new us(as.INVALID_DEFAULT_BUCKET,"Invalid default bucket '"+t+"'.")}function tw(t){return new us(as.INVALID_ARGUMENT,t)}function JS(){return new us(as.APP_DELETED,"The Firebase app was deleted.")}function s4(t){return new us(as.INVALID_ROOT_OPERATION,"The operation '"+t+"' cannot be performed on a root reference, create a non-root reference using child, such as .child('file.png').")}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Rr{constructor(e,n){this.bucket=e,this.path_=n}get path(){return this.path_}get isRoot(){return this.path.length===0}fullServerUrl(){const e=encodeURIComponent;return"/b/"+e(this.bucket)+"/o/"+e(this.path)}bucketOnlyServerUrl(){return"/b/"+encodeURIComponent(this.bucket)+"/o"}static makeFromBucketSpec(e,n){let r;try{r=Rr.makeFromUrl(e,n)}catch{return new Rr(e,"")}if(r.path==="")return r;throw r4(e)}static makeFromUrl(e,n){let r=null;const s="([A-Za-z0-9.\\-_]+)";function i(D){D.path.charAt(D.path.length-1)==="/"&&(D.path_=D.path_.slice(0,-1))}const o="(/(.*))?$",l=new RegExp("^gs://"+s+o,"i"),c={bucket:1,path:3};function u(D){D.path_=decodeURIComponent(D.path)}const f="v[A-Za-z0-9_]+",h=n.replace(/[.]/g,"\\."),m="(/([^?#]*).*)?$",p=new RegExp(`^https?://${h}/${f}/b/${s}/o${m}`,"i"),x={bucket:1,path:3},E=n===XS?"(?:storage.googleapis.com|storage.cloud.google.com)":n,C="([^?#]*)",y=new RegExp(`^https?://${E}/${s}/${C}`,"i"),_=[{regex:l,indices:c,postModify:i},{regex:p,indices:x,postModify:u},{regex:y,indices:{bucket:1,path:2},postModify:u}];for(let D=0;D<_.length;D++){const M=_[D],T=M.regex.exec(e);if(T){const S=T[M.indices.bucket];let w=T[M.indices.path];w||(w=""),r=new Rr(S,w),M.postModify(r);break}}if(r==null)throw n4(e);return r}}class i4{constructor(e){this.promise_=Promise.reject(e)}getPromise(){return this.promise_}cancel(e=!1){}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function o4(t,e,n){let r=1,s=null,i=null,o=!1,l=0;function c(){return l===2}let u=!1;function f(...C){u||(u=!0,e.apply(null,C))}function h(C){s=setTimeout(()=>{s=null,t(p,c())},C)}function m(){i&&clearTimeout(i)}function p(C,...y){if(u){m();return}if(C){m(),f.call(null,C,...y);return}if(c()||o){m(),f.call(null,C,...y);return}r<64&&(r*=2);let _;l===1?(l=2,_=0):_=(r+Math.random())*1e3,h(_)}let x=!1;function E(C){x||(x=!0,m(),!u&&(s!==null?(C||(l=2),clearTimeout(s),h(0)):C||(l=1)))}return h(0),i=setTimeout(()=>{o=!0,E(!0)},n),E}function a4(t){t(!1)}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function l4(t){return t!==void 0}function nw(t,e,n,r){if(rn)throw tw(`Invalid value for '${t}'. Expected ${n} or less.`)}function c4(t){const e=encodeURIComponent;let n="?";for(const r in t)if(t.hasOwnProperty(r)){const s=e(r)+"="+e(t[r]);n=n+s+"&"}return n=n.slice(0,-1),n}var Rd;(function(t){t[t.NO_ERROR=0]="NO_ERROR",t[t.NETWORK_ERROR=1]="NETWORK_ERROR",t[t.ABORT=2]="ABORT"})(Rd||(Rd={}));/** + * @license + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function u4(t,e){const n=t>=500&&t<600,s=[408,429].indexOf(t)!==-1,i=e.indexOf(t)!==-1;return n||s||i}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class d4{constructor(e,n,r,s,i,o,l,c,u,f,h,m=!0,p=!1){this.url_=e,this.method_=n,this.headers_=r,this.body_=s,this.successCodes_=i,this.additionalRetryCodes_=o,this.callback_=l,this.errorCallback_=c,this.timeout_=u,this.progressCallback_=f,this.connectionFactory_=h,this.retry=m,this.isUsingEmulator=p,this.pendingConnection_=null,this.backoffId_=null,this.canceled_=!1,this.appDelete_=!1,this.promise_=new Promise((x,E)=>{this.resolve_=x,this.reject_=E,this.start_()})}start_(){const e=(r,s)=>{if(s){r(!1,new mu(!1,null,!0));return}const i=this.connectionFactory_();this.pendingConnection_=i;const o=l=>{const c=l.loaded,u=l.lengthComputable?l.total:-1;this.progressCallback_!==null&&this.progressCallback_(c,u)};this.progressCallback_!==null&&i.addUploadProgressListener(o),i.send(this.url_,this.method_,this.isUsingEmulator,this.body_,this.headers_).then(()=>{this.progressCallback_!==null&&i.removeUploadProgressListener(o),this.pendingConnection_=null;const l=i.getErrorCode()===Rd.NO_ERROR,c=i.getStatus();if(!l||u4(c,this.additionalRetryCodes_)&&this.retry){const f=i.getErrorCode()===Rd.ABORT;r(!1,new mu(!1,null,f));return}const u=this.successCodes_.indexOf(c)!==-1;r(!0,new mu(u,i))})},n=(r,s)=>{const i=this.resolve_,o=this.reject_,l=s.connection;if(s.wasSuccessCode)try{const c=this.callback_(l,l.getResponse());l4(c)?i(c):i()}catch(c){o(c)}else if(l!==null){const c=ZR();c.serverResponse=l.getErrorText(),this.errorCallback_?o(this.errorCallback_(l,c)):o(c)}else if(s.canceled){const c=this.appDelete_?JS():t4();o(c)}else{const c=e4();o(c)}};this.canceled_?n(!1,new mu(!1,null,!0)):this.backoffId_=o4(e,n,this.timeout_)}getPromise(){return this.promise_}cancel(e){this.canceled_=!0,this.appDelete_=e||!1,this.backoffId_!==null&&a4(this.backoffId_),this.pendingConnection_!==null&&this.pendingConnection_.abort()}}class mu{constructor(e,n,r){this.wasSuccessCode=e,this.connection=n,this.canceled=!!r}}function h4(t,e){e!==null&&e.length>0&&(t.Authorization="Firebase "+e)}function f4(t,e){t["X-Firebase-Storage-Version"]="webjs/"+(e??"AppManager")}function p4(t,e){e&&(t["X-Firebase-GMPID"]=e)}function m4(t,e){e!==null&&(t["X-Firebase-AppCheck"]=e)}function g4(t,e,n,r,s,i,o=!0,l=!1){const c=c4(t.urlParams),u=t.url+c,f=Object.assign({},t.headers);return p4(f,e),h4(f,n),f4(f,i),m4(f,r),new d4(u,t.method,f,t.body,t.successCodes,t.additionalRetryCodes,t.handler,t.errorHandler,t.timeout,t.progressCallback,s,o,l)}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function y4(t){if(t.length===0)return null;const e=t.lastIndexOf("/");return e===-1?"":t.slice(0,e)}function x4(t){const e=t.lastIndexOf("/",t.length-2);return e===-1?t:t.slice(e+1)}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Dd{constructor(e,n){this._service=e,n instanceof Rr?this._location=n:this._location=Rr.makeFromUrl(n,e.host)}toString(){return"gs://"+this._location.bucket+"/"+this._location.path}_newRef(e,n){return new Dd(e,n)}get root(){const e=new Rr(this._location.bucket,"");return this._newRef(this._service,e)}get bucket(){return this._location.bucket}get fullPath(){return this._location.path}get name(){return x4(this._location.path)}get storage(){return this._service}get parent(){const e=y4(this._location.path);if(e===null)return null;const n=new Rr(this._location.bucket,e);return new Dd(this._service,n)}_throwIfRoot(e){if(this._location.path==="")throw s4(e)}}function rw(t,e){const n=e==null?void 0:e[YR];return n==null?null:Rr.makeFromBucketSpec(n,t)}function v4(t,e,n,r={}){t.host=`${e}:${n}`;const s=Sa(e);s&&Fg(`https://${t.host}/b`),t._isUsingEmulator=!0,t._protocol=s?"https":"http";const{mockUserToken:i}=r;i&&(t._overrideAuthToken=typeof i=="string"?i:dE(i,t.app.options.projectId))}class w4{constructor(e,n,r,s,i,o=!1){this.app=e,this._authProvider=n,this._appCheckProvider=r,this._url=s,this._firebaseVersion=i,this._isUsingEmulator=o,this._bucket=null,this._host=XS,this._protocol="https",this._appId=null,this._deleted=!1,this._maxOperationRetryTime=XR,this._maxUploadRetryTime=JR,this._requests=new Set,s!=null?this._bucket=Rr.makeFromBucketSpec(s,this._host):this._bucket=rw(this._host,this.app.options)}get host(){return this._host}set host(e){this._host=e,this._url!=null?this._bucket=Rr.makeFromBucketSpec(this._url,e):this._bucket=rw(e,this.app.options)}get maxUploadRetryTime(){return this._maxUploadRetryTime}set maxUploadRetryTime(e){nw("time",0,Number.POSITIVE_INFINITY,e),this._maxUploadRetryTime=e}get maxOperationRetryTime(){return this._maxOperationRetryTime}set maxOperationRetryTime(e){nw("time",0,Number.POSITIVE_INFINITY,e),this._maxOperationRetryTime=e}async _getAuthToken(){if(this._overrideAuthToken)return this._overrideAuthToken;const e=this._authProvider.getImmediate({optional:!0});if(e){const n=await e.getToken();if(n!==null)return n.accessToken}return null}async _getAppCheckToken(){if(Pr(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const e=this._appCheckProvider.getImmediate({optional:!0});return e?(await e.getToken()).token:null}_delete(){return this._deleted||(this._deleted=!0,this._requests.forEach(e=>e.cancel()),this._requests.clear()),Promise.resolve()}_makeStorageReference(e){return new Dd(this,e)}_makeRequest(e,n,r,s,i=!0){if(this._deleted)return new i4(JS());{const o=g4(e,this._appId,r,s,n,this._firebaseVersion,i,this._isUsingEmulator);return this._requests.add(o),o.getPromise().then(()=>this._requests.delete(o),()=>this._requests.delete(o)),o}}async makeRequestWithTokens(e,n){const[r,s]=await Promise.all([this._getAuthToken(),this._getAppCheckToken()]);return this._makeRequest(e,n,r,s).getPromise()}}const sw="@firebase/storage",iw="0.14.2";/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const ZS="storage";function b4(t=Bg(),e){t=sn(t);const r=ph(t,ZS).getImmediate({identifier:e}),s=lE("storage");return s&&_4(r,...s),r}function _4(t,e,n,r={}){v4(t,e,n,r)}function E4(t,{instanceIdentifier:e}){const n=t.getProvider("app").getImmediate(),r=t.getProvider("auth-internal"),s=t.getProvider("app-check-internal");return new w4(n,r,s,e,po)}function S4(){so(new vi(ZS,E4,"PUBLIC").setMultipleInstances(!0)),Zr(sw,iw,""),Zr(sw,iw,"esm2020")}S4();function e2(){return{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}}const T4=e2,t2=new fc("auth","Firebase",e2());/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Md=new zg("@firebase/auth");function N4(t,...e){Md.logLevel<=Ye.WARN&&Md.warn(`Auth (${po}): ${t}`,...e)}function zu(t,...e){Md.logLevel<=Ye.ERROR&&Md.error(`Auth (${po}): ${t}`,...e)}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Rs(t,...e){throw k0(t,...e)}function rs(t,...e){return k0(t,...e)}function n2(t,e,n){const r={...T4(),[e]:n};return new fc("auth","Firebase",r).create(e,{appName:t.name})}function Yi(t){return n2(t,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function k0(t,...e){if(typeof t!="string"){const n=e[0],r=[...e.slice(1)];return r[0]&&(r[0].appName=t.name),t._errorFactory.create(n,...r)}return t2.create(t,...e)}function Re(t,e,...n){if(!t)throw k0(e,...n)}function vs(t){const e="INTERNAL ASSERTION FAILED: "+t;throw zu(e),new Error(e)}function Ds(t,e){t||vs(e)}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function _m(){var t;return typeof self<"u"&&((t=self.location)==null?void 0:t.href)||""}function k4(){return ow()==="http:"||ow()==="https:"}function ow(){var t;return typeof self<"u"&&((t=self.location)==null?void 0:t.protocol)||null}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function I4(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(k4()||aC()||"connection"in navigator)?navigator.onLine:!0}function C4(){if(typeof navigator>"u")return null;const t=navigator;return t.languages&&t.languages[0]||t.language||null}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Nc{constructor(e,n){this.shortDelay=e,this.longDelay=n,Ds(n>e,"Short delay should be less than long delay!"),this.isMobile=sC()||lC()}get(){return I4()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function I0(t,e){Ds(t.emulator,"Emulator should always be set here");const{url:n}=t.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class r2{static initialize(e,n,r){this.fetchImpl=e,n&&(this.headersImpl=n),r&&(this.responseImpl=r)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;vs("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;vs("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;vs("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const A4={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const j4=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],P4=new Nc(3e4,6e4);function C0(t,e){return t.tenantId&&!e.tenantId?{...e,tenantId:t.tenantId}:e}async function Aa(t,e,n,r,s={}){return s2(t,s,async()=>{let i={},o={};r&&(e==="GET"?o=r:i={body:JSON.stringify(r)});const l=pc({key:t.config.apiKey,...o}).slice(1),c=await t._getAdditionalHeaders();c["Content-Type"]="application/json",t.languageCode&&(c["X-Firebase-Locale"]=t.languageCode);const u={method:e,headers:c,...i};return oC()||(u.referrerPolicy="no-referrer"),t.emulatorConfig&&Sa(t.emulatorConfig.host)&&(u.credentials="include"),r2.fetch()(await i2(t,t.config.apiHost,n,l),u)})}async function s2(t,e,n){t._canInitEmulator=!1;const r={...A4,...e};try{const s=new D4(t),i=await Promise.race([n(),s.promise]);s.clearNetworkTimeout();const o=await i.json();if("needConfirmation"in o)throw gu(t,"account-exists-with-different-credential",o);if(i.ok&&!("errorMessage"in o))return o;{const l=i.ok?o.errorMessage:o.error.message,[c,u]=l.split(" : ");if(c==="FEDERATED_USER_ID_ALREADY_LINKED")throw gu(t,"credential-already-in-use",o);if(c==="EMAIL_EXISTS")throw gu(t,"email-already-in-use",o);if(c==="USER_DISABLED")throw gu(t,"user-disabled",o);const f=r[c]||c.toLowerCase().replace(/[_\s]+/g,"-");if(u)throw n2(t,f,u);Rs(t,f)}}catch(s){if(s instanceof cs)throw s;Rs(t,"network-request-failed",{message:String(s)})}}async function R4(t,e,n,r,s={}){const i=await Aa(t,e,n,r,s);return"mfaPendingCredential"in i&&Rs(t,"multi-factor-auth-required",{_serverResponse:i}),i}async function i2(t,e,n,r){const s=`${e}${n}?${r}`,i=t,o=i.config.emulator?I0(t.config,s):`${t.config.apiScheme}://${s}`;return j4.includes(n)&&(await i._persistenceManagerAvailable,i._getPersistenceType()==="COOKIE")?i._getPersistence()._getFinalTarget(o).toString():o}class D4{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((n,r)=>{this.timer=setTimeout(()=>r(rs(this.auth,"network-request-failed")),P4.get())})}}function gu(t,e,n){const r={appName:t.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const s=rs(t,e,r);return s.customData._tokenResponse=n,s}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function M4(t,e){return Aa(t,"POST","/v1/accounts:delete",e)}async function Ld(t,e){return Aa(t,"POST","/v1/accounts:lookup",e)}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Sl(t){if(t)try{const e=new Date(Number(t));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function L4(t,e=!1){const n=sn(t),r=await n.getIdToken(e),s=A0(r);Re(s&&s.exp&&s.auth_time&&s.iat,n.auth,"internal-error");const i=typeof s.firebase=="object"?s.firebase:void 0,o=i==null?void 0:i.sign_in_provider;return{claims:s,token:r,authTime:Sl(Rf(s.auth_time)),issuedAtTime:Sl(Rf(s.iat)),expirationTime:Sl(Rf(s.exp)),signInProvider:o||null,signInSecondFactor:(i==null?void 0:i.sign_in_second_factor)||null}}function Rf(t){return Number(t)*1e3}function A0(t){const[e,n,r]=t.split(".");if(e===void 0||n===void 0||r===void 0)return zu("JWT malformed, contained fewer than 3 sections"),null;try{const s=oE(n);return s?JSON.parse(s):(zu("Failed to decode base64 JWT payload"),null)}catch(s){return zu("Caught error parsing JWT payload as JSON",s==null?void 0:s.toString()),null}}function aw(t){const e=A0(t);return Re(e,"internal-error"),Re(typeof e.exp<"u","internal-error"),Re(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function nc(t,e,n=!1){if(n)return e;try{return await e}catch(r){throw r instanceof cs&&O4(r)&&t.auth.currentUser===t&&await t.auth.signOut(),r}}function O4({code:t}){return t==="auth/user-disabled"||t==="auth/user-token-expired"}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class V4{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(e){if(e){const n=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),n}else{this.errorBackoff=3e4;const r=(this.user.stsTokenManager.expirationTime??0)-Date.now()-3e5;return Math.max(0,r)}}schedule(e=!1){if(!this.isRunning)return;const n=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},n)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){(e==null?void 0:e.code)==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Em{constructor(e,n){this.createdAt=e,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=Sl(this.lastLoginAt),this.creationTime=Sl(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function Od(t){var h;const e=t.auth,n=await t.getIdToken(),r=await nc(t,Ld(e,{idToken:n}));Re(r==null?void 0:r.users.length,e,"internal-error");const s=r.users[0];t._notifyReloadListener(s);const i=(h=s.providerUserInfo)!=null&&h.length?o2(s.providerUserInfo):[],o=z4(t.providerData,i),l=t.isAnonymous,c=!(t.email&&s.passwordHash)&&!(o!=null&&o.length),u=l?c:!1,f={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:o,metadata:new Em(s.createdAt,s.lastLoginAt),isAnonymous:u};Object.assign(t,f)}async function F4(t){const e=sn(t);await Od(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function z4(t,e){return[...t.filter(r=>!e.some(s=>s.providerId===r.providerId)),...e]}function o2(t){return t.map(({providerId:e,...n})=>({providerId:e,uid:n.rawId||"",displayName:n.displayName||null,email:n.email||null,phoneNumber:n.phoneNumber||null,photoURL:n.photoUrl||null}))}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function U4(t,e){const n=await s2(t,{},async()=>{const r=pc({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:s,apiKey:i}=t.config,o=await i2(t,s,"/v1/token",`key=${i}`),l=await t._getAdditionalHeaders();l["Content-Type"]="application/x-www-form-urlencoded";const c={method:"POST",headers:l,body:r};return t.emulatorConfig&&Sa(t.emulatorConfig.host)&&(c.credentials="include"),r2.fetch()(o,c)});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function B4(t,e){return Aa(t,"POST","/v2/accounts:revokeToken",C0(t,e))}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Zo{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){Re(e.idToken,"internal-error"),Re(typeof e.idToken<"u","internal-error"),Re(typeof e.refreshToken<"u","internal-error");const n="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):aw(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,n)}updateFromIdToken(e){Re(e.length!==0,"internal-error");const n=aw(e);this.updateTokensAndExpiration(e,null,n)}async getToken(e,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(Re(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(e,n){const{accessToken:r,refreshToken:s,expiresIn:i}=await U4(e,n);this.updateTokensAndExpiration(r,s,Number(i))}updateTokensAndExpiration(e,n,r){this.refreshToken=n||null,this.accessToken=e||null,this.expirationTime=Date.now()+r*1e3}static fromJSON(e,n){const{refreshToken:r,accessToken:s,expirationTime:i}=n,o=new Zo;return r&&(Re(typeof r=="string","internal-error",{appName:e}),o.refreshToken=r),s&&(Re(typeof s=="string","internal-error",{appName:e}),o.accessToken=s),i&&(Re(typeof i=="number","internal-error",{appName:e}),o.expirationTime=i),o}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new Zo,this.toJSON())}_performRefresh(){return vs("not implemented")}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Hs(t,e){Re(typeof t=="string"||typeof t>"u","internal-error",{appName:e})}class Dr{constructor({uid:e,auth:n,stsTokenManager:r,...s}){this.providerId="firebase",this.proactiveRefresh=new V4(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=n,this.stsTokenManager=r,this.accessToken=r.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new Em(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(e){const n=await nc(this,this.stsTokenManager.getToken(this.auth,e));return Re(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(e){return L4(this,e)}reload(){return F4(this)}_assign(e){this!==e&&(Re(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(n=>({...n})),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){const n=new Dr({...this,auth:e,stsTokenManager:this.stsTokenManager._clone()});return n.metadata._copy(this.metadata),n}_onReload(e){Re(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,n=!1){let r=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),r=!0),n&&await Od(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(Pr(this.auth.app))return Promise.reject(Yi(this.auth));const e=await this.getIdToken();return await nc(this,M4(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return{uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>({...e})),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId,...this.metadata.toJSON(),apiKey:this.auth.config.apiKey,appName:this.auth.name}}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,n){const r=n.displayName??void 0,s=n.email??void 0,i=n.phoneNumber??void 0,o=n.photoURL??void 0,l=n.tenantId??void 0,c=n._redirectEventId??void 0,u=n.createdAt??void 0,f=n.lastLoginAt??void 0,{uid:h,emailVerified:m,isAnonymous:p,providerData:x,stsTokenManager:E}=n;Re(h&&E,e,"internal-error");const C=Zo.fromJSON(this.name,E);Re(typeof h=="string",e,"internal-error"),Hs(r,e.name),Hs(s,e.name),Re(typeof m=="boolean",e,"internal-error"),Re(typeof p=="boolean",e,"internal-error"),Hs(i,e.name),Hs(o,e.name),Hs(l,e.name),Hs(c,e.name),Hs(u,e.name),Hs(f,e.name);const y=new Dr({uid:h,auth:e,email:s,emailVerified:m,displayName:r,isAnonymous:p,photoURL:o,phoneNumber:i,tenantId:l,stsTokenManager:C,createdAt:u,lastLoginAt:f});return x&&Array.isArray(x)&&(y.providerData=x.map(v=>({...v}))),c&&(y._redirectEventId=c),y}static async _fromIdTokenResponse(e,n,r=!1){const s=new Zo;s.updateFromServerResponse(n);const i=new Dr({uid:n.localId,auth:e,stsTokenManager:s,isAnonymous:r});return await Od(i),i}static async _fromGetAccountInfoResponse(e,n,r){const s=n.users[0];Re(s.localId!==void 0,"internal-error");const i=s.providerUserInfo!==void 0?o2(s.providerUserInfo):[],o=!(s.email&&s.passwordHash)&&!(i!=null&&i.length),l=new Zo;l.updateFromIdToken(r);const c=new Dr({uid:s.localId,auth:e,stsTokenManager:l,isAnonymous:o}),u={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:i,metadata:new Em(s.createdAt,s.lastLoginAt),isAnonymous:!(s.email&&s.passwordHash)&&!(i!=null&&i.length)};return Object.assign(c,u),c}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const lw=new Map;function ws(t){Ds(t instanceof Function,"Expected a class definition");let e=lw.get(t);return e?(Ds(e instanceof t,"Instance stored in cache mismatched with class"),e):(e=new t,lw.set(t,e),e)}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class a2{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,n){this.storage[e]=n}async _get(e){const n=this.storage[e];return n===void 0?null:n}async _remove(e){delete this.storage[e]}_addListener(e,n){}_removeListener(e,n){}}a2.type="NONE";const cw=a2;/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Uu(t,e,n){return`firebase:${t}:${e}:${n}`}class ea{constructor(e,n,r){this.persistence=e,this.auth=n,this.userKey=r;const{config:s,name:i}=this.auth;this.fullUserKey=Uu(this.userKey,s.apiKey,i),this.fullPersistenceKey=Uu("persistence",s.apiKey,i),this.boundEventHandler=n._onStorageEvent.bind(n),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){const e=await this.persistence._get(this.fullUserKey);if(!e)return null;if(typeof e=="string"){const n=await Ld(this.auth,{idToken:e}).catch(()=>{});return n?Dr._fromGetAccountInfoResponse(this.auth,n,e):null}return Dr._fromJSON(this.auth,e)}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;const n=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,n)return this.setCurrentUser(n)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,n,r="authUser"){if(!n.length)return new ea(ws(cw),e,r);const s=(await Promise.all(n.map(async u=>{if(await u._isAvailable())return u}))).filter(u=>u);let i=s[0]||ws(cw);const o=Uu(r,e.config.apiKey,e.name);let l=null;for(const u of n)try{const f=await u._get(o);if(f){let h;if(typeof f=="string"){const m=await Ld(e,{idToken:f}).catch(()=>{});if(!m)break;h=await Dr._fromGetAccountInfoResponse(e,m,f)}else h=Dr._fromJSON(e,f);u!==i&&(l=h),i=u;break}}catch{}const c=s.filter(u=>u._shouldAllowMigration);return!i._shouldAllowMigration||!c.length?new ea(i,e,r):(i=c[0],l&&await i._set(o,l.toJSON()),await Promise.all(n.map(async u=>{if(u!==i)try{await u._remove(o)}catch{}})),new ea(i,e,r))}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function uw(t){const e=t.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(d2(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(l2(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(f2(e))return"Blackberry";if(p2(e))return"Webos";if(c2(e))return"Safari";if((e.includes("chrome/")||u2(e))&&!e.includes("edge/"))return"Chrome";if(h2(e))return"Android";{const n=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,r=t.match(n);if((r==null?void 0:r.length)===2)return r[1]}return"Other"}function l2(t=An()){return/firefox\//i.test(t)}function c2(t=An()){const e=t.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function u2(t=An()){return/crios\//i.test(t)}function d2(t=An()){return/iemobile/i.test(t)}function h2(t=An()){return/android/i.test(t)}function f2(t=An()){return/blackberry/i.test(t)}function p2(t=An()){return/webos/i.test(t)}function j0(t=An()){return/iphone|ipad|ipod/i.test(t)||/macintosh/i.test(t)&&/mobile/i.test(t)}function $4(t=An()){var e;return j0(t)&&!!((e=window.navigator)!=null&&e.standalone)}function H4(){return cC()&&document.documentMode===10}function m2(t=An()){return j0(t)||h2(t)||p2(t)||f2(t)||/windows phone/i.test(t)||d2(t)}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function g2(t,e=[]){let n;switch(t){case"Browser":n=uw(An());break;case"Worker":n=`${uw(An())}-${t}`;break;default:n=t}const r=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${po}/${r}`}/** + * @license + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class q4{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,n){const r=i=>new Promise((o,l)=>{try{const c=e(i);o(c)}catch(c){l(c)}});r.onAbort=n,this.queue.push(r);const s=this.queue.length-1;return()=>{this.queue[s]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;const n=[];try{for(const r of this.queue)await r(e),r.onAbort&&n.push(r.onAbort)}catch(r){n.reverse();for(const s of n)try{s()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:r==null?void 0:r.message})}}}/** + * @license + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function G4(t,e={}){return Aa(t,"GET","/v2/passwordPolicy",C0(t,e))}/** + * @license + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const W4=6;class K4{constructor(e){var r;const n=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=n.minPasswordLength??W4,n.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=n.maxPasswordLength),n.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=n.containsLowercaseCharacter),n.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=n.containsUppercaseCharacter),n.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=n.containsNumericCharacter),n.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=n.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=((r=e.allowedNonAlphanumericCharacters)==null?void 0:r.join(""))??"",this.forceUpgradeOnSignin=e.forceUpgradeOnSignin??!1,this.schemaVersion=e.schemaVersion}validatePassword(e){const n={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,n),this.validatePasswordCharacterOptions(e,n),n.isValid&&(n.isValid=n.meetsMinPasswordLength??!0),n.isValid&&(n.isValid=n.meetsMaxPasswordLength??!0),n.isValid&&(n.isValid=n.containsLowercaseLetter??!0),n.isValid&&(n.isValid=n.containsUppercaseLetter??!0),n.isValid&&(n.isValid=n.containsNumericCharacter??!0),n.isValid&&(n.isValid=n.containsNonAlphanumericCharacter??!0),n}validatePasswordLengthOptions(e,n){const r=this.customStrengthOptions.minPasswordLength,s=this.customStrengthOptions.maxPasswordLength;r&&(n.meetsMinPasswordLength=e.length>=r),s&&(n.meetsMaxPasswordLength=e.length<=s)}validatePasswordCharacterOptions(e,n){this.updatePasswordCharacterOptionsStatuses(n,!1,!1,!1,!1);let r;for(let s=0;s="a"&&r<="z",r>="A"&&r<="Z",r>="0"&&r<="9",this.allowedNonAlphanumericCharacters.includes(r))}updatePasswordCharacterOptionsStatuses(e,n,r,s,i){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=n)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=r)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=s)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=i))}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Q4{constructor(e,n,r,s){this.app=e,this.heartbeatServiceProvider=n,this.appCheckServiceProvider=r,this.config=s,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new dw(this),this.idTokenSubscription=new dw(this),this.beforeStateQueue=new q4(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=t2,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this._resolvePersistenceManagerAvailable=void 0,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=s.sdkClientVersion,this._persistenceManagerAvailable=new Promise(i=>this._resolvePersistenceManagerAvailable=i)}_initializeWithPersistence(e,n){return n&&(this._popupRedirectResolver=ws(n)),this._initializationPromise=this.queue(async()=>{var r,s,i;if(!this._deleted&&(this.persistenceManager=await ea.create(this,e),(r=this._resolvePersistenceManagerAvailable)==null||r.call(this),!this._deleted)){if((s=this._popupRedirectResolver)!=null&&s._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(n),this.lastNotifiedUid=((i=this.currentUser)==null?void 0:i.uid)||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const e=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!e)){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUserFromIdToken(e){try{const n=await Ld(this,{idToken:e}),r=await Dr._fromGetAccountInfoResponse(this,n,e);await this.directlySetCurrentUser(r)}catch(n){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",n),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){var i;if(Pr(this.app)){const o=this.app.settings.authIdToken;return o?new Promise(l=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(o).then(l,l))}):this.directlySetCurrentUser(null)}const n=await this.assertedPersistence.getCurrentUser();let r=n,s=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const o=(i=this.redirectUser)==null?void 0:i._redirectEventId,l=r==null?void 0:r._redirectEventId,c=await this.tryRedirectSignIn(e);(!o||o===l)&&(c!=null&&c.user)&&(r=c.user,s=!0)}if(!r)return this.directlySetCurrentUser(null);if(!r._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(r)}catch(o){r=n,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(o))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return Re(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===r._redirectEventId?this.directlySetCurrentUser(r):this.reloadAndSetCurrentUserOrClear(r)}async tryRedirectSignIn(e){let n=null;try{n=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return n}async reloadAndSetCurrentUserOrClear(e){try{await Od(e)}catch(n){if((n==null?void 0:n.code)!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=C4()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(Pr(this.app))return Promise.reject(Yi(this));const n=e?sn(e):null;return n&&Re(n.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(n&&n._clone(this))}async _updateCurrentUser(e,n=!1){if(!this._deleted)return e&&Re(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),n||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return Pr(this.app)?Promise.reject(Yi(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return Pr(this.app)?Promise.reject(Yi(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(ws(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();const n=this._getPasswordPolicyInternal();return n.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):n.validatePassword(e)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){const e=await G4(this),n=new K4(e);this.tenantId===null?this._projectPasswordPolicy=n:this._tenantPasswordPolicies[this.tenantId]=n}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(e){this._errorFactory=new fc("auth","Firebase",e())}onAuthStateChanged(e,n,r){return this.registerStateListener(this.authStateSubscription,e,n,r)}beforeAuthStateChanged(e,n){return this.beforeStateQueue.pushCallback(e,n)}onIdTokenChanged(e,n,r){return this.registerStateListener(this.idTokenSubscription,e,n,r)}authStateReady(){return new Promise((e,n)=>{if(this.currentUser)e();else{const r=this.onAuthStateChanged(()=>{r(),e()},n)}})}async revokeAccessToken(e){if(this.currentUser){const n=await this.currentUser.getIdToken(),r={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:n};this.tenantId!=null&&(r.tenantId=this.tenantId),await B4(this,r)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:(e=this._currentUser)==null?void 0:e.toJSON()}}async _setRedirectUser(e,n){const r=await this.getOrInitRedirectPersistenceManager(n);return e===null?r.removeCurrentUser():r.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){const n=e&&ws(e)||this._popupRedirectResolver;Re(n,this,"argument-error"),this.redirectPersistenceManager=await ea.create(this,[ws(n._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var n,r;return this._isInitialized&&await this.queue(async()=>{}),((n=this._currentUser)==null?void 0:n._redirectEventId)===e?this._currentUser:((r=this.redirectUser)==null?void 0:r._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var n;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const e=((n=this.currentUser)==null?void 0:n.uid)??null;this.lastNotifiedUid!==e&&(this.lastNotifiedUid=e,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,n,r,s){if(this._deleted)return()=>{};const i=typeof n=="function"?n:n.next.bind(n);let o=!1;const l=this._isInitialized?Promise.resolve():this._initializationPromise;if(Re(l,this,"internal-error"),l.then(()=>{o||i(this.currentUser)}),typeof n=="function"){const c=e.addObserver(n,r,s);return()=>{o=!0,c()}}else{const c=e.addObserver(n);return()=>{o=!0,c()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return Re(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=g2(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var s;const e={"X-Client-Version":this.clientVersion};this.app.options.appId&&(e["X-Firebase-gmpid"]=this.app.options.appId);const n=await((s=this.heartbeatServiceProvider.getImmediate({optional:!0}))==null?void 0:s.getHeartbeatsHeader());n&&(e["X-Firebase-Client"]=n);const r=await this._getAppCheckToken();return r&&(e["X-Firebase-AppCheck"]=r),e}async _getAppCheckToken(){var n;if(Pr(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const e=await((n=this.appCheckServiceProvider.getImmediate({optional:!0}))==null?void 0:n.getToken());return e!=null&&e.error&&N4(`Error while retrieving App Check token: ${e.error}`),e==null?void 0:e.token}}function P0(t){return sn(t)}class dw{constructor(e){this.auth=e,this.observer=null,this.addObserver=yC(n=>this.observer=n)}get next(){return Re(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */let R0={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function Y4(t){R0=t}function X4(t){return R0.loadJS(t)}function J4(){return R0.gapiScript}function Z4(t){return`__${t}${Math.floor(Math.random()*1e6)}`}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function e5(t,e){const n=ph(t,"auth");if(n.isInitialized()){const s=n.getImmediate(),i=n.getOptions();if(ro(i,e??{}))return s;Rs(s,"already-initialized")}return n.initialize({options:e})}function t5(t,e){const n=(e==null?void 0:e.persistence)||[],r=(Array.isArray(n)?n:[n]).map(ws);e!=null&&e.errorMap&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(r,e==null?void 0:e.popupRedirectResolver)}function n5(t,e,n){const r=P0(t);Re(/^https?:\/\//.test(e),r,"invalid-emulator-scheme");const s=!1,i=y2(e),{host:o,port:l}=r5(e),c=l===null?"":`:${l}`,u={url:`${i}//${o}${c}/`},f=Object.freeze({host:o,port:l,protocol:i.replace(":",""),options:Object.freeze({disableWarnings:s})});if(!r._canInitEmulator){Re(r.config.emulator&&r.emulatorConfig,r,"emulator-config-failed"),Re(ro(u,r.config.emulator)&&ro(f,r.emulatorConfig),r,"emulator-config-failed");return}r.config.emulator=u,r.emulatorConfig=f,r.settings.appVerificationDisabledForTesting=!0,Sa(o)?Fg(`${i}//${o}${c}`):s5()}function y2(t){const e=t.indexOf(":");return e<0?"":t.substr(0,e+1)}function r5(t){const e=y2(t),n=/(\/\/)?([^?#/]+)/.exec(t.substr(e.length));if(!n)return{host:"",port:null};const r=n[2].split("@").pop()||"",s=/^(\[[^\]]+\])(:|$)/.exec(r);if(s){const i=s[1];return{host:i,port:hw(r.substr(i.length+1))}}else{const[i,o]=r.split(":");return{host:i,port:hw(o)}}}function hw(t){if(!t)return null;const e=Number(t);return isNaN(e)?null:e}function s5(){function t(){const e=document.createElement("p"),n=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",n.position="fixed",n.width="100%",n.backgroundColor="#ffffff",n.border=".1em solid #000000",n.color="#b50000",n.bottom="0px",n.left="0px",n.margin="0px",n.zIndex="10000",n.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",t):t())}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class x2{constructor(e,n){this.providerId=e,this.signInMethod=n}toJSON(){return vs("not implemented")}_getIdTokenResponse(e){return vs("not implemented")}_linkToIdToken(e,n){return vs("not implemented")}_getReauthenticationResolver(e){return vs("not implemented")}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function ta(t,e){return R4(t,"POST","/v1/accounts:signInWithIdp",C0(t,e))}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const i5="http://localhost";class co extends x2{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const n=new co(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(n.idToken=e.idToken),e.accessToken&&(n.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(n.nonce=e.nonce),e.pendingToken&&(n.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(n.accessToken=e.oauthToken,n.secret=e.oauthTokenSecret):Rs("argument-error"),n}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){const n=typeof e=="string"?JSON.parse(e):e,{providerId:r,signInMethod:s,...i}=n;if(!r||!s)return null;const o=new co(r,s);return o.idToken=i.idToken||void 0,o.accessToken=i.accessToken||void 0,o.secret=i.secret,o.nonce=i.nonce,o.pendingToken=i.pendingToken||null,o}_getIdTokenResponse(e){const n=this.buildRequest();return ta(e,n)}_linkToIdToken(e,n){const r=this.buildRequest();return r.idToken=n,ta(e,r)}_getReauthenticationResolver(e){const n=this.buildRequest();return n.autoCreate=!1,ta(e,n)}buildRequest(){const e={requestUri:i5,returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{const n={};this.idToken&&(n.id_token=this.idToken),this.accessToken&&(n.access_token=this.accessToken),this.secret&&(n.oauth_token_secret=this.secret),n.providerId=this.providerId,this.nonce&&!this.pendingToken&&(n.nonce=this.nonce),e.postBody=pc(n)}return e}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class v2{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class kc extends v2{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Xs extends kc{constructor(){super("facebook.com")}static credential(e){return co._fromParams({providerId:Xs.PROVIDER_ID,signInMethod:Xs.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return Xs.credentialFromTaggedObject(e)}static credentialFromError(e){return Xs.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return Xs.credential(e.oauthAccessToken)}catch{return null}}}Xs.FACEBOOK_SIGN_IN_METHOD="facebook.com";Xs.PROVIDER_ID="facebook.com";/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class gs extends kc{constructor(){super("google.com"),this.addScope("profile")}static credential(e,n){return co._fromParams({providerId:gs.PROVIDER_ID,signInMethod:gs.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:n})}static credentialFromResult(e){return gs.credentialFromTaggedObject(e)}static credentialFromError(e){return gs.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:n,oauthAccessToken:r}=e;if(!n&&!r)return null;try{return gs.credential(n,r)}catch{return null}}}gs.GOOGLE_SIGN_IN_METHOD="google.com";gs.PROVIDER_ID="google.com";/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Js extends kc{constructor(){super("github.com")}static credential(e){return co._fromParams({providerId:Js.PROVIDER_ID,signInMethod:Js.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return Js.credentialFromTaggedObject(e)}static credentialFromError(e){return Js.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return Js.credential(e.oauthAccessToken)}catch{return null}}}Js.GITHUB_SIGN_IN_METHOD="github.com";Js.PROVIDER_ID="github.com";/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Zs extends kc{constructor(){super("twitter.com")}static credential(e,n){return co._fromParams({providerId:Zs.PROVIDER_ID,signInMethod:Zs.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:n})}static credentialFromResult(e){return Zs.credentialFromTaggedObject(e)}static credentialFromError(e){return Zs.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthAccessToken:n,oauthTokenSecret:r}=e;if(!n||!r)return null;try{return Zs.credential(n,r)}catch{return null}}}Zs.TWITTER_SIGN_IN_METHOD="twitter.com";Zs.PROVIDER_ID="twitter.com";/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class va{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,n,r,s=!1){const i=await Dr._fromIdTokenResponse(e,r,s),o=fw(r);return new va({user:i,providerId:o,_tokenResponse:r,operationType:n})}static async _forOperation(e,n,r){await e._updateTokensIfNecessary(r,!0);const s=fw(r);return new va({user:e,providerId:s,_tokenResponse:r,operationType:n})}}function fw(t){return t.providerId?t.providerId:"phoneNumber"in t?"phone":null}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Vd extends cs{constructor(e,n,r,s){super(n.code,n.message),this.operationType=r,this.user=s,Object.setPrototypeOf(this,Vd.prototype),this.customData={appName:e.name,tenantId:e.tenantId??void 0,_serverResponse:n.customData._serverResponse,operationType:r}}static _fromErrorAndOperation(e,n,r,s){return new Vd(e,n,r,s)}}function w2(t,e,n,r){return(e==="reauthenticate"?n._getReauthenticationResolver(t):n._getIdTokenResponse(t)).catch(i=>{throw i.code==="auth/multi-factor-auth-required"?Vd._fromErrorAndOperation(t,i,e,r):i})}async function o5(t,e,n=!1){const r=await nc(t,e._linkToIdToken(t.auth,await t.getIdToken()),n);return va._forOperation(t,"link",r)}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function a5(t,e,n=!1){const{auth:r}=t;if(Pr(r.app))return Promise.reject(Yi(r));const s="reauthenticate";try{const i=await nc(t,w2(r,s,e,t),n);Re(i.idToken,r,"internal-error");const o=A0(i.idToken);Re(o,r,"internal-error");const{sub:l}=o;return Re(t.uid===l,r,"user-mismatch"),va._forOperation(t,s,i)}catch(i){throw(i==null?void 0:i.code)==="auth/user-not-found"&&Rs(r,"user-mismatch"),i}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function l5(t,e,n=!1){if(Pr(t.app))return Promise.reject(Yi(t));const r="signIn",s=await w2(t,r,e),i=await va._fromIdTokenResponse(t,r,s);return n||await t._updateCurrentUser(i.user),i}function c5(t,e,n,r){return sn(t).onIdTokenChanged(e,n,r)}function u5(t,e,n){return sn(t).beforeAuthStateChanged(e,n)}const Fd="__sak";/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class b2{constructor(e,n){this.storageRetriever=e,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(Fd,"1"),this.storage.removeItem(Fd),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,n){return this.storage.setItem(e,JSON.stringify(n)),Promise.resolve()}_get(e){const n=this.storage.getItem(e);return Promise.resolve(n?JSON.parse(n):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const d5=1e3,h5=10;class _2 extends b2{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,n)=>this.onStorageEvent(e,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=m2(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(const n of Object.keys(this.listeners)){const r=this.storage.getItem(n),s=this.localCache[n];r!==s&&e(n,s,r)}}onStorageEvent(e,n=!1){if(!e.key){this.forAllChangedKeys((o,l,c)=>{this.notifyListeners(o,c)});return}const r=e.key;n?this.detachListener():this.stopPolling();const s=()=>{const o=this.storage.getItem(r);!n&&this.localCache[r]===o||this.notifyListeners(r,o)},i=this.storage.getItem(r);H4()&&i!==e.newValue&&e.newValue!==e.oldValue?setTimeout(s,h5):s()}notifyListeners(e,n){this.localCache[e]=n;const r=this.listeners[e];if(r)for(const s of Array.from(r))s(n&&JSON.parse(n))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,n,r)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:n,newValue:r}),!0)})},d5)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,n){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(e,n){await super._set(e,n),this.localCache[e]=JSON.stringify(n)}async _get(e){const n=await super._get(e);return this.localCache[e]=JSON.stringify(n),n}async _remove(e){await super._remove(e),delete this.localCache[e]}}_2.type="LOCAL";const f5=_2;/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class E2 extends b2{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,n){}_removeListener(e,n){}}E2.type="SESSION";const S2=E2;/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function p5(t){return Promise.all(t.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(n){return{fulfilled:!1,reason:n}}}))}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Rh{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){const n=this.receivers.find(s=>s.isListeningto(e));if(n)return n;const r=new Rh(e);return this.receivers.push(r),r}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const n=e,{eventId:r,eventType:s,data:i}=n.data,o=this.handlersMap[s];if(!(o!=null&&o.size))return;n.ports[0].postMessage({status:"ack",eventId:r,eventType:s});const l=Array.from(o).map(async u=>u(n.origin,i)),c=await p5(l);n.ports[0].postMessage({status:"done",eventId:r,eventType:s,response:c})}_subscribe(e,n){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(n)}_unsubscribe(e,n){this.handlersMap[e]&&n&&this.handlersMap[e].delete(n),(!n||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}Rh.receivers=[];/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function D0(t="",e=10){let n="";for(let r=0;r{const u=D0("",20);s.port1.start();const f=setTimeout(()=>{c(new Error("unsupported_event"))},r);o={messageChannel:s,onMessage(h){const m=h;if(m.data.eventId===u)switch(m.data.status){case"ack":clearTimeout(f),i=setTimeout(()=>{c(new Error("timeout"))},3e3);break;case"done":clearTimeout(i),l(m.data.response);break;default:clearTimeout(f),clearTimeout(i),c(new Error("invalid_response"));break}}},this.handlers.add(o),s.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:u,data:n},[s.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function ss(){return window}function g5(t){ss().location.href=t}/** + * @license + * Copyright 2020 Google LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function T2(){return typeof ss().WorkerGlobalScope<"u"&&typeof ss().importScripts=="function"}async function y5(){if(!(navigator!=null&&navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function x5(){var t;return((t=navigator==null?void 0:navigator.serviceWorker)==null?void 0:t.controller)||null}function v5(){return T2()?self:null}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const N2="firebaseLocalStorageDb",w5=1,zd="firebaseLocalStorage",k2="fbase_key";class Ic{constructor(e){this.request=e}toPromise(){return new Promise((e,n)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{n(this.request.error)})})}}function Dh(t,e){return t.transaction([zd],e?"readwrite":"readonly").objectStore(zd)}function b5(){const t=indexedDB.deleteDatabase(N2);return new Ic(t).toPromise()}function Sm(){const t=indexedDB.open(N2,w5);return new Promise((e,n)=>{t.addEventListener("error",()=>{n(t.error)}),t.addEventListener("upgradeneeded",()=>{const r=t.result;try{r.createObjectStore(zd,{keyPath:k2})}catch(s){n(s)}}),t.addEventListener("success",async()=>{const r=t.result;r.objectStoreNames.contains(zd)?e(r):(r.close(),await b5(),e(await Sm()))})})}async function pw(t,e,n){const r=Dh(t,!0).put({[k2]:e,value:n});return new Ic(r).toPromise()}async function _5(t,e){const n=Dh(t,!1).get(e),r=await new Ic(n).toPromise();return r===void 0?null:r.value}function mw(t,e){const n=Dh(t,!0).delete(e);return new Ic(n).toPromise()}const E5=800,S5=3;class I2{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.db?this.db:(this.db=await Sm(),this.db)}async _withRetries(e){let n=0;for(;;)try{const r=await this._openDb();return await e(r)}catch(r){if(n++>S5)throw r;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return T2()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Rh._getInstance(v5()),this.receiver._subscribe("keyChanged",async(e,n)=>({keyProcessed:(await this._poll()).includes(n.key)})),this.receiver._subscribe("ping",async(e,n)=>["keyChanged"])}async initializeSender(){var n,r;if(this.activeServiceWorker=await y5(),!this.activeServiceWorker)return;this.sender=new m5(this.activeServiceWorker);const e=await this.sender._send("ping",{},800);e&&(n=e[0])!=null&&n.fulfilled&&(r=e[0])!=null&&r.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||x5()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;const e=await Sm();return await pw(e,Fd,"1"),await mw(e,Fd),!0}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,n){return this._withPendingWrite(async()=>(await this._withRetries(r=>pw(r,e,n)),this.localCache[e]=n,this.notifyServiceWorker(e)))}async _get(e){const n=await this._withRetries(r=>_5(r,e));return this.localCache[e]=n,n}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(n=>mw(n,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){const e=await this._withRetries(s=>{const i=Dh(s,!1).getAll();return new Ic(i).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];const n=[],r=new Set;if(e.length!==0)for(const{fbase_key:s,value:i}of e)r.add(s),JSON.stringify(this.localCache[s])!==JSON.stringify(i)&&(this.notifyListeners(s,i),n.push(s));for(const s of Object.keys(this.localCache))this.localCache[s]&&!r.has(s)&&(this.notifyListeners(s,null),n.push(s));return n}notifyListeners(e,n){this.localCache[e]=n;const r=this.listeners[e];if(r)for(const s of Array.from(r))s(n)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),E5)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,n){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&this.stopPolling()}}I2.type="LOCAL";const T5=I2;new Nc(3e4,6e4);/** + * @license + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function N5(t,e){return e?ws(e):(Re(t._popupRedirectResolver,t,"argument-error"),t._popupRedirectResolver)}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class M0 extends x2{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return ta(e,this._buildIdpRequest())}_linkToIdToken(e,n){return ta(e,this._buildIdpRequest(n))}_getReauthenticationResolver(e){return ta(e,this._buildIdpRequest())}_buildIdpRequest(e){const n={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(n.idToken=e),n}}function k5(t){return l5(t.auth,new M0(t),t.bypassAuthState)}function I5(t){const{auth:e,user:n}=t;return Re(n,e,"internal-error"),a5(n,new M0(t),t.bypassAuthState)}async function C5(t){const{auth:e,user:n}=t;return Re(n,e,"internal-error"),o5(n,new M0(t),t.bypassAuthState)}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class C2{constructor(e,n,r,s,i=!1){this.auth=e,this.resolver=r,this.user=s,this.bypassAuthState=i,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(n)?n:[n]}execute(){return new Promise(async(e,n)=>{this.pendingPromise={resolve:e,reject:n};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(r){this.reject(r)}})}async onAuthEvent(e){const{urlResponse:n,sessionId:r,postBody:s,tenantId:i,error:o,type:l}=e;if(o){this.reject(o);return}const c={auth:this.auth,requestUri:n,sessionId:r,tenantId:i||void 0,postBody:s||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(l)(c))}catch(u){this.reject(u)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return k5;case"linkViaPopup":case"linkViaRedirect":return C5;case"reauthViaPopup":case"reauthViaRedirect":return I5;default:Rs(this.auth,"internal-error")}}resolve(e){Ds(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){Ds(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const A5=new Nc(2e3,1e4);class Bo extends C2{constructor(e,n,r,s,i){super(e,n,s,i),this.provider=r,this.authWindow=null,this.pollId=null,Bo.currentPopupAction&&Bo.currentPopupAction.cancel(),Bo.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return Re(e,this.auth,"internal-error"),e}async onExecution(){Ds(this.filter.length===1,"Popup operations only handle one event");const e=D0();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(n=>{this.reject(n)}),this.resolver._isIframeWebStorageSupported(this.auth,n=>{n||this.reject(rs(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return((e=this.authWindow)==null?void 0:e.associatedEvent)||null}cancel(){this.reject(rs(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,Bo.currentPopupAction=null}pollUserCancellation(){const e=()=>{var n,r;if((r=(n=this.authWindow)==null?void 0:n.window)!=null&&r.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(rs(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,A5.get())};e()}}Bo.currentPopupAction=null;/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const j5="pendingRedirect",Bu=new Map;class P5 extends C2{constructor(e,n,r=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,r),this.eventId=null}async execute(){let e=Bu.get(this.auth._key());if(!e){try{const r=await R5(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(r)}catch(n){e=()=>Promise.reject(n)}Bu.set(this.auth._key(),e)}return this.bypassAuthState||Bu.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if(e.type==="signInViaRedirect")return super.onAuthEvent(e);if(e.type==="unknown"){this.resolve(null);return}if(e.eventId){const n=await this.auth._redirectUserForId(e.eventId);if(n)return this.user=n,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}}async function R5(t,e){const n=L5(e),r=M5(t);if(!await r._isAvailable())return!1;const s=await r._get(n)==="true";return await r._remove(n),s}function D5(t,e){Bu.set(t._key(),e)}function M5(t){return ws(t._redirectPersistence)}function L5(t){return Uu(j5,t.config.apiKey,t.name)}async function O5(t,e,n=!1){if(Pr(t.app))return Promise.reject(Yi(t));const r=P0(t),s=N5(r,e),o=await new P5(r,s,n).execute();return o&&!n&&(delete o.user._redirectEventId,await r._persistUserIfCurrent(o.user),await r._setRedirectUser(null,e)),o}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const V5=10*60*1e3;class F5{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let n=!1;return this.consumers.forEach(r=>{this.isEventForConsumer(e,r)&&(n=!0,this.sendToConsumer(e,r),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!z5(e)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=e,n=!0)),n}sendToConsumer(e,n){var r;if(e.error&&!A2(e)){const s=((r=e.error.code)==null?void 0:r.split("auth/")[1])||"internal-error";n.onError(rs(this.auth,s))}else n.onAuthEvent(e)}isEventForConsumer(e,n){const r=n.eventId===null||!!e.eventId&&e.eventId===n.eventId;return n.filter.includes(e.type)&&r}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=V5&&this.cachedEventUids.clear(),this.cachedEventUids.has(gw(e))}saveEventToCache(e){this.cachedEventUids.add(gw(e)),this.lastProcessedEventTime=Date.now()}}function gw(t){return[t.type,t.eventId,t.sessionId,t.tenantId].filter(e=>e).join("-")}function A2({type:t,error:e}){return t==="unknown"&&(e==null?void 0:e.code)==="auth/no-auth-event"}function z5(t){switch(t.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return A2(t);default:return!1}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function U5(t,e={}){return Aa(t,"GET","/v1/projects",e)}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const B5=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,$5=/^https?/;async function H5(t){if(t.config.emulator)return;const{authorizedDomains:e}=await U5(t);for(const n of e)try{if(q5(n))return}catch{}Rs(t,"unauthorized-domain")}function q5(t){const e=_m(),{protocol:n,hostname:r}=new URL(e);if(t.startsWith("chrome-extension://")){const o=new URL(t);return o.hostname===""&&r===""?n==="chrome-extension:"&&t.replace("chrome-extension://","")===e.replace("chrome-extension://",""):n==="chrome-extension:"&&o.hostname===r}if(!$5.test(n))return!1;if(B5.test(t))return r===t;const s=t.replace(/\./g,"\\.");return new RegExp("^(.+\\."+s+"|"+s+")$","i").test(r)}/** + * @license + * Copyright 2020 Google LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const G5=new Nc(3e4,6e4);function yw(){const t=ss().___jsl;if(t!=null&&t.H){for(const e of Object.keys(t.H))if(t.H[e].r=t.H[e].r||[],t.H[e].L=t.H[e].L||[],t.H[e].r=[...t.H[e].L],t.CP)for(let n=0;n{var s,i,o;function r(){yw(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{yw(),n(rs(t,"network-request-failed"))},timeout:G5.get()})}if((i=(s=ss().gapi)==null?void 0:s.iframes)!=null&&i.Iframe)e(gapi.iframes.getContext());else if((o=ss().gapi)!=null&&o.load)r();else{const l=Z4("iframefcb");return ss()[l]=()=>{gapi.load?r():n(rs(t,"network-request-failed"))},X4(`${J4()}?onload=${l}`).catch(c=>n(c))}}).catch(e=>{throw $u=null,e})}let $u=null;function K5(t){return $u=$u||W5(t),$u}/** + * @license + * Copyright 2020 Google LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Q5=new Nc(5e3,15e3),Y5="__/auth/iframe",X5="emulator/auth/iframe",J5={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},Z5=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function eD(t){const e=t.config;Re(e.authDomain,t,"auth-domain-config-required");const n=e.emulator?I0(e,X5):`https://${t.config.authDomain}/${Y5}`,r={apiKey:e.apiKey,appName:t.name,v:po},s=Z5.get(t.config.apiHost);s&&(r.eid=s);const i=t._getFrameworks();return i.length&&(r.fw=i.join(",")),`${n}?${pc(r).slice(1)}`}async function tD(t){const e=await K5(t),n=ss().gapi;return Re(n,t,"internal-error"),e.open({where:document.body,url:eD(t),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:J5,dontclear:!0},r=>new Promise(async(s,i)=>{await r.restyle({setHideOnLeave:!1});const o=rs(t,"network-request-failed"),l=ss().setTimeout(()=>{i(o)},Q5.get());function c(){ss().clearTimeout(l),s(r)}r.ping(c).then(c,()=>{i(o)})}))}/** + * @license + * Copyright 2020 Google LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const nD={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},rD=500,sD=600,iD="_blank",oD="http://localhost";class xw{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function aD(t,e,n,r=rD,s=sD){const i=Math.max((window.screen.availHeight-s)/2,0).toString(),o=Math.max((window.screen.availWidth-r)/2,0).toString();let l="";const c={...nD,width:r.toString(),height:s.toString(),top:i,left:o},u=An().toLowerCase();n&&(l=u2(u)?iD:n),l2(u)&&(e=e||oD,c.scrollbars="yes");const f=Object.entries(c).reduce((m,[p,x])=>`${m}${p}=${x},`,"");if($4(u)&&l!=="_self")return lD(e||"",l),new xw(null);const h=window.open(e||"",l,f);Re(h,t,"popup-blocked");try{h.focus()}catch{}return new xw(h)}function lD(t,e){const n=document.createElement("a");n.href=t,n.target=e;const r=document.createEvent("MouseEvent");r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(r)}/** + * @license + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const cD="__/auth/handler",uD="emulator/auth/handler",dD=encodeURIComponent("fac");async function vw(t,e,n,r,s,i){Re(t.config.authDomain,t,"auth-domain-config-required"),Re(t.config.apiKey,t,"invalid-api-key");const o={apiKey:t.config.apiKey,appName:t.name,authType:n,redirectUrl:r,v:po,eventId:s};if(e instanceof v2){e.setDefaultLanguage(t.languageCode),o.providerId=e.providerId||"",gC(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(const[f,h]of Object.entries({}))o[f]=h}if(e instanceof kc){const f=e.getScopes().filter(h=>h!=="");f.length>0&&(o.scopes=f.join(","))}t.tenantId&&(o.tid=t.tenantId);const l=o;for(const f of Object.keys(l))l[f]===void 0&&delete l[f];const c=await t._getAppCheckToken(),u=c?`#${dD}=${encodeURIComponent(c)}`:"";return`${hD(t)}?${pc(l).slice(1)}${u}`}function hD({config:t}){return t.emulator?I0(t,uD):`https://${t.authDomain}/${cD}`}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Df="webStorageSupport";class fD{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=S2,this._completeRedirectFn=O5,this._overrideRedirectResult=D5}async _openPopup(e,n,r,s){var o;Ds((o=this.eventManagers[e._key()])==null?void 0:o.manager,"_initialize() not called before _openPopup()");const i=await vw(e,n,r,_m(),s);return aD(e,i,D0())}async _openRedirect(e,n,r,s){await this._originValidation(e);const i=await vw(e,n,r,_m(),s);return g5(i),new Promise(()=>{})}_initialize(e){const n=e._key();if(this.eventManagers[n]){const{manager:s,promise:i}=this.eventManagers[n];return s?Promise.resolve(s):(Ds(i,"If manager is not set, promise should be"),i)}const r=this.initAndGetManager(e);return this.eventManagers[n]={promise:r},r.catch(()=>{delete this.eventManagers[n]}),r}async initAndGetManager(e){const n=await tD(e),r=new F5(e);return n.register("authEvent",s=>(Re(s==null?void 0:s.authEvent,e,"invalid-auth-event"),{status:r.onEvent(s.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:r},this.iframes[e._key()]=n,r}_isIframeWebStorageSupported(e,n){this.iframes[e._key()].send(Df,{type:Df},s=>{var o;const i=(o=s==null?void 0:s[0])==null?void 0:o[Df];i!==void 0&&n(!!i),Rs(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const n=e._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=H5(e)),this.originValidationPromises[n]}get _shouldInitProactively(){return m2()||c2()||j0()}}const pD=fD;var ww="@firebase/auth",bw="1.12.2";/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class mD{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),((e=this.auth.currentUser)==null?void 0:e.uid)||null}async getToken(e){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;const n=this.auth.onIdTokenChanged(r=>{e((r==null?void 0:r.stsTokenManager.accessToken)||null)});this.internalListeners.set(e,n),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();const n=this.internalListeners.get(e);n&&(this.internalListeners.delete(e),n(),this.updateProactiveRefresh())}assertAuthConfigured(){Re(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function gD(t){switch(t){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function yD(t){so(new vi("auth",(e,{options:n})=>{const r=e.getProvider("app").getImmediate(),s=e.getProvider("heartbeat"),i=e.getProvider("app-check-internal"),{apiKey:o,authDomain:l}=r.options;Re(o&&!o.includes(":"),"invalid-api-key",{appName:r.name});const c={apiKey:o,authDomain:l,clientPlatform:t,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:g2(t)},u=new Q4(r,s,i,c);return t5(u,n),u},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,n,r)=>{e.getProvider("auth-internal").initialize()})),so(new vi("auth-internal",e=>{const n=P0(e.getProvider("auth").getImmediate());return(r=>new mD(r))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),Zr(ww,bw,gD(t)),Zr(ww,bw,"esm2020")}/** + * @license + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const xD=5*60,vD=uE("authIdTokenMaxAge")||xD;let _w=null;const wD=t=>async e=>{const n=e&&await e.getIdTokenResult(),r=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(r&&r>vD)return;const s=n==null?void 0:n.token;_w!==s&&(_w=s,await fetch(t,{method:s?"POST":"DELETE",headers:s?{Authorization:`Bearer ${s}`}:{}}))};function bD(t=Bg()){const e=ph(t,"auth");if(e.isInitialized())return e.getImmediate();const n=e5(t,{popupRedirectResolver:pD,persistence:[T5,f5,S2]}),r=uE("authTokenSyncURL");if(r&&typeof isSecureContext=="boolean"&&isSecureContext){const i=new URL(r,location.origin);if(location.origin===i.origin){const o=wD(i.toString());u5(n,o,()=>o(n.currentUser)),c5(n,l=>o(l))}}const s=aE("auth");return s&&n5(n,`http://${s}`),n}function _D(){var t;return((t=document.getElementsByTagName("head"))==null?void 0:t[0])??document}Y4({loadJS(t){return new Promise((e,n)=>{const r=document.createElement("script");r.setAttribute("src",t),r.onload=e,r.onerror=s=>{const i=rs("internal-error");i.customData=s,n(i)},r.type="text/javascript",r.charset="UTF-8",_D().appendChild(r)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="});yD("Browser");const ED={apiKey:"AIzaSyAH3jvbe0_QLzIuuv5kTMK8246HNvohvfE",authDomain:"twistedbrody-9d163.firebaseapp.com",projectId:"twistedbrody-9d163",storageBucket:"twistedbrody-9d163.firebasestorage.app",messagingSenderId:"733213514129",appId:"1:733213514129:web:e9694684f5c3994ed06230",measurementId:"G-N8TQ7MY42W"},L0=pE(ED),Ae=MR(L0);b4(L0);bD(L0);new gs;function rc(t){if(t!=null){if(Array.isArray(t)){const e=t.map(n=>rc(n)).filter(n=>n!=null&&n!=="");return e.length>0?e:void 0}if(typeof t=="object"&&!(t instanceof Ke)){const e={};for(const n in t)if(t.hasOwnProperty(n)){const r=rc(t[n]);r!=null&&(e[n]=r)}return Object.keys(e).length>0?e:void 0}return t}}const Gt={ALL_MANGAS:"mangalib_all_v2",MANGA_PREFIX:"mangalib_detail_v2_"};function Ri(t,e){try{localStorage.setItem(t,JSON.stringify(e))}catch(n){console.warn(`Error saving ${t} to localStorage`,n)}}async function O0(t){const e=Ke.now(),n=t.map(async r=>{const s=Nt(Ae,"mangas",r.id);await tr(s,{title:r.title,updated_at:e});const i=bn.get(r.id);i&&(i.title=r.title,i.updated_at=e.toDate().toISOString(),bn.set(r.id,i),Ri(`${Gt.MANGA_PREFIX}${r.id}`,i))});await Promise.all(n)}function fr(t){try{localStorage.removeItem(t)}catch(e){console.warn(`Error removing ${t} from localStorage`,e)}}async function Mh(){const t=Vn(Dt(Ae,"mangas"),GR("created_at","desc")),e=await hn(t),r=(await hn(Dt(Ae,"categories"))).docs.reduce((o,l)=>(o[l.id]={id:l.id,...l.data()},o),{}),s=await Promise.all(e.docs.map(async o=>{var l,c;try{const u=o.data();let f=new Date().toISOString();(l=u.created_at)!=null&&l.toDate?f=u.created_at.toDate().toISOString():u.created_at&&(f=new Date(u.created_at).toISOString());let h=f;(c=u.updated_at)!=null&&c.toDate&&(h=u.updated_at.toDate().toISOString());const m=Vn(Dt(Ae,"chapters"),mr("manga_id","==",o.id)),x=(await hn(m)).docs.map(y=>{var M,T;const v=y.data(),_=(M=v.created_at)!=null&&M.toDate?v.created_at.toDate().toISOString():new Date().toISOString(),D=(T=v.updated_at)!=null&&T.toDate?v.updated_at.toDate().toISOString():new Date().toISOString();return{id:y.id,manga_id:v.manga_id,number:v.number,title:v.title,pages:v.pages||[],page_formats:v.page_formats||[],original_pages:v.original_pages||[],created_at:_,updated_at:D}}).sort((y,v)=>y.number-v.number),C=(u.categories||[]).map(y=>r[y]).filter(y=>y!==void 0);return{id:o.id,...u,created_at:f,updated_at:h,categories:C,chapters:x}}catch(u){return console.error(`[DATA ERROR] Skipping corrupt manga ${o.id}:`,u),null}})),i=s.filter(o=>o!==null);return console.log(`[DATA] Loaded ${i.length} mangas (Skipped ${s.length-i.length} corrupt)`),i}const bn=new Map;async function Ni(t){var f,h;const e=Nt(Ae,"mangas",t),n=await Ps(e);if(!n.exists())return null;const r=n.data(),s=Vn(Dt(Ae,"chapters"),mr("manga_id","==",t)),o=(await hn(s)).docs.map(m=>{const p=m.data();return{id:m.id,manga_id:p.manga_id,number:p.number,title:p.title,pages:p.pages||[],page_formats:p.page_formats||[],original_pages:p.original_pages||[],created_at:p.created_at.toDate().toISOString(),updated_at:p.updated_at.toDate().toISOString()}}).sort((m,p)=>m.number-p.number),l=r.categories||[],c=[];for(const m of l){const p=Nt(Ae,"categories",m),x=await Ps(p);x.exists()&&c.push({id:x.id,...x.data(),created_at:((h=(f=x.data().created_at)==null?void 0:f.toDate)==null?void 0:h.call(f).toISOString())||new Date().toISOString()})}const u={id:n.id,...r,created_at:r.created_at.toDate().toISOString(),categories:c,chapters:o,updated_at:r.updated_at?r.updated_at.toDate().toISOString():r.created_at.toDate().toISOString()};return bn.set(t,u),Ri(`${Gt.MANGA_PREFIX}${t}`,u),u}function SD(t,e){const n=Nt(Ae,"mangas",t);return N0(n,async r=>{if(!r.exists()){e(null);return}const s=r.data();let i=bn.get(t),o=(i==null?void 0:i.chapters)||[],l=(i==null?void 0:i.categories)||[];if(!i){const u=Vn(Dt(Ae,"chapters"),mr("manga_id","==",t));o=(await hn(u)).docs.map(m=>({id:m.id,...m.data(),created_at:m.data().created_at.toDate().toISOString(),updated_at:m.data().updated_at.toDate().toISOString()})).sort((m,p)=>m.number-p.number);const h=s.categories||[];l=[];for(const m of h){const p=await Ps(Nt(Ae,"categories",m));p.exists()&&l.push({id:p.id,...p.data()})}}const c={id:r.id,...s,chapters:o,categories:l,created_at:s.created_at.toDate().toISOString(),updated_at:s.updated_at?s.updated_at.toDate().toISOString():s.created_at.toDate().toISOString()};bn.set(t,c),Ri(`${Gt.MANGA_PREFIX}${t}`,c),e(c)})}async function Ew(t){const e=Ke.now(),n={title:t.title,author:t.author,description:t.description||"",status:t.status||"En curso",categories:t.categoryIds||[],views:0,rating:0,created_at:e,updated_at:e,...t.is_decensored!==void 0&&{is_decensored:t.is_decensored},...t.is_bn!==void 0&&{is_bn:t.is_bn},...t.is_color!==void 0&&{is_color:t.is_color},section:t.section||"flow"};t.thumbnail_url&&(n.thumbnail_url=t.thumbnail_url),t.cover_url&&(n.cover_url=t.cover_url);const r=await Sc(Dt(Ae,"mangas"),n),s=new Date().toISOString(),i={id:r.id,title:t.title,author:t.author,description:t.description||"",status:t.status||"En curso",categories:t.categoryIds||[],chapters:[],views:0,rating:0,created_at:s,updated_at:s,is_decensored:!!t.is_decensored,is_bn:!!t.is_bn,is_color:!!t.is_color,section:t.section||"flow"};return t.thumbnail_url&&(i.thumbnail_url=t.thumbnail_url),t.cover_url&&(i.cover_url=t.cover_url),bn.set(i.id,i),Ri(`${Gt.MANGA_PREFIX}${i.id}`,i),fr(Gt.ALL_MANGAS),i}async function j2(){return(await hn(Dt(Ae,"categories"))).docs.map(e=>({id:e.id,...e.data()}))}async function P2(t,e="genre"){const n=await Sc(Dt(Ae,"categories"),{name:t,type:e}),r=await Ps(n);return{id:r.id,...r.data()}}async function R2(t){const e=Nt(Ae,"categories",t);await tc(e);const n=Vn(Dt(Ae,"mangas"),mr("categories","array-contains",t)),s=(await hn(n)).docs.map(i=>{const c=(i.data().categories||[]).filter(u=>u!==t);return tr(Nt(Ae,"mangas",i.id),{categories:c})});await Promise.all(s)}async function na(t){const e=Ke.now(),n=await Sc(Dt(Ae,"chapters"),{manga_id:t.manga_id,number:t.number,title:t.title,pages:t.pages,page_formats:t.page_formats||[],original_pages:t.original_pages||[],created_at:e,updated_at:e}),r=await Ps(n),s=r.data();return{id:r.id,manga_id:s.manga_id,number:s.number,title:s.title,pages:s.pages||[],page_formats:s.page_formats||[],original_pages:s.original_pages||[],created_at:s.created_at.toDate().toISOString(),updated_at:s.updated_at.toDate().toISOString()}}async function TD(){const e=(await Mh()).map(n=>{const r=Nt(Ae,"mangas",n.id);return tr(r,{views:0})});await Promise.all(e)}async function ND(t){const e=Nt(Ae,"mangas",t);await tr(e,{views:HR(1)})}async function Lh(t,e){var x,E;const n=Nt(Ae,"mangas",t),r=Ke.now(),s={title:e.title,author:e.author,categories:e.categoryIds||[],updated_at:r,is_decensored:!!e.is_decensored,is_bn:!!e.is_bn,is_color:!!e.is_color};e.section&&(s.section=e.section),e.status&&(s.status=e.status),e.description!==void 0&&e.description!==null&&(s.description=e.description),e.thumbnail_url&&(s.thumbnail_url=e.thumbnail_url),e.cover_url&&(s.cover_url=e.cover_url);const i=rc(s);await tr(n,i);const o=await Ps(n);if(!o.exists())throw new Error("Manga no encontrado");const l=o.data(),c=Vn(Dt(Ae,"chapters"),mr("manga_id","==",t)),f=(await hn(c)).docs.map(C=>{const y=C.data();return{id:C.id,manga_id:y.manga_id,number:y.number,title:y.title,pages:y.pages||[],page_formats:y.page_formats||[],original_pages:y.original_pages||[],created_at:y.created_at.toDate().toISOString(),updated_at:y.updated_at.toDate().toISOString()}}).sort((C,y)=>C.number-y.number),h=l.categories||[],m=[];for(const C of h){const y=Nt(Ae,"categories",C),v=await Ps(y);v.exists()&&m.push({id:v.id,...v.data(),created_at:((E=(x=v.data().created_at)==null?void 0:x.toDate)==null?void 0:E.call(x).toISOString())||new Date().toISOString()})}const p={id:o.id,...l,created_at:l.created_at.toDate().toISOString(),categories:m,chapters:f,updated_at:l.updated_at.toDate().toISOString()};return bn.set(p.id,p),Ri(`${Gt.MANGA_PREFIX}${p.id}`,p),fr(Gt.ALL_MANGAS),p}async function V0(t,e,n){const r=Nt(Ae,"mangas",t);await tr(r,{is_deleted:e,updated_at:Ke.now()});const s=bn.get(t);s&&(s.is_deleted=e,s.updated_at=n,bn.set(t,s),Ri(`${Gt.MANGA_PREFIX}${t}`,s));const i=Vn(Dt(Ae,"mangas"),mr("folder_id","==",t)),o=await hn(i);for(const l of o.docs)await V0(l.id,e,n)}async function Ud(t){const e=new Date().toISOString();await V0(t,!0,e),fr(Gt.ALL_MANGAS)}async function kD(t){const e=new Date().toISOString();await V0(t,!1,e),fr(Gt.ALL_MANGAS)}async function D2(t){const e=Nt(Ae,"mangas",t),n=Vn(Dt(Ae,"mangas"),mr("folder_id","==",t)),r=await hn(n);for(const o of r.docs)await D2(o.id);const s=Vn(Dt(Ae,"chapters"),mr("manga_id","==",t)),i=await hn(s);for(const o of i.docs)await tc(o.ref);await tc(e),bn.delete(t),fr(`${Gt.MANGA_PREFIX}${t}`)}async function ID(t){await D2(t),fr(Gt.ALL_MANGAS)}async function CD(t,e){const n=Nt(Ae,"mangas",t),r=await Ps(n);if(!r.exists())throw new Error("Manga no encontrado");const i={external_links:[...r.data().external_links||[],e]},o=rc(i);await tr(n,o)}async function AD(t,e){const n=Nt(Ae,"mangas",t),r=await Ps(n);if(!r.exists())throw new Error("Manga no encontrado");const i={external_links:(r.data().external_links||[]).filter((l,c)=>c!==e)},o=rc(i);await tr(n,o)}function Sw(t){const e=t.match(/^(.*?)(?:\s*(?:-|_|#|vol\.?|volume|part|cap\.?|capitulo)?\s*(\d+(?:\.\d+)?))$/i);return e?{baseTitle:e[1].trim().toLowerCase(),number:parseFloat(e[2])}:{baseTitle:t.trim().toLowerCase(),number:null}}async function jD(t,e,n,r){const s=await Mh(),i=Sw(n),o=[],l=[];s.forEach(h=>{if(h.id===t||h.is_folder)return;const m=Sw(h.title);m.baseTitle===i.baseTitle&&m.baseTitle.length>0&&m.number!==null?o.push({manga:h,num:m.number}):l.push(h)}),o.sort((h,m)=>h.num-m.num);let c=[];if(i.number!==null){const h=o.filter(p=>p.num>i.number).map(p=>p.manga),m=o.filter(p=>p.nump.manga);c=[...h,...m]}else c=o.map(h=>h.manga);const u=l.map(h=>{var D,M;let m=0;const p=((D=h.categories)==null?void 0:D.map(T=>T.id))||[],x=e.filter(T=>p.includes(T));m+=x.length*10;const E=n.toLowerCase().split(/\s+/).filter(T=>T.length>2),C=h.title.toLowerCase().split(/\s+/).filter(T=>T.length>2),y=E.filter(T=>C.includes(T));m+=y.length*5;const v=((M=h.author)==null?void 0:M.toLowerCase().split(/\s+/).filter(T=>T.length>2))||[],_=E.filter(T=>v.includes(T));return m+=_.length*3,{manga:h,score:m}}).filter(h=>h.score>0).sort((h,m)=>{if(m.score!==h.score)return m.score-h.score;const p=h.manga.title.toLowerCase(),x=m.manga.title.toLowerCase();return p.localeCompare(x)}).map(h=>h.manga),f=[...c,...u];return r?f.slice(0,r):f}async function PD(t){const e=Vn(Dt(Ae,"mangas"),mr("author","==",t)),r=(await hn(e)).docs.map(s=>tr(Nt(Ae,"mangas",s.id),{author:""}));await Promise.all(r)}async function RD(){const t=Vn(Dt(Ae,"mangas")),e=await hn(t),n=new Set;return e.forEach(r=>{const s=r.data();s&&s.author&&typeof s.author=="string"&&s.author.trim()!==""&&n.add(s.author.trim())}),Array.from(n).sort()}async function DD(t,e,n,r="flow"){const s=Ke.now(),i={title:t,author:"Carpeta",description:"",status:"Carpeta",categories:[],views:0,rating:0,created_at:s,updated_at:s,is_folder:!0,section:r};n&&(i.folder_id=n);const l=(await Sc(Dt(Ae,"mangas"),i)).id;e.length>0&&await M2(e,l);const c=new Date().toISOString(),u={id:l,...i,created_at:c,updated_at:c,chapters:[],categories:[]};return bn.set(l,u),fr(Gt.ALL_MANGAS),u}async function M2(t,e){const n=Ke.now(),r=t.map(async s=>{const i=Nt(Ae,"mangas",s);await tr(i,{folder_id:e,updated_at:n});const o=bn.get(s);o&&(e?o.folder_id=e:delete o.folder_id,o.updated_at=n.toDate().toISOString(),bn.set(s,o),Ri(`${Gt.MANGA_PREFIX}${s}`,o))});await Promise.all(r),fr(Gt.ALL_MANGAS)}async function MD(t,e){const n=Ke.now(),r=[];for(let i=0;i{const h=u.data().folder_id,m=h&&s.has(h),p={section:e,updated_at:n};m||(p.folder_id=$R()),o.update(u.ref,p);const x=bn.get(u.id);x&&(x.section=e,m||delete x.folder_id,x.updated_at=n.toDate().toISOString(),bn.set(u.id,x),Ri(`${Gt.MANGA_PREFIX}${u.id}`,x))}),await o.commit()}fr(Gt.ALL_MANGAS)}async function Tw(t){if(t.length<2)return;const e=[];for(const p of t){const x=await Ni(p);x&&e.push(x)}if(e.length<2)return;const n=e.map(p=>p.title).join(" - "),r=e[0].section||"flow",s=e[0].folder_id,i=new Set;e.forEach(p=>{var x;(x=p.categories)==null||x.forEach(E=>i.add(E.id))});const o=Ke.now(),l={title:n,author:e[0].author,description:e.map(p=>p.description).filter(Boolean).join(` + +`),status:"En curso",categories:Array.from(i),views:0,rating:0,created_at:o,updated_at:o,section:r,is_decensored:e.some(p=>p.is_decensored),is_bn:e.some(p=>p.is_bn),is_color:e.some(p=>p.is_color)};e[0].thumbnail_url&&(l.thumbnail_url=e[0].thumbnail_url),e[0].cover_url&&(l.cover_url=e[0].cover_url),s&&(l.folder_id=s);const u=(await Sc(Dt(Ae,"mangas"),l)).id;let f=[],h=[],m=[];e.forEach(p=>{var x;(x=p.chapters)==null||x.forEach(E=>{E.pages&&(f=f.concat(E.pages)),E.original_pages&&(h=h.concat(E.original_pages)),E.page_formats&&(m=m.concat(E.page_formats))})}),m.length>0&&m.length!==f.length&&(m=f.map((p,x)=>m[x]||"webp")),f.length>0&&await na({manga_id:u,number:1,title:"Capítulo 1",pages:f,page_formats:m,original_pages:h});for(const p of t)await Ud(p);fr(Gt.ALL_MANGAS)}async function LD(t,e,n,r){const s=Vn(Dt(Ae,"chapters"),mr("manga_id","==",t)),i=await hn(s);for(const u of i.docs)await tc(u.ref);n.length>0&&await na({manga_id:t,number:1,title:"Capítulo 1",pages:n});const o=Vn(Dt(Ae,"chapters"),mr("manga_id","==",e)),l=await hn(o);for(const u of l.docs)await tc(u.ref);r.length>0&&await na({manga_id:e,number:1,title:"Capítulo 1",pages:r});const c=Ke.now();await tr(Nt(Ae,"mangas",t),{updated_at:c}),await tr(Nt(Ae,"mangas",e),{updated_at:c}),fr(`${Gt.MANGA_PREFIX}${t}`),fr(`${Gt.MANGA_PREFIX}${e}`),fr(Gt.ALL_MANGAS),bn.delete(t),bn.delete(e)}function OD(t){if(typeof document>"u")return;let e=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",e.appendChild(n),n.styleSheet?n.styleSheet.cssText=t:n.appendChild(document.createTextNode(t))}const VD=t=>{switch(t){case"success":return UD;case"info":return $D;case"warning":return BD;case"error":return HD;default:return null}},FD=Array(12).fill(0),zD=({visible:t,className:e})=>re.createElement("div",{className:["sonner-loading-wrapper",e].filter(Boolean).join(" "),"data-visible":t},re.createElement("div",{className:"sonner-spinner"},FD.map((n,r)=>re.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),UD=re.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},re.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),BD=re.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},re.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),$D=re.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},re.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),HD=re.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},re.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),qD=re.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},re.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),re.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),GD=()=>{const[t,e]=re.useState(document.hidden);return re.useEffect(()=>{const n=()=>{e(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),t};let Tm=1,WD=class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{const n=this.subscribers.indexOf(e);this.subscribers.splice(n,1)}),this.publish=e=>{this.subscribers.forEach(n=>n(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var n;const{message:r,...s}=e,i=typeof(e==null?void 0:e.id)=="number"||((n=e.id)==null?void 0:n.length)>0?e.id:Tm++,o=this.toasts.find(c=>c.id===i),l=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(i)&&this.dismissedToasts.delete(i),o?this.toasts=this.toasts.map(c=>c.id===i?(this.publish({...c,...e,id:i,title:r}),{...c,...e,id:i,dismissible:l,title:r}):c):this.addToast({title:r,...s,dismissible:l,id:i}),i},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(n=>n({id:e,dismiss:!0})))):this.toasts.forEach(n=>{this.subscribers.forEach(r=>r({id:n.id,dismiss:!0}))}),e),this.message=(e,n)=>this.create({...n,message:e}),this.error=(e,n)=>this.create({...n,message:e,type:"error"}),this.success=(e,n)=>this.create({...n,type:"success",message:e}),this.info=(e,n)=>this.create({...n,type:"info",message:e}),this.warning=(e,n)=>this.create({...n,type:"warning",message:e}),this.loading=(e,n)=>this.create({...n,type:"loading",message:e}),this.promise=(e,n)=>{if(!n)return;let r;n.loading!==void 0&&(r=this.create({...n,promise:e,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));const s=Promise.resolve(e instanceof Function?e():e);let i=r!==void 0,o;const l=s.then(async u=>{if(o=["resolve",u],re.isValidElement(u))i=!1,this.create({id:r,type:"default",message:u});else if(QD(u)&&!u.ok){i=!1;const h=typeof n.error=="function"?await n.error(`HTTP error! status: ${u.status}`):n.error,m=typeof n.description=="function"?await n.description(`HTTP error! status: ${u.status}`):n.description,x=typeof h=="object"&&!re.isValidElement(h)?h:{message:h};this.create({id:r,type:"error",description:m,...x})}else if(u instanceof Error){i=!1;const h=typeof n.error=="function"?await n.error(u):n.error,m=typeof n.description=="function"?await n.description(u):n.description,x=typeof h=="object"&&!re.isValidElement(h)?h:{message:h};this.create({id:r,type:"error",description:m,...x})}else if(n.success!==void 0){i=!1;const h=typeof n.success=="function"?await n.success(u):n.success,m=typeof n.description=="function"?await n.description(u):n.description,x=typeof h=="object"&&!re.isValidElement(h)?h:{message:h};this.create({id:r,type:"success",description:m,...x})}}).catch(async u=>{if(o=["reject",u],n.error!==void 0){i=!1;const f=typeof n.error=="function"?await n.error(u):n.error,h=typeof n.description=="function"?await n.description(u):n.description,p=typeof f=="object"&&!re.isValidElement(f)?f:{message:f};this.create({id:r,type:"error",description:h,...p})}}).finally(()=>{i&&(this.dismiss(r),r=void 0),n.finally==null||n.finally.call(n)}),c=()=>new Promise((u,f)=>l.then(()=>o[0]==="reject"?f(o[1]):u(o[1])).catch(f));return typeof r!="string"&&typeof r!="number"?{unwrap:c}:Object.assign(r,{unwrap:c})},this.custom=(e,n)=>{const r=(n==null?void 0:n.id)||Tm++;return this.create({jsx:e(r),id:r,...n}),r},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}};const Gn=new WD,KD=(t,e)=>{const n=(e==null?void 0:e.id)||Tm++;return Gn.addToast({title:t,...e,id:n}),n},QD=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",YD=KD,XD=()=>Gn.toasts,JD=()=>Gn.getActiveToasts(),be=Object.assign(YD,{success:Gn.success,info:Gn.info,warning:Gn.warning,error:Gn.error,custom:Gn.custom,message:Gn.message,promise:Gn.promise,dismiss:Gn.dismiss,loading:Gn.loading},{getHistory:XD,getToasts:JD});OD("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function yu(t){return t.label!==void 0}const ZD=3,eM="24px",tM="16px",Nw=4e3,nM=356,rM=14,sM=45,iM=200;function $r(...t){return t.filter(Boolean).join(" ")}function oM(t){const[e,n]=t.split("-"),r=[];return e&&r.push(e),n&&r.push(n),r}const aM=t=>{var e,n,r,s,i,o,l,c,u;const{invert:f,toast:h,unstyled:m,interacting:p,setHeights:x,visibleToasts:E,heights:C,index:y,toasts:v,expanded:_,removeToast:D,defaultRichColors:M,closeButton:T,style:S,cancelButtonStyle:w,actionButtonStyle:N,className:A="",descriptionClassName:I="",duration:P,position:k,gap:B,expandByDefault:z,classNames:W,icons:ee,closeButtonAriaLabel:F="Close toast"}=t,[K,R]=re.useState(null),[ne,pe]=re.useState(null),[O,Q]=re.useState(!1),[oe,le]=re.useState(!1),[Ie,te]=re.useState(!1),[it,pt]=re.useState(!1),[Ot,st]=re.useState(!1),[yt,Vt]=re.useState(0),[_n,xt]=re.useState(0),tt=re.useRef(h.duration||P||Nw),Bn=re.useRef(null),Ue=re.useRef(null),vt=y===0,Pn=y+1<=E,jt=h.type,on=h.dismissible!==!1,fn=h.className||"",wt=h.descriptionClassName||"",G=re.useMemo(()=>C.findIndex(we=>we.toastId===h.id)||0,[C,h.id]),ie=re.useMemo(()=>{var we;return(we=h.closeButton)!=null?we:T},[h.closeButton,T]),_e=re.useMemo(()=>h.duration||P||Nw,[h.duration,P]),Se=re.useRef(0),H=re.useRef(0),X=re.useRef(0),se=re.useRef(null),[de,Le]=k.split("-"),$=re.useMemo(()=>C.reduce((we,Ze,ot)=>ot>=G?we:we+Ze.height,0),[C,G]),J=GD(),me=h.invert||f,ge=jt==="loading";H.current=re.useMemo(()=>G*B+$,[G,$]),re.useEffect(()=>{tt.current=_e},[_e]),re.useEffect(()=>{Q(!0)},[]),re.useEffect(()=>{const we=Ue.current;if(we){const Ze=we.getBoundingClientRect().height;return xt(Ze),x(ot=>[{toastId:h.id,height:Ze,position:h.position},...ot]),()=>x(ot=>ot.filter($e=>$e.toastId!==h.id))}},[x,h.id]),re.useLayoutEffect(()=>{if(!O)return;const we=Ue.current,Ze=we.style.height;we.style.height="auto";const ot=we.getBoundingClientRect().height;we.style.height=Ze,xt(ot),x($e=>$e.find(ft=>ft.toastId===h.id)?$e.map(ft=>ft.toastId===h.id?{...ft,height:ot}:ft):[{toastId:h.id,height:ot,position:h.position},...$e])},[O,h.title,h.description,x,h.id,h.jsx,h.action,h.cancel]);const Ee=re.useCallback(()=>{le(!0),Vt(H.current),x(we=>we.filter(Ze=>Ze.toastId!==h.id)),setTimeout(()=>{D(h)},iM)},[h,D,x,H]);re.useEffect(()=>{if(h.promise&&jt==="loading"||h.duration===1/0||h.type==="loading")return;let we;return _||p||J?(()=>{if(X.current{tt.current!==1/0&&(Se.current=new Date().getTime(),we=setTimeout(()=>{h.onAutoClose==null||h.onAutoClose.call(h,h),Ee()},tt.current))})(),()=>clearTimeout(we)},[_,p,h,jt,J,Ee]),re.useEffect(()=>{h.delete&&(Ee(),h.onDismiss==null||h.onDismiss.call(h,h))},[Ee,h.delete]);function Ve(){var we;if(ee!=null&&ee.loading){var Ze;return re.createElement("div",{className:$r(W==null?void 0:W.loader,h==null||(Ze=h.classNames)==null?void 0:Ze.loader,"sonner-loader"),"data-visible":jt==="loading"},ee.loading)}return re.createElement(zD,{className:$r(W==null?void 0:W.loader,h==null||(we=h.classNames)==null?void 0:we.loader),visible:jt==="loading"})}const Be=h.icon||(ee==null?void 0:ee[jt])||VD(jt);var De,$n;return re.createElement("li",{tabIndex:0,ref:Ue,className:$r(A,fn,W==null?void 0:W.toast,h==null||(e=h.classNames)==null?void 0:e.toast,W==null?void 0:W.default,W==null?void 0:W[jt],h==null||(n=h.classNames)==null?void 0:n[jt]),"data-sonner-toast":"","data-rich-colors":(De=h.richColors)!=null?De:M,"data-styled":!(h.jsx||h.unstyled||m),"data-mounted":O,"data-promise":!!h.promise,"data-swiped":Ot,"data-removed":oe,"data-visible":Pn,"data-y-position":de,"data-x-position":Le,"data-index":y,"data-front":vt,"data-swiping":Ie,"data-dismissible":on,"data-type":jt,"data-invert":me,"data-swipe-out":it,"data-swipe-direction":ne,"data-expanded":!!(_||z&&O),"data-testid":h.testId,style:{"--index":y,"--toasts-before":y,"--z-index":v.length-y,"--offset":`${oe?yt:H.current}px`,"--initial-height":z?"auto":`${_n}px`,...S,...h.style},onDragEnd:()=>{te(!1),R(null),se.current=null},onPointerDown:we=>{we.button!==2&&(ge||!on||(Bn.current=new Date,Vt(H.current),we.target.setPointerCapture(we.pointerId),we.target.tagName!=="BUTTON"&&(te(!0),se.current={x:we.clientX,y:we.clientY})))},onPointerUp:()=>{var we,Ze,ot;if(it||!on)return;se.current=null;const $e=Number(((we=Ue.current)==null?void 0:we.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),He=Number(((Ze=Ue.current)==null?void 0:Ze.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),ft=new Date().getTime()-((ot=Bn.current)==null?void 0:ot.getTime()),bt=K==="x"?$e:He,ct=Math.abs(bt)/ft;if(Math.abs(bt)>=sM||ct>.11){Vt(H.current),h.onDismiss==null||h.onDismiss.call(h,h),pe(K==="x"?$e>0?"right":"left":He>0?"down":"up"),Ee(),pt(!0);return}else{var Ge,Bt;(Ge=Ue.current)==null||Ge.style.setProperty("--swipe-amount-x","0px"),(Bt=Ue.current)==null||Bt.style.setProperty("--swipe-amount-y","0px")}st(!1),te(!1),R(null)},onPointerMove:we=>{var Ze,ot,$e;if(!se.current||!on||((Ze=window.getSelection())==null?void 0:Ze.toString().length)>0)return;const ft=we.clientY-se.current.y,bt=we.clientX-se.current.x;var ct;const Ge=(ct=t.swipeDirections)!=null?ct:oM(k);!K&&(Math.abs(bt)>1||Math.abs(ft)>1)&&R(Math.abs(bt)>Math.abs(ft)?"x":"y");let Bt={x:0,y:0};const pn=Rn=>1/(1.5+Math.abs(Rn)/20);if(K==="y"){if(Ge.includes("top")||Ge.includes("bottom"))if(Ge.includes("top")&&ft<0||Ge.includes("bottom")&&ft>0)Bt.y=ft;else{const Rn=ft*pn(ft);Bt.y=Math.abs(Rn)0)Bt.x=bt;else{const Rn=bt*pn(bt);Bt.x=Math.abs(Rn)0||Math.abs(Bt.y)>0)&&st(!0),(ot=Ue.current)==null||ot.style.setProperty("--swipe-amount-x",`${Bt.x}px`),($e=Ue.current)==null||$e.style.setProperty("--swipe-amount-y",`${Bt.y}px`)}},ie&&!h.jsx&&jt!=="loading"?re.createElement("button",{"aria-label":F,"data-disabled":ge,"data-close-button":!0,onClick:ge||!on?()=>{}:()=>{Ee(),h.onDismiss==null||h.onDismiss.call(h,h)},className:$r(W==null?void 0:W.closeButton,h==null||(r=h.classNames)==null?void 0:r.closeButton)},($n=ee==null?void 0:ee.close)!=null?$n:qD):null,(jt||h.icon||h.promise)&&h.icon!==null&&((ee==null?void 0:ee[jt])!==null||h.icon)?re.createElement("div",{"data-icon":"",className:$r(W==null?void 0:W.icon,h==null||(s=h.classNames)==null?void 0:s.icon)},h.promise||h.type==="loading"&&!h.icon?h.icon||Ve():null,h.type!=="loading"?Be:null):null,re.createElement("div",{"data-content":"",className:$r(W==null?void 0:W.content,h==null||(i=h.classNames)==null?void 0:i.content)},re.createElement("div",{"data-title":"",className:$r(W==null?void 0:W.title,h==null||(o=h.classNames)==null?void 0:o.title)},h.jsx?h.jsx:typeof h.title=="function"?h.title():h.title),h.description?re.createElement("div",{"data-description":"",className:$r(I,wt,W==null?void 0:W.description,h==null||(l=h.classNames)==null?void 0:l.description)},typeof h.description=="function"?h.description():h.description):null),re.isValidElement(h.cancel)?h.cancel:h.cancel&&yu(h.cancel)?re.createElement("button",{"data-button":!0,"data-cancel":!0,style:h.cancelButtonStyle||w,onClick:we=>{yu(h.cancel)&&on&&(h.cancel.onClick==null||h.cancel.onClick.call(h.cancel,we),Ee())},className:$r(W==null?void 0:W.cancelButton,h==null||(c=h.classNames)==null?void 0:c.cancelButton)},h.cancel.label):null,re.isValidElement(h.action)?h.action:h.action&&yu(h.action)?re.createElement("button",{"data-button":!0,"data-action":!0,style:h.actionButtonStyle||N,onClick:we=>{yu(h.action)&&(h.action.onClick==null||h.action.onClick.call(h.action,we),!we.defaultPrevented&&Ee())},className:$r(W==null?void 0:W.actionButton,h==null||(u=h.classNames)==null?void 0:u.actionButton)},h.action.label):null)};function kw(){if(typeof window>"u"||typeof document>"u")return"ltr";const t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}function lM(t,e){const n={};return[t,e].forEach((r,s)=>{const i=s===1,o=i?"--mobile-offset":"--offset",l=i?tM:eM;function c(u){["top","right","bottom","left"].forEach(f=>{n[`${o}-${f}`]=typeof u=="number"?`${u}px`:u})}typeof r=="number"||typeof r=="string"?c(r):typeof r=="object"?["top","right","bottom","left"].forEach(u=>{r[u]===void 0?n[`${o}-${u}`]=l:n[`${o}-${u}`]=typeof r[u]=="number"?`${r[u]}px`:r[u]}):c(l)}),n}const cM=re.forwardRef(function(e,n){const{id:r,invert:s,position:i="bottom-right",hotkey:o=["altKey","KeyT"],expand:l,closeButton:c,className:u,offset:f,mobileOffset:h,theme:m="light",richColors:p,duration:x,style:E,visibleToasts:C=ZD,toastOptions:y,dir:v=kw(),gap:_=rM,icons:D,containerAriaLabel:M="Notifications"}=e,[T,S]=re.useState([]),w=re.useMemo(()=>r?T.filter(O=>O.toasterId===r):T.filter(O=>!O.toasterId),[T,r]),N=re.useMemo(()=>Array.from(new Set([i].concat(w.filter(O=>O.position).map(O=>O.position)))),[w,i]),[A,I]=re.useState([]),[P,k]=re.useState(!1),[B,z]=re.useState(!1),[W,ee]=re.useState(m!=="system"?m:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),F=re.useRef(null),K=o.join("+").replace(/Key/g,"").replace(/Digit/g,""),R=re.useRef(null),ne=re.useRef(!1),pe=re.useCallback(O=>{S(Q=>{var oe;return(oe=Q.find(le=>le.id===O.id))!=null&&oe.delete||Gn.dismiss(O.id),Q.filter(({id:le})=>le!==O.id)})},[]);return re.useEffect(()=>Gn.subscribe(O=>{if(O.dismiss){requestAnimationFrame(()=>{S(Q=>Q.map(oe=>oe.id===O.id?{...oe,delete:!0}:oe))});return}setTimeout(()=>{NI.flushSync(()=>{S(Q=>{const oe=Q.findIndex(le=>le.id===O.id);return oe!==-1?[...Q.slice(0,oe),{...Q[oe],...O},...Q.slice(oe+1)]:[O,...Q]})})})}),[T]),re.useEffect(()=>{if(m!=="system"){ee(m);return}if(m==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?ee("dark"):ee("light")),typeof window>"u")return;const O=window.matchMedia("(prefers-color-scheme: dark)");try{O.addEventListener("change",({matches:Q})=>{ee(Q?"dark":"light")})}catch{O.addListener(({matches:oe})=>{try{ee(oe?"dark":"light")}catch(le){console.error(le)}})}},[m]),re.useEffect(()=>{T.length<=1&&k(!1)},[T]),re.useEffect(()=>{const O=Q=>{var oe;if(o.every(te=>Q[te]||Q.code===te)){var Ie;k(!0),(Ie=F.current)==null||Ie.focus()}Q.code==="Escape"&&(document.activeElement===F.current||(oe=F.current)!=null&&oe.contains(document.activeElement))&&k(!1)};return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[o]),re.useEffect(()=>{if(F.current)return()=>{R.current&&(R.current.focus({preventScroll:!0}),R.current=null,ne.current=!1)}},[F.current]),re.createElement("section",{ref:n,"aria-label":`${M} ${K}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},N.map((O,Q)=>{var oe;const[le,Ie]=O.split("-");return w.length?re.createElement("ol",{key:O,dir:v==="auto"?kw():v,tabIndex:-1,ref:F,className:u,"data-sonner-toaster":!0,"data-sonner-theme":W,"data-y-position":le,"data-x-position":Ie,style:{"--front-toast-height":`${((oe=A[0])==null?void 0:oe.height)||0}px`,"--width":`${nM}px`,"--gap":`${_}px`,...E,...lM(f,h)},onBlur:te=>{ne.current&&!te.currentTarget.contains(te.relatedTarget)&&(ne.current=!1,R.current&&(R.current.focus({preventScroll:!0}),R.current=null))},onFocus:te=>{te.target instanceof HTMLElement&&te.target.dataset.dismissible==="false"||ne.current||(ne.current=!0,R.current=te.relatedTarget)},onMouseEnter:()=>k(!0),onMouseMove:()=>k(!0),onMouseLeave:()=>{B||k(!1)},onDragEnd:()=>k(!1),onPointerDown:te=>{te.target instanceof HTMLElement&&te.target.dataset.dismissible==="false"||z(!0)},onPointerUp:()=>z(!1)},w.filter(te=>!te.position&&Q===0||te.position===O).map((te,it)=>{var pt,Ot;return re.createElement(aM,{key:te.id,icons:D,index:it,toast:te,defaultRichColors:p,duration:(pt=y==null?void 0:y.duration)!=null?pt:x,className:y==null?void 0:y.className,descriptionClassName:y==null?void 0:y.descriptionClassName,invert:s,visibleToasts:C,closeButton:(Ot=y==null?void 0:y.closeButton)!=null?Ot:c,interacting:B,position:O,style:y==null?void 0:y.style,unstyled:y==null?void 0:y.unstyled,classNames:y==null?void 0:y.classNames,cancelButtonStyle:y==null?void 0:y.cancelButtonStyle,actionButtonStyle:y==null?void 0:y.actionButtonStyle,closeButtonAriaLabel:y==null?void 0:y.closeButtonAriaLabel,removeToast:pe,toasts:w.filter(st=>st.position==te.position),heights:A.filter(st=>st.position==te.position),setHeights:I,expandByDefault:l,gap:_,expanded:P,swipeDirections:e.swipeDirections})})):null}))});function ri({label:t,type:e,categories:n,selectedIds:r,onSelect:s,onRemove:i,onCreate:o,onDeleteCategory:l,colorClass:c,placeholder:u="Añadir..."}){const[f,h]=L.useState(""),[m,p]=L.useState(!1),x=L.useRef(null),E=L.useMemo(()=>n.filter(T=>T.type===e||!T.type&&e==="genre"),[n,e]),C=L.useMemo(()=>f.trim()?E.filter(T=>T.name.toLowerCase().includes(f.toLowerCase())):E,[E,f]);L.useEffect(()=>{const T=S=>{x.current&&!x.current.contains(S.target)&&p(!1)};return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[]);const y=T=>{T.key==="Enter"&&(T.preventDefault(),v())},v=()=>{if(!f.trim())return;const T=E.find(S=>S.name.toLowerCase()===f.trim().toLowerCase());T?r.includes(T.id)||s(T.id):o(f.trim()),h(""),p(!1)},_=(T,S)=>{T.stopPropagation(),be("¿Eliminar esta categoría permanentemente?",{description:"Esta acción no se puede deshacer.",action:{label:"Eliminar",onClick:()=>l(S)},cancel:{label:"Cancelar",onClick:()=>{}},duration:5e3})},M=c.includes("blue")?{bg:"bg-blue-500/20",text:"text-blue-300",border:"border-blue-500/30"}:c.includes("green")?{bg:"bg-green-500/20",text:"text-green-300",border:"border-green-500/30"}:c.includes("purple")?{bg:"bg-purple-500/20",text:"text-purple-300",border:"border-purple-500/30"}:c.includes("pink")?{bg:"bg-pink-500/20",text:"text-pink-300",border:"border-pink-500/30"}:{bg:"bg-gray-500/20",text:"text-gray-300",border:"border-gray-500/30"};return a.jsxs("div",{className:"space-y-3 mb-6",ref:x,children:[a.jsx("label",{className:`text-xs uppercase font-bold tracking-wider ${c}`,children:t}),a.jsxs("div",{className:"relative",children:[a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("div",{className:"relative flex-1",children:[a.jsx("input",{type:"text",value:f,onChange:T=>{h(T.target.value),p(!0)},onFocus:()=>p(!0),onKeyDown:y,placeholder:u,className:"w-full bg-[#1a1a1a] border border-gray-600/50 rounded-lg px-4 py-2 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-[#bb86fc] transition-all"}),f&&a.jsx("button",{onClick:()=>h(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-500 hover:text-white",children:a.jsx(gt,{className:"w-3 h-3"})})]}),a.jsx("button",{onClick:v,disabled:!f.trim(),className:"bg-[#bb86fc]/20 hover:bg-[#bb86fc]/30 text-[#bb86fc] px-3 rounded-lg transition-all",children:a.jsx(Kr,{className:"w-5 h-5"})})]}),m&&(C.length>0||f)&&a.jsx("div",{className:"absolute top-full left-0 right-0 mt-1 bg-[#1a1a1a] border border-gray-700/50 rounded-lg shadow-xl z-50 max-h-60 overflow-y-auto w-full custom-scrollbar",children:C.length>0?C.map(T=>{const S=r.includes(T.id);return a.jsxs("div",{className:"flex items-center justify-between px-4 py-2 hover:bg-white/5 cursor-pointer group",onClick:()=>{S||(s(T.id),h(""),p(!1))},children:[a.jsx("span",{className:`text-sm ${S?"text-[#bb86fc]":"text-gray-300"}`,children:T.name}),a.jsxs("div",{className:"flex items-center gap-2",children:[S&&a.jsx(dc,{className:"w-4 h-4 text-[#bb86fc]"}),a.jsx("button",{onClick:w=>_(w,T.id),className:"opacity-0 group-hover:opacity-100 p-1 hover:bg-red-500/20 text-gray-500 hover:text-red-400 rounded transition-all",title:"Eliminar permanentemente",children:a.jsx(tn,{className:"w-3.5 h-3.5"})})]})]},T.id)}):a.jsxs("div",{className:"px-4 py-3 text-center",children:[a.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"No encontrado."}),a.jsxs("button",{onClick:v,className:"text-xs text-[#bb86fc] hover:underline font-semibold",children:['Crear "',f,'"']})]})})]}),a.jsx("div",{className:"flex gap-2 flex-wrap",children:r.map(T=>{const S=n.find(w=>w.id===T);return!S||S.type!==e&&!(e==="genre"&&!S.type)?null:a.jsxs("span",{className:`px-3 py-1 ${M.bg} ${M.text} text-xs rounded-full border ${M.border} flex items-center gap-2`,children:[S.name,a.jsx("button",{onClick:()=>i(T),className:"hover:text-white",children:a.jsx(gt,{className:"w-3 h-3"})})]},T)})})]})}function Sr({size:t=40,borderWidth:e=2,className:n=""}){return a.jsx("div",{className:`flex items-center justify-center ${n}`,children:a.jsx("div",{className:"relative",style:{width:`${t}px`,height:`${t}px`},children:a.jsx("div",{className:"rounded-full animate-spin",style:{width:`${t}px`,height:`${t}px`,borderWidth:`${e}px`,borderStyle:"solid",borderColor:"rgba(187, 134, 252, 0.3)",borderTopColor:"#bb86fc",animation:"spin 1.2s linear infinite",boxShadow:"0 0 20px rgba(139, 92, 246, 0.2)"}})})})}function Iw(t){const e=new Map,n=t.split(` +`);let r="",s="Hugging Face";for(const l of n){const c=l.trim();if(c.includes("---- WEB P LINKS ----")){r="WEB P LINKS";continue}if(c.includes("---- ORIGINAL LINKS ----")){r="ORIGINAL LINKS";continue}if(c.includes("---- VIDEO LINKS ----")){r="VIDEO LINKS";continue}if(c.includes("Para Hugging Face (Público):")){s="Hugging Face";continue}if(c.includes("Para tu PC Local (Pruebas):")){s="Local";continue}if(s==="Hugging Face"&&c.match(/^\(\d+\)\s+.*?\s+=\s+http/)){const u=c.match(/^\(\d+\)\s+(.*?)\s+=\s+(http.*)$/);if(u){const f=u[1],h=u[2].trim(),p=(r==="VIDEO LINKS"||f.toLowerCase().endsWith(".mp4"))&&!h.includes("format=mp4")?h+(h.includes("?")?"&format=mp4":"?format=mp4"):h,x=c.match(/^\((\d+)\)/);let E=x?parseInt(x[1],10):0;if(!E){const y=f.match(/^(\d+)/);E=y?parseInt(y[1],10):0}e.has(E)||e.set(E,{originalFormat:"webp",originalBase64:""});const C=e.get(E);r==="WEB P LINKS"?(C.thumbnail=p,C.webpDisplay=p,C.webpCover=p):r==="ORIGINAL LINKS"?(C.original=p,C.originalUnmodified=p):(C.thumbnail=p,C.webpDisplay=p,C.webpCover=p,C.original=p,C.originalUnmodified=p)}}}const i=[],o=Array.from(e.keys()).sort((l,c)=>l-c);for(const l of o){const c=e.get(l);c&&(!c.original&&c.thumbnail?(c.original=c.thumbnail,c.originalUnmodified=c.thumbnail):!c.thumbnail&&c.original&&(c.thumbnail=c.original,c.webpDisplay=c.original,c.webpCover=c.original),c.thumbnail&&c.original&&i.push(c))}return i}function Nm({isOpen:t,onClose:e,onConfirm:n,title:r,message:s,confirmText:i="Confirmar",cancelText:o="Cancelar",variant:l="warning"}){if(!t)return null;const c={danger:"from-red-500 to-red-600 shadow-red-500/20",warning:"from-[#bb86fc] to-[#9966dd] shadow-[#bb86fc]/30",info:"from-blue-500 to-blue-600 shadow-blue-500/20"},u={danger:"bg-red-500/10 text-red-500",warning:"bg-[#bb86fc]/10 text-[#bb86fc]",info:"bg-blue-500/10 text-blue-500"};return a.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-[100] p-4 backdrop-blur-sm animate-[fadeIn_0.2s_ease-out]",children:a.jsxs("div",{className:"bg-gradient-to-b from-[#1f1f1f] to-[#121212] rounded-2xl border border-gray-700/40 w-full max-w-md shadow-2xl overflow-hidden scale-in-center",children:[a.jsxs("div",{className:"bg-gradient-to-b from-[#2a2a2a] to-[#1f1f1f] border-b border-gray-700/30 px-6 py-4 flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`p-2 rounded-lg ${u[l]}`,children:a.jsx(AI,{className:"w-5 h-5"})}),a.jsx("h2",{className:"text-xl font-bold text-white tracking-tight",children:r})]}),a.jsx("button",{onClick:e,className:"text-gray-500 hover:text-white hover:bg-white/10 transition-all p-1.5 rounded-lg",children:a.jsx(gt,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"p-8",children:[a.jsx("p",{className:"text-gray-300 leading-relaxed",children:s}),a.jsxs("div",{className:"flex gap-3 mt-8",children:[a.jsx("button",{onClick:e,className:"flex-1 bg-[#1a1a1a] border border-gray-600/40 hover:border-gray-500 hover:bg-[#242424] text-white px-5 py-3 rounded-xl font-semibold text-sm transition-all shadow-md active:scale-95",children:o}),a.jsx("button",{onClick:()=>{n(),e()},className:`flex-1 bg-gradient-to-r ${c[l]} text-white px-5 py-3 rounded-xl font-bold text-sm transition-all shadow-lg hover:brightness-110 active:scale-95`,children:i})]})]})]})})}function uM({currentSection:t,isOpen:e,onClose:n,onMangaCreated:r,editingManga:s,onDelete:i}){const[o,l]=L.useState({title:"",name:"",description:"",selectedCategories:[],is_decensored:!1,is_bn:!1,is_color:!1}),[c,u]=L.useState(null),[f,h]=L.useState(!1),[m,p]=L.useState(null),[x,E]=L.useState([]),[C,y]=L.useState(!1),[v,_]=L.useState([]),[D,M]=L.useState(!1),[T,S]=L.useState(null),[w,N]=L.useState(0),[A,I]=L.useState(!1),[P,k]=L.useState(0),[B,z]=L.useState(0),[W,ee]=L.useState(null),[F,K]=L.useState(!1),[R,ne]=L.useState(null),[pe,O]=L.useState(null),[Q,oe]=L.useState(!1),[le,Ie]=L.useState(rE()),[te,it]=L.useState(null),[pt,Ot]=L.useState(!1),st=!!s,yt=st&&(s==null?void 0:s.is_folder);L.useEffect(()=>{var H,X;if(e&&(Vt(),s)){l({title:s.title,name:s.author,description:s.description||"",selectedCategories:((H=s.categories)==null?void 0:H.map(de=>typeof de=="string"?de:de.id))||[],is_decensored:!!s.is_decensored,is_bn:!!s.is_bn,is_color:!!s.is_color}),s.thumbnail_url&&p(s.thumbnail_url);const se=(X=s.chapters)==null?void 0:X[0];if(se!=null&&se.pages&&se.pages.length>0){const de=se.pages,Le=se.original_pages||[],$=de.map((J,me)=>{var ge;return{thumbnail:J,original:Le[me]||J,webpDisplay:J,webpCover:J,originalFormat:((ge=se.page_formats)==null?void 0:ge[me])||"jpg",originalBase64:"",originalUnmodified:""}});_($)}}},[e,s]),L.useEffect(()=>{v.length>0&&R===null&&!c&&!pe&&!m&&_e(0)},[v]);async function Vt(){try{const H=await j2();E(H)}catch(H){console.error("Error loading categories:",H)}}const _n=async H=>{const{name:X,value:se}=H.target;l(de=>({...de,[X]:se}))},xt=H=>{l(X=>({...X,selectedCategories:X.selectedCategories.filter(se=>se!==H)}))},tt=async(H,X)=>{if(H.trim()){if(X==="tag"){const se=H.split(" ").map(de=>de.trim()).filter(de=>de.length>0);for(const de of se)await Bn(de,X);return}await Bn(H,X)}},Bn=async(H,X)=>{try{const se=x.find(de=>de.name.toLowerCase()===H.trim().toLowerCase()&&de.type===X);if(se)l(de=>de.selectedCategories.includes(se.id)?de:{...de,selectedCategories:[...de.selectedCategories,se.id]});else{const de=await P2(H.trim(),X);E(Le=>Le.find($=>$.id===de.id)?Le:[...Le,de]),l(Le=>Le.selectedCategories.includes(de.id)?Le:{...Le,selectedCategories:[...Le.selectedCategories,de.id]})}}catch(se){console.error("Error creating category:",se)}},Ue=async H=>{try{await R2(H),E(X=>X.filter(se=>se.id!==H)),l(X=>({...X,selectedCategories:X.selectedCategories.filter(se=>se!==H)}))}catch(X){console.error("Error deleting category:",X),alert("Error al eliminar la categoría")}},vt=async H=>{var se;const X=(se=H.target.files)==null?void 0:se[0];if(X){h(!0);try{const de=await $I(X);u(de),p(de.originalUnmodified)}catch(de){console.error("Error processing image:",de),alert("Error al procesar la imagen. Intenta con otro archivo.")}finally{h(!1)}}},Pn=async H=>{let X="";if(H.target instanceof HTMLInputElement&&H.target.files&&H.target.files.length>0){const se=Array.from(H.target.files);if(se.length>1){it(se);return}const de=se[0];if(!st||!o.title.trim()){const $=de.name.split(".").slice(0,-1).join(".").replace(/[_-]/g," ").trim();l(J=>({...J,title:$}))}try{X=await de.text()}catch(Le){console.error("Error reading text file:",Le),alert("Error al leer el archivo de texto.");return}}else H.target instanceof HTMLTextAreaElement&&(X=H.target.value);if(X.trim()){M(!0);try{const se=Iw(X);if(se.length===0){alert("No se encontraron enlaces válidos en el texto provisto. Asegúrate de copiar el formato correcto.");return}_(de=>[...de,...se])}catch(se){console.error("Error parsing pages from text:",se),alert("Error al procesar los enlaces.")}finally{M(!1),H.target instanceof HTMLInputElement&&(H.target.value="")}}},jt=async H=>{var X,se;if(st){alert("La subida masiva solo está disponible al crear nuevos mangas.");return}ee({uploading:!0,current:0,total:H.length,currentName:"",errors:[]});try{for(let de=0;deme?{...me,current:de+1,currentName:J}:null);try{const me=await Le.text(),ge=Iw(me);if(ge.length===0)throw new Error("No se encontraron enlaces válidos.");const Ee={title:J,author:((X=o.name)==null?void 0:X.trim())||"Anónimo",categoryIds:o.selectedCategories,is_decensored:o.is_decensored,is_bn:o.is_bn,is_color:o.is_color,section:t};(se=o.description)!=null&&se.trim()&&(Ee.description=o.description.trim()),ge.length>0&&(Ee.thumbnail_url=ge[0].webpDisplay,Ee.cover_url=ge[0].originalUnmodified);const Ve=await Ew(Ee);await na({manga_id:Ve.id,number:1,title:"Páginas",pages:ge.map(Be=>Be.webpDisplay),page_formats:ge.map(Be=>Be.originalFormat),original_pages:ge.map(Be=>Be.original)})}catch(me){console.error(`Error processing ${Le.name}:`,me),ee(ge=>ge?{...ge,errors:[...ge.errors,`${Le.name}: ${me.message||"Error desconocido"}`]}:null)}}ee(de=>de?{...de,currentName:"¡Completado!"}:null),setTimeout(()=>{ee(null),Se(),r()},2e3)}catch(de){console.error("Error general en subida masiva:",de),alert("Ocurrió un error inesperado durante la subida masiva."),ee(null)}},on=H=>{_(X=>X.filter((se,de)=>de!==H))},fn=H=>{S(H)},wt=(H,X)=>{if(H.preventDefault(),T===null||T===X)return;const se=[...v],de=se[T];se.splice(T,1),se.splice(X,0,de),_(se),S(X)},G=()=>{S(null)},ie=async()=>{var H,X,se,de,Le;if(!o.title||!o.title.trim()){alert("El título es requerido");return}y(!0);try{let $=[...o.selectedCategories],J=(s==null?void 0:s.thumbnail_url)||void 0,me=(s==null?void 0:s.cover_url)||void 0;if(pe)J=pe.thumbnail,me=pe.original;else if(c)if(c.originalBase64==="")J=c.thumbnail,me=c.originalUnmodified;else try{I(!0),z(2),k(1),N(0);const ge=await Zp(c.thumbnail,`${o.title}_thumb`);N(50),k(2);const Ee=await Zp(c.originalUnmodified,`${o.title}_cover`);N(100),J=ge.data.url,me=Ee.data.url}catch(ge){console.error("Error uploading cover images:",ge),alert("Error al subir la portada. Continuar sin portada.")}finally{I(!1),N(0)}else v.length>0&&(J=v[0].webpDisplay,me=v[0].originalUnmodified);if(st&&s){const ge={title:o.title.trim(),author:((H=o.name)==null?void 0:H.trim())||"",description:((X=o.description)==null?void 0:X.trim())||"",categoryIds:$,is_decensored:o.is_decensored,is_bn:o.is_bn,is_color:o.is_color};if(J&&(ge.thumbnail_url=J),me&&(ge.cover_url=me),await Lh(s.id,ge),v.length>0&&v.length>0)try{I(!0);const Ee=v.filter($e=>$e.originalBase64!==""&&!$e.original.includes("/stream/")&&!$e.original.includes("hash="));let Ve=[],Be=[];if(Ee.length>0){z(Ee.length*2),k(0),N(0);const $e=Ee.map(ct=>ct.webpDisplay),He=Ee.map(ct=>ct.originalUnmodified),ft=await cu($e,`${o.title}_updated_webp`,(ct,Ge)=>{k(ct),N(Math.round(ct/(Ee.length*2)*100))}),bt=await cu(He,`${o.title}_updated_original`,(ct,Ge)=>{k(Ee.length+ct),N(Math.round((Ee.length+ct)/(Ee.length*2)*100))});Ve=ft.map(ct=>ct.data.url),Be=bt.map(ct=>ct.data.url)}let De=0;const $n=v.map($e=>$e.originalBase64!==""&&!$e.original.includes("/stream/")&&!$e.original.includes("hash=")?Ve[De++]:$e.webpDisplay);De=0;const we=v.map($e=>$e.originalBase64!==""&&!$e.original.includes("/stream/")&&!$e.original.includes("hash=")?Be[De++]:$e.original),Ze=v.map($e=>$e.originalFormat);I(!1),N(0);const ot=(se=s.chapters)==null?void 0:se[0];ot?await tr(Nt(Ae,"chapters",ot.id),{pages:$n,page_formats:Ze,original_pages:we,updated_at:Ke.now()}):await na({manga_id:s.id,number:1,title:"Páginas",pages:$n,page_formats:Ze,original_pages:we})}catch(Ee){console.error("Error updating chapter:",Ee),alert("Error al actualizar las páginas.")}r(s.id)}else{const ge={title:o.title.trim(),author:((de=o.name)==null?void 0:de.trim())||"",categoryIds:$,is_decensored:o.is_decensored,is_bn:o.is_bn,is_color:o.is_color,section:t};(Le=o.description)!=null&&Le.trim()&&(ge.description=o.description.trim()),J&&(ge.thumbnail_url=J),me&&(ge.cover_url=me);const Ee=await Ew(ge);if(!Ee.id)throw new Error("No se pudo obtener el ID del manga creado");const Ve=Ee.id;if(v.length>0)try{I(!0);const Be=v.filter(He=>He.originalBase64!==""&&!He.original.includes("/stream/")&&!He.original.includes("hash="));let De=[],$n=[];if(Be.length>0){z(Be.length*2),k(0),N(0);const He=Be.map(Ge=>Ge.webpDisplay),ft=Be.map(Ge=>Ge.originalUnmodified),bt=await cu(He,`${o.title}_ch1_webp`,(Ge,Bt)=>{k(Ge),N(Math.round(Ge/(Be.length*2)*100))}),ct=await cu(ft,`${o.title}_ch1_original`,(Ge,Bt)=>{k(Be.length+Ge),N(Math.round((Be.length+Ge)/(Be.length*2)*100))});De=bt.map(Ge=>Ge.data.url),$n=ct.map(Ge=>Ge.data.url)}let we=0;const Ze=v.map(He=>He.originalBase64!==""&&!He.original.includes("/stream/")&&!He.original.includes("hash=")?De[we++]:He.webpDisplay);we=0;const ot=v.map(He=>He.originalBase64!==""&&!He.original.includes("/stream/")&&!He.original.includes("hash=")?$n[we++]:He.original),$e=v.map(He=>He.originalFormat);I(!1),N(0),await na({manga_id:Ve,number:1,title:"Páginas",pages:Ze,page_formats:$e,original_pages:ot})}catch(Be){console.error("Error creating chapter:",Be),alert("Error al crear el capítulo. Por favor intenta de nuevo.")}r(Ve)}Se()}catch($){console.error("Error creating/updating manga:",$);let J="Error al guardar el manga. ";if($.message)J+=$.message;else if($.code)switch($.code){case"permission-denied":J+="No tienes permisos para realizar esta operación.";break;case"unavailable":J+="El servicio no está disponible. Verifica tu conexión.";break;case"invalid-argument":J+="Algunos datos no son válidos. Revisa el formulario.";break;default:J+=`Código de error: ${$.code}`}else J+="Por favor intenta de nuevo.";alert(J)}finally{y(!1),I(!1),N(0)}},_e=H=>{const X=v[H];if(!X.originalBase64)O({thumbnail:X.thumbnail,original:X.original}),u(null);else{const de={thumbnail:X.thumbnail,original:X.originalUnmodified,webpDisplay:X.originalUnmodified,webpCover:X.originalUnmodified,originalFormat:X.originalFormat,originalBase64:X.originalBase64,originalUnmodified:X.originalUnmodified};u(de),O(null)}p(X.thumbnail),ne(H),K(!1)},Se=()=>{l({title:"",name:"",description:"",selectedCategories:[],is_decensored:!1,is_bn:!1,is_color:!1}),u(null),O(null),p(null),_([]),N(0),I(!1),k(0),z(0),K(!1),ne(null),n()};return e?a.jsxs("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:[a.jsxs("div",{className:"bg-gradient-to-b from-[#1f1f1f] to-[#121212] rounded-2xl border border-gray-700/40 w-full max-w-2xl max-h-[90vh] overflow-y-auto shadow-2xl",children:[a.jsxs("div",{className:"sticky top-0 bg-gradient-to-b from-[#2a2a2a] to-[#1f1f1f] border-b border-gray-700/30 px-8 py-6 flex items-center justify-between z-10",children:[a.jsxs("div",{children:[a.jsxs("h2",{className:"text-2xl font-bold flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-gradient-to-br from-[#bb86fc] to-[#9966dd] rounded-lg shadow-lg shadow-[#bb86fc]/30",children:a.jsx(fa,{className:"w-5 h-5 text-white"})}),yt?"Editar Carpeta":st?t==="patreon"||t==="onlyfans"?"Editar Galería":"Editar Manga":t==="patreon"?"Subir Imágenes":t==="onlyfans"?"Subir Only":"Crear Manga"]}),a.jsx("p",{className:"text-sm text-gray-400 mt-1.5",children:yt?"Actualiza el nombre de la carpeta":st?t==="patreon"||t==="onlyfans"?"Actualiza los detalles de la galería":"Actualiza los detalles de tu obra":t==="patreon"||t==="onlyfans"?"Sube nuevas imágenes exclusivas":"Comparte tu historia con el mundo"})]}),a.jsx("button",{onClick:Se,className:"text-gray-500 hover:text-white hover:bg-white/10 transition-all p-2 rounded-lg",children:a.jsx(gt,{className:"w-6 h-6"})})]}),a.jsxs("div",{className:"p-8 space-y-5",children:[a.jsxs("div",{className:"bg-gradient-to-br from-[#242424] to-[#1a1a1a] rounded-xl p-6 border border-gray-700/40 shadow-lg hover:border-gray-700/60 transition-all",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-5",children:[a.jsx("div",{className:"w-1 h-5 bg-gradient-to-b from-[#bb86fc] to-[#7744cc] rounded-full"}),a.jsx("h3",{className:"text-sm font-semibold text-white tracking-wide uppercase",children:"Información Principal"})]}),a.jsxs("div",{className:"space-y-3.5",children:[a.jsxs("div",{children:[a.jsxs("label",{className:"block text-xs font-semibold text-gray-200 mb-2",children:[yt?"Nombre de la Carpeta":t==="patreon"||t==="onlyfans"?"Título de la Galería":"Título del Manga"," ",a.jsx("span",{className:"text-red-400 font-bold",children:"*"})]}),a.jsx("input",{type:"text",name:"title",placeholder:t==="patreon"||t==="onlyfans"?"Nombre de la sesión o imágenes":"El nombre de tu obra maestra",value:o.title,onChange:_n,onKeyPress:H=>H.key==="Enter"&&st&&!C&&ie(),className:"w-full bg-[#1a1a1a] border border-gray-600/50 rounded-lg px-4 py-3 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-[#bb86fc] focus:ring-2 focus:ring-[#bb86fc]/30 transition-all shadow-md hover:border-gray-600/70"})]}),!yt&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{children:[a.jsxs("label",{className:"block text-xs font-semibold text-gray-200 mb-2",children:["Autor ",a.jsx("span",{className:"text-gray-500 font-normal",children:"(opcional)"})]}),a.jsx("input",{type:"text",name:"name",placeholder:"Tu nombre o seudónimo",value:o.name,onChange:_n,onKeyPress:H=>H.key==="Enter"&&st&&!C&&ie(),className:"w-full bg-[#1a1a1a] border border-gray-600/50 rounded-lg px-4 py-3 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-[#bb86fc] focus:ring-2 focus:ring-[#bb86fc]/30 transition-all shadow-md hover:border-gray-600/70"})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-xs font-semibold text-gray-200 mb-2",children:["Sinopsis ",a.jsx("span",{className:"text-gray-500 font-normal",children:"(opcional)"})]}),a.jsx("textarea",{name:"description",placeholder:t==="patreon"||t==="onlyfans"?"Cuéntanos detalles de estas imágenes...":"Cuéntanos de qué trata tu manga, qué lo hace especial...",value:o.description,onChange:_n,onKeyDown:H=>H.key==="Enter"&&H.ctrlKey&&st&&!C&&ie(),rows:3,className:"w-full bg-[#1a1a1a] border border-gray-600/50 rounded-lg px-4 py-3 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-[#bb86fc] focus:ring-2 focus:ring-[#bb86fc]/30 transition-all shadow-md hover:border-gray-600/70 resize-none"})]})]})]})]}),!yt&&a.jsxs("div",{className:"bg-gradient-to-br from-[#242424] to-[#1a1a1a] rounded-xl p-6 border border-gray-700/40 shadow-lg hover:border-gray-700/60 transition-all",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-5",children:[a.jsx("div",{className:"w-1 h-5 bg-gradient-to-b from-[#bb86fc] to-[#7744cc] rounded-full"}),a.jsx("h3",{className:"text-sm font-semibold text-white tracking-wide uppercase",children:"Clasificación"})]}),a.jsx(ri,{label:"Personajes",type:"character",categories:x,selectedIds:o.selectedCategories,onSelect:H=>{o.selectedCategories.includes(H)||l(X=>({...X,selectedCategories:[...X.selectedCategories,H]}))},onRemove:xt,onCreate:H=>tt(H,"character"),onDeleteCategory:Ue,colorClass:"text-blue-400",placeholder:"Añadir personaje..."}),a.jsx(ri,{label:"Series",type:"series",categories:x,selectedIds:o.selectedCategories,onSelect:H=>{o.selectedCategories.includes(H)||l(X=>({...X,selectedCategories:[...X.selectedCategories,H]}))},onRemove:xt,onCreate:H=>tt(H,"series"),onDeleteCategory:Ue,colorClass:"text-green-400",placeholder:"Añadir serie..."}),a.jsx(ri,{label:"Géneros",type:"genre",categories:x,selectedIds:o.selectedCategories,onSelect:H=>{o.selectedCategories.includes(H)||l(X=>({...X,selectedCategories:[...X.selectedCategories,H]}))},onRemove:xt,onCreate:H=>tt(H,"genre"),onDeleteCategory:Ue,colorClass:"text-purple-400",placeholder:"Añadir género..."}),a.jsx(ri,{label:"Etiquetas",type:"tag",categories:x,selectedIds:o.selectedCategories,onSelect:H=>{o.selectedCategories.includes(H)||l(X=>({...X,selectedCategories:[...X.selectedCategories,H]}))},onRemove:xt,onCreate:H=>tt(H,"tag"),onDeleteCategory:Ue,colorClass:"text-pink-400",placeholder:"Añadir etiqueta..."}),a.jsxs("div",{className:"mt-6 pt-5 border-t border-gray-700/50 space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-semibold text-white",children:"Sin censura"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Marcar como contenido sin censura"})]}),a.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[a.jsx("input",{type:"checkbox",className:"sr-only peer",checked:!!o.is_decensored,onChange:H=>l(X=>({...X,is_decensored:H.target.checked}))}),a.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-[#bb86fc]"})]})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-semibold text-white",children:"B/N"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Marcar como contenido Blanco y Negro"})]}),a.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[a.jsx("input",{type:"checkbox",className:"sr-only peer",checked:!!o.is_bn,onChange:H=>{const X=H.target.checked;l(se=>({...se,is_bn:X,...X?{is_color:!1}:{}}))}}),a.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-[#bb86fc]"})]})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-semibold text-white",children:"a color"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Marcar como contenido a color"})]}),a.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[a.jsx("input",{type:"checkbox",className:"sr-only peer",checked:!!o.is_color,onChange:H=>{const X=H.target.checked;l(se=>({...se,is_color:X,...X?{is_bn:!1}:{}}))}}),a.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-[#bb86fc]"})]})]})]})]}),!yt&&a.jsxs("div",{className:"bg-gradient-to-br from-[#242424] to-[#1a1a1a] rounded-xl p-6 border border-gray-700/40 shadow-lg hover:border-gray-700/60 transition-all",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-5",children:[a.jsx("div",{className:"w-1 h-5 bg-gradient-to-b from-[#bb86fc] to-[#7744cc] rounded-full"}),a.jsx("h3",{className:"text-sm font-semibold text-white tracking-wide uppercase",children:"Portada"}),a.jsx("span",{className:"text-xs text-gray-500 ml-auto",children:"Opcional"})]}),f&&a.jsxs("div",{className:"mb-4",children:[a.jsx("div",{className:"flex items-center justify-between mb-2",children:a.jsx("span",{className:"text-xs font-semibold text-[#bb86fc]",children:"Procesando portada..."})}),a.jsx("div",{className:"w-full bg-gray-700/40 rounded-full h-2 overflow-hidden border border-[#bb86fc]/30",children:a.jsx("div",{className:"bg-gradient-to-r from-[#bb86fc] to-[#9966dd] h-full transition-all duration-300 ease-out animate-pulse",style:{width:"100%"}})})]}),m&&!f&&a.jsxs("div",{className:"mb-4 relative group max-w-xs mx-auto",children:[a.jsx(un,{src:m,alt:"Preview",aspectRatio:"3/4",objectFit:"cover",loading:"eager",className:"rounded-xl border border-gray-600 shadow-2xl shadow-[#bb86fc]/20"}),a.jsx("div",{className:"absolute inset-0 rounded-xl bg-black/40 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center gap-2",children:a.jsx("button",{onClick:()=>{u(null),p(null),ne(null)},className:"bg-red-600/80 hover:bg-red-600 text-white p-2 rounded-lg transition-all shadow-lg",children:a.jsx(tn,{className:"w-4 h-4"})})}),R!==null&&a.jsxs("div",{className:"absolute bottom-2 left-2 bg-green-600/90 text-white text-xs px-2.5 py-1 rounded-lg font-semibold",children:["Página ",R+1]})]}),a.jsxs("div",{className:"flex gap-3 mb-4",children:[a.jsxs("label",{className:"flex-1 border-2 border-dashed border-gray-600/50 rounded-xl p-6 cursor-pointer hover:border-[#bb86fc]/50 hover:bg-[#bb86fc]/5 transition-all block group",children:[a.jsxs("div",{className:"flex flex-col items-center gap-2",children:[a.jsx("div",{className:"w-12 h-12 bg-gradient-to-br from-[#bb86fc] to-[#9966dd] rounded-xl flex items-center justify-center shadow-lg shadow-[#bb86fc]/40 group-hover:scale-110 group-hover:shadow-[#bb86fc]/60 transition-all",children:f?a.jsx(Sr,{size:24,borderWidth:2}):a.jsx(Kr,{className:"w-6 h-6 text-white"})}),a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"text-xs font-semibold text-white mb-0.5",children:f?"Procesando...":"Subir portada"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Archivo"})]})]}),a.jsx("input",{type:"file",accept:"image/*",onChange:vt,disabled:f,className:"hidden"})]}),v.length>0&&a.jsxs("button",{onClick:()=>K(!F),className:"flex-1 border-2 border-dashed border-gray-600/50 rounded-xl p-6 hover:border-[#bb86fc]/50 hover:bg-[#bb86fc]/5 transition-all group flex flex-col items-center justify-center gap-2 bg-gradient-to-br from-[#1a1a1a] to-[#0f0f0f]",children:[a.jsx("div",{className:"w-12 h-12 bg-gradient-to-br from-[#9966dd] to-[#bb86fc] rounded-xl flex items-center justify-center shadow-lg shadow-[#bb86fc]/40 group-hover:scale-110 group-hover:shadow-[#bb86fc]/60 transition-all",children:a.jsx(Yp,{className:"w-6 h-6 text-white"})}),a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"text-xs font-semibold text-white mb-0.5",children:"Elegir página"}),a.jsxs("p",{className:"text-xs text-gray-400",children:[v.length," disponibles"]})]})]})]})]}),!yt&&a.jsxs("div",{className:"bg-gradient-to-br from-[#242424] to-[#1a1a1a] rounded-xl p-6 border border-gray-700/40 shadow-lg hover:border-gray-700/60 transition-all",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-5",children:[a.jsx("div",{className:"w-1 h-5 bg-gradient-to-b from-[#bb86fc] to-[#7744cc] rounded-full"}),a.jsx("h3",{className:"text-sm font-semibold text-white tracking-wide uppercase",children:"Páginas del Capítulo"}),a.jsx("span",{className:"text-xs text-gray-500 ml-auto",children:"Opcional"}),a.jsxs("button",{onClick:()=>oe(!0),className:"bg-[#1a1a1a] hover:bg-[#242424] border border-gray-600/50 hover:border-[#bb86fc]/50 text-gray-300 hover:text-[#bb86fc] p-2 rounded-lg transition-all flex items-center gap-1.5 text-xs font-medium",title:"Configurar tamaño de lote de subida",children:[a.jsx($x,{className:"w-3.5 h-3.5"}),a.jsxs("span",{className:"hidden sm:inline",children:["Subida: ",le===0?"Sin límite":`${le} por lote`]})]})]}),D&&a.jsxs("div",{className:"mb-5",children:[a.jsx("div",{className:"flex items-center justify-between mb-2",children:a.jsx("span",{className:"text-xs font-semibold text-[#bb86fc]",children:"Procesando enlaces..."})}),a.jsx("div",{className:"w-full bg-gray-700/40 rounded-full h-2 overflow-hidden border border-[#bb86fc]/30",children:a.jsx("div",{className:"bg-gradient-to-r from-[#bb86fc] to-[#9966dd] h-full transition-all duration-300 ease-out animate-pulse",style:{width:"100%"}})})]}),v.length>0&&!D&&a.jsxs("div",{className:"mb-5",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[a.jsx(Ux,{className:"w-3.5 h-3.5 text-gray-500"}),a.jsxs("p",{className:"text-xs text-gray-400",children:[v.length," página",v.length!==1?"s":""," • Arrastra para reordenar"]})]}),a.jsx("div",{className:"grid grid-cols-4 gap-2",children:v.map((H,X)=>a.jsxs("div",{draggable:!0,onDragStart:()=>fn(X),onDragOver:se=>wt(se,X),onDragEnd:G,style:{animationDelay:`${X*40}ms`},className:`relative group cursor-move opacity-0 animate-[fadeIn_0.7s_ease-out_forwards] ${T===X?"opacity-50 scale-95":"hover:scale-105"} transition-all duration-200`,children:[a.jsxs("div",{className:"relative overflow-hidden w-full aspect-[3/4] rounded-lg border border-gray-600/50 shadow-md bg-black",children:[a.jsx("div",{className:"absolute inset-0 flex items-center justify-center z-10 transition-opacity duration-300",children:a.jsx("div",{className:"rounded-full animate-spin",style:{width:"24px",height:"24px",borderWidth:"2px",borderStyle:"solid",borderColor:"rgba(187, 134, 252, 0.2)",borderTopColor:"#bb86fc",animation:"spin 0.6s linear infinite"}})}),a.jsx("img",{src:H.thumbnail,alt:`Página ${X+1}`,className:"w-full h-full object-cover transition-all duration-700 ease-out transform-gpu group-hover:scale-[1.08] group-hover:shadow-[#bb86fc]/30 opacity-0 scale-95",onLoad:se=>{var Le;se.currentTarget.classList.remove("opacity-0","scale-95"),se.currentTarget.classList.add("opacity-100","scale-100");const de=(Le=se.currentTarget.parentElement)==null?void 0:Le.querySelector("div:nth-child(1)");de&&de.classList.add("opacity-0","pointer-events-none")}})]}),a.jsxs("div",{className:"absolute inset-0 bg-black/60 opacity-0 group-hover:opacity-100 transition-opacity rounded-lg flex items-center justify-center gap-2",children:[a.jsx(Ux,{className:"w-4 h-4 text-white/70"}),a.jsx("button",{onClick:()=>on(X),className:"bg-red-600/80 hover:bg-red-600 text-white p-1.5 rounded-lg transition-all shadow-lg",children:a.jsx(tn,{className:"w-3.5 h-3.5"})})]}),a.jsx("div",{className:"absolute top-1.5 left-1.5 bg-black/80 text-white text-xs px-2 py-0.5 rounded-md font-semibold",children:X+1})]},X))})]}),v.length===0&&a.jsxs("label",{className:"border-2 border-dashed border-gray-600/50 rounded-xl p-8 text-center hover:border-[#bb86fc]/50 hover:bg-[#bb86fc]/5 transition-all block group",children:[a.jsx("div",{className:"w-14 h-14 bg-gradient-to-br from-[#bb86fc] to-[#9966dd] rounded-xl flex items-center justify-center mx-auto mb-4 shadow-lg shadow-[#bb86fc]/40 group-hover:scale-110 group-hover:shadow-[#bb86fc]/60 transition-all",children:D?a.jsx(Sr,{size:24,borderWidth:2}):a.jsx(Yp,{className:"w-7 h-7 text-white"})}),a.jsx("p",{className:"text-sm font-semibold text-white mb-2",children:D?"Procesando...":"Sube tu archivo TXT"}),a.jsx("div",{className:"flex flex-col gap-4 max-w-lg mx-auto mt-4",children:a.jsxs("div",{className:"relative",children:[a.jsx("span",{className:"bg-[#1a1a1a] hover:bg-[#242424] border border-gray-600/50 text-white px-4 py-2 rounded-lg text-sm font-medium transition-all block w-max mx-auto cursor-pointer relative z-10",children:"Seleccionar Archivo .txt"}),a.jsx("input",{type:"file",accept:".txt",multiple:!0,onChange:Pn,disabled:D||((W==null?void 0:W.uploading)??!1),className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer z-20"})]})})]})]}),(W==null?void 0:W.uploading)&&a.jsxs("div",{className:"mb-6 bg-gradient-to-br from-[#242424] to-[#1a1a1a] rounded-xl p-5 border border-[#bb86fc]/30 shadow-xl",children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Sr,{size:16,borderWidth:2}),a.jsxs("span",{className:"text-sm font-semibold text-white",children:["Subida Masiva: ",W.current," de ",W.total]})]}),a.jsxs("span",{className:"text-sm font-bold text-[#bb86fc]",children:[Math.round(W.current/W.total*100),"%"]})]}),a.jsx("div",{className:"w-full bg-gray-700/40 rounded-full h-3 overflow-hidden border border-[#bb86fc]/40 shadow-inner",children:a.jsx("div",{className:"bg-gradient-to-r from-[#bb86fc] via-[#9966dd] to-[#bb86fc] h-full transition-all duration-500 ease-out relative overflow-hidden",style:{width:`${W.current/W.total*100}%`},children:a.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent animate-pulse"})})}),a.jsx("p",{className:"text-xs text-[#bb86fc] mt-2 font-medium",children:W.currentName}),W.errors.length>0&&a.jsxs("div",{className:"mt-3 text-[10px] text-red-400 max-h-20 overflow-y-auto bg-black/20 p-2 rounded border border-red-500/20",children:[a.jsxs("p",{className:"font-bold mb-1",children:["Errores (",W.errors.length,"):"]}),W.errors.map((H,X)=>a.jsxs("div",{children:["• ",H]},X))]}),a.jsx("p",{className:"text-xs text-gray-400 mt-2 text-center",children:"Procesando archivos... Por favor espera."})]}),A&&a.jsxs("div",{className:"mb-6 bg-gradient-to-br from-[#242424] to-[#1a1a1a] rounded-xl p-5 border border-[#bb86fc]/30 shadow-xl",children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Sr,{size:16,borderWidth:2}),a.jsxs("span",{className:"text-sm font-semibold text-white",children:["Subiendo imagen ",P," de ",B]})]}),a.jsxs("span",{className:"text-sm font-bold text-[#bb86fc]",children:[w,"%"]})]}),a.jsx("div",{className:"w-full bg-gray-700/40 rounded-full h-3 overflow-hidden border border-[#bb86fc]/40 shadow-inner",children:a.jsx("div",{className:"bg-gradient-to-r from-[#bb86fc] via-[#9966dd] to-[#bb86fc] h-full transition-all duration-500 ease-out relative overflow-hidden",style:{width:`${w}%`},children:a.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent animate-pulse"})})}),a.jsx("p",{className:"text-xs text-gray-400 mt-2 text-center",children:"Por favor no cierres esta ventana..."})]}),a.jsxs("div",{className:"flex gap-3 pt-6 border-t border-gray-700/50",children:[st&&i&&a.jsxs("button",{onClick:()=>Ot(!0),className:"bg-red-500/10 border border-red-500/30 hover:bg-red-500/20 text-red-500 px-4 py-3 rounded-lg font-semibold text-sm transition-all flex items-center gap-2 mr-auto",children:[a.jsx(tn,{className:"w-4 h-4"}),"Eliminar"]}),a.jsx("button",{onClick:Se,disabled:C||A,className:"flex-1 bg-[#1a1a1a] border border-gray-600/50 hover:border-gray-500 hover:bg-[#242424] text-white px-5 py-3 rounded-lg font-semibold text-sm transition-all shadow-md disabled:opacity-50 disabled:cursor-not-allowed",children:"Cancelar"}),a.jsx("button",{onClick:ie,disabled:C||A||!o.title.trim(),children:A?"Subiendo imágenes...":C?st?"Actualizando...":"Creando...":st?"Guardar Cambios":"Crear Manga"})]})]})]}),F&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:a.jsxs("div",{className:"bg-gradient-to-b from-[#1f1f1f] to-[#121212] rounded-2xl border border-gray-700/40 w-full max-w-2xl max-h-[80vh] shadow-2xl overflow-hidden flex flex-col",children:[a.jsxs("div",{className:"bg-gradient-to-b from-[#2a2a2a]/80 to-[#1f1f1f]/80 border-b border-gray-700/30 px-6 py-4 flex items-center justify-between flex-shrink-0",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-xl font-bold text-white",children:"Selecciona portada"}),a.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Elige una página para usar como portada del manga"})]}),a.jsx("button",{onClick:()=>K(!1),className:"text-gray-500 hover:text-white transition-colors p-1.5 rounded-lg hover:bg-white/10 flex-shrink-0",children:a.jsx(gt,{className:"w-5 h-5"})})]}),a.jsx("div",{className:"overflow-y-auto flex-1 p-6",children:a.jsx("div",{className:"grid grid-cols-3 md:grid-cols-4 gap-3",children:v.map((H,X)=>a.jsxs("button",{onClick:()=>_e(X),className:`group relative aspect-[3/4] rounded-lg overflow-hidden transition-all duration-300 hover:scale-105 border-2 ${R===X?"border-green-500 shadow-lg shadow-green-500/40":"border-gray-600/50 hover:border-[#bb86fc]/50"}`,children:[a.jsxs("div",{className:"absolute inset-0 overflow-hidden bg-black flex items-center justify-center",children:[a.jsx("div",{className:"absolute inset-0 flex items-center justify-center z-10 transition-opacity duration-300",children:a.jsx("div",{className:"rounded-full animate-spin",style:{width:"20px",height:"20px",borderWidth:"2px",borderStyle:"solid",borderColor:"rgba(187, 134, 252, 0.2)",borderTopColor:"#bb86fc",animation:"spin 0.6s linear infinite"}})}),a.jsx("img",{src:H.thumbnail,alt:`Página ${X+1}`,className:"w-full h-full object-cover transition-all duration-700 ease-out transform-gpu group-hover:scale-[1.10] opacity-0 scale-95",onLoad:se=>{var Le;se.currentTarget.classList.remove("opacity-0","scale-95"),se.currentTarget.classList.add("opacity-100","scale-100");const de=(Le=se.currentTarget.parentElement)==null?void 0:Le.querySelector("div:nth-child(1)");de&&de.classList.add("opacity-0","pointer-events-none")}})]}),a.jsx("div",{className:"absolute inset-0 bg-black/40 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center",children:a.jsx("div",{className:"bg-[#bb86fc]/90 text-white px-3 py-1.5 rounded-lg font-semibold text-sm",children:"Seleccionar"})}),a.jsx("div",{className:"absolute bottom-2 left-2 bg-black/80 text-white text-xs px-2 py-1 rounded-md font-semibold",children:X+1}),R===X&&a.jsxs("div",{className:"absolute top-2 right-2 bg-green-600/90 text-white px-2.5 py-1.5 rounded-lg flex items-center gap-1.5 font-semibold text-xs",children:[a.jsx("div",{className:"w-2 h-2 bg-white rounded-full"}),"Seleccionado"]})]},X))})}),a.jsxs("div",{className:"bg-gradient-to-b from-[#1f1f1f]/80 to-[#1a1a1a]/80 border-t border-gray-700/30 px-6 py-4 flex items-center justify-end gap-3 flex-shrink-0",children:[a.jsx("button",{onClick:()=>K(!1),className:"bg-[#1a1a1a] border border-gray-600/50 hover:border-gray-500 hover:bg-[#242424] text-white px-4 py-2 rounded-lg font-semibold text-sm transition-all",children:"Cancelar"}),a.jsx("button",{onClick:()=>K(!1),className:"bg-gradient-to-r from-[#bb86fc] to-[#9966dd] hover:from-[#9966dd] hover:to-[#7744cc] text-white px-4 py-2 rounded-lg font-semibold text-sm transition-all shadow-lg shadow-[#bb86fc]/40 hover:shadow-[#bb86fc]/60",children:"Confirmar"})]})]})}),Q&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:a.jsxs("div",{className:"bg-gradient-to-b from-[#1f1f1f] to-[#121212] rounded-2xl border border-gray-700/40 w-full max-w-md shadow-2xl",children:[a.jsxs("div",{className:"bg-gradient-to-b from-[#2a2a2a]/80 to-[#1f1f1f]/80 border-b border-gray-700/30 px-6 py-4 flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-gradient-to-br from-[#bb86fc] to-[#9966dd] rounded-lg shadow-lg shadow-[#bb86fc]/30",children:a.jsx($x,{className:"w-5 h-5 text-white"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-xl font-bold text-white",children:"Configurar Subida"}),a.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:"Tamaño de lote de imágenes"})]})]}),a.jsx("button",{onClick:()=>oe(!1),className:"text-gray-500 hover:text-white transition-colors p-1.5 rounded-lg hover:bg-white/10",children:a.jsx(gt,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"p-6 space-y-4",children:[a.jsxs("div",{className:"bg-[#1a1a1a] border border-gray-700/40 rounded-lg p-4 mb-4",children:[a.jsx("h3",{className:"text-xs font-semibold text-gray-300 mb-2",children:"Opciones disponibles:"}),a.jsxs("ul",{className:"text-xs text-gray-400 space-y-1.5",children:[a.jsx("li",{children:"• 1 por lote: Más lento pero más estable"}),a.jsx("li",{children:"• 10 por lote: Balance entre velocidad y estabilidad (predeterminado)"}),a.jsx("li",{children:"• 50 por lote: Más rápido para muchas imágenes"}),a.jsx("li",{children:"• Sin límite: Sube todas las imágenes simultáneamente"})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsx("button",{onClick:()=>{Ie(1),lu(1)},className:`p-4 rounded-lg border-2 transition-all ${le===1?"border-[#bb86fc] bg-[#bb86fc]/10 shadow-lg shadow-[#bb86fc]/30":"border-gray-600/50 hover:border-gray-600 bg-[#1a1a1a]"}`,children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"text-2xl font-bold text-white mb-1",children:"1"}),a.jsx("div",{className:"text-xs text-gray-400",children:"Por lote"})]})}),a.jsx("button",{onClick:()=>{Ie(10),lu(10)},className:`p-4 rounded-lg border-2 transition-all ${le===10?"border-[#bb86fc] bg-[#bb86fc]/10 shadow-lg shadow-[#bb86fc]/30":"border-gray-600/50 hover:border-gray-600 bg-[#1a1a1a]"}`,children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"text-2xl font-bold text-white mb-1",children:"10"}),a.jsx("div",{className:"text-xs text-gray-400",children:"Por lote"})]})}),a.jsx("button",{onClick:()=>{Ie(50),lu(50)},className:`p-4 rounded-lg border-2 transition-all ${le===50?"border-[#bb86fc] bg-[#bb86fc]/10 shadow-lg shadow-[#bb86fc]/30":"border-gray-600/50 hover:border-gray-600 bg-[#1a1a1a]"}`,children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"text-2xl font-bold text-white mb-1",children:"50"}),a.jsx("div",{className:"text-xs text-gray-400",children:"Por lote"})]})}),a.jsx("button",{onClick:()=>{Ie(0),lu(999999)},className:`p-4 rounded-lg border-2 transition-all ${le===0||le>=999999?"border-[#bb86fc] bg-[#bb86fc]/10 shadow-lg shadow-[#bb86fc]/30":"border-gray-600/50 hover:border-gray-600 bg-[#1a1a1a]"}`,children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"text-2xl font-bold text-white mb-1",children:"∞"}),a.jsx("div",{className:"text-xs text-gray-400",children:"Sin límite"})]})})]}),a.jsx("div",{className:"bg-green-500/10 border border-green-500/30 rounded-lg p-3",children:a.jsxs("p",{className:"text-green-400 text-xs font-semibold",children:["Configuración guardada: ",le===0||le>=999999?"Sin límite":`${le} imagen${le!==1?"es":""} por lote`]})}),a.jsx("button",{onClick:()=>oe(!1),className:"w-full bg-gradient-to-r from-[#bb86fc] to-[#9966dd] hover:from-[#9966dd] hover:to-[#7744cc] text-white px-4 py-3 rounded-lg font-semibold text-sm transition-all shadow-lg shadow-[#bb86fc]/40 hover:shadow-[#bb86fc]/60",children:"Cerrar"})]})]})}),a.jsx(Nm,{isOpen:!!te,onClose:()=>it(null),onConfirm:()=>{te&&(jt(te),it(null))},title:"Subida Masiva",message:`Estás a punto de subir ${te==null?void 0:te.length} archivos TXT. Se creará un manga por cada archivo usando la información de Autor y Categorías actual.`,confirmText:"Empezar Subida"}),a.jsx(Nm,{isOpen:pt,onClose:()=>Ot(!1),onConfirm:()=>{s&&i&&(i(s.id),n())},title:"Eliminar Manga",message:"¿Estás seguro de que deseas eliminar este manga? Esta acción no se puede deshacer y se borrarán todos sus capítulos.",confirmText:"Eliminar permanentemente",variant:"danger"})]}):null}const L2="settings",O2="announcement";async function Cw(t,e){const n=Nt(Ae,L2,O2),r=new Date;let s=null;e&&(s=new Date(r.getTime()+e).toISOString());const i={text:t,updatedAt:r.toISOString(),expiresAt:s};await QS(n,i)}function dM(t){const e=Nt(Ae,L2,O2);return N0(e,n=>{n.exists()?t(n.data()):t(null)})}async function hM(t){let e=0,n=0;try{const r=Dt(Ae,"mangas"),i=(await hn(r)).docs;let o=0;for(const l of i){const c=l.data(),u=l.id;o++,t&&t(c.title||u,o,i.length);try{const f=Vn(Dt(Ae,"chapters"),mr("manga_id","==",u)),h=await hn(f);for(const m of h.docs){const p=m.data(),x=p.pages||[],E=p.original_pages||[],C=p.page_formats||[];if(x.length===0)continue;const y=[];for(let M=0;MM.pageNum-T.pageNum);const v=y.map(M=>M.url),_=y.map(M=>M.originalUrl),D=y.map(M=>M.format);await tr(Nt(Ae,"chapters",m.id),{pages:v,original_pages:_,page_formats:D})}e++}catch(f){console.error(`Error processing chapter for manga ${u}`,f),n++}}return{updated:e,errors:n}}catch(r){throw console.error("Error fetching mangas for reorder: ",r),r}}function fM({isOpen:t,onClose:e,isAdmin:n,onAdminChange:r,isCategoryPlusEnabled:s,onCategoryPlusChange:i,isCopyIdsEnabled:o,onCopyIdsChange:l,isDeletePlusEnabled:c,onDeletePlusChange:u,isCategoryMinusEnabled:f,onCategoryMinusChange:h,isEditTitlePlusEnabled:m,onEditTitlePlusChange:p,isEtiquetadoraEnabled:x,onEtiquetadoraChange:E,isFolderPlusEnabled:C,onFolderPlusChange:y,isPortalPlusEnabled:v,onPortalPlusChange:_,isFolderAnimationEnabled:D,onFolderAnimationChange:M,isMergePlusEnabled:T,onMergePlusChange:S,isTransferPlusEnabled:w,onTransferPlusChange:N,onOpenTitleManager:A,onOpenFolderMap:I,onCleanKemonoTitles:P}){const[k,B]=L.useState(""),[z,W]=L.useState(24),[ee,F]=L.useState("hours"),[K,R]=L.useState(!1),[ne,pe]=L.useState(!1),[O,Q]=L.useState({current:0,total:0,title:""});L.useEffect(()=>{},[t]);const oe=async()=>{if(!k.trim()){be.error("El texto del anuncio no puede estar vacío");return}let te=0;ee==="seconds"&&(te=z*1e3),ee==="minutes"&&(te=z*60*1e3),ee==="hours"&&(te=z*60*60*1e3),ee==="days"&&(te=z*24*60*60*1e3);try{await Cw(k,te),be.success("Anuncio publicado exitosamente"),B(""),e()}catch(it){console.error(it),be.error("Error al publicar el anuncio")}},le=async()=>{try{await Cw("",null),B(""),R(!1),be.success("Anuncio eliminado.")}catch(te){console.error(te),be.error("Error al eliminar")}},Ie=async()=>{if(window.confirm("¿Seguro que quieres reordenar automáticamente TODAS las páginas de todos los mangas? Este proceso puede tardar un par de minutos.")){pe(!0),Q({current:0,total:0,title:"Iniciando..."});try{const te=await hM((it,pt,Ot)=>{Q({current:pt,total:Ot,title:it})});be.success(`Se reordenaron las páginas correctamente en ${te.updated} mangas (Errores: ${te.errors}).`)}catch(te){console.error(te),be.error("Ocurrió un error al reordenar las páginas.")}finally{pe(!1)}}};return t?a.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50 p-4 animate-in fade-in duration-200",children:a.jsxs("div",{className:"bg-[#121212] rounded-2xl border border-gray-800 w-full max-w-lg shadow-2xl overflow-hidden flex flex-col max-h-[90vh]",children:[a.jsxs("div",{className:"bg-[#1a1a1a] border-b border-gray-800 px-6 py-4 flex items-center justify-between sticky top-0 z-10",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-[#bb86fc]/10 rounded-lg text-[#bb86fc]",children:a.jsx(Z_,{className:"w-5 h-5"})}),a.jsx("h2",{className:"text-xl font-bold text-white",children:"Ajustes de Administrador"})]}),a.jsx("button",{onClick:e,className:"text-gray-400 hover:text-white transition-colors p-2 hover:bg-white/5 rounded-lg",children:a.jsx(gt,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"p-6 space-y-8 overflow-y-auto custom-scrollbar",children:[a.jsx("section",{className:"space-y-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`p-2 rounded-lg ${s?"bg-purple-500/10 text-purple-400":"bg-gray-800 text-gray-400"}`,children:a.jsx(Wr,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold text-white",children:"Categorías Plus"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Habilitar selección múltiple y edición masiva"})]})]}),a.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[a.jsx("input",{type:"checkbox",className:"sr-only peer",checked:s,onChange:te=>i(te.target.checked)}),a.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-purple-300 dark:peer-focus:ring-purple-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-[#bb86fc]"})]})]})}),a.jsx("section",{className:"space-y-4 pt-4 border-t border-gray-800",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`p-2 rounded-lg ${C?"bg-indigo-500/10 text-indigo-400":"bg-gray-800 text-gray-400"}`,children:a.jsx(Q_,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold text-white",children:"Carpetas Plus"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Habilitar selección para crear carpetas y agrupar mangas"})]})]}),a.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[a.jsx("input",{type:"checkbox",className:"sr-only peer",checked:C,onChange:te=>y(te.target.checked)}),a.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-indigo-300 dark:peer-focus:ring-indigo-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-indigo-500"})]})]})}),a.jsx("section",{className:"space-y-4 pt-4 border-t border-gray-800",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`p-2 rounded-lg ${v?"bg-cyan-500/10 text-cyan-400":"bg-gray-800 text-gray-400"}`,children:a.jsx(Dg,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold text-white",children:"Portal Plus"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Habilitar selección masiva para cambiar de sección (Patreon, OnlyFans, Flow)"})]})]}),a.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[a.jsx("input",{type:"checkbox",className:"sr-only peer",checked:v,onChange:te=>_(te.target.checked)}),a.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-cyan-300 dark:peer-focus:ring-cyan-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-cyan-500"})]})]})}),a.jsx("section",{className:"space-y-4 pt-4 border-t border-gray-800",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`p-2 rounded-lg ${T?"bg-emerald-500/10 text-emerald-400":"bg-gray-800 text-gray-400"}`,children:a.jsx(xd,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold text-white",children:"Unir Plus"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Habilitar selección de múltiples mangas para unirlos en uno"})]})]}),a.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[a.jsx("input",{type:"checkbox",className:"sr-only peer",checked:T,onChange:te=>S(te.target.checked)}),a.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-emerald-300 dark:peer-focus:ring-emerald-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-emerald-500"})]})]})}),a.jsx("section",{className:"space-y-4 pt-4 border-t border-gray-800",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`p-2 rounded-lg ${w?"bg-amber-500/10 text-amber-400":"bg-gray-800 text-gray-400"}`,children:a.jsx(Wr,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold text-white",children:"Transferencia Plus"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Habilitar selección de dos mangas para transferir páginas entre ellos"})]})]}),a.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[a.jsx("input",{type:"checkbox",className:"sr-only peer",checked:w,onChange:te=>N(te.target.checked)}),a.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-amber-300 dark:peer-focus:ring-amber-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-amber-500"})]})]})}),a.jsx("section",{className:"space-y-4 pt-4 border-t border-gray-800",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`p-2 rounded-lg ${f?"bg-orange-500/10 text-orange-400":"bg-gray-800 text-gray-400"}`,children:a.jsx(Wr,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold text-white",children:"Categorías Minus"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Habilitar eliminación masiva de categorías en mangas seleccionados"})]})]}),a.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[a.jsx("input",{type:"checkbox",className:"sr-only peer",checked:f,onChange:te=>h(te.target.checked)}),a.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-orange-300 dark:peer-focus:ring-orange-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-orange-500"})]})]})}),a.jsx("section",{className:"space-y-4 pt-4 border-t border-gray-800",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`p-2 rounded-lg ${m?"bg-pink-500/10 text-pink-400":"bg-gray-800 text-gray-400"}`,children:a.jsx(Yo,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold text-white",children:"Nombres Plus"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Habilitar selección masiva para editar títulos"})]})]}),a.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[a.jsx("input",{type:"checkbox",className:"sr-only peer",checked:m,onChange:te=>p(te.target.checked)}),a.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-pink-300 dark:peer-focus:ring-pink-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-pink-500"})]})]})}),a.jsx("section",{className:"space-y-4 pt-4 border-t border-gray-800",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`p-2 rounded-lg ${x?"bg-[#bb86fc]/10 text-[#bb86fc]":"bg-gray-800 text-gray-400"}`,children:a.jsx(vd,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold text-white",children:"Etiquetadora Plus"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Habilitar selección masiva para etiquetar clasificaciones (Sin censura, B/N, a color)"})]})]}),a.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[a.jsx("input",{type:"checkbox",className:"sr-only peer",checked:x,onChange:te=>E(te.target.checked)}),a.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-[#bb86fc]/30 dark:peer-focus:ring-[#bb86fc]/80 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-[#bb86fc]"})]})]})}),a.jsx("section",{className:"space-y-4 pt-4 border-t border-gray-800",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`p-2 rounded-lg ${o?"bg-blue-500/10 text-blue-400":"bg-gray-800 text-gray-400"}`,children:a.jsx(W_,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold text-white",children:"Copiar IDs Plus"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Habilitar selección masiva para copiar IDs"})]})]}),a.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[a.jsx("input",{type:"checkbox",className:"sr-only peer",checked:o,onChange:te=>l(te.target.checked)}),a.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-blue-300 dark:peer-focus:ring-blue-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-blue-500"})]})]})}),a.jsx("section",{className:"space-y-4 pt-4 border-t border-gray-800",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`p-2 rounded-lg ${c?"bg-red-500/10 text-red-500":"bg-gray-800 text-gray-400"}`,children:a.jsx(tn,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold text-white",children:"Eliminar Plus"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Habilitar selección masiva para eliminar mangas"})]})]}),a.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[a.jsx("input",{type:"checkbox",className:"sr-only peer",checked:c,onChange:te=>u(te.target.checked)}),a.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-red-300 dark:peer-focus:ring-red-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-red-500"})]})]})}),a.jsxs("section",{className:"space-y-4 pt-4 border-t border-gray-800",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[a.jsx("div",{className:"p-2 bg-red-500/10 rounded-lg text-red-500",children:a.jsx(Wp,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"tex-sm font-semibold text-white",children:"Gestión de Vistas"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Restablecer contadores de visualización"})]})]}),a.jsx("button",{onClick:async()=>{if(window.confirm("¿Seguro que quieres reiniciar las vistas de TODOS los mangas a 0? Esta acción no se puede deshacer."))try{await TD(),be.success("Vistas reiniciadas correctamente.")}catch(te){console.error(te),be.error("Error al reiniciar vistas.")}},className:"w-full bg-red-500/10 hover:bg-red-500/20 text-red-500 py-2.5 rounded-lg font-semibold text-sm transition-all border border-red-500/20 hover:border-red-500/40",children:"Reiniciar Vistas a 0"})]}),a.jsxs("section",{className:"space-y-4 pt-4 border-t border-gray-800",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[a.jsx("div",{className:"p-2 bg-blue-500/10 rounded-lg text-blue-400",children:a.jsx(Yo,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"tex-sm font-semibold text-white",children:"Gestor de Nombres"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Edición masiva rápida de títulos alfabéticamente"})]})]}),a.jsxs("button",{onClick:()=>{e(),A()},className:"w-full bg-blue-500/10 hover:bg-blue-500/20 text-blue-500 py-2.5 rounded-lg font-semibold text-sm transition-all border border-blue-500/20 hover:border-blue-500/40 flex items-center justify-center gap-2",children:[a.jsx(Yo,{className:"w-4 h-4"}),"Abrir Gestor de Nombres"]})]}),a.jsxs("section",{className:"space-y-4 pt-4 border-t border-gray-800",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[a.jsx("div",{className:"p-2 bg-indigo-500/10 rounded-lg text-indigo-400",children:a.jsx(Wr,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"tex-sm font-semibold text-white",children:"Mapa Mental de Carpetas"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Observa toda tu estructura de carpetas y cómics en un formato de mapa mental interconectado"})]})]}),a.jsxs("button",{onClick:()=>{e(),I()},className:"w-full bg-indigo-500/10 hover:bg-indigo-500/20 text-indigo-400 py-2.5 rounded-lg font-semibold text-sm transition-all border border-indigo-500/20 hover:border-indigo-500/40 flex items-center justify-center gap-2",children:[a.jsx(Wr,{className:"w-4 h-4"}),"Abrir Mapa Mental"]})]}),a.jsxs("section",{className:"space-y-4 pt-4 border-t border-gray-800",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[a.jsx("div",{className:"p-2 bg-yellow-500/10 rounded-lg text-yellow-500",children:a.jsx(Fx,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"tex-sm font-semibold text-white",children:"Limpiador Kemono"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Elimina el patrón [12345] del final de todos los nombres en la base de datos automáticamente"})]})]}),a.jsxs("button",{onClick:P,className:"w-full bg-yellow-500/10 hover:bg-yellow-500/20 text-yellow-500 py-2.5 rounded-lg font-semibold text-sm transition-all border border-yellow-500/20 hover:border-yellow-500/40 flex items-center justify-center gap-2",children:[a.jsx(Fx,{className:"w-4 h-4"}),"Limpiar IDs [Numeros]"]})]}),a.jsxs("section",{className:"space-y-4 pt-4 border-t border-gray-800",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[a.jsx("div",{className:"p-2 bg-emerald-500/10 rounded-lg text-emerald-500",children:a.jsx(Wr,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"tex-sm font-semibold text-white",children:"Ordenar Páginas Plus"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Reordena las páginas desordenadas analizando los archivos originales."})]})]}),a.jsx("button",{onClick:Ie,disabled:ne,className:`w-full py-2.5 rounded-lg font-semibold text-sm transition-all border flex items-center justify-center gap-2 ${ne?"bg-emerald-500/5 text-emerald-500/50 border-emerald-500/10 cursor-not-allowed":"bg-emerald-500/10 hover:bg-emerald-500/20 text-emerald-500 border-emerald-500/20 hover:border-emerald-500/40"}`,children:ne?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"w-4 h-4 border-2 border-emerald-500/30 border-t-emerald-500 rounded-full animate-spin"}),"Procesando ",O.current," / ",O.total," - ",O.title.substring(0,20),"..."]}):"Reordenar Todas Las Páginas Automáticamente"})]}),a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"h-px bg-gray-800"}),a.jsxs("section",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[a.jsx("div",{className:"p-2 bg-purple-500/10 rounded-lg text-purple-400",children:a.jsx(X_,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"tex-sm font-semibold text-white",children:"Publicar Anuncio"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Visible para todos los usuarios"})]})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("textarea",{value:k,onChange:te=>B(te.target.value),placeholder:"Escribe el mensaje del anuncio...",className:"w-full bg-[#1a1a1a] border border-gray-700 rounded-lg px-4 py-3 text-sm text-white placeholder-gray-600 focus:outline-none focus:border-[#bb86fc] min-h-[100px] resize-none"}),a.jsxs("div",{className:"flex gap-3",children:[a.jsxs("div",{className:"flex-1 bg-[#1a1a1a] border border-gray-700 rounded-lg px-3 py-2 flex items-center gap-2",children:[a.jsx(MI,{className:"w-4 h-4 text-gray-400"}),a.jsx("input",{type:"number",min:"1",value:z,onChange:te=>W(Number(te.target.value)),className:"bg-transparent text-white text-sm w-full focus:outline-none"})]}),a.jsxs("select",{value:ee,onChange:te=>F(te.target.value),className:"bg-[#1a1a1a] border border-gray-700 rounded-lg px-3 py-2 text-sm text-white focus:outline-none focus:border-[#bb86fc]",children:[a.jsx("option",{value:"seconds",children:"Segundos"}),a.jsx("option",{value:"minutes",children:"Minutos"}),a.jsx("option",{value:"hours",children:"Horas"}),a.jsx("option",{value:"days",children:"Días"})]})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:()=>R(!0),className:"px-4 py-2.5 rounded-lg font-semibold text-sm bg-red-500/10 text-red-500 border border-red-500/20 hover:bg-red-500/20 transition-colors",title:"Eliminar anuncio",children:a.jsx(tn,{className:"w-5 h-5"})}),a.jsx("button",{onClick:oe,className:"flex-1 bg-gradient-to-r from-[#bb86fc] to-[#9966dd] hover:from-[#9966dd] hover:to-[#7744cc] text-white py-2.5 rounded-lg font-semibold text-sm transition-all shadow-lg shadow-[#bb86fc]/20",children:"Publicar Anuncio"})]})]})]})]})]}),K&&a.jsx("div",{className:"absolute inset-0 bg-black/80 backdrop-blur-sm flex items-center justify-center z-50 p-6 animate-in fade-in duration-200",children:a.jsx("div",{className:"bg-[#1a1a1a] border border-gray-700 w-full max-w-sm rounded-xl shadow-2xl p-6 transform scale-100 animate-in zoom-in-95 duration-200",children:a.jsxs("div",{className:"flex flex-col items-center text-center gap-4",children:[a.jsx("div",{className:"p-3 bg-red-500/10 rounded-full text-red-500",children:a.jsx(tn,{className:"w-8 h-8"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-bold text-white mb-1",children:"¿Eliminar anuncio?"}),a.jsx("p",{className:"text-sm text-gray-400",children:"Esta acción eliminará el anuncio actual inmediatamente. No se puede deshacer."})]}),a.jsxs("div",{className:"flex gap-3 w-full mt-2",children:[a.jsx("button",{onClick:()=>R(!1),className:"flex-1 px-4 py-2 rounded-lg text-sm font-semibold text-gray-300 hover:bg-gray-800 transition-colors",children:"Cancelar"}),a.jsx("button",{onClick:le,className:"flex-1 px-4 py-2 rounded-lg text-sm font-semibold bg-red-500 hover:bg-red-600 text-white transition-colors shadow-lg shadow-red-500/20",children:"Eliminar"})]})]})})})]})}):null}function pM({isAdmin:t}){const[e,n]=L.useState(""),[r,s]=L.useState(null),[i,o]=L.useState(""),[l,c]=L.useState(!0);return L.useEffect(()=>{const u=dM(f=>{f?(n(f.text),s(f.expiresAt)):(n(""),s(null)),c(!1)});return()=>u()},[]),L.useEffect(()=>{if(!r){o("");return}const u=setInterval(()=>{const f=new Date().getTime(),m=new Date(r).getTime()-f;if(m<=0)n(""),s(null),clearInterval(u);else{const p=Math.floor(m/864e5),x=Math.floor(m%(1e3*60*60*24)/(1e3*60*60)),E=Math.floor(m%(1e3*60*60)/(1e3*60)),C=Math.floor(m%(1e3*60)/1e3);let y="";p>0&&(y+=`${p}d `),y+=`${x.toString().padStart(2,"0")}h ${E.toString().padStart(2,"0")}m ${C.toString().padStart(2,"0")}s`,o(y)}},1e3);return()=>clearInterval(u)},[r]),!e&&!l||!e?null:a.jsx("div",{className:"w-full max-w-[1800px] mx-auto px-4 sm:px-6 md:px-12 mt-6 mb-8 animate-in fade-in slide-in-from-top-4 duration-500 flex justify-center",children:a.jsxs("div",{className:"bg-gradient-to-r from-[#bb86fc]/20 to-[#121212] border border-[#bb86fc]/30 rounded-xl p-6 flex flex-col items-center gap-4 shadow-lg shadow-[#bb86fc]/10 relative group backdrop-blur-sm max-w-2xl w-full text-center",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2.5 bg-[#bb86fc]/20 rounded-lg animate-pulse",children:a.jsx(X_,{className:"w-6 h-6 text-[#bb86fc]"})}),a.jsxs("h3",{className:"text-sm font-bold text-[#bb86fc] uppercase tracking-wider flex items-center gap-2",children:["Información Importante",a.jsx("span",{className:"w-2 h-2 rounded-full bg-[#bb86fc] animate-ping"})]})]}),a.jsx("div",{className:"text-base text-gray-200 leading-relaxed whitespace-pre-wrap font-medium max-w-lg",children:e}),i&&a.jsxs("div",{className:"flex items-center gap-2 text-xs font-mono text-gray-400 bg-black/30 px-3 py-1.5 rounded-full border border-gray-800",children:[a.jsx(UI,{className:"w-3.5 h-3.5"}),a.jsxs("span",{children:["Expira en: ",i]})]})]})})}const V2=()=>"",Ks=t=>{if(!t)return;if(t.startsWith("blob:")||t.startsWith("data:"))return t;const e=V2(),n=new URLSearchParams({url:t,width:"600",quality:"85",format:"webp"});return`${e}/api/image-proxy?${n.toString()}`},mM=(t,e)=>{if(!t)return"";if(t.startsWith("blob:")||t.startsWith("data:"))return t;const n=V2(),r=new URLSearchParams({url:t});return`${n}/api/image-proxy?${r.toString()}`};function Aw(t){return t!==null&&typeof t=="object"&&"constructor"in t&&t.constructor===Object}function F0(t={},e={}){const n=["__proto__","constructor","prototype"];Object.keys(e).filter(r=>n.indexOf(r)<0).forEach(r=>{typeof t[r]>"u"?t[r]=e[r]:Aw(e[r])&&Aw(t[r])&&Object.keys(e[r]).length>0&&F0(t[r],e[r])})}const F2={body:{},addEventListener(){},removeEventListener(){},activeElement:{blur(){},nodeName:""},querySelector(){return null},querySelectorAll(){return[]},getElementById(){return null},createEvent(){return{initEvent(){}}},createElement(){return{children:[],childNodes:[],style:{},setAttribute(){},getElementsByTagName(){return[]}}},createElementNS(){return{}},importNode(){return null},location:{hash:"",host:"",hostname:"",href:"",origin:"",pathname:"",protocol:"",search:""}};function yo(){const t=typeof document<"u"?document:{};return F0(t,F2),t}const gM={document:F2,navigator:{userAgent:""},location:{hash:"",host:"",hostname:"",href:"",origin:"",pathname:"",protocol:"",search:""},history:{replaceState(){},pushState(){},go(){},back(){}},CustomEvent:function(){return this},addEventListener(){},removeEventListener(){},getComputedStyle(){return{getPropertyValue(){return""}}},Image(){},Date(){},screen:{},setTimeout(){},clearTimeout(){},matchMedia(){return{}},requestAnimationFrame(t){return typeof setTimeout>"u"?(t(),null):setTimeout(t,0)},cancelAnimationFrame(t){typeof setTimeout>"u"||clearTimeout(t)}};function Un(){const t=typeof window<"u"?window:{};return F0(t,gM),t}function yM(t=""){return t.trim().split(" ").filter(e=>!!e.trim())}function xM(t){const e=t;Object.keys(e).forEach(n=>{try{e[n]=null}catch{}try{delete e[n]}catch{}})}function z2(t,e=0){return setTimeout(t,e)}function Bd(){return Date.now()}function vM(t){const e=Un();let n;return e.getComputedStyle&&(n=e.getComputedStyle(t,null)),!n&&t.currentStyle&&(n=t.currentStyle),n||(n=t.style),n}function wM(t,e="x"){const n=Un();let r,s,i;const o=vM(t);return n.WebKitCSSMatrix?(s=o.transform||o.webkitTransform,s.split(",").length>6&&(s=s.split(", ").map(l=>l.replace(",",".")).join(", ")),i=new n.WebKitCSSMatrix(s==="none"?"":s)):(i=o.MozTransform||o.OTransform||o.MsTransform||o.msTransform||o.transform||o.getPropertyValue("transform").replace("translate(","matrix(1, 0, 0, 1,"),r=i.toString().split(",")),e==="x"&&(n.WebKitCSSMatrix?s=i.m41:r.length===16?s=parseFloat(r[12]):s=parseFloat(r[4])),e==="y"&&(n.WebKitCSSMatrix?s=i.m42:r.length===16?s=parseFloat(r[13]):s=parseFloat(r[5])),s||0}function xu(t){return typeof t=="object"&&t!==null&&t.constructor&&Object.prototype.toString.call(t).slice(8,-1)==="Object"}function bM(t){return typeof window<"u"&&typeof window.HTMLElement<"u"?t instanceof HTMLElement:t&&(t.nodeType===1||t.nodeType===11)}function lr(...t){const e=Object(t[0]);for(let n=1;ni!=="__proto__"&&i!=="constructor"&&i!=="prototype");for(let i=0,o=s.length;is?"next":"prev",u=(h,m)=>c==="next"&&h>=m||c==="prev"&&h<=m,f=()=>{o=new Date().getTime(),i===null&&(i=o);const h=Math.max(Math.min((o-i)/l,1),0),m=.5-Math.cos(h*Math.PI)/2;let p=s+m*(e-s);if(u(p,e)&&(p=e),t.wrapperEl.scrollTo({[n]:p}),u(p,e)){t.wrapperEl.style.overflow="hidden",t.wrapperEl.style.scrollSnapType="",setTimeout(()=>{t.wrapperEl.style.overflow="",t.wrapperEl.scrollTo({[n]:p})}),r.cancelAnimationFrame(t.cssModeFrameID);return}t.cssModeFrameID=r.requestAnimationFrame(f)};f()}function z0(t){return t.querySelector(".swiper-slide-transform")||t.shadowRoot&&t.shadowRoot.querySelector(".swiper-slide-transform")||t}function bs(t,e=""){const n=Un(),r=[...t.children];return n.HTMLSlotElement&&t instanceof HTMLSlotElement&&r.push(...t.assignedElements()),e?r.filter(s=>s.matches(e)):r}function _M(t,e){const n=[e];for(;n.length>0;){const r=n.shift();if(t===r)return!0;n.push(...r.children,...r.shadowRoot?r.shadowRoot.children:[],...r.assignedElements?r.assignedElements():[])}}function EM(t,e){const n=Un();let r=e.contains(t);return!r&&n.HTMLSlotElement&&e instanceof HTMLSlotElement&&(r=[...e.assignedElements()].includes(t),r||(r=_M(t,e))),r}function $d(t){try{console.warn(t);return}catch{}}function Hd(t,e=[]){const n=document.createElement(t);return n.classList.add(...Array.isArray(e)?e:yM(e)),n}function SM(t,e){const n=[];for(;t.previousElementSibling;){const r=t.previousElementSibling;e?r.matches(e)&&n.push(r):n.push(r),t=r}return n}function TM(t,e){const n=[];for(;t.nextElementSibling;){const r=t.nextElementSibling;e?r.matches(e)&&n.push(r):n.push(r),t=r}return n}function si(t,e){return Un().getComputedStyle(t,null).getPropertyValue(e)}function jw(t){let e=t,n;if(e){for(n=0;(e=e.previousSibling)!==null;)e.nodeType===1&&(n+=1);return n}}function NM(t,e){const n=[];let r=t.parentElement;for(;r;)n.push(r),r=r.parentElement;return n}function kM(t,e){function n(r){r.target===t&&(e.call(t,r),t.removeEventListener("transitionend",n))}e&&t.addEventListener("transitionend",n)}function Pw(t,e,n){const r=Un();return t[e==="width"?"offsetWidth":"offsetHeight"]+parseFloat(r.getComputedStyle(t,null).getPropertyValue(e==="width"?"margin-right":"margin-top"))+parseFloat(r.getComputedStyle(t,null).getPropertyValue(e==="width"?"margin-left":"margin-bottom"))}function IM(t){return e=>Math.abs(e)>0&&t.browser&&t.browser.need3dFix&&Math.abs(e)%90===0?e+.001:e}function Rw(t,e=""){typeof trustedTypes<"u"?t.innerHTML=trustedTypes.createPolicy("html",{createHTML:n=>n}).createHTML(e):t.innerHTML=e}let Mf;function CM(){const t=Un(),e=yo();return{smoothScroll:e.documentElement&&e.documentElement.style&&"scrollBehavior"in e.documentElement.style,touch:!!("ontouchstart"in t||t.DocumentTouch&&e instanceof t.DocumentTouch)}}function B2(){return Mf||(Mf=CM()),Mf}let Lf;function AM({userAgent:t}={}){const e=B2(),n=Un(),r=n.navigator.platform,s=t||n.navigator.userAgent,i={ios:!1,android:!1},o=n.screen.width,l=n.screen.height,c=s.match(/(Android);?[\s\/]+([\d.]+)?/);let u=s.match(/(iPad)(?!\1).*OS\s([\d_]+)/);const f=s.match(/(iPod)(.*OS\s([\d_]+))?/),h=!u&&s.match(/(iPhone\sOS|iOS)\s([\d_]+)/),m=r==="Win32";let p=r==="MacIntel";const x=["1024x1366","1366x1024","834x1194","1194x834","834x1112","1112x834","768x1024","1024x768","820x1180","1180x820","810x1080","1080x810"];return!u&&p&&e.touch&&x.indexOf(`${o}x${l}`)>=0&&(u=s.match(/(Version)\/([\d.]+)/),u||(u=[0,1,"13_0_0"]),p=!1),c&&!m&&(i.os="android",i.android=!0),(u||h||f)&&(i.os="ios",i.ios=!0),i}function $2(t={}){return Lf||(Lf=AM(t)),Lf}let Of;function jM(){const t=Un(),e=$2();let n=!1;function r(){const l=t.navigator.userAgent.toLowerCase();return l.indexOf("safari")>=0&&l.indexOf("chrome")<0&&l.indexOf("android")<0}if(r()){const l=String(t.navigator.userAgent);if(l.includes("Version/")){const[c,u]=l.split("Version/")[1].split(" ")[0].split(".").map(f=>Number(f));n=c<16||c===16&&u<2}}const s=/(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(t.navigator.userAgent),i=r(),o=i||s&&e.ios;return{isSafari:n||i,needPerspectiveFix:n,need3dFix:o,isWebView:s}}function H2(){return Of||(Of=jM()),Of}function PM({swiper:t,on:e,emit:n}){const r=Un();let s=null,i=null;const o=()=>{!t||t.destroyed||!t.initialized||(n("beforeResize"),n("resize"))},l=()=>{!t||t.destroyed||!t.initialized||(s=new ResizeObserver(f=>{i=r.requestAnimationFrame(()=>{const{width:h,height:m}=t;let p=h,x=m;f.forEach(({contentBoxSize:E,contentRect:C,target:y})=>{y&&y!==t.el||(p=C?C.width:(E[0]||E).inlineSize,x=C?C.height:(E[0]||E).blockSize)}),(p!==h||x!==m)&&o()})}),s.observe(t.el))},c=()=>{i&&r.cancelAnimationFrame(i),s&&s.unobserve&&t.el&&(s.unobserve(t.el),s=null)},u=()=>{!t||t.destroyed||!t.initialized||n("orientationchange")};e("init",()=>{if(t.params.resizeObserver&&typeof r.ResizeObserver<"u"){l();return}r.addEventListener("resize",o),r.addEventListener("orientationchange",u)}),e("destroy",()=>{c(),r.removeEventListener("resize",o),r.removeEventListener("orientationchange",u)})}function RM({swiper:t,extendParams:e,on:n,emit:r}){const s=[],i=Un(),o=(u,f={})=>{const h=i.MutationObserver||i.WebkitMutationObserver,m=new h(p=>{if(t.__preventObserver__)return;if(p.length===1){r("observerUpdate",p[0]);return}const x=function(){r("observerUpdate",p[0])};i.requestAnimationFrame?i.requestAnimationFrame(x):i.setTimeout(x,0)});m.observe(u,{attributes:typeof f.attributes>"u"?!0:f.attributes,childList:t.isElement||(typeof f.childList>"u"?!0:f).childList,characterData:typeof f.characterData>"u"?!0:f.characterData}),s.push(m)},l=()=>{if(t.params.observer){if(t.params.observeParents){const u=NM(t.hostEl);for(let f=0;f{s.forEach(u=>{u.disconnect()}),s.splice(0,s.length)};e({observer:!1,observeParents:!1,observeSlideChildren:!1}),n("init",l),n("destroy",c)}var DM={on(t,e,n){const r=this;if(!r.eventsListeners||r.destroyed||typeof e!="function")return r;const s=n?"unshift":"push";return t.split(" ").forEach(i=>{r.eventsListeners[i]||(r.eventsListeners[i]=[]),r.eventsListeners[i][s](e)}),r},once(t,e,n){const r=this;if(!r.eventsListeners||r.destroyed||typeof e!="function")return r;function s(...i){r.off(t,s),s.__emitterProxy&&delete s.__emitterProxy,e.apply(r,i)}return s.__emitterProxy=e,r.on(t,s,n)},onAny(t,e){const n=this;if(!n.eventsListeners||n.destroyed||typeof t!="function")return n;const r=e?"unshift":"push";return n.eventsAnyListeners.indexOf(t)<0&&n.eventsAnyListeners[r](t),n},offAny(t){const e=this;if(!e.eventsListeners||e.destroyed||!e.eventsAnyListeners)return e;const n=e.eventsAnyListeners.indexOf(t);return n>=0&&e.eventsAnyListeners.splice(n,1),e},off(t,e){const n=this;return!n.eventsListeners||n.destroyed||!n.eventsListeners||t.split(" ").forEach(r=>{typeof e>"u"?n.eventsListeners[r]=[]:n.eventsListeners[r]&&n.eventsListeners[r].forEach((s,i)=>{(s===e||s.__emitterProxy&&s.__emitterProxy===e)&&n.eventsListeners[r].splice(i,1)})}),n},emit(...t){const e=this;if(!e.eventsListeners||e.destroyed||!e.eventsListeners)return e;let n,r,s;return typeof t[0]=="string"||Array.isArray(t[0])?(n=t[0],r=t.slice(1,t.length),s=e):(n=t[0].events,r=t[0].data,s=t[0].context||e),r.unshift(s),(Array.isArray(n)?n:n.split(" ")).forEach(o=>{e.eventsAnyListeners&&e.eventsAnyListeners.length&&e.eventsAnyListeners.forEach(l=>{l.apply(s,[o,...r])}),e.eventsListeners&&e.eventsListeners[o]&&e.eventsListeners[o].forEach(l=>{l.apply(s,r)})}),e}};function MM(){const t=this;let e,n;const r=t.el;typeof t.params.width<"u"&&t.params.width!==null?e=t.params.width:e=r.clientWidth,typeof t.params.height<"u"&&t.params.height!==null?n=t.params.height:n=r.clientHeight,!(e===0&&t.isHorizontal()||n===0&&t.isVertical())&&(e=e-parseInt(si(r,"padding-left")||0,10)-parseInt(si(r,"padding-right")||0,10),n=n-parseInt(si(r,"padding-top")||0,10)-parseInt(si(r,"padding-bottom")||0,10),Number.isNaN(e)&&(e=0),Number.isNaN(n)&&(n=0),Object.assign(t,{width:e,height:n,size:t.isHorizontal()?e:n}))}function LM(){const t=this;function e(A,I){return parseFloat(A.getPropertyValue(t.getDirectionLabel(I))||0)}const n=t.params,{wrapperEl:r,slidesEl:s,rtlTranslate:i,wrongRTL:o}=t,l=t.virtual&&n.virtual.enabled,c=l?t.virtual.slides.length:t.slides.length,u=bs(s,`.${t.params.slideClass}, swiper-slide`),f=l?t.virtual.slides.length:u.length;let h=[];const m=[],p=[];let x=n.slidesOffsetBefore;typeof x=="function"&&(x=n.slidesOffsetBefore.call(t));let E=n.slidesOffsetAfter;typeof E=="function"&&(E=n.slidesOffsetAfter.call(t));const C=t.snapGrid.length,y=t.slidesGrid.length,v=t.size-x-E;let _=n.spaceBetween,D=-x,M=0,T=0;if(typeof v>"u")return;typeof _=="string"&&_.indexOf("%")>=0?_=parseFloat(_.replace("%",""))/100*v:typeof _=="string"&&(_=parseFloat(_)),t.virtualSize=-_-x-E,u.forEach(A=>{i?A.style.marginLeft="":A.style.marginRight="",A.style.marginBottom="",A.style.marginTop=""}),n.centeredSlides&&n.cssMode&&(So(r,"--swiper-centered-offset-before",""),So(r,"--swiper-centered-offset-after","")),n.cssMode&&(So(r,"--swiper-slides-offset-before",`${x}px`),So(r,"--swiper-slides-offset-after",`${E}px`));const S=n.grid&&n.grid.rows>1&&t.grid;S?t.grid.initSlides(u):t.grid&&t.grid.unsetSlides();let w;const N=n.slidesPerView==="auto"&&n.breakpoints&&Object.keys(n.breakpoints).filter(A=>typeof n.breakpoints[A].slidesPerView<"u").length>0;for(let A=0;A=0&&(z+=p[W]+(W1&&(I||h.push(t.virtualSize-v))}if(l&&n.loop){const A=p[0]+_;if(n.slidesPerGroup>1){const I=Math.ceil((t.virtual.slidesBefore+t.virtual.slidesAfter)/n.slidesPerGroup),P=A*n.slidesPerGroup;for(let k=0;k!n.cssMode||n.loop?!0:P!==u.length-1).forEach(I=>{I.style[A]=`${_}px`})}if(n.centeredSlides&&n.centeredSlidesBounds){let A=0;p.forEach(P=>{A+=P+(_||0)}),A-=_;const I=A>v?A-v:0;h=h.map(P=>P<=0?-x:P>I?I+E:P)}if(n.centerInsufficientSlides){let A=0;if(p.forEach(I=>{A+=I+(_||0)}),A-=_,A{h[k]=P-I}),m.forEach((P,k)=>{m[k]=P+I})}}if(Object.assign(t,{slides:u,snapGrid:h,slidesGrid:m,slidesSizesGrid:p}),n.centeredSlides&&n.cssMode&&!n.centeredSlidesBounds){So(r,"--swiper-centered-offset-before",`${-h[0]}px`),So(r,"--swiper-centered-offset-after",`${t.size/2-p[p.length-1]/2}px`);const A=-t.snapGrid[0],I=-t.slidesGrid[0];t.snapGrid=t.snapGrid.map(P=>P+A),t.slidesGrid=t.slidesGrid.map(P=>P+I)}if(f!==c&&t.emit("slidesLengthChange"),h.length!==C&&(t.params.watchOverflow&&t.checkOverflow(),t.emit("snapGridLengthChange")),m.length!==y&&t.emit("slidesGridLengthChange"),n.watchSlidesProgress&&t.updateSlidesOffset(),t.emit("slidesUpdated"),!l&&!n.cssMode&&(n.effect==="slide"||n.effect==="fade")){const A=`${n.containerModifierClass}backface-hidden`,I=t.el.classList.contains(A);f<=n.maxBackfaceHiddenSlides?I||t.el.classList.add(A):I&&t.el.classList.remove(A)}}function OM(t){const e=this,n=[],r=e.virtual&&e.params.virtual.enabled;let s=0,i;typeof t=="number"?e.setTransition(t):t===!0&&e.setTransition(e.params.speed);const o=l=>r?e.slides[e.getSlideIndexByData(l)]:e.slides[l];if(e.params.slidesPerView!=="auto"&&e.params.slidesPerView>1)if(e.params.centeredSlides)(e.visibleSlides||[]).forEach(l=>{n.push(l)});else for(i=0;ie.slides.length&&!r)break;n.push(o(l))}else n.push(o(e.activeIndex));for(i=0;is?l:s}(s||s===0)&&(e.wrapperEl.style.height=`${s}px`)}function VM(){const t=this,e=t.slides,n=t.isElement?t.isHorizontal()?t.wrapperEl.offsetLeft:t.wrapperEl.offsetTop:0;for(let r=0;r{e&&!t.classList.contains(n)?t.classList.add(n):!e&&t.classList.contains(n)&&t.classList.remove(n)};function FM(t=this&&this.translate||0){const e=this,n=e.params,{slides:r,rtlTranslate:s,snapGrid:i}=e;if(r.length===0)return;typeof r[0].swiperSlideOffset>"u"&&e.updateSlidesOffset();let o=-t;s&&(o=t),e.visibleSlidesIndexes=[],e.visibleSlides=[];let l=n.spaceBetween;typeof l=="string"&&l.indexOf("%")>=0?l=parseFloat(l.replace("%",""))/100*e.size:typeof l=="string"&&(l=parseFloat(l));for(let c=0;c=0&&p<=e.size-e.slidesSizesGrid[c],C=p>=0&&p1&&x<=e.size||p<=0&&x>=e.size;C&&(e.visibleSlides.push(u),e.visibleSlidesIndexes.push(c)),Dw(u,C,n.slideVisibleClass),Dw(u,E,n.slideFullyVisibleClass),u.progress=s?-h:h,u.originalProgress=s?-m:m}}function zM(t){const e=this;if(typeof t>"u"){const f=e.rtlTranslate?-1:1;t=e&&e.translate&&e.translate*f||0}const n=e.params,r=e.maxTranslate()-e.minTranslate();let{progress:s,isBeginning:i,isEnd:o,progressLoop:l}=e;const c=i,u=o;if(r===0)s=0,i=!0,o=!0;else{s=(t-e.minTranslate())/r;const f=Math.abs(t-e.minTranslate())<1,h=Math.abs(t-e.maxTranslate())<1;i=f||s<=0,o=h||s>=1,f&&(s=0),h&&(s=1)}if(n.loop){const f=e.getSlideIndexByData(0),h=e.getSlideIndexByData(e.slides.length-1),m=e.slidesGrid[f],p=e.slidesGrid[h],x=e.slidesGrid[e.slidesGrid.length-1],E=Math.abs(t);E>=m?l=(E-m)/x:l=(E+x-p)/x,l>1&&(l-=1)}Object.assign(e,{progress:s,progressLoop:l,isBeginning:i,isEnd:o}),(n.watchSlidesProgress||n.centeredSlides&&n.autoHeight)&&e.updateSlidesProgress(t),i&&!c&&e.emit("reachBeginning toEdge"),o&&!u&&e.emit("reachEnd toEdge"),(c&&!i||u&&!o)&&e.emit("fromEdge"),e.emit("progress",s)}const Vf=(t,e,n)=>{e&&!t.classList.contains(n)?t.classList.add(n):!e&&t.classList.contains(n)&&t.classList.remove(n)};function UM(){const t=this,{slides:e,params:n,slidesEl:r,activeIndex:s}=t,i=t.virtual&&n.virtual.enabled,o=t.grid&&n.grid&&n.grid.rows>1,l=h=>bs(r,`.${n.slideClass}${h}, swiper-slide${h}`)[0];let c,u,f;if(i)if(n.loop){let h=s-t.virtual.slidesBefore;h<0&&(h=t.virtual.slides.length+h),h>=t.virtual.slides.length&&(h-=t.virtual.slides.length),c=l(`[data-swiper-slide-index="${h}"]`)}else c=l(`[data-swiper-slide-index="${s}"]`);else o?(c=e.find(h=>h.column===s),f=e.find(h=>h.column===s+1),u=e.find(h=>h.column===s-1)):c=e[s];c&&(o||(f=TM(c,`.${n.slideClass}, swiper-slide`)[0],n.loop&&!f&&(f=e[0]),u=SM(c,`.${n.slideClass}, swiper-slide`)[0],n.loop&&!u===0&&(u=e[e.length-1]))),e.forEach(h=>{Vf(h,h===c,n.slideActiveClass),Vf(h,h===f,n.slideNextClass),Vf(h,h===u,n.slidePrevClass)}),t.emitSlidesClasses()}const Hu=(t,e)=>{if(!t||t.destroyed||!t.params)return;const n=()=>t.isElement?"swiper-slide":`.${t.params.slideClass}`,r=e.closest(n());if(r){let s=r.querySelector(`.${t.params.lazyPreloaderClass}`);!s&&t.isElement&&(r.shadowRoot?s=r.shadowRoot.querySelector(`.${t.params.lazyPreloaderClass}`):requestAnimationFrame(()=>{r.shadowRoot&&(s=r.shadowRoot.querySelector(`.${t.params.lazyPreloaderClass}`),s&&!s.lazyPreloaderManaged&&s.remove())})),s&&!s.lazyPreloaderManaged&&s.remove()}},Ff=(t,e)=>{if(!t.slides[e])return;const n=t.slides[e].querySelector('[loading="lazy"]');n&&n.removeAttribute("loading")},km=t=>{if(!t||t.destroyed||!t.params)return;let e=t.params.lazyPreloadPrevNext;const n=t.slides.length;if(!n||!e||e<0)return;e=Math.min(e,n);const r=t.params.slidesPerView==="auto"?t.slidesPerViewDynamic():Math.ceil(t.params.slidesPerView),s=t.activeIndex;if(t.params.grid&&t.params.grid.rows>1){const o=s,l=[o-e];l.push(...Array.from({length:e}).map((c,u)=>o+r+u)),t.slides.forEach((c,u)=>{l.includes(c.column)&&Ff(t,u)});return}const i=s+r-1;if(t.params.rewind||t.params.loop)for(let o=s-e;o<=i+e;o+=1){const l=(o%n+n)%n;(li)&&Ff(t,l)}else for(let o=Math.max(s-e,0);o<=Math.min(i+e,n-1);o+=1)o!==s&&(o>i||o=e[i]&&r=e[i]&&r=e[i]&&(s=i);return n.normalizeSlideIndex&&(s<0||typeof s>"u")&&(s=0),s}function $M(t){const e=this,n=e.rtlTranslate?e.translate:-e.translate,{snapGrid:r,params:s,activeIndex:i,realIndex:o,snapIndex:l}=e;let c=t,u;const f=p=>{let x=p-e.virtual.slidesBefore;return x<0&&(x=e.virtual.slides.length+x),x>=e.virtual.slides.length&&(x-=e.virtual.slides.length),x};if(typeof c>"u"&&(c=BM(e)),r.indexOf(n)>=0)u=r.indexOf(n);else{const p=Math.min(s.slidesPerGroupSkip,c);u=p+Math.floor((c-p)/s.slidesPerGroup)}if(u>=r.length&&(u=r.length-1),c===i&&!e.params.loop){u!==l&&(e.snapIndex=u,e.emit("snapIndexChange"));return}if(c===i&&e.params.loop&&e.virtual&&e.params.virtual.enabled){e.realIndex=f(c);return}const h=e.grid&&s.grid&&s.grid.rows>1;let m;if(e.virtual&&s.virtual.enabled)s.loop?m=f(c):m=c;else if(h){const p=e.slides.find(E=>E.column===c);let x=parseInt(p.getAttribute("data-swiper-slide-index"),10);Number.isNaN(x)&&(x=Math.max(e.slides.indexOf(p),0)),m=Math.floor(x/s.grid.rows)}else if(e.slides[c]){const p=e.slides[c].getAttribute("data-swiper-slide-index");p?m=parseInt(p,10):m=c}else m=c;Object.assign(e,{previousSnapIndex:l,snapIndex:u,previousRealIndex:o,realIndex:m,previousIndex:i,activeIndex:c}),e.initialized&&km(e),e.emit("activeIndexChange"),e.emit("snapIndexChange"),(e.initialized||e.params.runCallbacksOnInit)&&(o!==m&&e.emit("realIndexChange"),e.emit("slideChange"))}function HM(t,e){const n=this,r=n.params;let s=t.closest(`.${r.slideClass}, swiper-slide`);!s&&n.isElement&&e&&e.length>1&&e.includes(t)&&[...e.slice(e.indexOf(t)+1,e.length)].forEach(l=>{!s&&l.matches&&l.matches(`.${r.slideClass}, swiper-slide`)&&(s=l)});let i=!1,o;if(s){for(let l=0;lc?f=c:r&&ti?o="next":s"u"&&(e=i.params.speed);const E=Math.min(i.params.slidesPerGroupSkip,o);let C=E+Math.floor((o-E)/i.params.slidesPerGroup);C>=c.length&&(C=c.length-1);const y=-c[C];if(l.normalizeSlideIndex)for(let S=0;S=N&&w=N&&w=N&&(o=S)}if(i.initialized&&o!==h&&(!i.allowSlideNext&&(m?y>i.translate&&y>i.minTranslate():yi.translate&&y>i.maxTranslate()&&(h||0)!==o))return!1;o!==(f||0)&&n&&i.emit("beforeSlideChangeStart"),i.updateProgress(y);let v;o>h?v="next":o0?(i._cssModeVirtualInitialSet=!0,requestAnimationFrame(()=>{p[S?"scrollLeft":"scrollTop"]=w})):p[S?"scrollLeft":"scrollTop"]=w,_&&requestAnimationFrame(()=>{i.wrapperEl.style.scrollSnapType="",i._immediateVirtual=!1});else{if(!i.support.smoothScroll)return U2({swiper:i,targetPosition:w,side:S?"left":"top"}),!0;p.scrollTo({[S?"left":"top"]:w,behavior:"smooth"})}return!0}const T=H2().isSafari;return _&&!s&&T&&i.isElement&&i.virtual.update(!1,!1,o),i.setTransition(e),i.setTranslate(y),i.updateActiveIndex(o),i.updateSlidesClasses(),i.emit("beforeTransitionStart",e,r),i.transitionStart(n,v),e===0?i.transitionEnd(n,v):i.animating||(i.animating=!0,i.onSlideToWrapperTransitionEnd||(i.onSlideToWrapperTransitionEnd=function(w){!i||i.destroyed||w.target===this&&(i.wrapperEl.removeEventListener("transitionend",i.onSlideToWrapperTransitionEnd),i.onSlideToWrapperTransitionEnd=null,delete i.onSlideToWrapperTransitionEnd,i.transitionEnd(n,v))}),i.wrapperEl.addEventListener("transitionend",i.onSlideToWrapperTransitionEnd)),!0}function r3(t=0,e,n=!0,r){typeof t=="string"&&(t=parseInt(t,10));const s=this;if(s.destroyed)return;typeof e>"u"&&(e=s.params.speed);const i=s.grid&&s.params.grid&&s.params.grid.rows>1;let o=t;if(s.params.loop)if(s.virtual&&s.params.virtual.enabled)o=o+s.virtual.slidesBefore;else{let l;if(i){const E=o*s.params.grid.rows;l=s.slides.find(C=>C.getAttribute("data-swiper-slide-index")*1===E).column}else l=s.getSlideIndexByData(o);const c=i?Math.ceil(s.slides.length/s.params.grid.rows):s.slides.length,{centeredSlides:u,slidesOffsetBefore:f,slidesOffsetAfter:h}=s.params,m=u||!!f||!!h;let p=s.params.slidesPerView;p==="auto"?p=s.slidesPerViewDynamic():(p=Math.ceil(parseFloat(s.params.slidesPerView,10)),m&&p%2===0&&(p=p+1));let x=c-lC.getAttribute("data-swiper-slide-index")*1===E).column}else o=s.getSlideIndexByData(o)}return requestAnimationFrame(()=>{s.slideTo(o,e,n,r)}),s}function s3(t,e=!0,n){const r=this,{enabled:s,params:i,animating:o}=r;if(!s||r.destroyed)return r;typeof t>"u"&&(t=r.params.speed);let l=i.slidesPerGroup;i.slidesPerView==="auto"&&i.slidesPerGroup===1&&i.slidesPerGroupAuto&&(l=Math.max(r.slidesPerViewDynamic("current",!0),1));const c=r.activeIndex{r.slideTo(r.activeIndex+c,t,e,n)}),!0}return i.rewind&&r.isEnd?r.slideTo(0,t,e,n):r.slideTo(r.activeIndex+c,t,e,n)}function i3(t,e=!0,n){const r=this,{params:s,snapGrid:i,slidesGrid:o,rtlTranslate:l,enabled:c,animating:u}=r;if(!c||r.destroyed)return r;typeof t>"u"&&(t=r.params.speed);const f=r.virtual&&s.virtual.enabled;if(s.loop){if(u&&!f&&s.loopPreventsSliding)return!1;r.loopFix({direction:"prev"}),r._clientLeft=r.wrapperEl.clientLeft}const h=l?r.translate:-r.translate;function m(v){return v<0?-Math.floor(Math.abs(v)):Math.floor(v)}const p=m(h),x=i.map(v=>m(v)),E=s.freeMode&&s.freeMode.enabled;let C=i[x.indexOf(p)-1];if(typeof C>"u"&&(s.cssMode||E)){let v;i.forEach((_,D)=>{p>=_&&(v=D)}),typeof v<"u"&&(C=E?i[v]:i[v>0?v-1:v])}let y=0;if(typeof C<"u"&&(y=o.indexOf(C),y<0&&(y=r.activeIndex-1),s.slidesPerView==="auto"&&s.slidesPerGroup===1&&s.slidesPerGroupAuto&&(y=y-r.slidesPerViewDynamic("previous",!0)+1,y=Math.max(y,0))),s.rewind&&r.isBeginning){const v=r.params.virtual&&r.params.virtual.enabled&&r.virtual?r.virtual.slides.length-1:r.slides.length-1;return r.slideTo(v,t,e,n)}else if(s.loop&&r.activeIndex===0&&s.cssMode)return requestAnimationFrame(()=>{r.slideTo(y,t,e,n)}),!0;return r.slideTo(y,t,e,n)}function o3(t,e=!0,n){const r=this;if(!r.destroyed)return typeof t>"u"&&(t=r.params.speed),r.slideTo(r.activeIndex,t,e,n)}function a3(t,e=!0,n,r=.5){const s=this;if(s.destroyed)return;typeof t>"u"&&(t=s.params.speed);let i=s.activeIndex;const o=Math.min(s.params.slidesPerGroupSkip,i),l=o+Math.floor((i-o)/s.params.slidesPerGroup),c=s.rtlTranslate?s.translate:-s.translate;if(c>=s.snapGrid[l]){const u=s.snapGrid[l],f=s.snapGrid[l+1];c-u>(f-u)*r&&(i+=s.params.slidesPerGroup)}else{const u=s.snapGrid[l-1],f=s.snapGrid[l];c-u<=(f-u)*r&&(i-=s.params.slidesPerGroup)}return i=Math.max(i,0),i=Math.min(i,s.slidesGrid.length-1),s.slideTo(i,t,e,n)}function l3(){const t=this;if(t.destroyed)return;const{params:e,slidesEl:n}=t,r=e.slidesPerView==="auto"?t.slidesPerViewDynamic():e.slidesPerView;let s=t.getSlideIndexWhenGrid(t.clickedIndex),i;const o=t.isElement?"swiper-slide":`.${e.slideClass}`,l=t.grid&&t.params.grid&&t.params.grid.rows>1;if(e.loop){if(t.animating)return;i=parseInt(t.clickedSlide.getAttribute("data-swiper-slide-index"),10),e.centeredSlides?t.slideToLoop(i):s>(l?(t.slides.length-r)/2-(t.params.grid.rows-1):t.slides.length-r)?(t.loopFix(),s=t.getSlideIndex(bs(n,`${o}[data-swiper-slide-index="${i}"]`)[0]),z2(()=>{t.slideTo(s)})):t.slideTo(s)}else t.slideTo(s)}var c3={slideTo:n3,slideToLoop:r3,slideNext:s3,slidePrev:i3,slideReset:o3,slideToClosest:a3,slideToClickedSlide:l3};function u3(t,e){const n=this,{params:r,slidesEl:s}=n;if(!r.loop||n.virtual&&n.params.virtual.enabled)return;const i=()=>{bs(s,`.${r.slideClass}, swiper-slide`).forEach((x,E)=>{x.setAttribute("data-swiper-slide-index",E)})},o=()=>{const p=bs(s,`.${r.slideBlankClass}`);p.forEach(x=>{x.remove()}),p.length>0&&(n.recalcSlides(),n.updateSlides())},l=n.grid&&r.grid&&r.grid.rows>1;r.loopAddBlankSlides&&(r.slidesPerGroup>1||l)&&o();const c=r.slidesPerGroup*(l?r.grid.rows:1),u=n.slides.length%c!==0,f=l&&n.slides.length%r.grid.rows!==0,h=p=>{for(let x=0;x1;u.length<_+M||c.params.effect==="cards"&&u.length<_+M*2?$d("Swiper Loop Warning: The number of slides is not enough for loop mode, it will be disabled or not function properly. You need to add more slides (or make duplicates) or lower the values of slidesPerView and slidesPerGroup parameters"):T&&p.grid.fill==="row"&&$d("Swiper Loop Warning: Loop mode is not compatible with grid.fill = `row`");const S=[],w=[],N=T?Math.ceil(u.length/p.grid.rows):u.length,A=i&&N-y<_&&!v;let I=A?y:c.activeIndex;typeof s>"u"?s=c.getSlideIndex(u.find(F=>F.classList.contains(p.slideActiveClass))):I=s;const P=n==="next"||!n,k=n==="prev"||!n;let B=0,z=0;const ee=(T?u[s].column:s)+(v&&typeof r>"u"?-_/2+.5:0);if(ee=0;ne-=1)u[ne].column===R&&S.push(ne)}else S.push(N-K-1)}}else if(ee+_>N-M){z=Math.max(ee-(N-M*2),D),A&&(z=Math.max(z,_-N+y+1));for(let F=0;F{R.column===K&&w.push(ne)}):w.push(K)}}if(c.__preventObserver__=!0,requestAnimationFrame(()=>{c.__preventObserver__=!1}),c.params.effect==="cards"&&u.length<_+M*2&&(w.includes(s)&&w.splice(w.indexOf(s),1),S.includes(s)&&S.splice(S.indexOf(s),1)),k&&S.forEach(F=>{u[F].swiperLoopMoveDOM=!0,m.prepend(u[F]),u[F].swiperLoopMoveDOM=!1}),P&&w.forEach(F=>{u[F].swiperLoopMoveDOM=!0,m.append(u[F]),u[F].swiperLoopMoveDOM=!1}),c.recalcSlides(),p.slidesPerView==="auto"?c.updateSlides():T&&(S.length>0&&k||w.length>0&&P)&&c.slides.forEach((F,K)=>{c.grid.updateSlide(K,F,c.slides)}),p.watchSlidesProgress&&c.updateSlidesOffset(),e){if(S.length>0&&k){if(typeof t>"u"){const F=c.slidesGrid[I],R=c.slidesGrid[I+B]-F;l?c.setTranslate(c.translate-R):(c.slideTo(I+Math.ceil(B),0,!1,!0),r&&(c.touchEventsData.startTranslate=c.touchEventsData.startTranslate-R,c.touchEventsData.currentTranslate=c.touchEventsData.currentTranslate-R))}else if(r){const F=T?S.length/p.grid.rows:S.length;c.slideTo(c.activeIndex+F,0,!1,!0),c.touchEventsData.currentTranslate=c.translate}}else if(w.length>0&&P)if(typeof t>"u"){const F=c.slidesGrid[I],R=c.slidesGrid[I-z]-F;l?c.setTranslate(c.translate-R):(c.slideTo(I-z,0,!1,!0),r&&(c.touchEventsData.startTranslate=c.touchEventsData.startTranslate-R,c.touchEventsData.currentTranslate=c.touchEventsData.currentTranslate-R))}else{const F=T?w.length/p.grid.rows:w.length;c.slideTo(c.activeIndex-F,0,!1,!0)}}if(c.allowSlidePrev=f,c.allowSlideNext=h,c.controller&&c.controller.control&&!o){const F={slideRealIndex:t,direction:n,setTranslate:r,activeSlideIndex:s,byController:!0};Array.isArray(c.controller.control)?c.controller.control.forEach(K=>{!K.destroyed&&K.params.loop&&K.loopFix({...F,slideTo:K.params.slidesPerView===p.slidesPerView?e:!1})}):c.controller.control instanceof c.constructor&&c.controller.control.params.loop&&c.controller.control.loopFix({...F,slideTo:c.controller.control.params.slidesPerView===p.slidesPerView?e:!1})}c.emit("loopFix")}function h3(){const t=this,{params:e,slidesEl:n}=t;if(!e.loop||!n||t.virtual&&t.params.virtual.enabled)return;t.recalcSlides();const r=[];t.slides.forEach(s=>{const i=typeof s.swiperSlideIndex>"u"?s.getAttribute("data-swiper-slide-index")*1:s.swiperSlideIndex;r[i]=s}),t.slides.forEach(s=>{s.removeAttribute("data-swiper-slide-index")}),r.forEach(s=>{n.append(s)}),t.recalcSlides(),t.slideTo(t.realIndex,0)}var f3={loopCreate:u3,loopFix:d3,loopDestroy:h3};function p3(t){const e=this;if(!e.params.simulateTouch||e.params.watchOverflow&&e.isLocked||e.params.cssMode)return;const n=e.params.touchEventsTarget==="container"?e.el:e.wrapperEl;e.isElement&&(e.__preventObserver__=!0),n.style.cursor="move",n.style.cursor=t?"grabbing":"grab",e.isElement&&requestAnimationFrame(()=>{e.__preventObserver__=!1})}function m3(){const t=this;t.params.watchOverflow&&t.isLocked||t.params.cssMode||(t.isElement&&(t.__preventObserver__=!0),t[t.params.touchEventsTarget==="container"?"el":"wrapperEl"].style.cursor="",t.isElement&&requestAnimationFrame(()=>{t.__preventObserver__=!1}))}var g3={setGrabCursor:p3,unsetGrabCursor:m3};function y3(t,e=this){function n(r){if(!r||r===yo()||r===Un())return null;r.assignedSlot&&(r=r.assignedSlot);const s=r.closest(t);return!s&&!r.getRootNode?null:s||n(r.getRootNode().host)}return n(e)}function Mw(t,e,n){const r=Un(),{params:s}=t,i=s.edgeSwipeDetection,o=s.edgeSwipeThreshold;return i&&(n<=o||n>=r.innerWidth-o)?i==="prevent"?(e.preventDefault(),!0):!1:!0}function x3(t){const e=this,n=yo();let r=t;r.originalEvent&&(r=r.originalEvent);const s=e.touchEventsData;if(r.type==="pointerdown"){if(s.pointerId!==null&&s.pointerId!==r.pointerId)return;s.pointerId=r.pointerId}else r.type==="touchstart"&&r.targetTouches.length===1&&(s.touchId=r.targetTouches[0].identifier);if(r.type==="touchstart"){Mw(e,r,r.targetTouches[0].pageX);return}const{params:i,touches:o,enabled:l}=e;if(!l||!i.simulateTouch&&r.pointerType==="mouse"||e.animating&&i.preventInteractionOnTransition)return;!e.animating&&i.cssMode&&i.loop&&e.loopFix();let c=r.target;if(i.touchEventsTarget==="wrapper"&&!EM(c,e.wrapperEl)||"which"in r&&r.which===3||"button"in r&&r.button>0||s.isTouched&&s.isMoved)return;const u=!!i.noSwipingClass&&i.noSwipingClass!=="",f=r.composedPath?r.composedPath():r.path;u&&r.target&&r.target.shadowRoot&&f&&(c=f[0]);const h=i.noSwipingSelector?i.noSwipingSelector:`.${i.noSwipingClass}`,m=!!(r.target&&r.target.shadowRoot);if(i.noSwiping&&(m?y3(h,c):c.closest(h))){e.allowClick=!0;return}if(i.swipeHandler&&!c.closest(i.swipeHandler))return;o.currentX=r.pageX,o.currentY=r.pageY;const p=o.currentX,x=o.currentY;if(!Mw(e,r,p))return;Object.assign(s,{isTouched:!0,isMoved:!1,allowTouchCallbacks:!0,isScrolling:void 0,startMoving:void 0}),o.startX=p,o.startY=x,s.touchStartTime=Bd(),e.allowClick=!0,e.updateSize(),e.swipeDirection=void 0,i.threshold>0&&(s.allowThresholdMove=!1);let E=!0;c.matches(s.focusableElements)&&(E=!1,c.nodeName==="SELECT"&&(s.isTouched=!1)),n.activeElement&&n.activeElement.matches(s.focusableElements)&&n.activeElement!==c&&(r.pointerType==="mouse"||r.pointerType!=="mouse"&&!c.matches(s.focusableElements))&&n.activeElement.blur();const C=E&&e.allowTouchMove&&i.touchStartPreventDefault;(i.touchStartForcePreventDefault||C)&&!c.isContentEditable&&r.preventDefault(),i.freeMode&&i.freeMode.enabled&&e.freeMode&&e.animating&&!i.cssMode&&e.freeMode.onTouchStart(),e.emit("touchStart",r)}function v3(t){const e=yo(),n=this,r=n.touchEventsData,{params:s,touches:i,rtlTranslate:o,enabled:l}=n;if(!l||!s.simulateTouch&&t.pointerType==="mouse")return;let c=t;if(c.originalEvent&&(c=c.originalEvent),c.type==="pointermove"&&(r.touchId!==null||c.pointerId!==r.pointerId))return;let u;if(c.type==="touchmove"){if(u=[...c.changedTouches].find(M=>M.identifier===r.touchId),!u||u.identifier!==r.touchId)return}else u=c;if(!r.isTouched){r.startMoving&&r.isScrolling&&n.emit("touchMoveOpposite",c);return}const f=u.pageX,h=u.pageY;if(c.preventedByNestedSwiper){i.startX=f,i.startY=h;return}if(!n.allowTouchMove){c.target.matches(r.focusableElements)||(n.allowClick=!1),r.isTouched&&(Object.assign(i,{startX:f,startY:h,currentX:f,currentY:h}),r.touchStartTime=Bd());return}if(s.touchReleaseOnEdges&&!s.loop)if(n.isVertical()){if(hi.startY&&n.translate>=n.minTranslate()){r.isTouched=!1,r.isMoved=!1;return}}else{if(o&&(f>i.startX&&-n.translate<=n.maxTranslate()||f=n.minTranslate()))return;if(!o&&(fi.startX&&n.translate>=n.minTranslate()))return}if(e.activeElement&&e.activeElement.matches(r.focusableElements)&&e.activeElement!==c.target&&c.pointerType!=="mouse"&&e.activeElement.blur(),e.activeElement&&c.target===e.activeElement&&c.target.matches(r.focusableElements)){r.isMoved=!0,n.allowClick=!1;return}r.allowTouchCallbacks&&n.emit("touchMove",c),i.previousX=i.currentX,i.previousY=i.currentY,i.currentX=f,i.currentY=h;const m=i.currentX-i.startX,p=i.currentY-i.startY;if(n.params.threshold&&Math.sqrt(m**2+p**2)"u"){let M;n.isHorizontal()&&i.currentY===i.startY||n.isVertical()&&i.currentX===i.startX?r.isScrolling=!1:m*m+p*p>=25&&(M=Math.atan2(Math.abs(p),Math.abs(m))*180/Math.PI,r.isScrolling=n.isHorizontal()?M>s.touchAngle:90-M>s.touchAngle)}if(r.isScrolling&&n.emit("touchMoveOpposite",c),typeof r.startMoving>"u"&&(i.currentX!==i.startX||i.currentY!==i.startY)&&(r.startMoving=!0),r.isScrolling||c.type==="touchmove"&&r.preventTouchMoveFromPointerMove){r.isTouched=!1;return}if(!r.startMoving)return;n.allowClick=!1,!s.cssMode&&c.cancelable&&c.preventDefault(),s.touchMoveStopPropagation&&!s.nested&&c.stopPropagation();let x=n.isHorizontal()?m:p,E=n.isHorizontal()?i.currentX-i.previousX:i.currentY-i.previousY;s.oneWayMovement&&(x=Math.abs(x)*(o?1:-1),E=Math.abs(E)*(o?1:-1)),i.diff=x,x*=s.touchRatio,o&&(x=-x,E=-E);const C=n.touchesDirection;n.swipeDirection=x>0?"prev":"next",n.touchesDirection=E>0?"prev":"next";const y=n.params.loop&&!s.cssMode,v=n.touchesDirection==="next"&&n.allowSlideNext||n.touchesDirection==="prev"&&n.allowSlidePrev;if(!r.isMoved){if(y&&v&&n.loopFix({direction:n.swipeDirection}),r.startTranslate=n.getTranslate(),n.setTransition(0),n.animating){const M=new window.CustomEvent("transitionend",{bubbles:!0,cancelable:!0,detail:{bySwiperTouchMove:!0}});n.wrapperEl.dispatchEvent(M)}r.allowMomentumBounce=!1,s.grabCursor&&(n.allowSlideNext===!0||n.allowSlidePrev===!0)&&n.setGrabCursor(!0),n.emit("sliderFirstMove",c)}if(new Date().getTime(),s._loopSwapReset!==!1&&r.isMoved&&r.allowThresholdMove&&C!==n.touchesDirection&&y&&v&&Math.abs(x)>=1){Object.assign(i,{startX:f,startY:h,currentX:f,currentY:h,startTranslate:r.currentTranslate}),r.loopSwapReset=!0,r.startTranslate=r.currentTranslate;return}n.emit("sliderMove",c),r.isMoved=!0,r.currentTranslate=x+r.startTranslate;let _=!0,D=s.resistanceRatio;if(s.touchReleaseOnEdges&&(D=0),x>0?(y&&v&&r.allowThresholdMove&&r.currentTranslate>(s.centeredSlides?n.minTranslate()-n.slidesSizesGrid[n.activeIndex+1]-(s.slidesPerView!=="auto"&&n.slides.length-s.slidesPerView>=2?n.slidesSizesGrid[n.activeIndex+1]+n.params.spaceBetween:0)-n.params.spaceBetween:n.minTranslate())&&n.loopFix({direction:"prev",setTranslate:!0,activeSlideIndex:0}),r.currentTranslate>n.minTranslate()&&(_=!1,s.resistance&&(r.currentTranslate=n.minTranslate()-1+(-n.minTranslate()+r.startTranslate+x)**D))):x<0&&(y&&v&&r.allowThresholdMove&&r.currentTranslate<(s.centeredSlides?n.maxTranslate()+n.slidesSizesGrid[n.slidesSizesGrid.length-1]+n.params.spaceBetween+(s.slidesPerView!=="auto"&&n.slides.length-s.slidesPerView>=2?n.slidesSizesGrid[n.slidesSizesGrid.length-1]+n.params.spaceBetween:0):n.maxTranslate())&&n.loopFix({direction:"next",setTranslate:!0,activeSlideIndex:n.slides.length-(s.slidesPerView==="auto"?n.slidesPerViewDynamic():Math.ceil(parseFloat(s.slidesPerView,10)))}),r.currentTranslater.startTranslate&&(r.currentTranslate=r.startTranslate),!n.allowSlidePrev&&!n.allowSlideNext&&(r.currentTranslate=r.startTranslate),s.threshold>0)if(Math.abs(x)>s.threshold||r.allowThresholdMove){if(!r.allowThresholdMove){r.allowThresholdMove=!0,i.startX=i.currentX,i.startY=i.currentY,r.currentTranslate=r.startTranslate,i.diff=n.isHorizontal()?i.currentX-i.startX:i.currentY-i.startY;return}}else{r.currentTranslate=r.startTranslate;return}!s.followFinger||s.cssMode||((s.freeMode&&s.freeMode.enabled&&n.freeMode||s.watchSlidesProgress)&&(n.updateActiveIndex(),n.updateSlidesClasses()),s.freeMode&&s.freeMode.enabled&&n.freeMode&&n.freeMode.onTouchMove(),n.updateProgress(r.currentTranslate),n.setTranslate(r.currentTranslate))}function w3(t){const e=this,n=e.touchEventsData;let r=t;r.originalEvent&&(r=r.originalEvent);let s;if(r.type==="touchend"||r.type==="touchcancel"){if(s=[...r.changedTouches].find(M=>M.identifier===n.touchId),!s||s.identifier!==n.touchId)return}else{if(n.touchId!==null||r.pointerId!==n.pointerId)return;s=r}if(["pointercancel","pointerout","pointerleave","contextmenu"].includes(r.type)&&!(["pointercancel","contextmenu"].includes(r.type)&&(e.browser.isSafari||e.browser.isWebView)))return;n.pointerId=null,n.touchId=null;const{params:o,touches:l,rtlTranslate:c,slidesGrid:u,enabled:f}=e;if(!f||!o.simulateTouch&&r.pointerType==="mouse")return;if(n.allowTouchCallbacks&&e.emit("touchEnd",r),n.allowTouchCallbacks=!1,!n.isTouched){n.isMoved&&o.grabCursor&&e.setGrabCursor(!1),n.isMoved=!1,n.startMoving=!1;return}o.grabCursor&&n.isMoved&&n.isTouched&&(e.allowSlideNext===!0||e.allowSlidePrev===!0)&&e.setGrabCursor(!1);const h=Bd(),m=h-n.touchStartTime;if(e.allowClick){const M=r.path||r.composedPath&&r.composedPath();e.updateClickedSlide(M&&M[0]||r.target,M),e.emit("tap click",r),m<300&&h-n.lastClickTime<300&&e.emit("doubleTap doubleClick",r)}if(n.lastClickTime=Bd(),z2(()=>{e.destroyed||(e.allowClick=!0)}),!n.isTouched||!n.isMoved||!e.swipeDirection||l.diff===0&&!n.loopSwapReset||n.currentTranslate===n.startTranslate&&!n.loopSwapReset){n.isTouched=!1,n.isMoved=!1,n.startMoving=!1;return}n.isTouched=!1,n.isMoved=!1,n.startMoving=!1;let p;if(o.followFinger?p=c?e.translate:-e.translate:p=-n.currentTranslate,o.cssMode)return;if(o.freeMode&&o.freeMode.enabled){e.freeMode.onTouchEnd({currentPos:p});return}const x=p>=-e.maxTranslate()&&!e.params.loop;let E=0,C=e.slidesSizesGrid[0];for(let M=0;M=u[M]&&p=u[M])&&(E=M,C=u[u.length-1]-u[u.length-2])}let y=null,v=null;o.rewind&&(e.isBeginning?v=o.virtual&&o.virtual.enabled&&e.virtual?e.virtual.slides.length-1:e.slides.length-1:e.isEnd&&(y=0));const _=(p-u[E])/C,D=Eo.longSwipesMs){if(!o.longSwipes){e.slideTo(e.activeIndex);return}e.swipeDirection==="next"&&(_>=o.longSwipesRatio?e.slideTo(o.rewind&&e.isEnd?y:E+D):e.slideTo(E)),e.swipeDirection==="prev"&&(_>1-o.longSwipesRatio?e.slideTo(E+D):v!==null&&_<0&&Math.abs(_)>o.longSwipesRatio?e.slideTo(v):e.slideTo(E))}else{if(!o.shortSwipes){e.slideTo(e.activeIndex);return}e.navigation&&(r.target===e.navigation.nextEl||r.target===e.navigation.prevEl)?r.target===e.navigation.nextEl?e.slideTo(E+D):e.slideTo(E):(e.swipeDirection==="next"&&e.slideTo(y!==null?y:E+D),e.swipeDirection==="prev"&&e.slideTo(v!==null?v:E))}}function Lw(){const t=this,{params:e,el:n}=t;if(n&&n.offsetWidth===0)return;e.breakpoints&&t.setBreakpoint();const{allowSlideNext:r,allowSlidePrev:s,snapGrid:i}=t,o=t.virtual&&t.params.virtual.enabled;t.allowSlideNext=!0,t.allowSlidePrev=!0,t.updateSize(),t.updateSlides(),t.updateSlidesClasses();const l=o&&e.loop;if((e.slidesPerView==="auto"||e.slidesPerView>1)&&t.isEnd&&!t.isBeginning&&!t.params.centeredSlides&&!l){const c=o?t.virtual.slides:t.slides;t.slideTo(c.length-1,0,!1,!0)}else t.params.loop&&!o?t.slideToLoop(t.realIndex,0,!1,!0):t.slideTo(t.activeIndex,0,!1,!0);t.autoplay&&t.autoplay.running&&t.autoplay.paused&&(clearTimeout(t.autoplay.resizeTimeout),t.autoplay.resizeTimeout=setTimeout(()=>{t.autoplay&&t.autoplay.running&&t.autoplay.paused&&t.autoplay.resume()},500)),t.allowSlidePrev=s,t.allowSlideNext=r,t.params.watchOverflow&&i!==t.snapGrid&&t.checkOverflow()}function b3(t){const e=this;e.enabled&&(e.allowClick||(e.params.preventClicks&&t.preventDefault(),e.params.preventClicksPropagation&&e.animating&&(t.stopPropagation(),t.stopImmediatePropagation())))}function _3(){const t=this,{wrapperEl:e,rtlTranslate:n,enabled:r}=t;if(!r)return;t.previousTranslate=t.translate,t.isHorizontal()?t.translate=-e.scrollLeft:t.translate=-e.scrollTop,t.translate===0&&(t.translate=0),t.updateActiveIndex(),t.updateSlidesClasses();let s;const i=t.maxTranslate()-t.minTranslate();i===0?s=0:s=(t.translate-t.minTranslate())/i,s!==t.progress&&t.updateProgress(n?-t.translate:t.translate),t.emit("setTranslate",t.translate,!1)}function E3(t){const e=this;Hu(e,t.target),!(e.params.cssMode||e.params.slidesPerView!=="auto"&&!e.params.autoHeight)&&e.update()}function S3(){const t=this;t.documentTouchHandlerProceeded||(t.documentTouchHandlerProceeded=!0,t.params.touchReleaseOnEdges&&(t.el.style.touchAction="auto"))}const G2=(t,e)=>{const n=yo(),{params:r,el:s,wrapperEl:i,device:o}=t,l=!!r.nested,c=e==="on"?"addEventListener":"removeEventListener",u=e;!s||typeof s=="string"||(n[c]("touchstart",t.onDocumentTouchStart,{passive:!1,capture:l}),s[c]("touchstart",t.onTouchStart,{passive:!1}),s[c]("pointerdown",t.onTouchStart,{passive:!1}),n[c]("touchmove",t.onTouchMove,{passive:!1,capture:l}),n[c]("pointermove",t.onTouchMove,{passive:!1,capture:l}),n[c]("touchend",t.onTouchEnd,{passive:!0}),n[c]("pointerup",t.onTouchEnd,{passive:!0}),n[c]("pointercancel",t.onTouchEnd,{passive:!0}),n[c]("touchcancel",t.onTouchEnd,{passive:!0}),n[c]("pointerout",t.onTouchEnd,{passive:!0}),n[c]("pointerleave",t.onTouchEnd,{passive:!0}),n[c]("contextmenu",t.onTouchEnd,{passive:!0}),(r.preventClicks||r.preventClicksPropagation)&&s[c]("click",t.onClick,!0),r.cssMode&&i[c]("scroll",t.onScroll),r.updateOnWindowResize?t[u](o.ios||o.android?"resize orientationchange observerUpdate":"resize observerUpdate",Lw,!0):t[u]("observerUpdate",Lw,!0),s[c]("load",t.onLoad,{capture:!0}))};function T3(){const t=this,{params:e}=t;t.onTouchStart=x3.bind(t),t.onTouchMove=v3.bind(t),t.onTouchEnd=w3.bind(t),t.onDocumentTouchStart=S3.bind(t),e.cssMode&&(t.onScroll=_3.bind(t)),t.onClick=b3.bind(t),t.onLoad=E3.bind(t),G2(t,"on")}function N3(){G2(this,"off")}var k3={attachEvents:T3,detachEvents:N3};const Ow=(t,e)=>t.grid&&e.grid&&e.grid.rows>1;function I3(){const t=this,{realIndex:e,initialized:n,params:r,el:s}=t,i=r.breakpoints;if(!i||i&&Object.keys(i).length===0)return;const o=yo(),l=r.breakpointsBase==="window"||!r.breakpointsBase?r.breakpointsBase:"container",c=["window","container"].includes(r.breakpointsBase)||!r.breakpointsBase?t.el:o.querySelector(r.breakpointsBase),u=t.getBreakpoint(i,l,c);if(!u||t.currentBreakpoint===u)return;const h=(u in i?i[u]:void 0)||t.originalParams,m=Ow(t,r),p=Ow(t,h),x=t.params.grabCursor,E=h.grabCursor,C=r.enabled;m&&!p?(s.classList.remove(`${r.containerModifierClass}grid`,`${r.containerModifierClass}grid-column`),t.emitContainerClasses()):!m&&p&&(s.classList.add(`${r.containerModifierClass}grid`),(h.grid.fill&&h.grid.fill==="column"||!h.grid.fill&&r.grid.fill==="column")&&s.classList.add(`${r.containerModifierClass}grid-column`),t.emitContainerClasses()),x&&!E?t.unsetGrabCursor():!x&&E&&t.setGrabCursor(),["navigation","pagination","scrollbar"].forEach(T=>{if(typeof h[T]>"u")return;const S=r[T]&&r[T].enabled,w=h[T]&&h[T].enabled;S&&!w&&t[T].disable(),!S&&w&&t[T].enable()});const y=h.direction&&h.direction!==r.direction,v=r.loop&&(h.slidesPerView!==r.slidesPerView||y),_=r.loop;y&&n&&t.changeDirection(),lr(t.params,h);const D=t.params.enabled,M=t.params.loop;Object.assign(t,{allowTouchMove:t.params.allowTouchMove,allowSlideNext:t.params.allowSlideNext,allowSlidePrev:t.params.allowSlidePrev}),C&&!D?t.disable():!C&&D&&t.enable(),t.currentBreakpoint=u,t.emit("_beforeBreakpoint",h),n&&(v?(t.loopDestroy(),t.loopCreate(e),t.updateSlides()):!_&&M?(t.loopCreate(e),t.updateSlides()):_&&!M&&t.loopDestroy()),t.emit("breakpoint",h)}function C3(t,e="window",n){if(!t||e==="container"&&!n)return;let r=!1;const s=Un(),i=e==="window"?s.innerHeight:n.clientHeight,o=Object.keys(t).map(l=>{if(typeof l=="string"&&l.indexOf("@")===0){const c=parseFloat(l.substr(1));return{value:i*c,point:l}}return{value:l,point:l}});o.sort((l,c)=>parseInt(l.value,10)-parseInt(c.value,10));for(let l=0;l{typeof r=="object"?Object.keys(r).forEach(s=>{r[s]&&n.push(e+s)}):typeof r=="string"&&n.push(e+r)}),n}function P3(){const t=this,{classNames:e,params:n,rtl:r,el:s,device:i}=t,o=j3(["initialized",n.direction,{"free-mode":t.params.freeMode&&n.freeMode.enabled},{autoheight:n.autoHeight},{rtl:r},{grid:n.grid&&n.grid.rows>1},{"grid-column":n.grid&&n.grid.rows>1&&n.grid.fill==="column"},{android:i.android},{ios:i.ios},{"css-mode":n.cssMode},{centered:n.cssMode&&n.centeredSlides},{"watch-progress":n.watchSlidesProgress}],n.containerModifierClass);e.push(...o),s.classList.add(...e),t.emitContainerClasses()}function R3(){const t=this,{el:e,classNames:n}=t;!e||typeof e=="string"||(e.classList.remove(...n),t.emitContainerClasses())}var D3={addClasses:P3,removeClasses:R3};function M3(){const t=this,{isLocked:e,params:n}=t,{slidesOffsetBefore:r}=n;if(r){const s=t.slides.length-1,i=t.slidesGrid[s]+t.slidesSizesGrid[s]+r*2;t.isLocked=t.size>i}else t.isLocked=t.snapGrid.length===1;n.allowSlideNext===!0&&(t.allowSlideNext=!t.isLocked),n.allowSlidePrev===!0&&(t.allowSlidePrev=!t.isLocked),e&&e!==t.isLocked&&(t.isEnd=!1),e!==t.isLocked&&t.emit(t.isLocked?"lock":"unlock")}var L3={checkOverflow:M3},Im={init:!0,direction:"horizontal",oneWayMovement:!1,swiperElementNodeName:"SWIPER-CONTAINER",touchEventsTarget:"wrapper",initialSlide:0,speed:300,cssMode:!1,updateOnWindowResize:!0,resizeObserver:!0,nested:!1,createElements:!1,eventsPrefix:"swiper",enabled:!0,focusableElements:"input, select, option, textarea, button, video, label",width:null,height:null,preventInteractionOnTransition:!1,userAgent:null,url:null,edgeSwipeDetection:!1,edgeSwipeThreshold:20,autoHeight:!1,setWrapperSize:!1,virtualTranslate:!1,effect:"slide",breakpoints:void 0,breakpointsBase:"window",spaceBetween:0,slidesPerView:1,slidesPerGroup:1,slidesPerGroupSkip:0,slidesPerGroupAuto:!1,centeredSlides:!1,centeredSlidesBounds:!1,slidesOffsetBefore:0,slidesOffsetAfter:0,normalizeSlideIndex:!0,centerInsufficientSlides:!1,snapToSlideEdge:!1,watchOverflow:!0,roundLengths:!1,touchRatio:1,touchAngle:45,simulateTouch:!0,shortSwipes:!0,longSwipes:!0,longSwipesRatio:.5,longSwipesMs:300,followFinger:!0,allowTouchMove:!0,threshold:5,touchMoveStopPropagation:!1,touchStartPreventDefault:!0,touchStartForcePreventDefault:!1,touchReleaseOnEdges:!1,uniqueNavElements:!0,resistance:!0,resistanceRatio:.85,watchSlidesProgress:!1,grabCursor:!1,preventClicks:!0,preventClicksPropagation:!0,slideToClickedSlide:!1,loop:!1,loopAddBlankSlides:!0,loopAdditionalSlides:0,loopPreventsSliding:!0,rewind:!1,allowSlidePrev:!0,allowSlideNext:!0,swipeHandler:null,noSwiping:!0,noSwipingClass:"swiper-no-swiping",noSwipingSelector:null,passiveListeners:!0,maxBackfaceHiddenSlides:10,containerModifierClass:"swiper-",slideClass:"swiper-slide",slideBlankClass:"swiper-slide-blank",slideActiveClass:"swiper-slide-active",slideVisibleClass:"swiper-slide-visible",slideFullyVisibleClass:"swiper-slide-fully-visible",slideNextClass:"swiper-slide-next",slidePrevClass:"swiper-slide-prev",wrapperClass:"swiper-wrapper",lazyPreloaderClass:"swiper-lazy-preloader",lazyPreloadPrevNext:0,runCallbacksOnInit:!0,_emitClasses:!1};function O3(t,e){return function(r={}){const s=Object.keys(r)[0],i=r[s];if(typeof i!="object"||i===null){lr(e,r);return}if(t[s]===!0&&(t[s]={enabled:!0}),s==="navigation"&&t[s]&&t[s].enabled&&!t[s].prevEl&&!t[s].nextEl&&(t[s].auto=!0),["pagination","scrollbar"].indexOf(s)>=0&&t[s]&&t[s].enabled&&!t[s].el&&(t[s].auto=!0),!(s in t&&"enabled"in i)){lr(e,r);return}typeof t[s]=="object"&&!("enabled"in t[s])&&(t[s].enabled=!0),t[s]||(t[s]={enabled:!1}),lr(e,r)}}const zf={eventsEmitter:DM,update:qM,translate:XM,transition:t3,slide:c3,loop:f3,grabCursor:g3,events:k3,breakpoints:A3,checkOverflow:L3,classes:D3},Uf={};let U0=class fs{constructor(...e){let n,r;e.length===1&&e[0].constructor&&Object.prototype.toString.call(e[0]).slice(8,-1)==="Object"?r=e[0]:[n,r]=e,r||(r={}),r=lr({},r),n&&!r.el&&(r.el=n);const s=yo();if(r.el&&typeof r.el=="string"&&s.querySelectorAll(r.el).length>1){const c=[];return s.querySelectorAll(r.el).forEach(u=>{const f=lr({},r,{el:u});c.push(new fs(f))}),c}const i=this;i.__swiper__=!0,i.support=B2(),i.device=$2({userAgent:r.userAgent}),i.browser=H2(),i.eventsListeners={},i.eventsAnyListeners=[],i.modules=[...i.__modules__],r.modules&&Array.isArray(r.modules)&&r.modules.forEach(c=>{typeof c=="function"&&i.modules.indexOf(c)<0&&i.modules.push(c)});const o={};i.modules.forEach(c=>{c({params:r,swiper:i,extendParams:O3(r,o),on:i.on.bind(i),once:i.once.bind(i),off:i.off.bind(i),emit:i.emit.bind(i)})});const l=lr({},Im,o);return i.params=lr({},l,Uf,r),i.originalParams=lr({},i.params),i.passedParams=lr({},r),i.params&&i.params.on&&Object.keys(i.params.on).forEach(c=>{i.on(c,i.params.on[c])}),i.params&&i.params.onAny&&i.onAny(i.params.onAny),Object.assign(i,{enabled:i.params.enabled,el:n,classNames:[],slides:[],slidesGrid:[],snapGrid:[],slidesSizesGrid:[],isHorizontal(){return i.params.direction==="horizontal"},isVertical(){return i.params.direction==="vertical"},activeIndex:0,realIndex:0,isBeginning:!0,isEnd:!1,translate:0,previousTranslate:0,progress:0,velocity:0,animating:!1,cssOverflowAdjustment(){return Math.trunc(this.translate/2**23)*2**23},allowSlideNext:i.params.allowSlideNext,allowSlidePrev:i.params.allowSlidePrev,touchEventsData:{isTouched:void 0,isMoved:void 0,allowTouchCallbacks:void 0,touchStartTime:void 0,isScrolling:void 0,currentTranslate:void 0,startTranslate:void 0,allowThresholdMove:void 0,focusableElements:i.params.focusableElements,lastClickTime:0,clickTimeout:void 0,velocities:[],allowMomentumBounce:void 0,startMoving:void 0,pointerId:null,touchId:null},allowClick:!0,allowTouchMove:i.params.allowTouchMove,touches:{startX:0,startY:0,currentX:0,currentY:0,diff:0},imagesToLoad:[],imagesLoaded:0}),i.emit("_swiper"),i.params.init&&i.init(),i}getDirectionLabel(e){return this.isHorizontal()?e:{width:"height","margin-top":"margin-left","margin-bottom ":"margin-right","margin-left":"margin-top","margin-right":"margin-bottom","padding-left":"padding-top","padding-right":"padding-bottom",marginRight:"marginBottom"}[e]}getSlideIndex(e){const{slidesEl:n,params:r}=this,s=bs(n,`.${r.slideClass}, swiper-slide`),i=jw(s[0]);return jw(e)-i}getSlideIndexByData(e){return this.getSlideIndex(this.slides.find(n=>n.getAttribute("data-swiper-slide-index")*1===e))}getSlideIndexWhenGrid(e){return this.grid&&this.params.grid&&this.params.grid.rows>1&&(this.params.grid.fill==="column"?e=Math.floor(e/this.params.grid.rows):this.params.grid.fill==="row"&&(e=e%Math.ceil(this.slides.length/this.params.grid.rows))),e}recalcSlides(){const e=this,{slidesEl:n,params:r}=e;e.slides=bs(n,`.${r.slideClass}, swiper-slide`)}enable(){const e=this;e.enabled||(e.enabled=!0,e.params.grabCursor&&e.setGrabCursor(),e.emit("enable"))}disable(){const e=this;e.enabled&&(e.enabled=!1,e.params.grabCursor&&e.unsetGrabCursor(),e.emit("disable"))}setProgress(e,n){const r=this;e=Math.min(Math.max(e,0),1);const s=r.minTranslate(),o=(r.maxTranslate()-s)*e+s;r.translateTo(o,typeof n>"u"?0:n),r.updateActiveIndex(),r.updateSlidesClasses()}emitContainerClasses(){const e=this;if(!e.params._emitClasses||!e.el)return;const n=e.el.className.split(" ").filter(r=>r.indexOf("swiper")===0||r.indexOf(e.params.containerModifierClass)===0);e.emit("_containerClasses",n.join(" "))}getSlideClasses(e){const n=this;return n.destroyed?"":e.className.split(" ").filter(r=>r.indexOf("swiper-slide")===0||r.indexOf(n.params.slideClass)===0).join(" ")}emitSlidesClasses(){const e=this;if(!e.params._emitClasses||!e.el)return;const n=[];e.slides.forEach(r=>{const s=e.getSlideClasses(r);n.push({slideEl:r,classNames:s}),e.emit("_slideClass",r,s)}),e.emit("_slideClasses",n)}slidesPerViewDynamic(e="current",n=!1){const r=this,{params:s,slides:i,slidesGrid:o,slidesSizesGrid:l,size:c,activeIndex:u}=r;let f=1;if(typeof s.slidesPerView=="number")return s.slidesPerView;if(s.centeredSlides){let h=i[u]?Math.ceil(i[u].swiperSlideSize):0,m;for(let p=u+1;pc&&(m=!0));for(let p=u-1;p>=0;p-=1)i[p]&&!m&&(h+=i[p].swiperSlideSize,f+=1,h>c&&(m=!0))}else if(e==="current")for(let h=u+1;h=0;h-=1)o[u]-o[h]{o.complete&&Hu(e,o)}),e.updateSize(),e.updateSlides(),e.updateProgress(),e.updateSlidesClasses();function s(){const o=e.rtlTranslate?e.translate*-1:e.translate,l=Math.min(Math.max(o,e.maxTranslate()),e.minTranslate());e.setTranslate(l),e.updateActiveIndex(),e.updateSlidesClasses()}let i;if(r.freeMode&&r.freeMode.enabled&&!r.cssMode)s(),r.autoHeight&&e.updateAutoHeight();else{if((r.slidesPerView==="auto"||r.slidesPerView>1)&&e.isEnd&&!r.centeredSlides){const o=e.virtual&&r.virtual.enabled?e.virtual.slides:e.slides;i=e.slideTo(o.length-1,0,!1,!0)}else i=e.slideTo(e.activeIndex,0,!1,!0);i||s()}r.watchOverflow&&n!==e.snapGrid&&e.checkOverflow(),e.emit("update")}changeDirection(e,n=!0){const r=this,s=r.params.direction;return e||(e=s==="horizontal"?"vertical":"horizontal"),e===s||e!=="horizontal"&&e!=="vertical"||(r.el.classList.remove(`${r.params.containerModifierClass}${s}`),r.el.classList.add(`${r.params.containerModifierClass}${e}`),r.emitContainerClasses(),r.params.direction=e,r.slides.forEach(i=>{e==="vertical"?i.style.width="":i.style.height=""}),r.emit("changeDirection"),n&&r.update()),r}changeLanguageDirection(e){const n=this;n.rtl&&e==="rtl"||!n.rtl&&e==="ltr"||(n.rtl=e==="rtl",n.rtlTranslate=n.params.direction==="horizontal"&&n.rtl,n.rtl?(n.el.classList.add(`${n.params.containerModifierClass}rtl`),n.el.dir="rtl"):(n.el.classList.remove(`${n.params.containerModifierClass}rtl`),n.el.dir="ltr"),n.update())}mount(e){const n=this;if(n.mounted)return!0;let r=e||n.params.el;if(typeof r=="string"&&(r=document.querySelector(r)),!r)return!1;r.swiper=n,r.parentNode&&r.parentNode.host&&r.parentNode.host.nodeName===n.params.swiperElementNodeName.toUpperCase()&&(n.isElement=!0);const s=()=>`.${(n.params.wrapperClass||"").trim().split(" ").join(".")}`;let o=r&&r.shadowRoot&&r.shadowRoot.querySelector?r.shadowRoot.querySelector(s()):bs(r,s())[0];return!o&&n.params.createElements&&(o=Hd("div",n.params.wrapperClass),r.append(o),bs(r,`.${n.params.slideClass}`).forEach(l=>{o.append(l)})),Object.assign(n,{el:r,wrapperEl:o,slidesEl:n.isElement&&!r.parentNode.host.slideSlots?r.parentNode.host:o,hostEl:n.isElement?r.parentNode.host:r,mounted:!0,rtl:r.dir.toLowerCase()==="rtl"||si(r,"direction")==="rtl",rtlTranslate:n.params.direction==="horizontal"&&(r.dir.toLowerCase()==="rtl"||si(r,"direction")==="rtl"),wrongRTL:si(o,"display")==="-webkit-box"}),!0}init(e){const n=this;if(n.initialized||n.mount(e)===!1)return n;n.emit("beforeInit"),n.params.breakpoints&&n.setBreakpoint(),n.addClasses(),n.updateSize(),n.updateSlides(),n.params.watchOverflow&&n.checkOverflow(),n.params.grabCursor&&n.enabled&&n.setGrabCursor(),n.params.loop&&n.virtual&&n.params.virtual.enabled?n.slideTo(n.params.initialSlide+n.virtual.slidesBefore,0,n.params.runCallbacksOnInit,!1,!0):n.slideTo(n.params.initialSlide,0,n.params.runCallbacksOnInit,!1,!0),n.params.loop&&n.loopCreate(void 0,!0),n.attachEvents();const s=[...n.el.querySelectorAll('[loading="lazy"]')];return n.isElement&&s.push(...n.hostEl.querySelectorAll('[loading="lazy"]')),s.forEach(i=>{i.complete?Hu(n,i):i.addEventListener("load",o=>{Hu(n,o.target)})}),km(n),n.initialized=!0,km(n),n.emit("init"),n.emit("afterInit"),n}destroy(e=!0,n=!0){const r=this,{params:s,el:i,wrapperEl:o,slides:l}=r;return typeof r.params>"u"||r.destroyed||(r.emit("beforeDestroy"),r.initialized=!1,r.detachEvents(),s.loop&&r.loopDestroy(),n&&(r.removeClasses(),i&&typeof i!="string"&&i.removeAttribute("style"),o&&o.removeAttribute("style"),l&&l.length&&l.forEach(c=>{c.classList.remove(s.slideVisibleClass,s.slideFullyVisibleClass,s.slideActiveClass,s.slideNextClass,s.slidePrevClass),c.removeAttribute("style"),c.removeAttribute("data-swiper-slide-index")})),r.emit("destroy"),Object.keys(r.eventsListeners).forEach(c=>{r.off(c)}),e!==!1&&(r.el&&typeof r.el!="string"&&(r.el.swiper=null),xM(r)),r.destroyed=!0),null}static extendDefaults(e){lr(Uf,e)}static get extendedDefaults(){return Uf}static get defaults(){return Im}static installModule(e){fs.prototype.__modules__||(fs.prototype.__modules__=[]);const n=fs.prototype.__modules__;typeof e=="function"&&n.indexOf(e)<0&&n.push(e)}static use(e){return Array.isArray(e)?(e.forEach(n=>fs.installModule(n)),fs):(fs.installModule(e),fs)}};Object.keys(zf).forEach(t=>{Object.keys(zf[t]).forEach(e=>{U0.prototype[e]=zf[t][e]})});U0.use([PM,RM]);const W2=["eventsPrefix","injectStyles","injectStylesUrls","modules","init","_direction","oneWayMovement","swiperElementNodeName","touchEventsTarget","initialSlide","_speed","cssMode","updateOnWindowResize","resizeObserver","nested","focusableElements","_enabled","_width","_height","preventInteractionOnTransition","userAgent","url","_edgeSwipeDetection","_edgeSwipeThreshold","_freeMode","_autoHeight","setWrapperSize","virtualTranslate","_effect","breakpoints","breakpointsBase","_spaceBetween","_slidesPerView","maxBackfaceHiddenSlides","_grid","_slidesPerGroup","_slidesPerGroupSkip","_slidesPerGroupAuto","_centeredSlides","_centeredSlidesBounds","_slidesOffsetBefore","_slidesOffsetAfter","normalizeSlideIndex","_centerInsufficientSlides","_snapToSlideEdge","_watchOverflow","roundLengths","touchRatio","touchAngle","simulateTouch","_shortSwipes","_longSwipes","longSwipesRatio","longSwipesMs","_followFinger","allowTouchMove","_threshold","touchMoveStopPropagation","touchStartPreventDefault","touchStartForcePreventDefault","touchReleaseOnEdges","uniqueNavElements","_resistance","_resistanceRatio","_watchSlidesProgress","_grabCursor","preventClicks","preventClicksPropagation","_slideToClickedSlide","_loop","loopAdditionalSlides","loopAddBlankSlides","loopPreventsSliding","_rewind","_allowSlidePrev","_allowSlideNext","_swipeHandler","_noSwiping","noSwipingClass","noSwipingSelector","passiveListeners","containerModifierClass","slideClass","slideActiveClass","slideVisibleClass","slideFullyVisibleClass","slideNextClass","slidePrevClass","slideBlankClass","wrapperClass","lazyPreloaderClass","lazyPreloadPrevNext","runCallbacksOnInit","observer","observeParents","observeSlideChildren","a11y","_autoplay","_controller","coverflowEffect","cubeEffect","fadeEffect","flipEffect","creativeEffect","cardsEffect","hashNavigation","history","keyboard","mousewheel","_navigation","_pagination","parallax","_scrollbar","_thumbs","virtual","zoom","control"];function uo(t){return typeof t=="object"&&t!==null&&t.constructor&&Object.prototype.toString.call(t).slice(8,-1)==="Object"&&!t.__swiper__}function ra(t,e){const n=["__proto__","constructor","prototype"];Object.keys(e).filter(r=>n.indexOf(r)<0).forEach(r=>{typeof t[r]>"u"?t[r]=e[r]:uo(e[r])&&uo(t[r])&&Object.keys(e[r]).length>0?e[r].__swiper__?t[r]=e[r]:ra(t[r],e[r]):t[r]=e[r]})}function K2(t={}){return t.navigation&&typeof t.navigation.nextEl>"u"&&typeof t.navigation.prevEl>"u"}function Q2(t={}){return t.pagination&&typeof t.pagination.el>"u"}function Y2(t={}){return t.scrollbar&&typeof t.scrollbar.el>"u"}function X2(t=""){const e=t.split(" ").map(r=>r.trim()).filter(r=>!!r),n=[];return e.forEach(r=>{n.indexOf(r)<0&&n.push(r)}),n.join(" ")}function V3(t=""){return t?t.includes("swiper-wrapper")?t:`swiper-wrapper ${t}`:"swiper-wrapper"}function F3({swiper:t,slides:e,passedParams:n,changedParams:r,nextEl:s,prevEl:i,scrollbarEl:o,paginationEl:l}){const c=r.filter(w=>w!=="children"&&w!=="direction"&&w!=="wrapperClass"),{params:u,pagination:f,navigation:h,scrollbar:m,virtual:p,thumbs:x}=t;let E,C,y,v,_,D,M,T;r.includes("thumbs")&&n.thumbs&&n.thumbs.swiper&&!n.thumbs.swiper.destroyed&&u.thumbs&&(!u.thumbs.swiper||u.thumbs.swiper.destroyed)&&(E=!0),r.includes("controller")&&n.controller&&n.controller.control&&u.controller&&!u.controller.control&&(C=!0),r.includes("pagination")&&n.pagination&&(n.pagination.el||l)&&(u.pagination||u.pagination===!1)&&f&&!f.el&&(y=!0),r.includes("scrollbar")&&n.scrollbar&&(n.scrollbar.el||o)&&(u.scrollbar||u.scrollbar===!1)&&m&&!m.el&&(v=!0),r.includes("navigation")&&n.navigation&&(n.navigation.prevEl||i)&&(n.navigation.nextEl||s)&&(u.navigation||u.navigation===!1)&&h&&!h.prevEl&&!h.nextEl&&(_=!0);const S=w=>{t[w]&&(t[w].destroy(),w==="navigation"?(t.isElement&&(t[w].prevEl.remove(),t[w].nextEl.remove()),u[w].prevEl=void 0,u[w].nextEl=void 0,t[w].prevEl=void 0,t[w].nextEl=void 0):(t.isElement&&t[w].el.remove(),u[w].el=void 0,t[w].el=void 0))};r.includes("loop")&&t.isElement&&(u.loop&&!n.loop?D=!0:!u.loop&&n.loop?M=!0:T=!0),c.forEach(w=>{if(uo(u[w])&&uo(n[w]))Object.assign(u[w],n[w]),(w==="navigation"||w==="pagination"||w==="scrollbar")&&"enabled"in n[w]&&!n[w].enabled&&S(w);else{const N=n[w];(N===!0||N===!1)&&(w==="navigation"||w==="pagination"||w==="scrollbar")?N===!1&&S(w):u[w]=n[w]}}),c.includes("controller")&&!C&&t.controller&&t.controller.control&&u.controller&&u.controller.control&&(t.controller.control=u.controller.control),r.includes("children")&&e&&p&&u.virtual.enabled?(p.slides=e,p.update(!0)):r.includes("virtual")&&p&&u.virtual.enabled&&(e&&(p.slides=e),p.update(!0)),r.includes("children")&&e&&u.loop&&(T=!0),E&&x.init()&&x.update(!0),C&&(t.controller.control=u.controller.control),y&&(t.isElement&&(!l||typeof l=="string")&&(l=document.createElement("div"),l.classList.add("swiper-pagination"),l.part.add("pagination"),t.el.appendChild(l)),l&&(u.pagination.el=l),f.init(),f.render(),f.update()),v&&(t.isElement&&(!o||typeof o=="string")&&(o=document.createElement("div"),o.classList.add("swiper-scrollbar"),o.part.add("scrollbar"),t.el.appendChild(o)),o&&(u.scrollbar.el=o),m.init(),m.updateSize(),m.setTranslate()),_&&(t.isElement&&((!s||typeof s=="string")&&(s=document.createElement("div"),s.classList.add("swiper-button-next"),Rw(s,t.navigation.arrowSvg),s.part.add("button-next"),t.el.appendChild(s)),(!i||typeof i=="string")&&(i=document.createElement("div"),i.classList.add("swiper-button-prev"),Rw(i,t.navigation.arrowSvg),i.part.add("button-prev"),t.el.appendChild(i))),s&&(u.navigation.nextEl=s),i&&(u.navigation.prevEl=i),h.init(),h.update()),r.includes("allowSlideNext")&&(t.allowSlideNext=n.allowSlideNext),r.includes("allowSlidePrev")&&(t.allowSlidePrev=n.allowSlidePrev),r.includes("direction")&&t.changeDirection(n.direction,!1),(D||T)&&t.loopDestroy(),(M||T)&&t.loopCreate(),t.update()}function z3(t={},e=!0){const n={on:{}},r={},s={};ra(n,Im),n._emitClasses=!0,n.init=!1;const i={},o=W2.map(c=>c.replace(/_/,"")),l=Object.assign({},t);return Object.keys(l).forEach(c=>{typeof t[c]>"u"||(o.indexOf(c)>=0?uo(t[c])?(n[c]={},s[c]={},ra(n[c],t[c]),ra(s[c],t[c])):(n[c]=t[c],s[c]=t[c]):c.search(/on[A-Z]/)===0&&typeof t[c]=="function"?e?r[`${c[2].toLowerCase()}${c.substr(3)}`]=t[c]:n.on[`${c[2].toLowerCase()}${c.substr(3)}`]=t[c]:i[c]=t[c])}),["navigation","pagination","scrollbar"].forEach(c=>{n[c]===!0&&(n[c]={}),n[c]===!1&&delete n[c]}),{params:n,passedParams:s,rest:i,events:r}}function U3({el:t,nextEl:e,prevEl:n,paginationEl:r,scrollbarEl:s,swiper:i},o){K2(o)&&e&&n&&(i.params.navigation.nextEl=e,i.originalParams.navigation.nextEl=e,i.params.navigation.prevEl=n,i.originalParams.navigation.prevEl=n),Q2(o)&&r&&(i.params.pagination.el=r,i.originalParams.pagination.el=r),Y2(o)&&s&&(i.params.scrollbar.el=s,i.originalParams.scrollbar.el=s),i.init(t)}function B3(t,e,n,r,s){const i=[];if(!e)return i;const o=c=>{i.indexOf(c)<0&&i.push(c)};if(n&&r){const c=r.map(s),u=n.map(s);c.join("")!==u.join("")&&o("children"),r.length!==n.length&&o("children")}return W2.filter(c=>c[0]==="_").map(c=>c.replace(/_/,"")).forEach(c=>{if(c in t&&c in e)if(uo(t[c])&&uo(e[c])){const u=Object.keys(t[c]),f=Object.keys(e[c]);u.length!==f.length?o(c):(u.forEach(h=>{t[c][h]!==e[c][h]&&o(c)}),f.forEach(h=>{t[c][h]!==e[c][h]&&o(c)}))}else t[c]!==e[c]&&o(c)}),i}const $3=t=>{!t||t.destroyed||!t.params.virtual||t.params.virtual&&!t.params.virtual.enabled||(t.updateSlides(),t.updateProgress(),t.updateSlidesClasses(),t.emit("_virtualUpdated"),t.parallax&&t.params.parallax&&t.params.parallax.enabled&&t.parallax.setTranslate())};function qd(){return qd=Object.assign?Object.assign.bind():function(t){for(var e=1;e{J2(n)?e.push(n):n.props&&n.props.children&&Z2(n.props.children).forEach(r=>e.push(r))}),e}function H3(t){const e=[],n={"container-start":[],"container-end":[],"wrapper-start":[],"wrapper-end":[]};return re.Children.toArray(t).forEach(r=>{if(J2(r))e.push(r);else if(r.props&&r.props.slot&&n[r.props.slot])n[r.props.slot].push(r);else if(r.props&&r.props.children){const s=Z2(r.props.children);s.length>0?s.forEach(i=>e.push(i)):n["container-end"].push(r)}else n["container-end"].push(r)}),{slides:e,slots:n}}function q3(t,e,n){if(!n)return null;const r=f=>{let h=f;return f<0?h=e.length+f:h>=e.length&&(h=h-e.length),h},s=t.isHorizontal()?{[t.rtlTranslate?"right":"left"]:`${n.offset}px`}:{top:`${n.offset}px`},{from:i,to:o}=n,l=t.params.loop?-e.length:0,c=t.params.loop?e.length*2:e.length,u=[];for(let f=l;f=i&&f<=o&&u.push(e[r(f)]);return u.map((f,h)=>re.cloneElement(f,{swiper:t,style:s,key:f.props.virtualIndex||f.key||`slide-${h}`}))}function Tl(t,e){return typeof window>"u"?L.useEffect(t,e):L.useLayoutEffect(t,e)}const Vw=L.createContext(null),G3=L.createContext(null),eT=L.forwardRef(({className:t,tag:e="div",wrapperTag:n="div",children:r,onSwiper:s,...i}={},o)=>{let l=!1;const[c,u]=L.useState("swiper"),[f,h]=L.useState(null),[m,p]=L.useState(!1),x=L.useRef(!1),E=L.useRef(null),C=L.useRef(null),y=L.useRef(null),v=L.useRef(null),_=L.useRef(null),D=L.useRef(null),M=L.useRef(null),T=L.useRef(null),{params:S,passedParams:w,rest:N,events:A}=z3(i),{slides:I,slots:P}=H3(r),k=()=>{p(!m)};Object.assign(S.on,{_containerClasses(F,K){u(K)}});const B=()=>{Object.assign(S.on,A),l=!0;const F={...S};if(delete F.wrapperClass,C.current=new U0(F),C.current.virtual&&C.current.params.virtual.enabled){C.current.virtual.slides=I;const K={cache:!1,slides:I,renderExternal:h,renderExternalUpdate:!1};ra(C.current.params.virtual,K),ra(C.current.originalParams.virtual,K)}};E.current||B(),C.current&&C.current.on("_beforeBreakpoint",k);const z=()=>{l||!A||!C.current||Object.keys(A).forEach(F=>{C.current.on(F,A[F])})},W=()=>{!A||!C.current||Object.keys(A).forEach(F=>{C.current.off(F,A[F])})};L.useEffect(()=>()=>{C.current&&C.current.off("_beforeBreakpoint",k)}),L.useEffect(()=>{!x.current&&C.current&&(C.current.emitSlidesClasses(),x.current=!0)}),Tl(()=>{if(o&&(o.current=E.current),!!E.current)return C.current.destroyed&&B(),U3({el:E.current,nextEl:_.current,prevEl:D.current,paginationEl:M.current,scrollbarEl:T.current,swiper:C.current},S),s&&!C.current.destroyed&&s(C.current),()=>{C.current&&!C.current.destroyed&&C.current.destroy(!0,!1)}},[]),Tl(()=>{z();const F=B3(w,y.current,I,v.current,K=>K.key);return y.current=w,v.current=I,F.length&&C.current&&!C.current.destroyed&&F3({swiper:C.current,slides:I,passedParams:w,changedParams:F,nextEl:_.current,prevEl:D.current,scrollbarEl:T.current,paginationEl:M.current}),()=>{W()}}),Tl(()=>{$3(C.current)},[f]);function ee(){return S.virtual?q3(C.current,I,f):I.map((F,K)=>re.cloneElement(F,{swiper:C.current,swiperSlideIndex:K}))}return re.createElement(e,qd({ref:E,className:X2(`${c}${t?` ${t}`:""}`)},N),re.createElement(G3.Provider,{value:C.current},P["container-start"],re.createElement(n,{className:V3(S.wrapperClass)},P["wrapper-start"],ee(),P["wrapper-end"]),K2(S)&&re.createElement(re.Fragment,null,re.createElement("div",{ref:D,className:"swiper-button-prev"}),re.createElement("div",{ref:_,className:"swiper-button-next"})),Y2(S)&&re.createElement("div",{ref:T,className:"swiper-scrollbar"}),Q2(S)&&re.createElement("div",{ref:M,className:"swiper-pagination"}),P["container-end"]))});eT.displayName="Swiper";const tT=L.forwardRef(({tag:t="div",children:e,className:n="",swiper:r,zoom:s,lazy:i,virtualIndex:o,swiperSlideIndex:l,...c}={},u)=>{const f=L.useRef(null),[h,m]=L.useState("swiper-slide"),[p,x]=L.useState(!1);function E(_,D,M){D===f.current&&m(M)}Tl(()=>{if(typeof l<"u"&&(f.current.swiperSlideIndex=l),u&&(u.current=f.current),!(!f.current||!r)){if(r.destroyed){h!=="swiper-slide"&&m("swiper-slide");return}return r.on("_slideClass",E),()=>{r&&r.off("_slideClass",E)}}}),Tl(()=>{r&&f.current&&!r.destroyed&&m(r.getSlideClasses(f.current))},[r]);const C={isActive:h.indexOf("swiper-slide-active")>=0,isVisible:h.indexOf("swiper-slide-visible")>=0,isPrev:h.indexOf("swiper-slide-prev")>=0,isNext:h.indexOf("swiper-slide-next")>=0},y=()=>typeof e=="function"?e(C):e,v=()=>{x(!0)};return re.createElement(t,qd({ref:f,className:X2(`${h}${n?` ${n}`:""}`),"data-swiper-slide-index":o,onLoad:v},c),s&&re.createElement(Vw.Provider,{value:C},re.createElement("div",{className:"swiper-zoom-container","data-swiper-zoom":typeof s=="number"?s:void 0},y(),i&&!p&&re.createElement("div",{className:"swiper-lazy-preloader",ref:_=>{_&&(_.lazyPreloaderManaged=!0)}}))),!s&&re.createElement(Vw.Provider,{value:C},y(),i&&!p&&re.createElement("div",{className:"swiper-lazy-preloader",ref:_=>{_&&(_.lazyPreloaderManaged=!0)}})))});tT.displayName="SwiperSlide";const sc=({className:t})=>a.jsxs("svg",{viewBox:"0 0 569 546",fill:"currentColor",className:t,xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("circle",{cx:"362.59",cy:"204.59",r:"204.59"}),a.jsx("rect",{height:"545.8",width:"100",x:"0",y:"0"})]});function W3(t){const{effect:e,swiper:n,on:r,setTranslate:s,setTransition:i,overwriteParams:o,perspective:l,recreateShadows:c,getEffectParams:u}=t;r("beforeInit",()=>{if(n.params.effect!==e)return;n.classNames.push(`${n.params.containerModifierClass}${e}`),l&&l()&&n.classNames.push(`${n.params.containerModifierClass}3d`);const h=o?o():{};Object.assign(n.params,h),Object.assign(n.originalParams,h)}),r("setTranslate _virtualUpdated",()=>{n.params.effect===e&&s()}),r("setTransition",(h,m)=>{n.params.effect===e&&i(m)}),r("transitionEnd",()=>{if(n.params.effect===e&&c){if(!u||!u().slideShadows)return;n.slides.forEach(h=>{h.querySelectorAll(".swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left").forEach(m=>m.remove())}),c()}});let f;r("virtualUpdate",()=>{n.params.effect===e&&(n.slides.length||(f=!0),requestAnimationFrame(()=>{f&&n.slides&&n.slides.length&&(s(),f=!1)}))})}function K3(t,e){const n=z0(e);return n!==e&&(n.style.backfaceVisibility="hidden",n.style["-webkit-backface-visibility"]="hidden"),n}function Q3({swiper:t,duration:e,transformElements:n,allSlides:r}){const{activeIndex:s}=t;if(t.params.virtualTranslate&&e!==0){let i=!1,o;o=n,o.forEach(l=>{kM(l,()=>{if(i||!t||t.destroyed)return;i=!0,t.animating=!1;const c=new window.CustomEvent("transitionend",{bubbles:!0,cancelable:!0});t.wrapperEl.dispatchEvent(c)})})}}function Y3(t,e,n){const r=`swiper-slide-shadow${` swiper-slide-shadow-${t}`}`,s=z0(e);let i=s.querySelector(`.${r.split(" ").join(".")}`);return i||(i=Hd("div",r.split(" ")),s.append(i)),i}function X3({swiper:t,extendParams:e,on:n}){e({creativeEffect:{limitProgress:1,shadowPerProgress:!1,progressMultiplier:1,perspective:!0,prev:{translate:[0,0,0],rotate:[0,0,0],opacity:1,scale:1},next:{translate:[0,0,0],rotate:[0,0,0],opacity:1,scale:1}}});const r=o=>typeof o=="string"?o:`${o}px`;W3({effect:"creative",swiper:t,on:n,setTranslate:()=>{const{slides:o,wrapperEl:l,slidesSizesGrid:c}=t,u=t.params.creativeEffect,{progressMultiplier:f}=u,h=t.params.centeredSlides,m=IM(t);if(h){const p=c[0]/2-t.params.slidesOffsetBefore||0;l.style.transform=`translateX(calc(50% - ${p}px))`}for(let p=0;p0&&(T=u.prev,M=!0),_.forEach((k,B)=>{_[B]=`calc(${k}px + (${r(T.translate[B])} * ${Math.abs(C*f)}))`}),D.forEach((k,B)=>{let z=T.rotate[B]*Math.abs(C*f);D[B]=z}),x.style.zIndex=-Math.abs(Math.round(E))+o.length;const S=_.join(", "),w=`rotateX(${m(D[0])}deg) rotateY(${m(D[1])}deg) rotateZ(${m(D[2])}deg)`,N=y<0?`scale(${1+(1-T.scale)*y*f})`:`scale(${1-(1-T.scale)*y*f})`,A=y<0?1+(1-T.opacity)*y*f:1-(1-T.opacity)*y*f,I=`translate3d(${S}) ${w} ${N}`;if(M&&T.shadow||!M){let k=x.querySelector(".swiper-slide-shadow");if(!k&&T.shadow&&(k=Y3("creative",x)),k){const B=u.shadowPerProgress?C*(1/u.limitProgress):C;k.style.opacity=Math.min(Math.max(Math.abs(B),0),1)}}const P=K3(u,x);P.style.transform=I,P.style.opacity=A,T.origin&&(P.style.transformOrigin=T.origin)}},setTransition:o=>{const l=t.slides.map(c=>z0(c));l.forEach(c=>{c.style.transitionDuration=`${o}ms`,c.querySelectorAll(".swiper-slide-shadow").forEach(u=>{u.style.transitionDuration=`${o}ms`})}),Q3({swiper:t,duration:o,transformElements:l,allSlides:!0})},perspective:()=>t.params.creativeEffect.perspective,overwriteParams:()=>({watchSlidesProgress:!0,virtualTranslate:!t.params.cssMode})})}function nT({id:t,title:e,author:n,pageCount:r,thumbnail:s,manga:i,onSelect:o,onEdit:l,onDelete:c,isCategoryPlusEnabled:u,isSelected:f,onMouseDown:h,onMouseEnter:m,folderItemCount:p,folderThumbnails:x,hasSubfolders:E,isFolderAnimationEnabled:C=!0,currentSection:y,dragStateParams:v,hasAnySelection:_,onToggleSelect:D}){const[M,T]=L.useState(!1),[S,w]=L.useState(0),N=s?Ks(s):void 0,[A,I]=L.useState(null),[P,k]=L.useState(!0),[B,z]=L.useState(!1),ee=!!(i!=null&&i.is_folder&&e.toLowerCase().includes("patreon"))&&!(i!=null&&i.folder_id)&&!!(x&&x.length>=2);L.useEffect(()=>{let ne;if(!B||!C){i!=null&&i.is_folder&&x&&x.length>2&&k(!0);return}if(i!=null&&i.is_folder&&x&&x.length===2){const pe=()=>{w(O=>(O+1)%x.length)};pe(),ne=setInterval(pe,4e3)}if(A&&(i!=null&&i.is_folder)&&x&&x.length>2){const pe=()=>{k(!1),setTimeout(()=>{A==null||A.slideNext(600),setTimeout(()=>{k(!0)},700)},400)};pe(),ne=setInterval(pe,4500)}return()=>clearInterval(ne)},[i==null?void 0:i.is_folder,x,A,B]);const F=ne=>{ne.stopPropagation(),T(!0)},K=ne=>{ne.stopPropagation(),c==null||c(t),T(!1)},R=ne=>{ne.stopPropagation(),i&&(l==null||l(i))};return a.jsxs("div",{className:"group cursor-pointer flex flex-col w-full max-w-xs",children:[a.jsxs("div",{onMouseDown:h,onMouseEnter:ne=>{z(!0),m==null||m(ne)},onMouseLeave:()=>z(!1),onDragStart:ne=>{ne.preventDefault()},onClick:ne=>{v!=null&&v.hasDragged?ne.preventDefault():u||_?(ne.preventDefault(),D==null||D()):(ND(t),o==null||o(t))},className:`relative bg-black rounded-lg shadow-lg overflow-hidden transition-transform duration-300 hover:scale-[1.02] aspect-[2/3] ${f?"ring-4 ring-[#bb86fc]":""}`,children:[i!=null&&i.is_folder?a.jsx("div",{className:"w-full aspect-[2/3] relative flex items-center justify-center bg-gradient-to-br from-[#1a1a1a] to-[#2a2a2a] rounded-lg border-2 border-gray-800 transition-colors duration-300 overflow-hidden group-hover:border-purple-500/50",children:x&&x.length>0?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"absolute inset-0 w-full h-full bg-black flex items-center justify-center overflow-hidden pointer-events-none",children:y!=="flow"&&x.length>=2?a.jsx("div",{className:"w-full h-full bg-[#111] p-[3px] grid gap-[3px]",style:{gridTemplateColumns:"1fr 1fr",gridTemplateRows:x.length>=3?"1fr 1fr":"1fr"},children:x.slice(0,4).map((ne,pe)=>a.jsx("div",{className:`relative overflow-hidden bg-gray-900 rounded-[3px] ${x.length===3&&pe===0?"col-span-2":""}`,children:a.jsx(un,{src:Ks(ne)||"",alt:"Patreon Collage",aspectRatio:"auto",objectFit:"cover",className:"absolute inset-0 w-full h-full",imgClassName:"w-full h-full object-cover transition-transform duration-700 group-hover:scale-110"})},ne+pe))}):x.length>2?B&&C?a.jsx(eT,{onSwiper:I,effect:"creative",grabCursor:!1,centeredSlides:!0,slidesPerView:1,loop:x.length>2,allowTouchMove:!1,speed:600,creativeEffect:{limitProgress:2,prev:{shadow:!0,translate:["-65%",0,-300],rotate:[0,45,0]},next:{shadow:!0,translate:["65%",0,-300],rotate:[0,-45,0]}},modules:[X3],className:"w-full h-full flex items-center justify-center overflow-visible",children:x.map((ne,pe)=>a.jsx(tT,{style:{width:"100%",height:"100%"},className:"flex items-center justify-center overflow-visible",children:({isActive:O})=>a.jsx("div",{className:`w-full h-full transition-transform duration-[400ms] ease-in-out origin-center rounded-lg overflow-hidden shadow-2xl border-2 border-white/5 ${O&&P?"scale-100":"scale-[0.80]"}`,children:a.jsx(un,{src:Ks(ne)||"",alt:"Folder Cover",aspectRatio:"2/3",objectFit:"cover",className:"w-full h-full"})})},ne+pe))}):a.jsx(un,{src:Ks(x[0])||"",alt:"Folder Cover",aspectRatio:"2/3",objectFit:"cover",className:"w-full h-full",imgClassName:"transition-transform duration-700"}):x.length===2?x.map((ne,pe)=>a.jsx("div",{className:`absolute inset-0 w-full h-full transition-all duration-[600ms] ease-out ${pe===S?"opacity-100 scale-100 blur-0 z-10":"opacity-0 scale-110 blur-md z-0"} pointer-events-none`,children:a.jsx(un,{src:Ks(ne)||"",alt:"Folder Cover",aspectRatio:"2/3",objectFit:"cover",className:"w-full h-full",imgClassName:""})},ne+pe)):a.jsx(un,{src:Ks(x[0])||"",alt:"Folder Cover",aspectRatio:"2/3",objectFit:"cover",className:"w-full h-full",imgClassName:"transition-transform duration-700 group-hover:scale-110"})}),a.jsx("div",{className:"absolute inset-x-0 bottom-0 h-1/3 bg-gradient-to-t from-black/60 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300 pointer-events-none z-10"}),ee&&a.jsx("div",{className:"absolute inset-0 z-30 flex items-center justify-center pointer-events-none",children:a.jsxs("div",{className:"bg-gray-800/50 backdrop-blur-[8px] rounded-2xl w-[55%] aspect-square border border-white/10 shadow-[0_8px_32px_0_rgba(0,0,0,0.5)] flex flex-col items-center justify-center gap-2 sm:gap-3 transition-transform duration-500 group-hover:scale-105",children:[a.jsx(sc,{className:"w-[40%] h-[40%] text-white drop-shadow-[0_2px_4px_rgba(0,0,0,0.6)]"}),a.jsx("span",{className:"text-white font-bold text-[9px] sm:text-[11px] tracking-widest uppercase drop-shadow-[0_2px_4px_rgba(0,0,0,0.6)]",children:"Patreon"})]})}),!ee&&a.jsx("div",{className:"absolute bottom-2 right-2 z-20 flex items-center justify-center bg-gray-800/70 backdrop-blur-md rounded-lg p-1.5 border border-gray-500/50 shadow-xl transition-all duration-300 group-hover:bg-gray-700/80 group-hover:scale-110",children:E?a.jsxs("div",{className:"relative w-[20px] h-[20px]",children:[a.jsx(xr,{className:"absolute top-0 right-0 w-3.5 h-3.5 text-white/50"}),a.jsx(xr,{className:"absolute bottom-0 left-0 w-4 h-4 text-white drop-shadow-[0_0_5px_rgba(255,255,255,0.5)] fill-black/20"})]}):a.jsx(xr,{className:"w-4 h-4 text-white drop-shadow-[0_0_5px_rgba(255,255,255,0.5)]"})})]}):a.jsxs(a.Fragment,{children:[ee&&a.jsx("div",{className:"absolute inset-0 z-30 flex items-center justify-center pointer-events-none",children:a.jsxs("div",{className:"bg-gray-800/50 backdrop-blur-[8px] rounded-2xl w-[55%] aspect-square border border-white/10 shadow-[0_8px_32px_0_rgba(0,0,0,0.5)] flex flex-col items-center justify-center gap-2 sm:gap-3 transition-transform duration-500 group-hover:scale-105",children:[a.jsx(sc,{className:"w-[40%] h-[40%] text-white drop-shadow-[0_2px_4px_rgba(0,0,0,0.6)]"}),a.jsx("span",{className:"text-white font-bold text-[9px] sm:text-[11px] tracking-widest uppercase drop-shadow-[0_2px_4px_rgba(0,0,0,0.6)]",children:"Patreon"})]})}),!ee&&a.jsx("div",{className:"absolute bottom-2 right-2 z-20 flex items-center justify-center bg-gray-800/70 backdrop-blur-md rounded-lg p-1.5 border border-gray-500/50 shadow-xl transition-all duration-300 group-hover:bg-gray-700/80 group-hover:scale-110",children:E?a.jsxs("div",{className:"relative w-[20px] h-[20px]",children:[a.jsx(xr,{className:"absolute top-0 right-0 w-3.5 h-3.5 text-white/50"}),a.jsx(xr,{className:"absolute bottom-0 left-0 w-4 h-4 text-white drop-shadow-[0_0_5px_rgba(255,255,255,0.5)] fill-black/20"})]}):a.jsx(xr,{className:"w-4 h-4 text-white drop-shadow-[0_0_5px_rgba(255,255,255,0.5)]"})}),a.jsx("div",{className:"relative z-10 flex flex-col items-center justify-center opacity-30",children:!ee&&a.jsx(xr,{className:"w-16 h-16 text-gray-400 mb-2"})})]})}):N?a.jsxs(a.Fragment,{children:[a.jsx(un,{src:N,alt:e,aspectRatio:"2/3",objectFit:"cover",loading:"lazy",imgClassName:"group-hover:scale-110"}),a.jsx("div",{className:"absolute inset-x-0 bottom-0 h-1/3 bg-gradient-to-t from-black/60 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300 pointer-events-none"})]}):a.jsx("div",{className:"w-full aspect-[2/3] flex items-center justify-center text-white/40 bg-gradient-to-br from-gray-800 to-gray-900 rounded-lg group-hover:text-white/60",children:a.jsx(fa,{className:"w-12 h-12"})}),(i==null?void 0:i.is_folder)&&p!==void 0&&a.jsx("div",{className:"absolute bottom-2 left-2 flex gap-1 flex-wrap pointer-events-none items-end z-10",children:a.jsxs("div",{className:"bg-black/70 text-white text-xs px-2 py-1 rounded-md font-semibold opacity-0 group-hover:opacity-100 transition-opacity duration-300 shadow-md",children:[p," elementos"]})}),!(i!=null&&i.is_folder)&&a.jsxs("div",{className:"absolute bottom-2 left-2 flex gap-1 flex-wrap pointer-events-none items-end",children:[a.jsxs("div",{className:"bg-black/70 text-white text-xs px-2 py-1 rounded-md font-semibold opacity-0 group-hover:opacity-100 transition-opacity duration-300 shadow-md",children:[r," paginas"]}),(i==null?void 0:i.is_decensored)&&a.jsx("div",{className:"bg-black/70 text-white text-xs px-2 py-1 rounded-md font-semibold opacity-0 group-hover:opacity-100 transition-opacity duration-300 shadow-md",children:"Sin censura"}),(i==null?void 0:i.is_bn)&&a.jsx("div",{className:"bg-black/70 text-white text-xs px-2 py-1 rounded-md font-semibold opacity-0 group-hover:opacity-100 transition-opacity duration-300 shadow-md",children:"B/N"}),(i==null?void 0:i.is_color)&&a.jsx("div",{className:"bg-black/70 text-white text-xs px-2 py-1 rounded-md font-semibold opacity-0 group-hover:opacity-100 transition-opacity duration-300 shadow-md",children:"a color"})]}),(u||_)&&a.jsx("div",{className:`absolute top-2 left-2 w-6 h-6 rounded-md border-2 flex items-center justify-center transition-all ${f?"bg-[#bb86fc] border-[#bb86fc]":"bg-black/50 border-white/50 hover:border-white"}`,children:f&&a.jsx(dc,{className:"w-4 h-4 text-white"})}),!u&&!_&&a.jsxs("div",{className:"absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity duration-300 flex gap-1",children:[i&&l&&a.jsx("button",{onClick:R,className:"bg-black/60 hover:bg-purple-600 text-white p-1.5 rounded-full transition-colors backdrop-blur-sm",title:"Editar manga",children:a.jsx(J_,{className:"w-3 h-3"})}),c&&a.jsx("button",{onClick:F,className:"bg-black/60 hover:bg-red-600 text-white p-1.5 rounded-full transition-colors backdrop-blur-sm",title:"Eliminar manga",children:a.jsx(tn,{className:"w-3 h-3"})})]}),M&&a.jsxs("div",{className:"absolute inset-0 bg-black/80 backdrop-blur-sm flex flex-col items-center justify-center gap-3 rounded-lg z-20 animate-in fade-in duration-200",children:[a.jsx("p",{className:"text-white text-sm font-semibold text-center px-3",children:"Eliminar manga?"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:ne=>{ne.stopPropagation(),T(!1)},className:"bg-gray-600 hover:bg-gray-700 text-white px-3 py-1.5 rounded-md text-xs font-semibold transition-all duration-200 transform hover:scale-105 active:scale-95",children:"Cancelar"}),a.jsx("button",{onClick:K,className:"bg-red-600 hover:bg-red-700 text-white px-3 py-1.5 rounded-md text-xs font-semibold transition-all duration-200 transform hover:scale-105 active:scale-95",children:"Eliminar"})]})]})]}),a.jsxs("div",{className:"mt-1 sm:mt-2 flex flex-col gap-0.5 text-center mb-2",children:[a.jsx("h3",{onClick:()=>o==null?void 0:o(t),className:"font-semibold text-xs sm:text-sm text-white line-clamp-2 cursor-pointer text-center group-hover:text-purple-400 transition-colors duration-300 ease-out",children:e}),n&&n.trim()!==""&&n.toLowerCase()!=="anónimo"&&n.toLowerCase()!=="anonimo"&&a.jsx("p",{className:"text-xs text-gray-400 text-center group-hover:text-gray-300 transition-colors duration-300 ease-out",children:n})]})]})}function J3({id:t,onBack:e,onNavigateToManga:n,onMangaLoaded:r,onSelectCategory:s,onSelectAuthor:i,isAdmin:o=!1}){var H,X,se,de,Le;const[l,c]=L.useState(null),[u,f]=L.useState(!0),[h,m]=L.useState(!1),[p,x]=L.useState(0),[E,C]=L.useState(!1),[y,v]=L.useState(!1),[_,D]=L.useState(!1),[M,T]=L.useState(0),[S,w]=L.useState(!1),[N,A]=L.useState({name:"",url:""}),[I,P]=L.useState([]),[k,B]=L.useState("portrait"),[z,W]=L.useState("vertical"),[ee,F]=L.useState(!1),[K,R]=L.useState(0),[ne,pe]=L.useState([]),[O,Q]=L.useState(!1),[oe,le]=L.useState(""),[Ie,te]=L.useState([]),[it,pt]=L.useState(!1),[Ot,st]=L.useState(!1),[yt,Vt]=L.useState(1),[_n,xt]=L.useState(1),tt=6,Bn=()=>xt($=>Math.min($+.25,3)),Ue=()=>xt($=>Math.max($-.25,.5)),vt=()=>xt(1);L.useEffect(()=>{wt();const $=SD(t,me=>{me&&(c(()=>me),f(!1))});Pn(),le("");const J=localStorage.getItem("manga-view-mode");return(J==="vertical"||J==="gallery"||J==="grid")&&W(J),()=>$()},[t]);async function Pn(){try{pt(!0);const $=await Mh();te($)}catch($){console.error("Error loading all mangas:",$)}finally{pt(!1)}}L.useEffect(()=>{function $(J){const me=J.target;E&&!me.closest(".download-menu-container")&&C(!1),y&&!me.closest(".pdf-menu-container")&&v(!1)}return document.addEventListener("mousedown",$),()=>document.removeEventListener("mousedown",$)},[E,y]);const jt=async()=>{if(N.name.trim()&&N.url.trim()&&l)try{await CD(l.id,N),P([...I,N]),A({name:"",url:""}),w(!1)}catch($){console.error("Error al guardar el enlace:",$),alert("Error al guardar el enlace")}},on=async $=>{if(l)try{await AD(l.id,$),P(I.filter((J,me)=>me!==$))}catch(J){console.error("Error al eliminar el enlace:",J),alert("Error al eliminar el enlace")}},fn=$=>{W($),localStorage.setItem("manga-view-mode",$)};async function wt(){try{f(!0);const $=await Ni(t);if($){if(c($),P($.external_links||[]),$.cover_url)try{const J=await GI($.cover_url);B(J)}catch(J){console.warn("Failed to detect image orientation:",J),B("portrait")}G($)}}catch($){console.error("Error loading manga:",$)}finally{}}async function G($){var J;try{Q(!0);const me=((J=$.categories)==null?void 0:J.map(Ee=>Ee.id))||[],ge=await jD($.id,me,$.title);pe(ge),Vt(1)}catch(me){console.error("Error loading recommendations:",me)}finally{Q(!1)}}async function ie($){const J=(l==null?void 0:l.id)||t;if(!J){alert("Error: ID no encontrado.");return}const me=J;console.log(`🚀 [CLIENTE] Suscribiendo a progreso: ${me}`);const ge=new EventSource(`/api/download/progress/${me}`);ge.onmessage=Ee=>{const Ve=JSON.parse(Ee.data);x(Ve.progress),Ve.progress>=100&&ge.close()};try{console.log("🚀 [CLIENTE] Iniciando descarga para ID:",J),m(!0),C(!1),x(0);const Ee=await fetch("/api/download/zip",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mangaId:J,mangaTitle:(l==null?void 0:l.title)||"Descarga",format:$,jobId:me})});if(!Ee.ok)throw new Error("Error en el servidor");const Ve=await Ee.blob(),Be=window.URL.createObjectURL(Ve),De=document.createElement("a");De.href=Be,De.download=`${(l==null?void 0:l.title)||"manga"}.zip`,document.body.appendChild(De),De.click(),De.remove(),window.URL.revokeObjectURL(Be),console.log("✅ [CLIENTE] Descarga disparada con éxito")}catch(Ee){console.error("❌ Error en la descarga:",Ee),alert("Hubo un fallo en la matriz de descarga.")}finally{m(!1),ge.close()}}async function _e($){const J=(l==null?void 0:l.id)||t;if(!J){alert("Error: ID no encontrado.");return}const me=J;console.log(`🚀 [CLIENTE] Suscribiendo a progreso PDF: ${me}`);const ge=new EventSource(`/api/download/progress/${me}`);ge.onmessage=Ee=>{const Ve=JSON.parse(Ee.data);Ve.progress&&T(Ve.progress),Ve.progress>=100&&ge.close()};try{console.log("🚀 [CLIENTE] Iniciando PDF para ID:",J),D(!0),T(0),v(!1);const Ee=await fetch("/api/download/pdf",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mangaId:J,mangaTitle:(l==null?void 0:l.title)||"Descarga",format:$,jobId:me})});if(!Ee.ok)throw new Error("Error en el servidor al generar PDF");const Ve=await Ee.blob(),Be=window.URL.createObjectURL(Ve),De=document.createElement("a");De.href=Be,De.download=`${(l==null?void 0:l.title)||"manga"}.pdf`,document.body.appendChild(De),De.click(),De.remove(),window.URL.revokeObjectURL(Be),console.log("✅ [CLIENTE] PDF descargado con éxito")}catch(Ee){console.error("Error initiating PDF generation:",Ee),alert("Error al generar PDF (puede que el archivo sea muy grande o Python falló).")}finally{D(!1),ge.close()}}if(u)return a.jsxs("div",{className:"h-screen bg-[#121212] flex flex-col items-center justify-center gap-4",children:[a.jsx(Sr,{size:40,borderWidth:2}),a.jsx("div",{className:"text-gray-400 text-sm",children:"Cargando..."})]});if(!l)return a.jsx("div",{className:"h-screen bg-[#121212] flex items-center justify-center",children:a.jsx("div",{className:"text-gray-400 text-lg",children:"Manga no encontrado"})});const Se=oe.trim()?Ie.filter($=>{var Ve;if(!$.id||!$.title||$.id===l.id)return!1;const J=oe.toLowerCase(),me=$.title.toLowerCase().includes(J),ge=$.author?$.author.toLowerCase().includes(J):!1,Ee=((Ve=$.categories)==null?void 0:Ve.some(Be=>{var De;return(De=Be==null?void 0:Be.name)==null?void 0:De.toLowerCase().includes(J)}))||!1;return me||ge||Ee}):[];return a.jsxs("div",{className:"h-screen flex flex-col bg-[#121212] overflow-hidden",children:[a.jsx("header",{className:"border-b border-gray-800 z-40 bg-[#121212] flex-shrink-0",children:a.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 py-3 sm:py-4 flex items-center gap-3 sm:gap-4",children:[a.jsx("button",{onClick:e,className:"p-2 hover:bg-[#333] rounded-lg transition-colors text-gray-300 hover:text-white flex-shrink-0",children:a.jsx(Is,{className:"w-5 h-5"})}),a.jsx("h1",{className:"text-base sm:text-lg font-bold text-white truncate flex-shrink-0",children:l.title}),a.jsx("div",{className:"flex-1 max-w-md ml-auto",children:a.jsxs("div",{className:"relative",children:[a.jsx(no,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400"}),a.jsx("input",{type:"text",placeholder:"Buscar comics…",value:oe,onChange:$=>le($.target.value),className:"w-full bg-[#1a1a1a] text-white rounded-lg pl-10 pr-3 py-2 text-sm placeholder-gray-400 focus:ring-2 focus:ring-[#bb86fc] focus:outline-none transition-all border border-gray-700/50 focus:border-[#bb86fc]"})]})})]})}),a.jsxs("main",{className:"flex-1 overflow-y-auto bg-[#121212]",children:[a.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 py-4 sm:py-8",children:[!oe.trim()&&a.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 sm:gap-6",children:[a.jsx("div",{className:"flex-shrink-0 mx-auto sm:mx-0",children:a.jsx("div",{className:"group w-56 sm:w-64",children:a.jsx("div",{className:"relative bg-black rounded-lg shadow-lg overflow-hidden transition-transform duration-300 hover:scale-[1.02]",children:l.cover_url?a.jsxs(a.Fragment,{children:[a.jsx(un,{src:l.cover_url,alt:l.title,aspectRatio:"2/3",objectFit:"cover",loading:"eager",imgClassName:"group-hover:scale-110"}),a.jsx("div",{className:"absolute inset-x-0 bottom-0 h-1/3 bg-gradient-to-t from-black/60 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300 ease-in-out pointer-events-none"})]}):a.jsx("div",{className:"w-full aspect-[2/3] flex items-center justify-center text-white/40 bg-black",children:a.jsx(Vx,{className:"w-16 h-16"})})})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("h2",{className:"text-2xl sm:text-4xl font-bold text-white mb-3 sm:mb-4",children:l.title}),a.jsx("div",{className:"mb-4",children:a.jsxs("div",{className:"flex items-center gap-2 text-gray-300",children:[l.author&&l.author.toLowerCase()!=="anónimo"&&l.author.toLowerCase()!=="anonimo"&&a.jsxs(a.Fragment,{children:[a.jsx(Lg,{className:"w-4 h-4 text-[#bb86fc]"}),a.jsx("button",{onClick:()=>i==null?void 0:i(l.author),className:"text-sm hover:text-[#bb86fc] hover:underline transition-colors",children:l.author}),a.jsx("div",{className:"w-1 h-1 bg-gray-600 rounded-full mx-2"})]}),a.jsx(Wp,{className:"w-4 h-4 text-[#bb86fc]"}),a.jsxs("span",{className:"text-sm",children:[((H=l.views)==null?void 0:H.toLocaleString())||0," vistas"]})]})}),a.jsxs("div",{className:"mb-6",children:[a.jsx("h3",{className:"text-sm font-semibold text-gray-300 mb-3",children:"Categorías"}),a.jsx("div",{className:"flex gap-2 flex-wrap",children:(X=l.categories)==null?void 0:X.sort(($,J)=>{const me={series:1,character:2,genre:3,tag:4,other:5},ge=$.type||"genre",Ee=J.type||"genre";return(me[ge]||5)-(me[Ee]||5)}).map($=>{let J="bg-[#bb86fc]/20 text-[#bb86fc] border-[#bb86fc]/40";return $.type==="character"?J="bg-blue-500/20 text-blue-300 border-blue-500/30":$.type==="series"?J="bg-green-500/20 text-green-300 border-green-500/30":$.type==="tag"&&(J="bg-pink-500/20 text-pink-300 border-pink-500/30"),a.jsx("button",{onClick:()=>s==null?void 0:s($.name),className:`px-3 py-1.5 text-xs rounded-full border ${J} hover:opacity-80 transition-opacity cursor-pointer`,children:$.name},$.id)})})]}),l.description&&l.description.trim()!==""&&a.jsxs("div",{className:"mb-6",children:[a.jsx("h3",{className:"text-sm font-semibold text-gray-300 mb-2",children:"Sinopsis"}),a.jsx("p",{className:"text-sm text-gray-400 leading-relaxed whitespace-pre-wrap",children:l.description})]}),a.jsx("div",{className:"flex flex-col gap-3 sm:gap-4",children:l.chapters&&l.chapters.length>0&&l.chapters[0].pages&&l.chapters[0].pages.length>0&&a.jsxs(a.Fragment,{children:[h&&a.jsxs("div",{className:"w-full",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("span",{className:"text-xs sm:text-sm font-semibold text-[#bb86fc]",children:"Descargando ZIP"}),a.jsxs("span",{className:"text-xs sm:text-sm font-bold text-[#bb86fc]",children:[p,"%"]})]}),a.jsx("div",{className:"w-full bg-gray-700/40 rounded-full h-2 overflow-hidden border border-[#bb86fc]/30",children:a.jsx("div",{className:"bg-gradient-to-r from-[#bb86fc] to-[#9966dd] h-full transition-all duration-300 ease-out",style:{width:`${p}%`}})})]}),_&&a.jsxs("div",{className:"w-full",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("span",{className:"text-xs sm:text-sm font-semibold text-[#bb86fc]",children:"Generando PDF"}),a.jsxs("span",{className:"text-xs sm:text-sm font-bold text-[#bb86fc]",children:[M,"%"]})]}),a.jsx("div",{className:"w-full bg-gray-700/40 rounded-full h-2 overflow-hidden border border-[#bb86fc]/30",children:a.jsx("div",{className:"bg-gradient-to-r from-[#bb86fc] to-[#9966dd] h-full transition-all duration-300 ease-out",style:{width:`${M}%`}})})]}),a.jsxs("div",{className:"flex flex-wrap gap-2 items-center",children:[a.jsxs("div",{className:"relative download-menu-container",children:[a.jsxs("button",{onClick:()=>C(!E),disabled:h,className:"bg-[#121212] hover:bg-[#1f1f1f] border border-[#bb86fc]/50 hover:border-[#bb86fc] text-[#bb86fc] px-2 sm:px-3 py-1.5 sm:py-2 rounded-lg flex items-center gap-1 font-semibold text-xs sm:text-sm transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed",children:[a.jsx(Ja,{className:"w-3 h-3 sm:w-4 sm:h-4 flex-shrink-0"}),a.jsx("span",{className:"hidden sm:inline",children:h?`Descargando (${p}%)`:"ZIP"}),a.jsx("span",{className:"sm:hidden",children:"ZIP"})]}),E&&!h&&a.jsxs("div",{className:"absolute top-full mt-2 left-0 bg-[#1f1f1f] border border-gray-700/60 rounded-lg shadow-2xl shadow-black/50 overflow-hidden z-50 min-w-[200px]",children:[a.jsxs("button",{onClick:()=>ie("original"),className:"w-full px-3 py-2 text-left text-xs sm:text-sm text-white hover:bg-[#bb86fc]/20 transition-colors flex items-center gap-2 border-b border-gray-700/40",children:[a.jsx(Ja,{className:"w-3 h-3 text-[#bb86fc]"}),a.jsxs("div",{children:[a.jsx("div",{className:"font-semibold",children:"Original"}),a.jsx("div",{className:"text-xs text-gray-400",children:"Sin cambios"})]})]}),a.jsxs("button",{onClick:()=>ie("webp"),className:"w-full px-3 py-2 text-left text-xs sm:text-sm text-white hover:bg-[#bb86fc]/20 transition-colors flex items-center gap-2 border-b border-gray-700/40",children:[a.jsx(Ja,{className:"w-3 h-3 text-[#bb86fc]"}),a.jsxs("div",{children:[a.jsx("div",{className:"font-semibold",children:"WebP"}),a.jsx("div",{className:"text-xs text-gray-400",children:"Optimizado"})]})]}),a.jsxs("button",{onClick:()=>ie("png"),className:"w-full px-3 py-2 text-left text-xs sm:text-sm text-white hover:bg-[#bb86fc]/20 transition-colors flex items-center gap-2 border-b border-gray-700/40",children:[a.jsx(Ja,{className:"w-3 h-3 text-[#bb86fc]"}),a.jsxs("div",{children:[a.jsx("div",{className:"font-semibold",children:"PNG"}),a.jsx("div",{className:"text-xs text-gray-400",children:"Sin pérdida"})]})]}),a.jsxs("button",{onClick:()=>ie("jpg"),className:"w-full px-3 py-2 text-left text-xs sm:text-sm text-white hover:bg-[#bb86fc]/20 transition-colors flex items-center gap-2",children:[a.jsx(Ja,{className:"w-3 h-3 text-[#bb86fc]"}),a.jsxs("div",{children:[a.jsx("div",{className:"font-semibold",children:"JPG"}),a.jsx("div",{className:"text-xs text-gray-400",children:"Comprimido"})]})]})]})]}),a.jsxs("div",{className:"relative pdf-menu-container",children:[a.jsxs("button",{onClick:()=>v(!y),disabled:_,className:"bg-[#121212] hover:bg-[#1f1f1f] border border-[#bb86fc]/50 hover:border-[#bb86fc] text-[#bb86fc] px-2 sm:px-3 py-1.5 sm:py-2 rounded-lg flex items-center gap-1 font-semibold text-xs sm:text-sm transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed",children:[a.jsx(Za,{className:"w-3 h-3 sm:w-4 sm:h-4 flex-shrink-0"}),a.jsx("span",{className:"hidden sm:inline",children:_?`Generando (${M}%)`:"PDF"}),a.jsx("span",{className:"sm:hidden",children:"PDF"})]}),y&&!_&&a.jsxs("div",{className:"absolute top-full mt-2 left-0 bg-[#1f1f1f] border border-gray-700/60 rounded-lg shadow-2xl shadow-black/50 overflow-hidden z-50 min-w-[200px]",children:[a.jsxs("button",{onClick:()=>_e("original"),className:"w-full px-3 py-2 text-left text-xs sm:text-sm text-white hover:bg-[#bb86fc]/20 transition-colors flex items-center gap-2 border-b border-gray-700/40",children:[a.jsx(Za,{className:"w-3 h-3 text-[#bb86fc]"}),a.jsxs("div",{children:[a.jsx("div",{className:"font-semibold",children:"Original"}),a.jsx("div",{className:"text-xs text-gray-400",children:"Sin cambios"})]})]}),a.jsxs("button",{onClick:()=>_e("webp"),className:"w-full px-3 py-2 text-left text-xs sm:text-sm text-white hover:bg-[#bb86fc]/20 transition-colors flex items-center gap-2 border-b border-gray-700/40",children:[a.jsx(Za,{className:"w-3 h-3 text-[#bb86fc]"}),a.jsxs("div",{children:[a.jsx("div",{className:"font-semibold",children:"WebP"}),a.jsx("div",{className:"text-xs text-gray-400",children:"Optimizado"})]})]}),a.jsxs("button",{onClick:()=>_e("png"),className:"w-full px-3 py-2 text-left text-xs sm:text-sm text-white hover:bg-[#bb86fc]/20 transition-colors flex items-center gap-2 border-b border-gray-700/40",children:[a.jsx(Za,{className:"w-3 h-3 text-[#bb86fc]"}),a.jsxs("div",{children:[a.jsx("div",{className:"font-semibold",children:"PNG"}),a.jsx("div",{className:"text-xs text-gray-400",children:"Sin pérdida"})]})]}),a.jsxs("button",{onClick:()=>_e("jpg"),className:"w-full px-3 py-2 text-left text-xs sm:text-sm text-white hover:bg-[#bb86fc]/20 transition-colors flex items-center gap-2",children:[a.jsx(Za,{className:"w-3 h-3 text-[#bb86fc]"}),a.jsxs("div",{children:[a.jsx("div",{className:"font-semibold",children:"JPG"}),a.jsx("div",{className:"text-xs text-gray-400",children:"Comprimido"})]})]})]})]}),a.jsxs("button",{onClick:()=>{l!=null&&l.id&&(window.location.hash=`manga/${l.id}/hd`)},className:"bg-[#121212] hover:bg-[#1f1f1f] border border-[#bb86fc]/50 hover:border-[#bb86fc] text-[#bb86fc] px-2 sm:px-3 py-1.5 sm:py-2 rounded-lg flex items-center gap-1 font-semibold text-xs sm:text-sm transition-all duration-200",children:[a.jsx(Wp,{className:"w-3 h-3 sm:w-4 sm:h-4 flex-shrink-0"}),a.jsx("span",{className:"hidden sm:inline",children:"Ver HD"}),a.jsx("span",{className:"sm:hidden",children:"HD"})]}),a.jsxs("button",{onClick:async()=>{try{await navigator.clipboard.writeText(l.id),st(!0),setTimeout(()=>st(!1),2e3),window.open("https://t.me/twistedbrodymangaflowbot","_blank")}catch($){console.error("Failed to copy:",$)}},className:"bg-[#121212] hover:bg-[#1f1f1f] border border-[#bb86fc]/50 hover:border-[#bb86fc] text-[#bb86fc] px-2 sm:px-3 py-1.5 sm:py-2 rounded-lg flex items-center gap-1 font-semibold text-xs sm:text-sm transition-all duration-200",children:[Ot?a.jsx(dc,{className:"w-3 h-3 sm:w-4 sm:h-4 flex-shrink-0"}):a.jsx(zI,{className:"w-3 h-3 sm:w-4 sm:h-4 flex-shrink-0"}),a.jsx("span",{className:"hidden sm:inline",children:Ot?"ID Copiado":"Bot Telegram"}),a.jsx("span",{className:"sm:hidden",children:Ot?"Copiado":"Bot"})]}),I.map(($,J)=>a.jsxs("a",{href:$.url,target:"_blank",rel:"noopener noreferrer",className:"bg-[#121212] hover:bg-[#1f1f1f] border border-[#bb86fc]/50 hover:border-[#bb86fc] text-[#bb86fc] px-2 sm:px-3 py-1.5 sm:py-2 rounded-lg flex items-center gap-1.5 font-semibold text-xs sm:text-sm transition-all duration-200 group",children:[a.jsx(xd,{className:"w-3 h-3 sm:w-4 sm:h-4 flex-shrink-0"}),a.jsx("span",{className:"truncate max-w-[150px]",children:$.name}),o&&a.jsx("button",{onClick:me=>{me.preventDefault(),me.stopPropagation(),on(J)},className:"opacity-0 group-hover:opacity-100 hover:text-red-400 transition-all flex-shrink-0",children:a.jsx(gt,{className:"w-3 h-3 sm:w-4 sm:h-4"})})]},J)),o&&a.jsx("button",{onClick:()=>w(!0),className:"bg-[#121212] hover:bg-[#1f1f1f] border border-[#bb86fc]/50 hover:border-[#bb86fc] text-[#bb86fc] p-1.5 sm:p-2 rounded-lg transition-all duration-200 flex items-center justify-center",title:"Añadir enlace externo",children:a.jsx(Kr,{className:"w-4 h-4 sm:w-5 sm:h-5"})})]})]})})]})]}),oe.trim()?a.jsxs("div",{className:"mt-2",children:[a.jsxs("h3",{className:"text-lg font-semibold text-white mb-4",children:["Resultados de búsqueda",Se.length>0&&a.jsxs("span",{className:"text-sm text-gray-400 ml-2",children:["(",Se.length," ",Se.length===1?"resultado":"resultados",")"]})]}),it?a.jsx("div",{className:"flex justify-center py-12",children:a.jsx(Sr,{size:40,borderWidth:2})}):Se.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[a.jsx(no,{className:"w-12 h-12 text-gray-600 mb-3"}),a.jsxs("p",{className:"text-gray-400 text-sm",children:['No se encontraron comics que coincidan con "',oe,'"']})]}):a.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 gap-1.5 sm:gap-2 md:gap-3",children:Se.map($=>{var me,ge;if(!$.id||!$.title)return null;(me=$.chapters)!=null&&me.length;const J=((ge=$.chapters)==null?void 0:ge.reduce((Ee,Ve)=>{var Be;return Ee+(((Be=Ve.pages)==null?void 0:Be.length)||0)},0))||0;return a.jsx(nT,{id:$.id,title:$.title,author:$.author||"Desconocido",pageCount:J,thumbnail:$.cover_url||$.thumbnail_url||void 0,manga:$,onSelect:Ee=>{n&&(window.scrollTo({top:0,behavior:"smooth"}),n(Ee))}},$.id)})})]}):l.chapters&&l.chapters.length>0&&l.chapters[0].pages&&l.chapters[0].pages.length>0&&a.jsxs("div",{className:"mt-6 sm:mt-8 border-t border-gray-800 pt-6 sm:pt-8",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4 sm:mb-6",children:[a.jsx("h3",{className:"text-lg font-semibold text-white",children:"Páginas"}),a.jsxs("div",{className:"flex items-center gap-1 bg-[#0a0a0a] border border-gray-800 rounded-lg p-1",children:[a.jsxs("button",{onClick:()=>fn("vertical"),className:`px-3 py-2 rounded-md flex items-center gap-2 text-xs sm:text-sm font-medium transition-all duration-200 ${z==="vertical"?"bg-gradient-to-r from-[#bb86fc] to-[#9966dd] text-white shadow-lg shadow-[#bb86fc]/30":"text-gray-400 hover:text-white hover:bg-[#242424]"}`,title:"Vista vertical",children:[a.jsx(Xp,{className:"w-4 h-4"}),a.jsx("span",{className:"hidden sm:inline",children:"Vertical"})]}),a.jsxs("button",{onClick:()=>fn("gallery"),className:`px-3 py-2 rounded-md flex items-center gap-2 text-xs sm:text-sm font-medium transition-all duration-200 ${z==="gallery"?"bg-gradient-to-r from-[#bb86fc] to-[#9966dd] text-white shadow-lg shadow-[#bb86fc]/30":"text-gray-400 hover:text-white hover:bg-[#242424]"}`,title:"Vista galería",children:[a.jsx(Kp,{className:"w-4 h-4"}),a.jsx("span",{className:"hidden sm:inline",children:"Galería"})]}),a.jsxs("button",{onClick:()=>fn("grid"),className:`px-3 py-2 rounded-md flex items-center gap-2 text-xs sm:text-sm font-medium transition-all duration-200 ${z==="grid"?"bg-gradient-to-r from-[#bb86fc] to-[#9966dd] text-white shadow-lg shadow-[#bb86fc]/30":"text-gray-400 hover:text-white hover:bg-[#242424]"}`,title:"Vista cuadrícula",children:[a.jsx(Qp,{className:"w-4 h-4"}),a.jsx("span",{className:"hidden sm:inline",children:"Cuadrícula"})]}),z==="vertical"&&a.jsxs("div",{className:"flex items-center gap-1 ml-2 border-l border-gray-700 pl-2",children:[a.jsx("button",{onClick:Ue,className:"p-2 text-gray-400 hover:text-white hover:bg-[#242424] rounded-md transition-colors",title:"Reducir",children:a.jsx(Vg,{className:"w-4 h-4"})}),a.jsxs("span",{className:"text-xs text-gray-300 w-8 text-center hidden sm:inline-block",children:[Math.round(_n*100),"%"]}),a.jsx("button",{onClick:Bn,className:"p-2 text-gray-400 hover:text-white hover:bg-[#242424] rounded-md transition-colors",title:"Aumentar",children:a.jsx(Og,{className:"w-4 h-4"})}),a.jsx("button",{onClick:vt,className:"p-2 text-gray-400 hover:text-white hover:bg-[#242424] rounded-md transition-colors",title:"Restablecer",children:a.jsx(Mg,{className:"w-3 h-3"})})]})]})]}),a.jsx("div",{className:`bg-[#121212] rounded-lg p-0 sm:p-4 transition-all duration-150 ease-out ${z==="vertical"?"flex flex-col items-center gap-0 sm:gap-4":z==="gallery"?"masonry-container":"grid grid-cols-3 md:grid-cols-5 gap-2"}`,children:z==="gallery"?l.chapters[0].pages.map(($,J)=>({pageUrl:$,index:J})).map(({pageUrl:$,index:J})=>a.jsx("div",{className:"masonry-item group cursor-pointer relative bg-black rounded-lg shadow-lg overflow-hidden transition-transform duration-300 hover:scale-[1.02]",onClick:()=>{R(J),F(!0)},children:a.jsx(un,{src:$,alt:`Página ${J+1}`,aspectRatio:"auto",objectFit:"contain",loading:J>2?"lazy":"eager",className:"rounded-lg",imgClassName:"group-hover:scale-110"})},J)):l.chapters[0].pages.map(($,J)=>({pageUrl:$,index:J})).map(({pageUrl:$,index:J})=>a.jsx("div",{className:z==="vertical"?"relative transition-all duration-200 mx-auto":"group cursor-pointer relative bg-black rounded-lg shadow-lg overflow-hidden transition-transform duration-300 hover:scale-[1.02]",style:z==="vertical"?{width:`${Math.min(100*_n,100)}%`,maxWidth:_n>1?"none":void 0}:void 0,onClick:()=>{z==="grid"&&(R(J),F(!0))},children:z==="vertical"?a.jsx(tE,{minHeight:"50vh",children:()=>a.jsx(un,{src:$,alt:`Página ${J+1}`,aspectRatio:"auto",objectFit:"contain",loading:"eager",className:"rounded-none sm:rounded-lg shadow-none sm:shadow-2xl w-full block",imgClassName:"w-full block"})}):a.jsx(un,{src:$,alt:`Página ${J+1}`,aspectRatio:"1/1",objectFit:"cover",loading:J>2?"lazy":"eager",className:"rounded-lg",imgClassName:"group-hover:scale-110"})},J))})]}),!oe.trim()&&ne.length>0&&a.jsxs("div",{className:"mt-8 sm:mt-12 border-t border-gray-800 pt-8 sm:pt-12",children:[a.jsx("h3",{className:"text-xl sm:text-2xl font-bold text-white mb-6",children:"Recomendaciones"}),O?a.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 gap-1.5 sm:gap-2 md:gap-3",children:Array.from({length:6}).map(($,J)=>a.jsxs("div",{className:"animate-pulse",children:[a.jsx("div",{className:"bg-gray-800 rounded-lg aspect-[2/3] w-full mb-2"}),a.jsx("div",{className:"h-3 bg-gray-800 rounded w-3/4 mx-auto mb-1"}),a.jsx("div",{className:"h-2 bg-gray-800 rounded w-1/2 mx-auto"})]},J))}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 gap-1.5 sm:gap-2 md:gap-3 mb-6 animate-slide-in-right",children:ne.slice((yt-1)*tt,yt*tt).map(($,J)=>{var me;return a.jsx("div",{children:a.jsxs("div",{onClick:()=>{window.scrollTo({top:0,behavior:"smooth"}),n&&n($.id)},className:"group cursor-pointer flex flex-col",children:[a.jsxs("div",{className:"relative bg-black rounded-lg shadow-lg overflow-hidden transition-transform duration-300 hover:scale-[1.02]",children:[$.cover_url||$.thumbnail_url?a.jsxs(a.Fragment,{children:[a.jsx(un,{src:$.cover_url||$.thumbnail_url||"",alt:$.title,aspectRatio:"2/3",objectFit:"cover",loading:"lazy",imgClassName:"group-hover:scale-110"}),a.jsx("div",{className:"absolute inset-x-0 bottom-0 h-1/3 bg-gradient-to-t from-black/60 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300 ease-in-out pointer-events-none"})]}):a.jsx("div",{className:"w-full aspect-[2/3] flex items-center justify-center text-white/40 bg-black",children:a.jsx(Vx,{className:"w-8 h-8"})}),a.jsxs("div",{className:"absolute bottom-2 left-2 flex gap-1 flex-wrap pointer-events-none items-end",children:[a.jsxs("div",{className:"bg-black/70 text-white text-[10px] sm:text-xs px-1.5 sm:px-2 py-0.5 sm:py-1 rounded font-semibold opacity-0 group-hover:opacity-100 transition-opacity duration-300 shadow-md",children:[((me=$.chapters)==null?void 0:me.reduce((ge,Ee)=>{var Ve;return ge+(((Ve=Ee.pages)==null?void 0:Ve.length)||0)},0))||0," paginas"]}),$.is_decensored&&a.jsx("div",{className:"bg-black/70 text-white text-[10px] sm:text-xs px-1.5 sm:px-2 py-0.5 sm:py-1 rounded font-semibold opacity-0 group-hover:opacity-100 transition-opacity duration-300 shadow-md",children:"Sin censura"}),$.is_bn&&a.jsx("div",{className:"bg-black/70 text-white text-[10px] sm:text-xs px-1.5 sm:px-2 py-0.5 sm:py-1 rounded font-semibold opacity-0 group-hover:opacity-100 transition-opacity duration-300 shadow-md",children:"B/N"}),$.is_color&&a.jsx("div",{className:"bg-black/70 text-white text-[10px] sm:text-xs px-1.5 sm:px-2 py-0.5 sm:py-1 rounded font-semibold opacity-0 group-hover:opacity-100 transition-opacity duration-300 shadow-md",children:"a color"})]})]}),a.jsxs("div",{className:"mt-2 flex flex-col gap-0.5",children:[a.jsx("h4",{className:"font-semibold text-xs text-white line-clamp-2 text-center group-hover:text-[#bb86fc] transition-colors duration-300",children:$.title}),$.categories&&$.categories.length>0&&a.jsx("p",{className:"text-xs text-gray-500 text-center truncate",children:($.categories.find(ge=>ge.type==="series")||$.categories[0]).name})]})]})},$.id)})},yt),ne.length>tt&&a.jsxs("div",{className:"flex items-center justify-center gap-2 mt-4 flex-wrap",children:[a.jsx("button",{onClick:()=>Vt(1),disabled:yt===1,className:"p-2 rounded-lg bg-[#1a1a1a] text-white hover:bg-[#bb86fc] disabled:opacity-50 disabled:hover:bg-[#1a1a1a] transition-colors",children:a.jsx(q_,{className:"w-4 h-4"})}),a.jsx("button",{onClick:()=>Vt($=>Math.max(1,$-1)),disabled:yt===1,className:"p-2 rounded-lg bg-[#1a1a1a] text-white hover:bg-[#bb86fc] disabled:opacity-50 disabled:hover:bg-[#1a1a1a] transition-colors",children:a.jsx(dh,{className:"w-4 h-4"})}),a.jsxs("span",{className:"text-sm text-gray-400 px-2",children:["Página ",yt," de ",Math.ceil(ne.length/tt)]}),a.jsx("button",{onClick:()=>Vt($=>Math.min(Math.ceil(ne.length/tt),$+1)),disabled:yt===Math.ceil(ne.length/tt),className:"p-2 rounded-lg bg-[#1a1a1a] text-white hover:bg-[#bb86fc] disabled:opacity-50 disabled:hover:bg-[#1a1a1a] transition-colors",children:a.jsx(hc,{className:"w-4 h-4"})}),a.jsx("button",{onClick:()=>Vt(Math.ceil(ne.length/tt)),disabled:yt===Math.ceil(ne.length/tt),className:"p-2 rounded-lg bg-[#1a1a1a] text-white hover:bg-[#bb86fc] disabled:opacity-50 disabled:hover:bg-[#1a1a1a] transition-colors",children:a.jsx(G_,{className:"w-4 h-4"})})]})]})]})]}),a.jsx(hh,{})]}),ee&&((de=(se=l.chapters)==null?void 0:se[0])==null?void 0:de.pages)&&a.jsx(eE,{images:((Le=l.chapters)==null?void 0:Le[0].pages)||[],initialIndex:K,onClose:()=>F(!1)}),S&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:a.jsxs("div",{className:"bg-gradient-to-b from-[#1f1f1f] to-[#121212] rounded-2xl border border-gray-700/40 w-full max-w-md shadow-2xl",children:[a.jsxs("div",{className:"bg-gradient-to-b from-[#2a2a2a]/80 to-[#1f1f1f]/80 border-b border-gray-700/30 px-6 py-4 flex items-center justify-between",children:[a.jsx("h2",{className:"text-xl font-bold text-white",children:"Añadir Enlace Externo"}),a.jsx("button",{onClick:()=>w(!1),className:"text-gray-500 hover:text-white transition-colors p-1.5 rounded-lg hover:bg-white/10",children:a.jsx(gt,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"p-6 space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-semibold text-gray-200 mb-2",children:"Nombre del Enlace"}),a.jsx("input",{type:"text",placeholder:"Ej: Servidor Alternativo",value:N.name,onChange:$=>A({...N,name:$.target.value}),className:"w-full bg-[#1a1a1a] border border-gray-600/50 rounded-lg px-4 py-3 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-[#bb86fc] focus:ring-2 focus:ring-[#bb86fc]/30 transition-all"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-semibold text-gray-200 mb-2",children:"URL del Enlace"}),a.jsx("input",{type:"url",placeholder:"https://ejemplo.com/descarga",value:N.url,onChange:$=>A({...N,url:$.target.value}),className:"w-full bg-[#1a1a1a] border border-gray-600/50 rounded-lg px-4 py-3 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-[#bb86fc] focus:ring-2 focus:ring-[#bb86fc]/30 transition-all"})]}),a.jsxs("div",{className:"flex gap-3 pt-2",children:[a.jsx("button",{onClick:()=>w(!1),className:"flex-1 bg-[#1a1a1a] border border-gray-600/50 hover:border-gray-500 hover:bg-[#242424] text-white px-4 py-3 rounded-lg font-semibold text-sm transition-all",children:"Cancelar"}),a.jsx("button",{onClick:jt,disabled:!N.name.trim()||!N.url.trim(),className:"flex-1 bg-gradient-to-r from-[#bb86fc] to-[#9966dd] hover:from-[#9966dd] hover:to-[#7744cc] disabled:opacity-50 disabled:cursor-not-allowed text-white px-4 py-3 rounded-lg font-semibold text-sm transition-all shadow-lg shadow-[#bb86fc]/40 hover:shadow-[#bb86fc]/60",children:"Añadir Enlace"})]})]})]})})]})}function Z3({manga:t,chapter:e,onBack:n}){const[r,s]=L.useState(0);if(!e.pages||e.pages.length===0)return a.jsxs("div",{className:"h-screen bg-[#121212] flex flex-col items-center justify-center",children:[a.jsx("button",{onClick:n,className:"absolute top-6 left-6 p-2 hover:bg-[#333] rounded-lg transition-colors text-gray-300 hover:text-white",children:a.jsx(Is,{className:"w-5 h-5"})}),a.jsx("div",{className:"text-gray-400 text-lg",children:"No hay páginas disponibles"})]});const i=()=>{r>0&&s(r-1)},o=()=>{r{const u=c<2,f=mM(l);return a.jsx("div",{className:"w-full flex justify-center",children:a.jsx(un,{src:f,alt:`Página ${c+1}`,aspectRatio:"auto",objectFit:"contain",loading:u?"eager":"lazy",className:"max-w-full shadow-2xl",showPlaceholder:c>0})},c)}),a.jsx("div",{className:"w-full mt-8",children:a.jsx(hh,{})})]})}),a.jsx("div",{className:"border-t border-gray-700/60 bg-gradient-to-r from-[#2a2a2a] to-[#252525] px-6 py-6 flex-shrink-0",children:a.jsxs("div",{className:"max-w-7xl mx-auto flex items-center justify-between",children:[a.jsxs("button",{onClick:i,disabled:r===0,className:"flex items-center gap-2 px-4 py-2 rounded-lg bg-gray-800 hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed text-white transition-all",children:[a.jsx(dh,{className:"w-5 h-5"}),"Anterior"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{type:"range",min:"0",max:e.pages.length-1,value:r,onChange:l=>s(parseInt(l.target.value)),className:"w-64 h-2 bg-gray-700 rounded-lg appearance-none cursor-pointer accent-[#bb86fc]"}),a.jsxs("span",{className:"text-sm text-gray-400 w-12 text-right",children:[r+1,"/",e.pages.length]})]}),a.jsxs("button",{onClick:o,disabled:r===e.pages.length-1,className:"flex items-center gap-2 px-4 py-2 rounded-lg bg-gray-800 hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed text-white transition-all",children:["Siguiente",a.jsx(hc,{className:"w-5 h-5"})]})]})})]})}const rT="settings",sT="info",e6=`# Bienvenid@ a Twisted Brody MangaFlow +¡Tu plataforma definitiva para la gestión y lectura de mangas! + +Este proyecto nació con la misión de ofrecer una experiencia de lectura fluida, moderna y sin interrupciones, diseñada por fans para fans. + +## 🌟 Características Principales + +* **⚡ Lectura sin límites:** Disfruta de una interfaz optimizada, rápida y responsiva. +* **📥 Descargas Flexibles:** Baja tus capítulos favoritos en formato **ZIP** o **PDF** para leer offline. +* **🔄 Conversión Inteligente:** Nuestro servidor procesa las imágenes para darte la mejor calidad y compatibilidad. + +## 🤝 Comunidad y Apoyo + +Este es un proyecto **sin fines de lucro**, desarrollado por pura pasión. + +Sin embargo, si valoras mi trabajo y quieres apoyarme para mantener el proyecto vivo, puedes suscribirte a mi **Patreon**. ¡Tu apoyo significa mucho! + +* [**💜 Apóyame en Patreon**](https://www.patreon.com/cw/Twistedbrody) + +### 💡 ¿Tienes nuevas ideas? +¡Quiero escucharlas! Si tienes sugerencias, feedback o ideas locas, háblame directamente: + +* **Telegram:** [@twistedbrodyoficial](https://t.me/twistedbrodyoficial) + +También puedes unirte a nuestros canales: +* [Canal Principal](https://t.me/twistedbrody) +* [Canal Hub](https://t.me/+CmmZFHM9hpViYzMx) +* [X (Twitter)](https://x.com/TwistedBrody) + +--- +> **Disclaimer:** Todo el contenido es propiedad de sus respectivos autores. Apoya el material original siempre que sea posible. + + +`;async function t6(t){const e=Nt(Ae,rT,sT),n={content:t,updatedAt:new Date().toISOString()};await QS(e,n)}function n6(t){const e=Nt(Ae,rT,sT);return N0(e,n=>{n.exists()?t(n.data()):t({content:e6,updatedAt:new Date().toISOString()})})}function r6(t,e){const n={};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const s6=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,i6=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,o6={};function Fw(t,e){return(o6.jsx?i6:s6).test(t)}const a6=/[ \t\n\f\r]/g;function l6(t){return typeof t=="object"?t.type==="text"?zw(t.value):!1:zw(t)}function zw(t){return t.replace(a6,"")===""}class Cc{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}Cc.prototype.normal={};Cc.prototype.property={};Cc.prototype.space=void 0;function iT(t,e){const n={},r={};for(const s of t)Object.assign(n,s.property),Object.assign(r,s.normal);return new Cc(n,r,e)}function Cm(t){return t.toLowerCase()}class nr{constructor(e,n){this.attribute=n,this.property=e}}nr.prototype.attribute="";nr.prototype.booleanish=!1;nr.prototype.boolean=!1;nr.prototype.commaOrSpaceSeparated=!1;nr.prototype.commaSeparated=!1;nr.prototype.defined=!1;nr.prototype.mustUseProperty=!1;nr.prototype.number=!1;nr.prototype.overloadedBoolean=!1;nr.prototype.property="";nr.prototype.spaceSeparated=!1;nr.prototype.space=void 0;let c6=0;const Fe=xo(),Kt=xo(),Am=xo(),ce=xo(),_t=xo(),sa=xo(),or=xo();function xo(){return 2**++c6}const jm=Object.freeze(Object.defineProperty({__proto__:null,boolean:Fe,booleanish:Kt,commaOrSpaceSeparated:or,commaSeparated:sa,number:ce,overloadedBoolean:Am,spaceSeparated:_t},Symbol.toStringTag,{value:"Module"})),Bf=Object.keys(jm);class B0 extends nr{constructor(e,n,r,s){let i=-1;if(super(e,n),Uw(this,"space",s),typeof r=="number")for(;++i4&&n.slice(0,4)==="data"&&p6.test(e)){if(e.charAt(4)==="-"){const i=e.slice(5).replace(Bw,y6);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=e.slice(4);if(!Bw.test(i)){let o=i.replace(f6,g6);o.charAt(0)!=="-"&&(o="-"+o),e="data"+o}}s=B0}return new s(r,e)}function g6(t){return"-"+t.toLowerCase()}function y6(t){return t.charAt(1).toUpperCase()}const x6=iT([oT,u6,cT,uT,dT],"html"),$0=iT([oT,d6,cT,uT,dT],"svg");function v6(t){return t.join(" ").trim()}var H0={},$w=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,w6=/\n/g,b6=/^\s*/,_6=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,E6=/^:\s*/,S6=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,T6=/^[;\s]*/,N6=/^\s+|\s+$/g,k6=` +`,Hw="/",qw="*",Ui="",I6="comment",C6="declaration";function A6(t,e){if(typeof t!="string")throw new TypeError("First argument must be a string");if(!t)return[];e=e||{};var n=1,r=1;function s(x){var E=x.match(w6);E&&(n+=E.length);var C=x.lastIndexOf(k6);r=~C?x.length-C:r+x.length}function i(){var x={line:n,column:r};return function(E){return E.position=new o(x),u(),E}}function o(x){this.start=x,this.end={line:n,column:r},this.source=e.source}o.prototype.content=t;function l(x){var E=new Error(e.source+":"+n+":"+r+": "+x);if(E.reason=x,E.filename=e.source,E.line=n,E.column=r,E.source=t,!e.silent)throw E}function c(x){var E=x.exec(t);if(E){var C=E[0];return s(C),t=t.slice(C.length),E}}function u(){c(b6)}function f(x){var E;for(x=x||[];E=h();)E!==!1&&x.push(E);return x}function h(){var x=i();if(!(Hw!=t.charAt(0)||qw!=t.charAt(1))){for(var E=2;Ui!=t.charAt(E)&&(qw!=t.charAt(E)||Hw!=t.charAt(E+1));)++E;if(E+=2,Ui===t.charAt(E-1))return l("End of comment missing");var C=t.slice(2,E-2);return r+=2,s(C),t=t.slice(E),r+=2,x({type:I6,comment:C})}}function m(){var x=i(),E=c(_6);if(E){if(h(),!c(E6))return l("property missing ':'");var C=c(S6),y=x({type:C6,property:Gw(E[0].replace($w,Ui)),value:C?Gw(C[0].replace($w,Ui)):Ui});return c(T6),y}}function p(){var x=[];f(x);for(var E;E=m();)E!==!1&&(x.push(E),f(x));return x}return u(),p()}function Gw(t){return t?t.replace(N6,Ui):Ui}var j6=A6,P6=Wu&&Wu.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(H0,"__esModule",{value:!0});H0.default=D6;const R6=P6(j6);function D6(t,e){let n=null;if(!t||typeof t!="string")return n;const r=(0,R6.default)(t),s=typeof e=="function";return r.forEach(i=>{if(i.type!=="declaration")return;const{property:o,value:l}=i;s?e(o,l,i):l&&(n=n||{},n[o]=l)}),n}var Oh={};Object.defineProperty(Oh,"__esModule",{value:!0});Oh.camelCase=void 0;var M6=/^--[a-zA-Z0-9_-]+$/,L6=/-([a-z])/g,O6=/^[^-]+$/,V6=/^-(webkit|moz|ms|o|khtml)-/,F6=/^-(ms)-/,z6=function(t){return!t||O6.test(t)||M6.test(t)},U6=function(t,e){return e.toUpperCase()},Ww=function(t,e){return"".concat(e,"-")},B6=function(t,e){return e===void 0&&(e={}),z6(t)?t:(t=t.toLowerCase(),e.reactCompat?t=t.replace(F6,Ww):t=t.replace(V6,Ww),t.replace(L6,U6))};Oh.camelCase=B6;var $6=Wu&&Wu.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},H6=$6(H0),q6=Oh;function Pm(t,e){var n={};return!t||typeof t!="string"||(0,H6.default)(t,function(r,s){r&&s&&(n[(0,q6.camelCase)(r,e)]=s)}),n}Pm.default=Pm;var G6=Pm;const W6=Kd(G6),hT=fT("end"),q0=fT("start");function fT(t){return e;function e(n){const r=n&&n.position&&n.position[t]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function K6(t){const e=q0(t),n=hT(t);if(e&&n)return{start:e,end:n}}function Nl(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?Kw(t.position):"start"in t||"end"in t?Kw(t):"line"in t||"column"in t?Rm(t):""}function Rm(t){return Qw(t&&t.line)+":"+Qw(t&&t.column)}function Kw(t){return Rm(t&&t.start)+"-"+Rm(t&&t.end)}function Qw(t){return t&&typeof t=="number"?t:1}class jn extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",i={},o=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof e=="string"?s=e:!i.cause&&e&&(o=!0,s=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?i.ruleId=r:(i.source=r.slice(0,c),i.ruleId=r.slice(c+1))}if(!i.place&&i.ancestors&&i.ancestors){const c=i.ancestors[i.ancestors.length-1];c&&(i.place=c.position)}const l=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=l?l.line:void 0,this.name=Nl(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=o&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}jn.prototype.file="";jn.prototype.name="";jn.prototype.reason="";jn.prototype.message="";jn.prototype.stack="";jn.prototype.column=void 0;jn.prototype.line=void 0;jn.prototype.ancestors=void 0;jn.prototype.cause=void 0;jn.prototype.fatal=void 0;jn.prototype.place=void 0;jn.prototype.ruleId=void 0;jn.prototype.source=void 0;const G0={}.hasOwnProperty,Q6=new Map,Y6=/[A-Z]/g,X6=new Set(["table","tbody","thead","tfoot","tr"]),J6=new Set(["td","th"]),pT="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Z6(t,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=e.filePath||void 0;let r;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=aL(n,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=oL(n,e.jsx,e.jsxs)}const s={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:r,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?$0:x6,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},i=mT(s,t,void 0);return i&&typeof i!="string"?i:s.create(t,s.Fragment,{children:i||void 0},void 0)}function mT(t,e,n){if(e.type==="element")return eL(t,e,n);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return tL(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return rL(t,e,n);if(e.type==="mdxjsEsm")return nL(t,e);if(e.type==="root")return sL(t,e,n);if(e.type==="text")return iL(t,e)}function eL(t,e,n){const r=t.schema;let s=r;e.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=$0,t.schema=s),t.ancestors.push(e);const i=yT(t,e.tagName,!1),o=lL(t,e);let l=K0(t,e);return X6.has(e.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!l6(c):!0})),gT(t,o,i,e),W0(o,l),t.ancestors.pop(),t.schema=r,t.create(e,i,o,n)}function tL(t,e){if(e.data&&e.data.estree&&t.evaluater){const r=e.data.estree.body[0];return r.type,t.evaluater.evaluateExpression(r.expression)}ic(t,e.position)}function nL(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);ic(t,e.position)}function rL(t,e,n){const r=t.schema;let s=r;e.name==="svg"&&r.space==="html"&&(s=$0,t.schema=s),t.ancestors.push(e);const i=e.name===null?t.Fragment:yT(t,e.name,!0),o=cL(t,e),l=K0(t,e);return gT(t,o,i,e),W0(o,l),t.ancestors.pop(),t.schema=r,t.create(e,i,o,n)}function sL(t,e,n){const r={};return W0(r,K0(t,e)),t.create(e,t.Fragment,r,n)}function iL(t,e){return e.value}function gT(t,e,n,r){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=r)}function W0(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function oL(t,e,n){return r;function r(s,i,o,l){const u=Array.isArray(o.children)?n:e;return l?u(i,o,l):u(i,o)}}function aL(t,e){return n;function n(r,s,i,o){const l=Array.isArray(i.children),c=q0(r);return e(s,i,o,l,{columnNumber:c?c.column-1:void 0,fileName:t,lineNumber:c?c.line:void 0},void 0)}}function lL(t,e){const n={};let r,s;for(s in e.properties)if(s!=="children"&&G0.call(e.properties,s)){const i=uL(t,s,e.properties[s]);if(i){const[o,l]=i;t.tableCellAlignToStyle&&o==="align"&&typeof l=="string"&&J6.has(e.tagName)?r=l:n[o]=l}}if(r){const i=n.style||(n.style={});i[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function cL(t,e){const n={};for(const r of e.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&t.evaluater){const i=r.data.estree.body[0];i.type;const o=i.expression;o.type;const l=o.properties[0];l.type,Object.assign(n,t.evaluater.evaluateExpression(l.argument))}else ic(t,e.position);else{const s=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&t.evaluater){const l=r.value.data.estree.body[0];l.type,i=t.evaluater.evaluateExpression(l.expression)}else ic(t,e.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function K0(t,e){const n=[];let r=-1;const s=t.passKeys?new Map:Q6;for(;++rs?0:s+e:e=e>s?s:e,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(e,n),t.splice(...o);else for(n&&t.splice(e,n);i0?(ls(t,t.length,0,e),t):e}const Jw={}.hasOwnProperty;function xL(t){const e={};let n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function ia(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Yr=Di(/[A-Za-z]/),dr=Di(/[\dA-Za-z]/),bL=Di(/[#-'*+\--9=?A-Z^-~]/);function Dm(t){return t!==null&&(t<32||t===127)}const Mm=Di(/\d/),_L=Di(/[\dA-Fa-f]/),EL=Di(/[!-/:-@[-`{-~]/);function Pe(t){return t!==null&&t<-2}function er(t){return t!==null&&(t<0||t===32)}function lt(t){return t===-2||t===-1||t===32}const SL=Di(new RegExp("\\p{P}|\\p{S}","u")),TL=Di(/\s/);function Di(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function Pa(t){const e=[];let n=-1,r=0,s=0;for(;++n55295&&i<57344){const l=t.charCodeAt(n+1);i<56320&&l>56319&&l<57344?(o=String.fromCharCode(i,l),s=1):o="�"}else o=String.fromCharCode(i);o&&(e.push(t.slice(r,n),encodeURIComponent(o)),r=n+s+1,o=""),s&&(n+=s,s=0)}return e.join("")+t.slice(r)}function Tt(t,e,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return o;function o(c){return lt(c)?(t.enter(n),l(c)):e(c)}function l(c){return lt(c)&&i++o))return;const S=e.events.length;let w=S,N,A;for(;w--;)if(e.events[w][0]==="exit"&&e.events[w][1].type==="chunkFlow"){if(N){A=e.events[w][1].end;break}N=!0}for(y(r),T=S;T_;){const M=n[D];e.containerState=M[1],M[0].exit.call(e,t)}n.length=_}function v(){s.write([null]),i=void 0,s=void 0,e.containerState._closeFlow=void 0}}function AL(t,e,n){return Tt(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function eb(t){if(t===null||er(t)||TL(t))return 1;if(SL(t))return 2}function Y0(t,e,n){const r=[];let s=-1;for(;++s1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const h={...t[r][1].end},m={...t[n][1].start};tb(h,-c),tb(m,c),o={type:c>1?"strongSequence":"emphasisSequence",start:h,end:{...t[r][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:m},i={type:c>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},s={type:c>1?"strong":"emphasis",start:{...o.start},end:{...l.end}},t[r][1].end={...o.start},t[n][1].start={...l.end},u=[],t[r][1].end.offset-t[r][1].start.offset&&(u=br(u,[["enter",t[r][1],e],["exit",t[r][1],e]])),u=br(u,[["enter",s,e],["enter",o,e],["exit",o,e],["enter",i,e]]),u=br(u,Y0(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),u=br(u,[["exit",i,e],["enter",l,e],["exit",l,e],["exit",s,e]]),t[n][1].end.offset-t[n][1].start.offset?(f=2,u=br(u,[["enter",t[n][1],e],["exit",t[n][1],e]])):f=0,ls(t,r-1,n-r+3,u),n=r+u.length-f-2;break}}for(n=-1;++n0&<(T)?Tt(t,v,"linePrefix",i+1)(T):v(T)}function v(T){return T===null||Pe(T)?t.check(nb,E,D)(T):(t.enter("codeFlowValue"),_(T))}function _(T){return T===null||Pe(T)?(t.exit("codeFlowValue"),v(T)):(t.consume(T),_)}function D(T){return t.exit("codeFenced"),e(T)}function M(T,S,w){let N=0;return A;function A(z){return T.enter("lineEnding"),T.consume(z),T.exit("lineEnding"),I}function I(z){return T.enter("codeFencedFence"),lt(z)?Tt(T,P,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z):P(z)}function P(z){return z===l?(T.enter("codeFencedFenceSequence"),k(z)):w(z)}function k(z){return z===l?(N++,T.consume(z),k):N>=o?(T.exit("codeFencedFenceSequence"),lt(z)?Tt(T,B,"whitespace")(z):B(z)):w(z)}function B(z){return z===null||Pe(z)?(T.exit("codeFencedFence"),S(z)):w(z)}}}function BL(t,e,n){const r=this;return s;function s(o){return o===null?n(o):(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),i)}function i(o){return r.parser.lazy[r.now().line]?n(o):e(o)}}const Hf={name:"codeIndented",tokenize:HL},$L={partial:!0,tokenize:qL};function HL(t,e,n){const r=this;return s;function s(u){return t.enter("codeIndented"),Tt(t,i,"linePrefix",5)(u)}function i(u){const f=r.events[r.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?o(u):n(u)}function o(u){return u===null?c(u):Pe(u)?t.attempt($L,o,c)(u):(t.enter("codeFlowValue"),l(u))}function l(u){return u===null||Pe(u)?(t.exit("codeFlowValue"),o(u)):(t.consume(u),l)}function c(u){return t.exit("codeIndented"),e(u)}}function qL(t,e,n){const r=this;return s;function s(o){return r.parser.lazy[r.now().line]?n(o):Pe(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s):Tt(t,i,"linePrefix",5)(o)}function i(o){const l=r.events[r.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?e(o):Pe(o)?s(o):n(o)}}const GL={name:"codeText",previous:KL,resolve:WL,tokenize:QL};function WL(t){let e=t.length-4,n=3,r,s;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(r=n;++r=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return ethis.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(e,n,r){const s=n||0;this.setCursor(Math.trunc(e));const i=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&tl(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),tl(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),tl(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e=4?e(o):t.interrupt(r.parser.constructs.flow,n,e)(o)}}function ST(t,e,n,r,s,i,o,l,c){const u=c||Number.POSITIVE_INFINITY;let f=0;return h;function h(y){return y===60?(t.enter(r),t.enter(s),t.enter(i),t.consume(y),t.exit(i),m):y===null||y===32||y===41||Dm(y)?n(y):(t.enter(r),t.enter(o),t.enter(l),t.enter("chunkString",{contentType:"string"}),E(y))}function m(y){return y===62?(t.enter(i),t.consume(y),t.exit(i),t.exit(s),t.exit(r),e):(t.enter(l),t.enter("chunkString",{contentType:"string"}),p(y))}function p(y){return y===62?(t.exit("chunkString"),t.exit(l),m(y)):y===null||y===60||Pe(y)?n(y):(t.consume(y),y===92?x:p)}function x(y){return y===60||y===62||y===92?(t.consume(y),p):p(y)}function E(y){return!f&&(y===null||y===41||er(y))?(t.exit("chunkString"),t.exit(l),t.exit(o),t.exit(r),e(y)):f999||p===null||p===91||p===93&&!c||p===94&&!l&&"_hiddenFootnoteSupport"in o.parser.constructs?n(p):p===93?(t.exit(i),t.enter(s),t.consume(p),t.exit(s),t.exit(r),e):Pe(p)?(t.enter("lineEnding"),t.consume(p),t.exit("lineEnding"),f):(t.enter("chunkString",{contentType:"string"}),h(p))}function h(p){return p===null||p===91||p===93||Pe(p)||l++>999?(t.exit("chunkString"),f(p)):(t.consume(p),c||(c=!lt(p)),p===92?m:h)}function m(p){return p===91||p===92||p===93?(t.consume(p),l++,h):h(p)}}function NT(t,e,n,r,s,i){let o;return l;function l(m){return m===34||m===39||m===40?(t.enter(r),t.enter(s),t.consume(m),t.exit(s),o=m===40?41:m,c):n(m)}function c(m){return m===o?(t.enter(s),t.consume(m),t.exit(s),t.exit(r),e):(t.enter(i),u(m))}function u(m){return m===o?(t.exit(i),c(o)):m===null?n(m):Pe(m)?(t.enter("lineEnding"),t.consume(m),t.exit("lineEnding"),Tt(t,u,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),f(m))}function f(m){return m===o||m===null||Pe(m)?(t.exit("chunkString"),u(m)):(t.consume(m),m===92?h:f)}function h(m){return m===o||m===92?(t.consume(m),f):f(m)}}function kl(t,e){let n;return r;function r(s){return Pe(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),n=!0,r):lt(s)?Tt(t,r,n?"linePrefix":"lineSuffix")(s):e(s)}}const rO={name:"definition",tokenize:iO},sO={partial:!0,tokenize:oO};function iO(t,e,n){const r=this;let s;return i;function i(p){return t.enter("definition"),o(p)}function o(p){return TT.call(r,t,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function l(p){return s=ia(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(t.enter("definitionMarker"),t.consume(p),t.exit("definitionMarker"),c):n(p)}function c(p){return er(p)?kl(t,u)(p):u(p)}function u(p){return ST(t,f,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function f(p){return t.attempt(sO,h,h)(p)}function h(p){return lt(p)?Tt(t,m,"whitespace")(p):m(p)}function m(p){return p===null||Pe(p)?(t.exit("definition"),r.parser.defined.push(s),e(p)):n(p)}}function oO(t,e,n){return r;function r(l){return er(l)?kl(t,s)(l):n(l)}function s(l){return NT(t,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function i(l){return lt(l)?Tt(t,o,"whitespace")(l):o(l)}function o(l){return l===null||Pe(l)?e(l):n(l)}}const aO={name:"hardBreakEscape",tokenize:lO};function lO(t,e,n){return r;function r(i){return t.enter("hardBreakEscape"),t.consume(i),s}function s(i){return Pe(i)?(t.exit("hardBreakEscape"),e(i)):n(i)}}const cO={name:"headingAtx",resolve:uO,tokenize:dO};function uO(t,e){let n=t.length-2,r=3,s,i;return t[r][1].type==="whitespace"&&(r+=2),n-2>r&&t[n][1].type==="whitespace"&&(n-=2),t[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&t[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(s={type:"atxHeadingText",start:t[r][1].start,end:t[n][1].end},i={type:"chunkText",start:t[r][1].start,end:t[n][1].end,contentType:"text"},ls(t,r,n-r+1,[["enter",s,e],["enter",i,e],["exit",i,e],["exit",s,e]])),t}function dO(t,e,n){let r=0;return s;function s(f){return t.enter("atxHeading"),i(f)}function i(f){return t.enter("atxHeadingSequence"),o(f)}function o(f){return f===35&&r++<6?(t.consume(f),o):f===null||er(f)?(t.exit("atxHeadingSequence"),l(f)):n(f)}function l(f){return f===35?(t.enter("atxHeadingSequence"),c(f)):f===null||Pe(f)?(t.exit("atxHeading"),e(f)):lt(f)?Tt(t,l,"whitespace")(f):(t.enter("atxHeadingText"),u(f))}function c(f){return f===35?(t.consume(f),c):(t.exit("atxHeadingSequence"),l(f))}function u(f){return f===null||f===35||er(f)?(t.exit("atxHeadingText"),l(f)):(t.consume(f),u)}}const hO=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],sb=["pre","script","style","textarea"],fO={concrete:!0,name:"htmlFlow",resolveTo:gO,tokenize:yO},pO={partial:!0,tokenize:vO},mO={partial:!0,tokenize:xO};function gO(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function yO(t,e,n){const r=this;let s,i,o,l,c;return u;function u(O){return f(O)}function f(O){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(O),h}function h(O){return O===33?(t.consume(O),m):O===47?(t.consume(O),i=!0,E):O===63?(t.consume(O),s=3,r.interrupt?e:R):Yr(O)?(t.consume(O),o=String.fromCharCode(O),C):n(O)}function m(O){return O===45?(t.consume(O),s=2,p):O===91?(t.consume(O),s=5,l=0,x):Yr(O)?(t.consume(O),s=4,r.interrupt?e:R):n(O)}function p(O){return O===45?(t.consume(O),r.interrupt?e:R):n(O)}function x(O){const Q="CDATA[";return O===Q.charCodeAt(l++)?(t.consume(O),l===Q.length?r.interrupt?e:P:x):n(O)}function E(O){return Yr(O)?(t.consume(O),o=String.fromCharCode(O),C):n(O)}function C(O){if(O===null||O===47||O===62||er(O)){const Q=O===47,oe=o.toLowerCase();return!Q&&!i&&sb.includes(oe)?(s=1,r.interrupt?e(O):P(O)):hO.includes(o.toLowerCase())?(s=6,Q?(t.consume(O),y):r.interrupt?e(O):P(O)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(O):i?v(O):_(O))}return O===45||dr(O)?(t.consume(O),o+=String.fromCharCode(O),C):n(O)}function y(O){return O===62?(t.consume(O),r.interrupt?e:P):n(O)}function v(O){return lt(O)?(t.consume(O),v):A(O)}function _(O){return O===47?(t.consume(O),A):O===58||O===95||Yr(O)?(t.consume(O),D):lt(O)?(t.consume(O),_):A(O)}function D(O){return O===45||O===46||O===58||O===95||dr(O)?(t.consume(O),D):M(O)}function M(O){return O===61?(t.consume(O),T):lt(O)?(t.consume(O),M):_(O)}function T(O){return O===null||O===60||O===61||O===62||O===96?n(O):O===34||O===39?(t.consume(O),c=O,S):lt(O)?(t.consume(O),T):w(O)}function S(O){return O===c?(t.consume(O),c=null,N):O===null||Pe(O)?n(O):(t.consume(O),S)}function w(O){return O===null||O===34||O===39||O===47||O===60||O===61||O===62||O===96||er(O)?M(O):(t.consume(O),w)}function N(O){return O===47||O===62||lt(O)?_(O):n(O)}function A(O){return O===62?(t.consume(O),I):n(O)}function I(O){return O===null||Pe(O)?P(O):lt(O)?(t.consume(O),I):n(O)}function P(O){return O===45&&s===2?(t.consume(O),W):O===60&&s===1?(t.consume(O),ee):O===62&&s===4?(t.consume(O),ne):O===63&&s===3?(t.consume(O),R):O===93&&s===5?(t.consume(O),K):Pe(O)&&(s===6||s===7)?(t.exit("htmlFlowData"),t.check(pO,pe,k)(O)):O===null||Pe(O)?(t.exit("htmlFlowData"),k(O)):(t.consume(O),P)}function k(O){return t.check(mO,B,pe)(O)}function B(O){return t.enter("lineEnding"),t.consume(O),t.exit("lineEnding"),z}function z(O){return O===null||Pe(O)?k(O):(t.enter("htmlFlowData"),P(O))}function W(O){return O===45?(t.consume(O),R):P(O)}function ee(O){return O===47?(t.consume(O),o="",F):P(O)}function F(O){if(O===62){const Q=o.toLowerCase();return sb.includes(Q)?(t.consume(O),ne):P(O)}return Yr(O)&&o.length<8?(t.consume(O),o+=String.fromCharCode(O),F):P(O)}function K(O){return O===93?(t.consume(O),R):P(O)}function R(O){return O===62?(t.consume(O),ne):O===45&&s===2?(t.consume(O),R):P(O)}function ne(O){return O===null||Pe(O)?(t.exit("htmlFlowData"),pe(O)):(t.consume(O),ne)}function pe(O){return t.exit("htmlFlow"),e(O)}}function xO(t,e,n){const r=this;return s;function s(o){return Pe(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),i):n(o)}function i(o){return r.parser.lazy[r.now().line]?n(o):e(o)}}function vO(t,e,n){return r;function r(s){return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),t.attempt(Vh,e,n)}}const wO={name:"htmlText",tokenize:bO};function bO(t,e,n){const r=this;let s,i,o;return l;function l(R){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(R),c}function c(R){return R===33?(t.consume(R),u):R===47?(t.consume(R),M):R===63?(t.consume(R),_):Yr(R)?(t.consume(R),w):n(R)}function u(R){return R===45?(t.consume(R),f):R===91?(t.consume(R),i=0,x):Yr(R)?(t.consume(R),v):n(R)}function f(R){return R===45?(t.consume(R),p):n(R)}function h(R){return R===null?n(R):R===45?(t.consume(R),m):Pe(R)?(o=h,ee(R)):(t.consume(R),h)}function m(R){return R===45?(t.consume(R),p):h(R)}function p(R){return R===62?W(R):R===45?m(R):h(R)}function x(R){const ne="CDATA[";return R===ne.charCodeAt(i++)?(t.consume(R),i===ne.length?E:x):n(R)}function E(R){return R===null?n(R):R===93?(t.consume(R),C):Pe(R)?(o=E,ee(R)):(t.consume(R),E)}function C(R){return R===93?(t.consume(R),y):E(R)}function y(R){return R===62?W(R):R===93?(t.consume(R),y):E(R)}function v(R){return R===null||R===62?W(R):Pe(R)?(o=v,ee(R)):(t.consume(R),v)}function _(R){return R===null?n(R):R===63?(t.consume(R),D):Pe(R)?(o=_,ee(R)):(t.consume(R),_)}function D(R){return R===62?W(R):_(R)}function M(R){return Yr(R)?(t.consume(R),T):n(R)}function T(R){return R===45||dr(R)?(t.consume(R),T):S(R)}function S(R){return Pe(R)?(o=S,ee(R)):lt(R)?(t.consume(R),S):W(R)}function w(R){return R===45||dr(R)?(t.consume(R),w):R===47||R===62||er(R)?N(R):n(R)}function N(R){return R===47?(t.consume(R),W):R===58||R===95||Yr(R)?(t.consume(R),A):Pe(R)?(o=N,ee(R)):lt(R)?(t.consume(R),N):W(R)}function A(R){return R===45||R===46||R===58||R===95||dr(R)?(t.consume(R),A):I(R)}function I(R){return R===61?(t.consume(R),P):Pe(R)?(o=I,ee(R)):lt(R)?(t.consume(R),I):N(R)}function P(R){return R===null||R===60||R===61||R===62||R===96?n(R):R===34||R===39?(t.consume(R),s=R,k):Pe(R)?(o=P,ee(R)):lt(R)?(t.consume(R),P):(t.consume(R),B)}function k(R){return R===s?(t.consume(R),s=void 0,z):R===null?n(R):Pe(R)?(o=k,ee(R)):(t.consume(R),k)}function B(R){return R===null||R===34||R===39||R===60||R===61||R===96?n(R):R===47||R===62||er(R)?N(R):(t.consume(R),B)}function z(R){return R===47||R===62||er(R)?N(R):n(R)}function W(R){return R===62?(t.consume(R),t.exit("htmlTextData"),t.exit("htmlText"),e):n(R)}function ee(R){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(R),t.exit("lineEnding"),F}function F(R){return lt(R)?Tt(t,K,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):K(R)}function K(R){return t.enter("htmlTextData"),o(R)}}const X0={name:"labelEnd",resolveAll:TO,resolveTo:NO,tokenize:kO},_O={tokenize:IO},EO={tokenize:CO},SO={tokenize:AO};function TO(t){let e=-1;const n=[];for(;++e=3&&(u===null||Pe(u))?(t.exit("thematicBreak"),e(u)):n(u)}function c(u){return u===s?(t.consume(u),r++,c):(t.exit("thematicBreakSequence"),lt(u)?Tt(t,l,"whitespace")(u):l(u))}}const qn={continuation:{tokenize:zO},exit:BO,name:"list",tokenize:FO},OO={partial:!0,tokenize:$O},VO={partial:!0,tokenize:UO};function FO(t,e,n){const r=this,s=r.events[r.events.length-1];let i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,o=0;return l;function l(p){const x=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(x==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:Mm(p)){if(r.containerState.type||(r.containerState.type=x,t.enter(x,{_container:!0})),x==="listUnordered")return t.enter("listItemPrefix"),p===42||p===45?t.check(qu,n,u)(p):u(p);if(!r.interrupt||p===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),c(p)}return n(p)}function c(p){return Mm(p)&&++o<10?(t.consume(p),c):(!r.interrupt||o<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(t.exit("listItemValue"),u(p)):n(p)}function u(p){return t.enter("listItemMarker"),t.consume(p),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,t.check(Vh,r.interrupt?n:f,t.attempt(OO,m,h))}function f(p){return r.containerState.initialBlankLine=!0,i++,m(p)}function h(p){return lt(p)?(t.enter("listItemPrefixWhitespace"),t.consume(p),t.exit("listItemPrefixWhitespace"),m):n(p)}function m(p){return r.containerState.size=i+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(p)}}function zO(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(Vh,s,i);function s(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Tt(t,e,"listItemIndent",r.containerState.size+1)(l)}function i(l){return r.containerState.furtherBlankLines||!lt(l)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(l)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(VO,e,o)(l))}function o(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,Tt(t,t.attempt(qn,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function UO(t,e,n){const r=this;return Tt(t,s,"listItemIndent",r.containerState.size+1);function s(i){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?e(i):n(i)}}function BO(t){t.exit(this.containerState.type)}function $O(t,e,n){const r=this;return Tt(t,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(i){const o=r.events[r.events.length-1];return!lt(i)&&o&&o[1].type==="listItemPrefixWhitespace"?e(i):n(i)}}const ib={name:"setextUnderline",resolveTo:HO,tokenize:qO};function HO(t,e){let n=t.length,r,s,i;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){r=n;break}t[n][1].type==="paragraph"&&(s=n)}else t[n][1].type==="content"&&t.splice(n,1),!i&&t[n][1].type==="definition"&&(i=n);const o={type:"setextHeading",start:{...t[r][1].start},end:{...t[t.length-1][1].end}};return t[s][1].type="setextHeadingText",i?(t.splice(s,0,["enter",o,e]),t.splice(i+1,0,["exit",t[r][1],e]),t[r][1].end={...t[i][1].end}):t[r][1]=o,t.push(["exit",o,e]),t}function qO(t,e,n){const r=this;let s;return i;function i(u){let f=r.events.length,h;for(;f--;)if(r.events[f][1].type!=="lineEnding"&&r.events[f][1].type!=="linePrefix"&&r.events[f][1].type!=="content"){h=r.events[f][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||h)?(t.enter("setextHeadingLine"),s=u,o(u)):n(u)}function o(u){return t.enter("setextHeadingLineSequence"),l(u)}function l(u){return u===s?(t.consume(u),l):(t.exit("setextHeadingLineSequence"),lt(u)?Tt(t,c,"lineSuffix")(u):c(u))}function c(u){return u===null||Pe(u)?(t.exit("setextHeadingLine"),e(u)):n(u)}}const GO={tokenize:WO};function WO(t){const e=this,n=t.attempt(Vh,r,t.attempt(this.parser.constructs.flowInitial,s,Tt(t,t.attempt(this.parser.constructs.flow,s,t.attempt(JL,s)),"linePrefix")));return n;function r(i){if(i===null){t.consume(i);return}return t.enter("lineEndingBlank"),t.consume(i),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n}function s(i){if(i===null){t.consume(i);return}return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),e.currentConstruct=void 0,n}}const KO={resolveAll:IT()},QO=kT("string"),YO=kT("text");function kT(t){return{resolveAll:IT(t==="text"?XO:void 0),tokenize:e};function e(n){const r=this,s=this.parser.constructs[t],i=n.attempt(s,o,l);return o;function o(f){return u(f)?i(f):l(f)}function l(f){if(f===null){n.consume(f);return}return n.enter("data"),n.consume(f),c}function c(f){return u(f)?(n.exit("data"),i(f)):(n.consume(f),c)}function u(f){if(f===null)return!0;const h=s[f];let m=-1;if(h)for(;++m-1){const l=o[0];typeof l=="string"?o[0]=l.slice(r):o.shift()}i>0&&o.push(t[s].slice(0,i))}return o}function uV(t,e){let n=-1;const r=[];let s;for(;++n0){const X=_e.tokenStack[_e.tokenStack.length-1];(X[1]||ab).call(_e,void 0,X[0])}for(ie.position={start:qs(G.length>0?G[0][1].start:{line:1,column:1,offset:0}),end:qs(G.length>0?G[G.length-2][1].end:{line:1,column:1,offset:0})},H=-1;++H0&&(r.className=["language-"+s[0]]);let i={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return e.meta&&(i.data={meta:e.meta}),t.patch(e,i),i=t.applyData(e,i),i={type:"element",tagName:"pre",properties:{},children:[i]},t.patch(e,i),i}function SV(t,e){const n={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function TV(t,e){const n={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function NV(t,e){const n=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=String(e.identifier).toUpperCase(),s=Pa(r.toLowerCase()),i=t.footnoteOrder.indexOf(r);let o,l=t.footnoteCounts.get(r);l===void 0?(l=0,t.footnoteOrder.push(r),o=t.footnoteOrder.length):o=i+1,l+=1,t.footnoteCounts.set(r,l);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};t.patch(e,c);const u={type:"element",tagName:"sup",properties:{},children:[c]};return t.patch(e,u),t.applyData(e,u)}function kV(t,e){const n={type:"element",tagName:"h"+e.depth,properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function IV(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}}function jT(t,e){const n=e.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+r}];const s=t.all(e),i=s[0];i&&i.type==="text"?i.value="["+i.value:s.unshift({type:"text",value:"["});const o=s[s.length-1];return o&&o.type==="text"?o.value+=r:s.push({type:"text",value:r}),s}function CV(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return jT(t,e);const s={src:Pa(r.url||""),alt:e.alt};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"img",properties:s,children:[]};return t.patch(e,i),t.applyData(e,i)}function AV(t,e){const n={src:Pa(e.url)};e.alt!==null&&e.alt!==void 0&&(n.alt=e.alt),e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"img",properties:n,children:[]};return t.patch(e,r),t.applyData(e,r)}function jV(t,e){const n={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};t.patch(e,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return t.patch(e,r),t.applyData(e,r)}function PV(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return jT(t,e);const s={href:Pa(r.url||"")};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"a",properties:s,children:t.all(e)};return t.patch(e,i),t.applyData(e,i)}function RV(t,e){const n={href:Pa(e.url)};e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"a",properties:n,children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function DV(t,e,n){const r=t.all(e),s=n?MV(n):PT(e),i={},o=[];if(typeof e.checked=="boolean"){const f=r[0];let h;f&&f.type==="element"&&f.tagName==="p"?h=f:(h={type:"element",tagName:"p",properties:{},children:[]},r.unshift(h)),h.children.length>0&&h.children.unshift({type:"text",value:" "}),h.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let l=-1;for(;++l1}function LV(t,e){const n={},r=t.all(e);let s=-1;for(typeof e.start=="number"&&e.start!==1&&(n.start=e.start);++s0){const o={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},l=q0(e.children[1]),c=hT(e.children[e.children.length-1]);l&&c&&(o.position={start:l,end:c}),s.push(o)}const i={type:"element",tagName:"table",properties:{},children:t.wrap(s,!0)};return t.patch(e,i),t.applyData(e,i)}function UV(t,e,n){const r=n?n.children:void 0,i=(r?r.indexOf(e):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,l=o?o.length:e.children.length;let c=-1;const u=[];for(;++c0,!0),r[0]),s=r.index+r[0].length,r=n.exec(e);return i.push(ub(e.slice(s),s>0,!1)),i.join("")}function ub(t,e,n){let r=0,s=t.length;if(e){let i=t.codePointAt(r);for(;i===lb||i===cb;)r++,i=t.codePointAt(r)}if(n){let i=t.codePointAt(s-1);for(;i===lb||i===cb;)s--,i=t.codePointAt(s-1)}return s>r?t.slice(r,s):""}function HV(t,e){const n={type:"text",value:$V(String(e.value))};return t.patch(e,n),t.applyData(e,n)}function qV(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)}const GV={blockquote:bV,break:_V,code:EV,delete:SV,emphasis:TV,footnoteReference:NV,heading:kV,html:IV,imageReference:CV,image:AV,inlineCode:jV,linkReference:PV,link:RV,listItem:DV,list:LV,paragraph:OV,root:VV,strong:FV,table:zV,tableCell:BV,tableRow:UV,text:HV,thematicBreak:qV,toml:vu,yaml:vu,definition:vu,footnoteDefinition:vu};function vu(){}const RT=-1,Fh=0,Il=1,Gd=2,J0=3,Z0=4,ey=5,ty=6,DT=7,MT=8,db=typeof self=="object"?self:globalThis,WV=(t,e)=>{const n=(s,i)=>(t.set(i,s),s),r=s=>{if(t.has(s))return t.get(s);const[i,o]=e[s];switch(i){case Fh:case RT:return n(o,s);case Il:{const l=n([],s);for(const c of o)l.push(r(c));return l}case Gd:{const l=n({},s);for(const[c,u]of o)l[r(c)]=r(u);return l}case J0:return n(new Date(o),s);case Z0:{const{source:l,flags:c}=o;return n(new RegExp(l,c),s)}case ey:{const l=n(new Map,s);for(const[c,u]of o)l.set(r(c),r(u));return l}case ty:{const l=n(new Set,s);for(const c of o)l.add(r(c));return l}case DT:{const{name:l,message:c}=o;return n(new db[l](c),s)}case MT:return n(BigInt(o),s);case"BigInt":return n(Object(BigInt(o)),s);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:l}=new Uint8Array(o);return n(new DataView(l),o)}}return n(new db[i](o),s)};return r},hb=t=>WV(new Map,t)(0),To="",{toString:KV}={},{keys:QV}=Object,nl=t=>{const e=typeof t;if(e!=="object"||!t)return[Fh,e];const n=KV.call(t).slice(8,-1);switch(n){case"Array":return[Il,To];case"Object":return[Gd,To];case"Date":return[J0,To];case"RegExp":return[Z0,To];case"Map":return[ey,To];case"Set":return[ty,To];case"DataView":return[Il,n]}return n.includes("Array")?[Il,n]:n.includes("Error")?[DT,n]:[Gd,n]},wu=([t,e])=>t===Fh&&(e==="function"||e==="symbol"),YV=(t,e,n,r)=>{const s=(o,l)=>{const c=r.push(o)-1;return n.set(l,c),c},i=o=>{if(n.has(o))return n.get(o);let[l,c]=nl(o);switch(l){case Fh:{let f=o;switch(c){case"bigint":l=MT,f=o.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+c);f=null;break;case"undefined":return s([RT],o)}return s([l,f],o)}case Il:{if(c){let m=o;return c==="DataView"?m=new Uint8Array(o.buffer):c==="ArrayBuffer"&&(m=new Uint8Array(o)),s([c,[...m]],o)}const f=[],h=s([l,f],o);for(const m of o)f.push(i(m));return h}case Gd:{if(c)switch(c){case"BigInt":return s([c,o.toString()],o);case"Boolean":case"Number":case"String":return s([c,o.valueOf()],o)}if(e&&"toJSON"in o)return i(o.toJSON());const f=[],h=s([l,f],o);for(const m of QV(o))(t||!wu(nl(o[m])))&&f.push([i(m),i(o[m])]);return h}case J0:return s([l,o.toISOString()],o);case Z0:{const{source:f,flags:h}=o;return s([l,{source:f,flags:h}],o)}case ey:{const f=[],h=s([l,f],o);for(const[m,p]of o)(t||!(wu(nl(m))||wu(nl(p))))&&f.push([i(m),i(p)]);return h}case ty:{const f=[],h=s([l,f],o);for(const m of o)(t||!wu(nl(m)))&&f.push(i(m));return h}}const{message:u}=o;return s([l,{name:c,message:u}],o)};return i},fb=(t,{json:e,lossy:n}={})=>{const r=[];return YV(!(e||n),!!e,new Map,r)(t),r},Wd=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?hb(fb(t,e)):structuredClone(t):(t,e)=>hb(fb(t,e));function XV(t,e){const n=[{type:"text",value:"↩"}];return e>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),n}function JV(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function ZV(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=t.options.footnoteBackContent||XV,r=t.options.footnoteBackLabel||JV,s=t.options.footnoteLabel||"Footnotes",i=t.options.footnoteLabelTagName||"h2",o=t.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let c=-1;for(;++c0&&x.push({type:"text",value:" "});let v=typeof n=="string"?n:n(c,p);typeof v=="string"&&(v={type:"text",value:v}),x.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+m+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,p),className:["data-footnote-backref"]},children:Array.isArray(v)?v:[v]})}const C=f[f.length-1];if(C&&C.type==="element"&&C.tagName==="p"){const v=C.children[C.children.length-1];v&&v.type==="text"?v.value+=" ":C.children.push({type:"text",value:" "}),C.children.push(...x)}else f.push(...x);const y={type:"element",tagName:"li",properties:{id:e+"fn-"+m},children:t.wrap(f,!0)};t.patch(u,y),l.push(y)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...Wd(o),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:` +`},{type:"element",tagName:"ol",properties:{},children:t.wrap(l,!0)},{type:"text",value:` +`}]}}const LT=function(t){if(t==null)return rF;if(typeof t=="function")return zh(t);if(typeof t=="object")return Array.isArray(t)?eF(t):tF(t);if(typeof t=="string")return nF(t);throw new Error("Expected function, string, or object as test")};function eF(t){const e=[];let n=-1;for(;++n":""))+")"})}return m;function m(){let p=OT,x,E,C;if((!e||i(c,u,f[f.length-1]||void 0))&&(p=lF(n(c,f)),p[0]===pb))return p;if("children"in c&&c.children){const y=c;if(y.children&&p[0]!==oF)for(E=(r?y.children.length:-1)+o,C=f.concat(y);E>-1&&E0&&n.push({type:"text",value:` +`}),n}function mb(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function gb(t,e){const n=uF(t,e),r=n.one(t,void 0),s=ZV(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&i.children.push({type:"text",value:` +`},s),i}function mF(t,e){return t&&"run"in t?async function(n,r){const s=gb(n,{file:r,...e});await t.run(s,r)}:function(n,r){return gb(n,{file:r,...t||e})}}function yb(t){if(t)throw t}var Gu=Object.prototype.hasOwnProperty,FT=Object.prototype.toString,xb=Object.defineProperty,vb=Object.getOwnPropertyDescriptor,wb=function(e){return typeof Array.isArray=="function"?Array.isArray(e):FT.call(e)==="[object Array]"},bb=function(e){if(!e||FT.call(e)!=="[object Object]")return!1;var n=Gu.call(e,"constructor"),r=e.constructor&&e.constructor.prototype&&Gu.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!r)return!1;var s;for(s in e);return typeof s>"u"||Gu.call(e,s)},_b=function(e,n){xb&&n.name==="__proto__"?xb(e,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):e[n.name]=n.newValue},Eb=function(e,n){if(n==="__proto__")if(Gu.call(e,n)){if(vb)return vb(e,n).value}else return;return e[n]},gF=function t(){var e,n,r,s,i,o,l=arguments[0],c=1,u=arguments.length,f=!1;for(typeof l=="boolean"&&(f=l,l=arguments[1]||{},c=2),(l==null||typeof l!="object"&&typeof l!="function")&&(l={});co.length;let c;l&&o.push(s);try{c=t.apply(this,o)}catch(u){const f=u;if(l&&n)throw f;return s(f)}l||(c&&c.then&&typeof c.then=="function"?c.then(i,s):c instanceof Error?s(c):i(c))}function s(o,...l){n||(n=!0,e(o,...l))}function i(o){s(null,o)}}const qr={basename:vF,dirname:wF,extname:bF,join:_F,sep:"/"};function vF(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');Ac(t);let n=0,r=-1,s=t.length,i;if(e===void 0||e.length===0||e.length>t.length){for(;s--;)if(t.codePointAt(s)===47){if(i){n=s+1;break}}else r<0&&(i=!0,r=s+1);return r<0?"":t.slice(n,r)}if(e===t)return"";let o=-1,l=e.length-1;for(;s--;)if(t.codePointAt(s)===47){if(i){n=s+1;break}}else o<0&&(i=!0,o=s+1),l>-1&&(t.codePointAt(s)===e.codePointAt(l--)?l<0&&(r=s):(l=-1,r=o));return n===r?r=o:r<0&&(r=t.length),t.slice(n,r)}function wF(t){if(Ac(t),t.length===0)return".";let e=-1,n=t.length,r;for(;--n;)if(t.codePointAt(n)===47){if(r){e=n;break}}else r||(r=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function bF(t){Ac(t);let e=t.length,n=-1,r=0,s=-1,i=0,o;for(;e--;){const l=t.codePointAt(e);if(l===47){if(o){r=e+1;break}continue}n<0&&(o=!0,n=e+1),l===46?s<0?s=e:i!==1&&(i=1):s>-1&&(i=-1)}return s<0||n<0||i===0||i===1&&s===n-1&&s===r+1?"":t.slice(s,n)}function _F(...t){let e=-1,n;for(;++e0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function SF(t,e){let n="",r=0,s=-1,i=0,o=-1,l,c;for(;++o<=t.length;){if(o2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),s=o,i=0;continue}}else if(n.length>0){n="",r=0,s=o,i=0;continue}}e&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+t.slice(s+1,o):n=t.slice(s+1,o),r=o-s-1;s=o,i=0}else l===46&&i>-1?i++:i=-1}return n}function Ac(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const TF={cwd:NF};function NF(){return"/"}function Fm(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function kF(t){if(typeof t=="string")t=new URL(t);else if(!Fm(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return IF(t)}function IF(t){if(t.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const e=t.pathname;let n=-1;for(;++n0){let[p,...x]=f;const E=r[m][1];Vm(E)&&Vm(p)&&(p=Gf(!0,E,p)),r[m]=[u,p,...x]}}}}const PF=new ny().freeze();function Yf(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function Xf(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function Jf(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Tb(t){if(!Vm(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function Nb(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function bu(t){return RF(t)?t:new zT(t)}function RF(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function DF(t){return typeof t=="string"||MF(t)}function MF(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const LF="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",kb=[],Ib={allowDangerousHtml:!0},OF=/^(https?|ircs?|mailto|xmpp)$/i,VF=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function FF(t){const e=zF(t),n=UF(t);return BF(e.runSync(e.parse(n),n),t)}function zF(t){const e=t.rehypePlugins||kb,n=t.remarkPlugins||kb,r=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...Ib}:Ib;return PF().use(wV).use(n).use(mF,r).use(e)}function UF(t){const e=t.children||"",n=new zT;return typeof e=="string"&&(n.value=e),n}function BF(t,e){const n=e.allowedElements,r=e.allowElement,s=e.components,i=e.disallowedElements,o=e.skipHtml,l=e.unwrapDisallowed,c=e.urlTransform||$F;for(const f of VF)Object.hasOwn(e,f.from)&&(""+f.from+(f.to?"use `"+f.to+"` instead":"remove it")+LF+f.id,void 0);return VT(t,u),Z6(t,{Fragment:a.Fragment,components:s,ignoreInvalidStyle:!0,jsx:a.jsx,jsxs:a.jsxs,passKeys:!0,passNode:!0});function u(f,h,m){if(f.type==="raw"&&m&&typeof h=="number")return o?m.children.splice(h,1):m.children[h]={type:"text",value:f.value},h;if(f.type==="element"){let p;for(p in $f)if(Object.hasOwn($f,p)&&Object.hasOwn(f.properties,p)){const x=f.properties[p],E=$f[p];(E===null||E.includes(f.tagName))&&(f.properties[p]=c(String(x||""),p,f))}}if(f.type==="element"){let p=n?!n.includes(f.tagName):i?i.includes(f.tagName):!1;if(!p&&r&&typeof h=="number"&&(p=!r(f,h,m)),p&&m&&typeof h=="number")return l&&f.children?m.children.splice(h,1,...f.children):m.children.splice(h,1),h}}}function $F(t){const e=t.indexOf(":"),n=t.indexOf("?"),r=t.indexOf("#"),s=t.indexOf("/");return e===-1||s!==-1&&e>s||n!==-1&&e>n||r!==-1&&e>r||OF.test(t.slice(0,e))?t:""}function HF({onBack:t,isAdmin:e}){const[n,r]=L.useState(""),[s,i]=L.useState(!1),[o,l]=L.useState(""),[c,u]=L.useState(!0);L.useEffect(()=>{const m=n6(p=>{p&&r(p.content),u(!1)});return()=>m()},[]);const f=async()=>{try{await t6(o),i(!1)}catch(m){console.error("Error saving info:",m),alert("Error al guardar la información.")}},h=()=>{l(n),i(!0)};return a.jsx("div",{className:"min-h-screen bg-[#0a0a0a] text-white p-4 sm:p-6 md:p-12 animate-in fade-in slide-in-from-bottom-4 duration-300",children:a.jsxs("div",{className:"max-w-4xl mx-auto",children:[a.jsxs("button",{onClick:t,className:"flex items-center gap-2 text-gray-400 hover:text-white transition-colors mb-8 group",children:[a.jsx(Is,{className:"w-5 h-5 group-hover:-translate-x-1 transition-transform"}),a.jsx("span",{className:"font-medium",children:"Volver al inicio"})]}),a.jsxs("div",{className:"bg-[#1a1a1a] rounded-2xl border border-gray-800 p-8 sm:p-12 shadow-2xl relative",children:[e&&!s&&a.jsx("button",{onClick:h,className:"absolute top-8 right-8 p-2 rounded-lg bg-gray-800 text-gray-400 hover:text-[#bb86fc] hover:bg-[#bb86fc]/10 transition-colors",title:"Editar información",children:a.jsx(J_,{className:"w-5 h-5"})}),a.jsxs("div",{className:"flex items-center gap-4 mb-8 border-b border-gray-800 pb-8",children:[a.jsx("div",{className:"p-3 bg-gradient-to-br from-[#bb86fc] to-[#9966dd] rounded-xl shadow-lg shadow-[#bb86fc]/20",children:a.jsx(Y_,{className:"w-8 h-8 text-white"})}),a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-bold bg-gradient-to-r from-white to-gray-400 bg-clip-text text-transparent",children:"Información"}),a.jsx("p",{className:"text-gray-400 mt-1",children:"Sobre Twisted Brody MangaFlow"})]})]}),s?a.jsxs("div",{className:"space-y-4",children:[a.jsx("textarea",{value:o,onChange:m=>l(m.target.value),className:"w-full h-[500px] bg-black/50 border border-[#bb86fc]/50 rounded-lg p-4 text-sm text-white focus:outline-none focus:border-[#bb86fc] font-mono",placeholder:"Escribe el contenido en Markdown..."}),a.jsxs("div",{className:"flex gap-3 justify-end",children:[a.jsxs("button",{onClick:()=>i(!1),className:"px-4 py-2 rounded-lg font-semibold text-gray-400 hover:text-white hover:bg-white/10 transition-colors flex items-center gap-2",children:[a.jsx(gt,{className:"w-4 h-4"}),"Cancelar"]}),a.jsxs("button",{onClick:f,className:"px-4 py-2 rounded-lg font-semibold bg-[#bb86fc] hover:bg-[#9966dd] text-white transition-colors shadow-lg shadow-[#bb86fc]/20 flex items-center gap-2",children:[a.jsx(Ea,{className:"w-4 h-4"}),"Guardar Cambios"]})]})]}):a.jsx("div",{className:"prose prose-invert prose-p:text-gray-300 prose-headings:text-white prose-a:no-underline max-w-none",children:a.jsx(FF,{components:{h1:({node:m,...p})=>a.jsx("h1",{className:"text-3xl font-bold bg-gradient-to-r from-[#bb86fc] to-[#7744cc] bg-clip-text text-transparent mb-6 pb-2 border-b border-gray-800",...p}),h2:({node:m,...p})=>a.jsx("h2",{className:"text-xl font-semibold text-white mt-8 mb-4 flex items-center gap-2",...p}),p:({node:m,...p})=>a.jsx("p",{className:"text-gray-300 leading-relaxed mb-4",...p}),ul:({node:m,...p})=>a.jsx("ul",{className:"space-y-2 mb-6",...p}),li:({node:m,...p})=>a.jsx("li",{className:"flex items-start gap-2 text-gray-300",...p}),a:({node:m,href:p,children:x,...E})=>{const C=p==null?void 0:p.startsWith("http");if((p==null?void 0:p.includes("t.me"))||(p==null?void 0:p.includes("patreon.com"))||(p==null?void 0:p.includes("x.com"))){let v="bg-[#1a1a1a] border border-gray-700 hover:border-gray-500",_="text-gray-300 hover:text-white";return p!=null&&p.includes("patreon")&&(v="bg-[#1a1a1a] border border-gray-700 hover:border-[#FF424D] hover:text-[#FF424D]"),p!=null&&p.includes("t.me")&&(v="bg-[#1a1a1a] border border-gray-700 hover:border-[#24A1DE] hover:text-[#24A1DE]"),p!=null&&p.includes("x.com")&&(v="bg-[#1a1a1a] border border-gray-700 hover:border-white hover:text-white"),a.jsx("a",{href:p,target:C?"_blank":void 0,rel:C?"noopener noreferrer":void 0,className:`inline-flex items-center gap-2 px-3 py-1.5 rounded-lg transition-all transform hover:scale-105 shadow-sm my-1 mr-2 no-underline text-xs sm:text-sm font-medium ${v} ${_}`,...E,children:x})}return a.jsx("a",{href:p,className:"text-[#bb86fc] hover:underline",target:C?"_blank":void 0,rel:C?"noopener noreferrer":void 0,...E,children:x})},blockquote:({node:m,...p})=>a.jsx("blockquote",{className:"border-l-4 border-[#bb86fc] pl-4 py-2 bg-[#bb86fc]/10 rounded-r-lg italic text-gray-400 my-6",...p}),hr:({node:m,...p})=>a.jsx("hr",{className:"border-gray-800 my-8",...p}),img:()=>null},children:n})}),!s&&a.jsxs("div",{className:"pt-8 border-t border-gray-800 text-center text-sm text-gray-500 mt-8",children:["© ",new Date().getFullYear()," Twisted Brody. Todos los derechos reservados."]})]})]})})}function qF({label:t,authors:e,value:n,onChange:r,onDelete:s,placeholder:i="Añadir autor...",colorClass:o="text-gray-400"}){const[l,c]=L.useState(""),[u,f]=L.useState(!1),h=L.useRef(null),m=L.useMemo(()=>l.trim()?e.filter(v=>v.toLowerCase().includes(l.toLowerCase())):e,[e,l]);L.useEffect(()=>{const v=_=>{h.current&&!h.current.contains(_.target)&&f(!1)};return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[]);const p=v=>{v.key==="Enter"&&(v.preventDefault(),x())},x=()=>{const v=l.trim();v&&(n.includes(v)||r([...n,v]),c(""),f(!1))},E=v=>{const _=v.trim();_&&!n.includes(_)&&r([...n,_]),c(""),f(!1)},C=v=>{r(n.filter(_=>_!==v))},y=(v,_)=>{v.stopPropagation(),v.preventDefault(),s&&s(_)};return a.jsxs("div",{className:"space-y-3 mb-6",ref:h,children:[a.jsx("label",{className:`text-xs uppercase font-bold tracking-wider ${o}`,children:t}),a.jsxs("div",{className:"relative",children:[a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("div",{className:"relative flex-1",children:[a.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:a.jsx(Lg,{className:"h-4 w-4 text-gray-500"})}),a.jsx("input",{type:"text",value:l,onChange:v=>{c(v.target.value),f(!0)},onFocus:()=>f(!0),onKeyDown:p,placeholder:i,className:"w-full bg-[#1a1a1a] border border-gray-600/50 rounded-lg pl-10 pr-10 py-2.5 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-[#bb86fc] transition-all"}),l&&a.jsx("button",{onClick:()=>c(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-500 hover:text-white",children:a.jsx(gt,{className:"w-3.5 h-3.5"})})]}),a.jsx("button",{onClick:x,disabled:!l.trim(),className:"bg-[#bb86fc]/20 hover:bg-[#bb86fc]/30 text-[#bb86fc] px-4 rounded-lg flex items-center justify-center transition-all disabled:opacity-50 disabled:cursor-not-allowed",children:a.jsx(Kr,{className:"w-5 h-5"})})]}),u&&(m.length>0||l)&&a.jsx("div",{className:"absolute top-full left-0 right-0 mt-1 bg-[#1a1a1a] border border-gray-700/50 rounded-lg shadow-xl z-50 max-h-60 overflow-y-auto w-full custom-scrollbar",children:m.length>0?m.map((v,_)=>{const D=n.includes(v);return a.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5 hover:bg-white/5 cursor-pointer group",onMouseDown:M=>{M.preventDefault(),E(v)},children:[a.jsx("span",{className:`text-sm ${D?"text-[#bb86fc]":"text-gray-300"}`,children:v}),a.jsxs("div",{className:"flex items-center gap-2",children:[D&&a.jsx(dc,{className:"w-4 h-4 text-[#bb86fc]"}),s&&a.jsx("button",{onMouseDown:M=>y(M,v),className:"opacity-0 group-hover:opacity-100 p-1 hover:bg-red-500/20 text-gray-500 hover:text-red-400 rounded transition-all",title:"Eliminar autor de todos los mangas",children:a.jsx(tn,{className:"w-3.5 h-3.5"})})]})]},_)}):a.jsxs("div",{className:"px-4 py-3 text-center",children:[a.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"No encontrado."}),a.jsxs("button",{onMouseDown:v=>{v.preventDefault(),x()},className:"text-xs text-[#bb86fc] hover:underline font-semibold",children:['Añadir "',l,'"']})]})})]}),a.jsx("div",{className:"flex gap-2 flex-wrap mt-3",children:n.map((v,_)=>a.jsxs("span",{className:"px-3 py-1 bg-[#2a2a2a] text-[#bb86fc] text-xs rounded-full border border-gray-600/50 flex items-center gap-2",children:[v,a.jsx("button",{onClick:()=>C(v),className:"hover:text-white",children:a.jsx(gt,{className:"w-3 h-3"})})]},_))}),a.jsx("p",{className:"text-[10px] text-gray-500 mt-2",children:n.length>0?`Autores seleccionados: ${n.join(", ")}`:"Deja en blanco para no modificar el autor."})]})}function GF({isOpen:t,onClose:e,selectedMangaIds:n,onSaveComplete:r}){const[s,i]=L.useState([]),[o,l]=L.useState([]),[c,u]=L.useState([]),[f,h]=L.useState([]),[m,p]=L.useState(!1),[x,E]=L.useState(!1),[C,y]=L.useState(!1),[v,_]=L.useState(!1),[D,M]=L.useState(!1);L.useEffect(()=>{t&&(T(),l([]),h([]),p(!1),E(!1),y(!1))},[t]);const T=async()=>{try{M(!0);const k=await j2();i(k);const B=await RD();u(B)}catch(k){console.error("Error loading categories:",k)}finally{M(!1)}},S=async(k,B)=>{if(k.trim()){if(B==="tag"){const z=k.split(" ").map(W=>W.trim()).filter(W=>W.length>0);for(const W of z)await w(W,B);return}await w(k,B)}},w=async(k,B)=>{try{const z=s.find(W=>W.name.toLowerCase()===k.trim().toLowerCase()&&W.type===B);if(z)l(W=>W.includes(z.id)?W:[...W,z.id]);else{const W=await P2(k.trim(),B);i(ee=>ee.find(F=>F.id===W.id)?ee:[...ee,W]),l(ee=>ee.includes(W.id)?ee:[...ee,W.id])}}catch(z){console.error("Error creating category:",z)}},N=k=>{l(B=>B.filter(z=>z!==k))},A=async k=>{try{await R2(k),i(B=>B.filter(z=>z.id!==k)),l(B=>B.filter(z=>z!==k))}catch(B){console.error("Error deleting category:",B),be.error("Error al eliminar la categoría")}},I=k=>{be(`¿Eliminar al autor "${k}" permanentemente?`,{description:"Se eliminará este autor de TODOS los mangas. Esta acción no se puede deshacer.",action:{label:"Eliminar",onClick:async()=>{try{M(!0),await PD(k),be.success(`Autor "${k}" eliminado correctamente.`),u(B=>B.filter(z=>z!==k)),f.includes(k)&&h(B=>B.filter(z=>z!==k))}catch(B){console.error("Error deleting author:",B),be.error("Error al eliminar el autor.")}finally{M(!1)}}},cancel:{label:"Cancelar",onClick:()=>{}},duration:5e3})},P=async()=>{if(o.length===0&&f.length===0&&!m&&!x&&!C){be.error("Selecciona al menos una categoría, autor o clasificación para aplicar.");return}_(!0);try{const k=n.map(async B=>{var z;try{const W=await Ni(B);if(!W)return;const ee=((z=W.categories)==null?void 0:z.map(R=>R.id))||[],F=Array.from(new Set([...ee,...o])),K={title:W.title,author:W.author,categoryIds:F};f.length>0&&(K.author=f.join(", ")),m&&(K.is_decensored=!0),x&&(K.is_bn=!0,K.is_color=!1),C&&(K.is_color=!0,K.is_bn=!1),await Lh(B,K)}catch(W){console.error(`Error updating manga ${B}`,W)}});await Promise.all(k),be.success("Categorías aplicadas correctamente."),r(),e()}catch(k){console.error("Error bulk updating mangas:",k),be.error("Error al aplicar cambios.")}finally{_(!1)}};return t?a.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50 p-4 animate-in fade-in duration-200",children:a.jsxs("div",{className:"bg-[#121212] rounded-2xl border border-gray-800 w-full max-w-2xl shadow-2xl overflow-hidden flex flex-col max-h-[90vh]",children:[a.jsxs("div",{className:"bg-[#1a1a1a] border-b border-gray-800 px-6 py-4 flex items-center justify-between sticky top-0 z-10",children:[a.jsxs("h2",{className:"text-xl font-bold text-white",children:["Aplicar Categorías a ",n.length," Mangas"]}),a.jsx("button",{onClick:e,className:"text-gray-400 hover:text-white transition-colors p-2 hover:bg-white/5 rounded-lg",children:a.jsx(gt,{className:"w-5 h-5"})})]}),a.jsx("div",{className:"p-6 overflow-y-auto custom-scrollbar flex-1",children:D?a.jsx("div",{className:"flex justify-center p-8",children:a.jsx(Sr,{size:32})}):a.jsxs("div",{className:"space-y-6",children:[a.jsx("div",{className:"bg-[#1f1f1f] p-4 rounded-xl border border-gray-800",children:a.jsx(qF,{label:"Autor",authors:c,value:f,onChange:h,onDelete:I,placeholder:"Seleccionar o escribir autor..."})}),a.jsxs("div",{className:"bg-[#1f1f1f] p-4 rounded-xl border border-gray-800 space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-semibold text-white",children:"Sin censura"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Marcar todos como sin censura"})]}),a.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[a.jsx("input",{type:"checkbox",className:"sr-only peer",checked:m,onChange:k=>p(k.target.checked)}),a.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-[#bb86fc]"})]})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-semibold text-white",children:"B/N"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Marcar todos como Blanco y Negro"})]}),a.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[a.jsx("input",{type:"checkbox",className:"sr-only peer",checked:x,onChange:k=>{E(k.target.checked),k.target.checked&&y(!1)}}),a.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-[#bb86fc]"})]})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-semibold text-white",children:"a color"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Marcar todos como a color"})]}),a.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[a.jsx("input",{type:"checkbox",className:"sr-only peer",checked:C,onChange:k=>{y(k.target.checked),k.target.checked&&E(!1)}}),a.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-[#bb86fc]"})]})]})]}),a.jsx(ri,{label:"Personajes",type:"character",categories:s,selectedIds:o,onSelect:k=>{o.includes(k)||l(B=>[...B,k])},onRemove:N,onCreate:k=>S(k,"character"),onDeleteCategory:A,colorClass:"text-blue-400",placeholder:"Añadir personaje..."}),a.jsx(ri,{label:"Series",type:"series",categories:s,selectedIds:o,onSelect:k=>{o.includes(k)||l(B=>[...B,k])},onRemove:N,onCreate:k=>S(k,"series"),onDeleteCategory:A,colorClass:"text-green-400",placeholder:"Añadir serie..."}),a.jsx(ri,{label:"Géneros",type:"genre",categories:s,selectedIds:o,onSelect:k=>{o.includes(k)||l(B=>[...B,k])},onRemove:N,onCreate:k=>S(k,"genre"),onDeleteCategory:A,colorClass:"text-purple-400",placeholder:"Añadir género..."}),a.jsx(ri,{label:"Etiquetas",type:"tag",categories:s,selectedIds:o,onSelect:k=>{o.includes(k)||l(B=>[...B,k])},onRemove:N,onCreate:k=>S(k,"tag"),onDeleteCategory:A,colorClass:"text-pink-400",placeholder:"Añadir etiqueta..."})]})}),a.jsxs("div",{className:"p-6 border-t border-gray-800 flex justify-end gap-3 bg-[#1a1a1a]",children:[a.jsx("button",{onClick:e,className:"px-4 py-2 rounded-lg text-sm font-semibold text-gray-300 hover:text-white transition-colors",children:"Cancelar"}),a.jsx("button",{onClick:P,disabled:v||o.length===0&&f.length===0&&!m&&!x&&!C,className:"bg-[#bb86fc] hover:bg-[#9966dd] text-white px-6 py-2 rounded-lg font-semibold text-sm transition-all shadow-lg shadow-[#bb86fc]/20 flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",children:v?a.jsxs(a.Fragment,{children:[a.jsx(Sr,{size:16}),"Guardando..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Ea,{className:"w-4 h-4"}),"Aplicar Cambios"]})})]})]})}):null}function WF({isOpen:t,onClose:e,selectedMangaIds:n,onSaveComplete:r}){const[s,i]=L.useState([]),[o,l]=L.useState([]),[c,u]=L.useState([]),[f,h]=L.useState([]),[m,p]=L.useState(!1),[x,E]=L.useState(!1);L.useEffect(()=>{t&&(C(),u([]),h([]))},[t]);const C=async()=>{try{E(!0);const T=(await Promise.all(n.map(N=>Ni(N).catch(()=>null)))).filter(Boolean),S=new Map,w=new Set;T.forEach(N=>{N.author&&w.add(N.author),N.categories&&N.categories.forEach(A=>S.set(A.id,A))}),i(Array.from(S.values())),l(Array.from(w))}catch(M){console.error("Error loading mangas data:",M),be.error("Error al cargar datos de los mangas")}finally{E(!1)}},y=M=>{u(T=>T.includes(M)?T.filter(S=>S!==M):[...T,M])},v=M=>{h(T=>T.includes(M)?T.filter(S=>S!==M):[...T,M])},_=async()=>{if(c.length===0&&f.length===0){be.error("Selecciona al menos una categoría o autor para eliminar.");return}p(!0);try{const M=n.map(async T=>{try{const S=await Ni(T);if(!S)return;let w=!1;const N={title:S.title,author:S.author};if(f.includes(S.author)&&(N.author="Desconocido",w=!0),S.categories&&S.categories.length>0){const A=S.categories.map(P=>P.id),I=A.filter(P=>!c.includes(P));I.length!==A.length?(N.categoryIds=I,w=!0):N.categoryIds=A}else N.categoryIds=[];w&&await Lh(T,N)}catch(S){console.error(`Error updating manga ${T}`,S)}});await Promise.all(M),be.success("Categorías eliminadas de los mangas correctamente."),r(),e()}catch(M){console.error("Error bulk updating mangas:",M),be.error("Error al aplicar cambios.")}finally{p(!1)}};if(!t)return null;const D=(M,T,S)=>{const w=s.filter(N=>N.type===M);return w.length===0?null:a.jsxs("div",{className:"bg-[#1f1f1f] p-4 rounded-xl border border-gray-800 space-y-3",children:[a.jsx("span",{className:"text-xs font-bold text-gray-400 uppercase tracking-wider",children:T}),a.jsx("div",{className:"flex flex-wrap gap-2",children:w.map(N=>{const A=c.includes(N.id);return a.jsxs("button",{onClick:()=>y(N.id),className:`px-3 py-1.5 rounded-full text-sm font-medium flex items-center gap-2 border transition-all ${A?"bg-red-500/20 text-red-500 border-red-500/50 hover:bg-red-500/30":`bg-[#1a1a1a] ${S} border-gray-700 hover:border-gray-500`}`,children:[N.name,A&&a.jsx(tn,{className:"w-3.5 h-3.5"})]},N.id)})})]})};return a.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50 p-4 animate-in fade-in duration-200",children:a.jsxs("div",{className:"bg-[#121212] rounded-2xl border border-gray-800 w-full max-w-2xl shadow-2xl overflow-hidden flex flex-col max-h-[90vh]",children:[a.jsxs("div",{className:"bg-[#1a1a1a] border-b border-gray-800 px-6 py-4 flex items-center justify-between sticky top-0 z-10",children:[a.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[a.jsx(tn,{className:"w-5 h-5 text-red-500"}),"Remover Categorías en ",n.length," Mangas"]}),a.jsx("button",{onClick:e,className:"text-gray-400 hover:text-white transition-colors p-2 hover:bg-white/5 rounded-lg",children:a.jsx(gt,{className:"w-5 h-5"})})]}),a.jsx("div",{className:"p-6 overflow-y-auto custom-scrollbar flex-1",children:x?a.jsxs("div",{className:"flex flex-col items-center justify-center py-12 gap-4",children:[a.jsx(Sr,{size:32}),a.jsx("p",{className:"text-gray-400 text-sm",children:"Escaneando mangas seleccionados..."})]}):s.length===0&&o.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[a.jsx(tn,{className:"w-12 h-12 text-gray-600 mb-3"}),a.jsx("h3",{className:"text-lg font-semibold text-white",children:"Sin categorías"}),a.jsx("p",{className:"text-gray-400 text-sm max-w-sm mt-1",children:"Los mangas seleccionados no tienen autores ni categorías para remover."})]}):a.jsxs("div",{className:"space-y-6",children:[a.jsxs("p",{className:"text-sm text-gray-400",children:["Selecciona los autores y categorías que deseas ",a.jsx("b",{className:"text-red-400",children:"eliminar"})," de los mangas seleccionados."]}),o.length>0&&a.jsxs("div",{className:"bg-[#1f1f1f] p-4 rounded-xl border border-gray-800 space-y-3",children:[a.jsx("span",{className:"text-xs font-bold text-gray-400 uppercase tracking-wider",children:"Autor"}),a.jsx("div",{className:"flex flex-wrap gap-2",children:o.map(M=>{const T=f.includes(M);return a.jsxs("button",{onClick:()=>v(M),className:`px-3 py-1.5 rounded-full text-sm font-medium flex items-center gap-2 border transition-all ${T?"bg-red-500/20 text-red-500 border-red-500/50 hover:bg-red-500/30":"bg-[#1a1a1a] text-purple-400 border-gray-700 hover:border-gray-500"}`,children:[M,T&&a.jsx(tn,{className:"w-3.5 h-3.5"})]},M)})}),a.jsx("p",{className:"text-xs text-red-500/80 mt-2",children:'* Remover al autor lo dejará como "Desconocido".'})]}),D("character","Personajes","text-blue-400"),D("series","Series","text-green-400"),D("genre","Géneros","text-purple-400"),D("tag","Etiquetas","text-pink-400")]})}),a.jsxs("div",{className:"p-6 border-t border-gray-800 flex justify-end gap-3 bg-[#1a1a1a]",children:[a.jsx("button",{onClick:e,className:"px-4 py-2 rounded-lg text-sm font-semibold text-gray-300 hover:text-white transition-colors",children:"Cancelar"}),a.jsx("button",{onClick:_,disabled:m||c.length===0&&f.length===0,className:"bg-red-600 hover:bg-red-700 text-white px-6 py-2 rounded-lg font-semibold text-sm transition-all shadow-lg shadow-red-600/20 flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",children:m?a.jsxs(a.Fragment,{children:[a.jsx(Sr,{size:16}),"Eliminando..."]}):a.jsxs(a.Fragment,{children:[a.jsx(tn,{className:"w-4 h-4"}),"Remover Selección"]})})]})]})})}const Cb=["series","character","genre","tag","other"],KF={series:"Series",character:"Personajes",genre:"Géneros",tag:"Etiquetas",other:"Otros"};function QF({isOpen:t,onClose:e,categories:n,selectedCategories:r,onToggleCategory:s,onClearFilters:i,filterDecensored:o,setFilterDecensored:l,filterBN:c,setFilterBN:u,filterColor:f,setFilterColor:h}){const[m,p]=L.useState(""),x=L.useMemo(()=>{const E=n.filter(y=>y.name.toLowerCase().includes(m.toLowerCase())),C={};return Cb.forEach(y=>{C[y]=[]}),C.other=[],E.forEach(y=>{const v=y.type||"other";C[v]||(C[v]=[]),C[v].push(y)}),C},[n,m]);return t?a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/80 backdrop-blur-sm animate-in fade-in duration-200",children:a.jsxs("div",{className:"bg-[#1a1a1a] w-full max-w-4xl max-h-[85vh] rounded-2xl border border-gray-800 shadow-2xl flex flex-col overflow-hidden animate-in zoom-in-95 duration-200",onClick:E=>E.stopPropagation(),children:[a.jsxs("div",{className:"p-4 sm:p-6 border-b border-gray-800 flex items-center justify-between bg-[#1a1a1a]",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"bg-purple-500/20 p-2 rounded-lg",children:a.jsx(K_,{className:"w-5 h-5 text-purple-400"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-xl font-bold text-white",children:"Filtrar por Categorías"}),a.jsx("p",{className:"text-sm text-gray-400",children:"Selecciona múltiples opciones para refinar tu búsqueda"})]})]}),a.jsx("button",{onClick:e,className:"text-gray-400 hover:text-white hover:bg-gray-800 p-2 rounded-lg transition-all",children:a.jsx(gt,{className:"w-5 h-5"})})]}),a.jsx("div",{className:"p-4 border-b border-gray-800 bg-[#151515]",children:a.jsxs("div",{className:"relative",children:[a.jsx(no,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400"}),a.jsx("input",{type:"text",placeholder:"Buscar categorías...",value:m,onChange:E=>p(E.target.value),className:"w-full bg-[#0f0f0f] border border-gray-700/50 rounded-lg pl-10 pr-4 py-2.5 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-purple-500/50 focus:ring-1 focus:ring-purple-500/50 transition-all"})]})}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-4 sm:p-6 space-y-8 custom-scrollbar",children:[a.jsxs("div",{className:"animate-in slide-in-from-bottom-2 duration-300",children:[a.jsxs("h3",{className:"text-sm font-bold text-purple-400 uppercase tracking-wider mb-3 flex items-center gap-2",children:[a.jsx("span",{className:"w-1 h-4 bg-purple-500 rounded-full"}),"Propiedades Especiales"]}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3 mb-8",children:[a.jsxs("button",{onClick:()=>l(!o),className:`relative group flex flex-col p-3 rounded-lg text-left transition-all duration-200 border ${o?"bg-purple-500/20 border-purple-500/50 shadow-[0_0_15px_-3px_rgba(168,85,247,0.3)]":"bg-[#252525] border-transparent hover:bg-[#2a2a2a] hover:border-gray-700"}`,children:[a.jsxs("div",{className:"flex items-center justify-between w-full mb-1",children:[a.jsx("span",{className:"font-bold text-white text-sm",children:"Sin censura"}),a.jsx("div",{className:`w-8 h-4 rounded-full transition-colors ${o?"bg-purple-500":"bg-gray-600"} relative`,children:a.jsx("div",{className:`absolute top-0.5 left-0.5 w-3 h-3 rounded-full bg-white transition-transform duration-200 ${o?"translate-x-4":"translate-x-0"}`})})]}),a.jsx("span",{className:"text-xs text-gray-400",children:"Mostrar solo contenido sin censura"})]}),a.jsxs("button",{onClick:()=>u(!c),className:`relative group flex flex-col p-3 rounded-lg text-left transition-all duration-200 border ${c?"bg-purple-500/20 border-purple-500/50 shadow-[0_0_15px_-3px_rgba(168,85,247,0.3)]":"bg-[#252525] border-transparent hover:bg-[#2a2a2a] hover:border-gray-700"}`,children:[a.jsxs("div",{className:"flex items-center justify-between w-full mb-1",children:[a.jsx("span",{className:"font-bold text-white text-sm",children:"B/N"}),a.jsx("div",{className:`w-8 h-4 rounded-full transition-colors ${c?"bg-purple-500":"bg-gray-600"} relative`,children:a.jsx("div",{className:`absolute top-0.5 left-0.5 w-3 h-3 rounded-full bg-white transition-transform duration-200 ${c?"translate-x-4":"translate-x-0"}`})})]}),a.jsx("span",{className:"text-xs text-gray-400",children:"Mostrar solo Blanco y Negro"})]}),a.jsxs("button",{onClick:()=>h(!f),className:`relative group flex flex-col p-3 rounded-lg text-left transition-all duration-200 border ${f?"bg-purple-500/20 border-purple-500/50 shadow-[0_0_15px_-3px_rgba(168,85,247,0.3)]":"bg-[#252525] border-transparent hover:bg-[#2a2a2a] hover:border-gray-700"}`,children:[a.jsxs("div",{className:"flex items-center justify-between w-full mb-1",children:[a.jsx("span",{className:"font-bold text-white text-sm",children:"A color"}),a.jsx("div",{className:`w-8 h-4 rounded-full transition-colors ${f?"bg-purple-500":"bg-gray-600"} relative`,children:a.jsx("div",{className:`absolute top-0.5 left-0.5 w-3 h-3 rounded-full bg-white transition-transform duration-200 ${f?"translate-x-4":"translate-x-0"}`})})]}),a.jsx("span",{className:"text-xs text-gray-400",children:"Mostrar solo contenido a color"})]})]})]}),Cb.map(E=>{const C=x[E];return!C||C.length===0?null:a.jsxs("div",{className:"animate-in slide-in-from-bottom-2 duration-300",children:[a.jsxs("h3",{className:"text-sm font-bold text-purple-400 uppercase tracking-wider mb-3 flex items-center gap-2",children:[a.jsx("span",{className:"w-1 h-4 bg-purple-500 rounded-full"}),KF[E]||E]}),a.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-2",children:C.sort((y,v)=>y.name.localeCompare(v.name)).map(y=>{const v=r.includes(y.name);return a.jsxs("button",{onClick:()=>s(y.name),className:` + relative group flex items-center justify-between px-3 py-2 rounded-lg text-sm text-left transition-all duration-200 border + ${v?"bg-purple-500/20 border-purple-500/50 text-purple-100 shadow-[0_0_15px_-3px_rgba(168,85,247,0.3)]":"bg-[#252525] border-transparent text-gray-300 hover:bg-[#2a2a2a] hover:border-gray-700"} + `,children:[a.jsx("span",{className:"truncate mr-2 font-medium",children:y.name}),v&&a.jsx("div",{className:"bg-purple-500 rounded-full p-0.5 animate-in zoom-in duration-200",children:a.jsx(dc,{className:"w-3 h-3 text-white"})})]},y.id)})})]},E)})]}),a.jsxs("div",{className:"p-4 border-t border-gray-800 bg-[#1a1a1a] flex items-center justify-between",children:[a.jsxs("div",{className:"text-sm text-gray-400",children:[r.length+(o?1:0)+(c?1:0)+(f?1:0)," filtros activos"]}),a.jsxs("div",{className:"flex items-center gap-3",children:[(r.length>0||o||c||f)&&a.jsx("button",{onClick:i,className:"px-4 py-2 text-sm text-gray-400 hover:text-white transition-colors",children:"Limpiar todo"}),a.jsx("button",{onClick:e,className:"px-6 py-2 bg-purple-600 hover:bg-purple-700 text-white rounded-lg text-sm font-semibold shadow-lg shadow-purple-900/20 transition-all hover:scale-105 active:scale-95",children:"Listo"})]})]})]})}):null}function YF({isOpen:t,onClose:e,mangas:n,onSaveComplete:r}){const[s,i]=L.useState(""),[o,l]=L.useState({}),[c,u]=L.useState(!1);L.useEffect(()=>{t&&(i(""),l({}))},[t]);const f=L.useMemo(()=>{let p=[...n];if(s){const x=s.toLowerCase();p=p.filter(E=>E.title.toLowerCase().includes(x))}return p.sort((x,E)=>x.title.localeCompare(E.title))},[n,s]),h=(p,x)=>{l(E=>({...E,[p]:x}))},m=async()=>{const p=Object.entries(o).filter(([x,E])=>{const C=n.find(y=>y.id===x);return C&&C.title!==E.trim()&&E.trim()!==""});if(p.length===0){be.info("No hay cambios para guardar");return}try{u(!0);const x=p.map(([E,C])=>({id:E,title:C.trim()}));await O0(x),be.success(`Se actualizaron ${x.length} nombres correctamente`),r(),e()}catch(x){console.error("Error saving titles:",x),be.error("Error al guardar los cambios")}finally{u(!1)}};return t?a.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-[60] p-4 animate-in fade-in duration-200",children:a.jsxs("div",{className:"bg-[#121212] rounded-2xl border border-gray-800 w-full max-w-2xl shadow-2xl overflow-hidden flex flex-col max-h-[85vh]",children:[a.jsxs("div",{className:"bg-[#1a1a1a] border-b border-gray-800 px-6 py-4 flex items-center justify-between sticky top-0 z-10 flex-shrink-0",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-blue-500/10 rounded-lg text-blue-400",children:a.jsx(Yo,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-xl font-bold text-white",children:"Gestor de Nombres"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Edita los títulos de los mangas masivamente"})]})]}),a.jsx("button",{onClick:e,className:"text-gray-400 hover:text-white transition-colors p-2 hover:bg-white/5 rounded-lg",children:a.jsx(gt,{className:"w-5 h-5"})})]}),a.jsx("div",{className:"p-4 border-b border-gray-800 bg-[#121212] flex-shrink-0",children:a.jsxs("div",{className:"relative",children:[a.jsx(no,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400"}),a.jsx("input",{type:"text",value:s,onChange:p=>i(p.target.value),placeholder:"Buscar manga por título...",className:"w-full bg-[#1a1a1a] border border-gray-700 rounded-xl pl-10 pr-4 py-3 text-sm text-white focus:outline-none focus:border-blue-500 transition-colors"})]})}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-2 custom-scrollbar",children:[f.map(p=>{const x=p.cover_url||p.thumbnail_url,E=x?Ks(x):void 0;return a.jsxs("div",{className:"flex items-center gap-3 bg-[#1a1a1a] p-3 rounded-lg border border-gray-800/50 hover:border-gray-700 transition-colors",children:[E?a.jsx("img",{src:E,alt:"",className:"w-10 h-10 rounded object-cover"}):a.jsx("div",{className:"w-10 h-10 rounded bg-gray-800 flex items-center justify-center",children:a.jsx("span",{className:"text-xs text-gray-500 text-center",children:"Sin img"})}),a.jsx("div",{className:"flex-1",children:a.jsx("input",{type:"text",value:o[p.id]!==void 0?o[p.id]:p.title,onChange:C=>h(p.id,C.target.value),className:`w-full bg-transparent border-b pl-2 py-1 text-sm focus:outline-none transition-colors ${o[p.id]!==void 0&&o[p.id].trim()!==p.title?"border-blue-500 text-blue-300":"border-transparent hover:border-gray-700 text-white focus:border-gray-600"}`,placeholder:"Título del manga"})})]},p.id)}),f.length===0&&a.jsx("div",{className:"text-center py-8 text-gray-500",children:"No se encontraron mangas con ese nombre"})]}),a.jsxs("div",{className:"bg-[#1a1a1a] border-t border-gray-800 px-6 py-4 flex justify-between items-center sticky bottom-0 flex-shrink-0",children:[a.jsxs("span",{className:"text-sm text-gray-400",children:[Object.keys(o).filter(p=>{var x;return o[p].trim()!==((x=n.find(E=>E.id===p))==null?void 0:x.title)}).length," cambios pendientes"]}),a.jsxs("div",{className:"flex gap-3",children:[a.jsx("button",{onClick:e,className:"px-4 py-2 text-sm font-semibold text-gray-300 hover:text-white transition-colors",disabled:c,children:"Cancelar"}),a.jsx("button",{onClick:m,disabled:c,className:"bg-blue-600 hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed text-white px-6 py-2 rounded-lg text-sm font-bold shadow-lg shadow-blue-500/20 transition-all flex items-center gap-2",children:c?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Ea,{className:"w-4 h-4"}),"Guardar Cambios"]})})]})]})]})}):null}function XF({isOpen:t,onClose:e,mangas:n,selectedMangaIds:r,onSaveComplete:s}){const[i,o]=L.useState(""),[l,c]=L.useState(""),[u,f]=L.useState({}),[h,m]=L.useState(!1);L.useEffect(()=>{t&&(o(""),c(""),f({}))},[t]);const p=()=>{if(!l.trim())return;const y={...u};n.filter(v=>r.includes(v.id)).forEach(v=>{y[v.id]=l}),f(y),be.success(`Nombre aplicado a ${r.length} mangas localmente`)},x=L.useMemo(()=>{let y=n.filter(v=>r.includes(v.id));if(i){const v=i.toLowerCase();y=y.filter(_=>_.title.toLowerCase().includes(v))}return y.sort((v,_)=>v.title.localeCompare(_.title))},[n,r,i]),E=(y,v)=>{f(_=>({..._,[y]:v}))},C=async()=>{const y=Object.entries(u).filter(([v,_])=>{const D=n.find(M=>M.id===v);return D&&D.title!==_.trim()&&_.trim()!==""});if(y.length===0){be.info("No hay cambios para guardar");return}try{m(!0);const v=y.map(([_,D])=>({id:_,title:D.trim()}));await O0(v),be.success(`Se actualizaron ${v.length} nombres correctamente`),s(),e()}catch(v){console.error("Error saving titles:",v),be.error("Error al guardar los cambios")}finally{m(!1)}};return t?a.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-[60] p-4 animate-in fade-in duration-200",children:a.jsxs("div",{className:"bg-[#121212] rounded-2xl border border-gray-800 w-full max-w-2xl shadow-2xl overflow-hidden flex flex-col max-h-[85vh]",children:[a.jsxs("div",{className:"bg-[#1a1a1a] border-b border-gray-800 px-6 py-4 flex items-center justify-between sticky top-0 z-10 flex-shrink-0",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-pink-500/10 rounded-lg text-pink-400",children:a.jsx(Yo,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-xl font-bold text-white",children:"Editar Nombres"}),a.jsxs("p",{className:"text-xs text-gray-400",children:["Edita los títulos de los ",r.length," mangas seleccionados"]})]})]}),a.jsx("button",{onClick:e,className:"text-gray-400 hover:text-white transition-colors p-2 hover:bg-white/5 rounded-lg",children:a.jsx(gt,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"p-4 border-b border-gray-800 bg-[#121212] flex-shrink-0 space-y-3",children:[a.jsxs("div",{className:"relative",children:[a.jsx(no,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400"}),a.jsx("input",{type:"text",value:i,onChange:y=>o(y.target.value),placeholder:"Filtrar manga por título...",className:"w-full bg-[#1a1a1a] border border-gray-700 rounded-xl pl-10 pr-4 py-3 text-sm text-white focus:outline-none focus:border-pink-500 transition-colors"})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("input",{type:"text",value:l,onChange:y=>c(y.target.value),placeholder:"Pon un nombre para aplicar a todos los seleccionados (Opcional)",className:"flex-1 bg-[#1a1a1a] border border-gray-700 rounded-xl px-4 py-3 text-sm text-white focus:outline-none focus:border-pink-500 transition-colors"}),a.jsx("button",{onClick:p,className:"bg-gray-800 hover:bg-gray-700 text-white px-6 py-3 rounded-xl text-sm font-medium transition-colors whitespace-nowrap",children:"Aplicar a todos"})]})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-2 custom-scrollbar",children:[x.map(y=>{const v=y.cover_url||y.thumbnail_url,_=v?Ks(v):void 0;return a.jsxs("div",{className:"flex items-center gap-3 bg-[#1a1a1a] p-3 rounded-lg border border-gray-800/50 hover:border-gray-700 transition-colors",children:[_?a.jsx("img",{src:_,alt:"",className:"w-10 h-10 rounded object-cover"}):a.jsx("div",{className:"w-10 h-10 rounded bg-gray-800 flex items-center justify-center",children:a.jsx("span",{className:"text-xs text-gray-500 text-center",children:"Sin img"})}),a.jsx("div",{className:"flex-1",children:a.jsx("input",{type:"text",value:u[y.id]!==void 0?u[y.id]:y.title,onChange:D=>E(y.id,D.target.value),className:`w-full bg-transparent border-b pl-2 py-1 text-sm focus:outline-none transition-colors ${u[y.id]!==void 0&&u[y.id].trim()!==y.title?"border-pink-500 text-pink-300":"border-transparent hover:border-gray-700 text-white focus:border-gray-600"}`,placeholder:"Título del manga"})})]},y.id)}),x.length===0&&a.jsx("div",{className:"text-center py-8 text-gray-500",children:"No se encontraron mangas con ese nombre en la selección"})]}),a.jsxs("div",{className:"bg-[#1a1a1a] border-t border-gray-800 px-6 py-4 flex justify-between items-center sticky bottom-0 flex-shrink-0",children:[a.jsxs("span",{className:"text-sm text-gray-400",children:[Object.keys(u).filter(y=>{var v;return u[y].trim()!==((v=n.find(_=>_.id===y))==null?void 0:v.title)}).length," cambios pendientes"]}),a.jsxs("div",{className:"flex gap-3",children:[a.jsx("button",{onClick:e,className:"px-4 py-2 text-sm font-semibold text-gray-300 hover:text-white transition-colors",disabled:h,children:"Cancelar"}),a.jsx("button",{onClick:C,disabled:h,className:"bg-pink-600 hover:bg-pink-700 disabled:opacity-50 disabled:cursor-not-allowed text-white px-6 py-2 rounded-lg text-sm font-bold shadow-lg shadow-pink-500/20 transition-all flex items-center gap-2",children:h?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Ea,{className:"w-4 h-4"}),"Guardar Cambios"]})})]})]})]})}):null}function JF({isOpen:t,onClose:e,selectedMangaIds:n,onSaveComplete:r}){const[s,i]=L.useState([]),[o,l]=L.useState(!1),[c,u]=L.useState(!1),[f,h]=L.useState(!1),[m,p]=L.useState(!1),[x,E]=L.useState(!1);L.useEffect(()=>{t&&(C(),h(!1),p(!1),E(!1))},[t,n]);const C=async()=>{l(!0);try{const T=await Promise.all(n.map(async S=>{const w=await Ni(S);return w?{id:w.id,title:w.title,is_decensored:!!w.is_decensored,is_bn:!!w.is_bn,is_color:!!w.is_color,hasChanged:!1}:null}));i(T.filter(S=>S!==null))}catch(T){console.error("Error loading mangas:",T),be.error("Error al cargar la información de los mangas")}finally{l(!1)}},y=T=>{h(T),i(S=>S.map(w=>({...w,is_decensored:T,hasChanged:!0})))},v=T=>{p(T),T&&E(!1),i(S=>S.map(w=>({...w,is_bn:T,is_color:T?!1:w.is_color,hasChanged:!0})))},_=T=>{E(T),T&&p(!1),i(S=>S.map(w=>({...w,is_color:T,is_bn:T?!1:w.is_bn,hasChanged:!0})))},D=(T,S,w)=>{i(N=>N.map(A=>{if(A.id!==T)return A;const I={...A,[S]:w,hasChanged:!0};return S==="is_bn"&&w&&(I.is_color=!1),S==="is_color"&&w&&(I.is_bn=!1),I}))},M=async()=>{const T=s.filter(S=>S.hasChanged);if(T.length===0){be.info("No hay cambios para guardar"),e();return}u(!0);try{const S=T.map(w=>Lh(w.id,{is_decensored:w.is_decensored,is_bn:w.is_bn,is_color:w.is_color}));await Promise.all(S),be.success(`Se actualizaron las etiquetas de ${T.length} mangas`),r(),e()}catch(S){console.error("Error updating mangas:",S),be.error("Ocurrió un error al guardar los cambios")}finally{u(!1)}};return t?a.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50 p-4 animate-in fade-in duration-200",children:a.jsxs("div",{className:"bg-[#121212] rounded-2xl border border-gray-800 w-full max-w-4xl shadow-2xl overflow-hidden flex flex-col max-h-[90vh]",children:[a.jsxs("div",{className:"bg-[#1a1a1a] border-b border-gray-800 px-6 py-4 flex items-center justify-between sticky top-0 z-10",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-[#bb86fc]/10 rounded-lg text-[#bb86fc]",children:a.jsx(vd,{className:"w-5 h-5"})}),a.jsxs("h2",{className:"text-xl font-bold text-white",children:["Etiquetadora (",n.length," mangas)"]})]}),a.jsx("button",{onClick:e,className:"text-gray-400 hover:text-white transition-colors p-2 hover:bg-white/5 rounded-lg",children:a.jsx(gt,{className:"w-5 h-5"})})]}),a.jsx("div",{className:"p-6 overflow-y-auto custom-scrollbar flex-1 space-y-6",children:o?a.jsx("div",{className:"flex justify-center p-8",children:a.jsx(Sr,{size:32})}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"bg-[#1f1f1f] p-5 rounded-xl border border-gray-700 shadow-lg",children:[a.jsxs("h3",{className:"text-md font-bold text-white mb-4 flex items-center gap-2",children:[a.jsx(vd,{className:"w-4 h-4 text-[#bb86fc]"})," Opciones Generales"]}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-6",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[a.jsx("input",{type:"checkbox",className:"sr-only peer",checked:f,onChange:T=>y(T.target.checked)}),a.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-[#bb86fc]"})]}),a.jsx("div",{children:a.jsx("span",{className:"text-sm font-semibold text-white",children:"Sin censura (Todos)"})})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[a.jsx("input",{type:"checkbox",className:"sr-only peer",checked:m,onChange:T=>v(T.target.checked)}),a.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-[#bb86fc]"})]}),a.jsx("div",{children:a.jsx("span",{className:"text-sm font-semibold text-white",children:"B/N (Todos)"})})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[a.jsx("input",{type:"checkbox",className:"sr-only peer",checked:x,onChange:T=>_(T.target.checked)}),a.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-[#bb86fc]"})]}),a.jsx("div",{children:a.jsx("span",{className:"text-sm font-semibold text-white",children:"a color (Todos)"})})]})]})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("h3",{className:"text-sm font-bold text-gray-400 uppercase tracking-wider px-2",children:["Mangas Individuales (",s.length,")"]}),a.jsx("div",{className:"bg-[#1a1a1a] rounded-xl border border-gray-800 divide-y divide-gray-800",children:s.map(T=>a.jsxs("div",{className:`p-4 flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4 transition-colors ${T.hasChanged?"bg-[#bb86fc]/5":"hover:bg-[#1f1f1f]"}`,children:[a.jsxs("div",{className:"flex-1 min-w-0 pr-4",children:[a.jsx("h4",{className:"text-sm font-semibold text-white truncate",title:T.title,children:T.title}),T.hasChanged&&a.jsx("span",{className:"text-[10px] text-[#bb86fc] uppercase tracking-widest font-bold",children:"Modificado"})]}),a.jsxs("div",{className:"flex items-center gap-4 sm:gap-6 shrink-0",children:[a.jsxs("div",{className:"flex flex-col items-center gap-1",children:[a.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[a.jsx("input",{type:"checkbox",className:"sr-only peer",checked:T.is_decensored,onChange:S=>D(T.id,"is_decensored",S.target.checked)}),a.jsx("div",{className:"w-9 h-5 bg-gray-700 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-[#bb86fc]"})]}),a.jsx("span",{className:"text-[10px] text-gray-400 font-medium",children:"Sin censura"})]}),a.jsxs("div",{className:"flex flex-col items-center gap-1",children:[a.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[a.jsx("input",{type:"checkbox",className:"sr-only peer",checked:T.is_bn,onChange:S=>D(T.id,"is_bn",S.target.checked)}),a.jsx("div",{className:"w-9 h-5 bg-gray-700 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-[#bb86fc]"})]}),a.jsx("span",{className:"text-[10px] text-gray-400 font-medium",children:"B/N"})]}),a.jsxs("div",{className:"flex flex-col items-center gap-1",children:[a.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[a.jsx("input",{type:"checkbox",className:"sr-only peer",checked:T.is_color,onChange:S=>D(T.id,"is_color",S.target.checked)}),a.jsx("div",{className:"w-9 h-5 bg-gray-700 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-[#bb86fc]"})]}),a.jsx("span",{className:"text-[10px] text-gray-400 font-medium",children:"a color"})]})]})]},T.id))})]})]})}),a.jsxs("div",{className:"p-6 border-t border-gray-800 flex justify-end gap-3 bg-[#1a1a1a]",children:[a.jsx("button",{onClick:e,className:"px-4 py-2 rounded-lg text-sm font-semibold text-gray-300 hover:text-white transition-colors",children:"Cancelar"}),a.jsx("button",{onClick:M,disabled:c||o||s.filter(T=>T.hasChanged).length===0,className:"bg-[#bb86fc] hover:bg-[#9966dd] text-white px-6 py-2 rounded-lg font-semibold text-sm transition-all shadow-lg shadow-[#bb86fc]/20 flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",children:c?a.jsxs(a.Fragment,{children:[a.jsx(Sr,{size:16}),"Guardando..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Ea,{className:"w-4 h-4"}),"Guardar Cambios (",s.filter(T=>T.hasChanged).length,")"]})})]})]})}):null}function ZF({isOpen:t,onClose:e,selectedMangaIds:n,onSaveComplete:r,currentFolderId:s,currentSection:i}){const[o,l]=L.useState(""),[c,u]=L.useState(!1),f=async()=>{if(!o.trim()){be.error("Gamba: Escribe un nombre para la carpeta");return}try{u(!0),await DD(o.trim(),n,s,i),be.success(`Carpeta "${o}" creada exitosamente.`),r(),e(),l("")}catch(h){console.error("Error creating folder:",h),be.error("Error al crear la carpeta")}finally{u(!1)}};return t?a.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-[70] p-4 animate-in fade-in duration-200",children:a.jsxs("div",{className:"bg-[#121212] rounded-2xl border border-gray-800 w-full max-w-sm shadow-2xl overflow-hidden flex flex-col",children:[a.jsxs("div",{className:"bg-[#1a1a1a] border-b border-gray-800 px-6 py-4 flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-purple-500/10 rounded-lg text-purple-400",children:a.jsx(Q_,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-xl font-bold text-white",children:"Crear Carpeta"}),a.jsxs("p",{className:"text-xs text-gray-400",children:[n.length," elementos seleccionados"]})]})]}),a.jsx("button",{onClick:e,className:"text-gray-400 hover:text-white transition-colors p-2 hover:bg-white/5 rounded-lg",children:a.jsx(gt,{className:"w-5 h-5"})})]}),a.jsx("div",{className:"p-6",children:a.jsx("input",{type:"text",value:o,onChange:h=>l(h.target.value),placeholder:"Nombre de la nueva carpeta",className:"w-full bg-[#1a1a1a] border border-gray-700 rounded-xl px-4 py-3 text-sm text-white focus:outline-none focus:border-purple-500 transition-colors",autoFocus:!0})}),a.jsxs("div",{className:"bg-[#1a1a1a] border-t border-gray-800 px-6 py-4 flex justify-end gap-3",children:[a.jsx("button",{onClick:e,className:"px-4 py-2 text-sm font-semibold text-gray-300 hover:text-white transition-colors",disabled:c,children:"Cancelar"}),a.jsx("button",{onClick:f,disabled:c||!o.trim(),className:"bg-purple-600 hover:bg-purple-700 disabled:opacity-50 disabled:cursor-not-allowed text-white px-6 py-2 rounded-lg text-sm font-bold shadow-lg shadow-purple-500/20 transition-all flex items-center gap-2",children:c?"Creando...":"Crear"})]})]})}):null}function e8({isOpen:t,onClose:e,selectedMangaIds:n,mangas:r,onSaveComplete:s}){const[i,o]=L.useState(""),[l,c]=L.useState(!1),[u,f]=L.useState(null),[h,m]=L.useState(new Set),p=(v,_)=>{v.stopPropagation(),m(D=>{const M=new Set(D);return M.has(_)?M.delete(_):M.add(_),M})},x=L.useMemo(()=>{const v=r.filter(T=>T.is_folder&&!n.includes(T.id)),_=new Map;v.forEach(T=>{_.set(T.id,{folder:T,children:[]})});const D=[];v.forEach(T=>{const S=_.get(T.id);T.folder_id&&_.has(T.folder_id)?_.get(T.folder_id).children.push(S):D.push(S)});const M=T=>{T.sort((S,w)=>S.folder.title.localeCompare(w.folder.title)),T.forEach(S=>M(S.children))};return M(D),D},[r,n]),E=L.useMemo(()=>{const v=[],_=i.toLowerCase(),D=T=>!_||T.folder.title.toLowerCase().includes(_)?!0:T.children.some(D),M=(T,S,w)=>{T.forEach(N=>{if(D(N)){v.push({folder:N.folder,level:S,hasChildren:N.children.length>0});const I=w||h.has(N.folder.id);N.children.length>0&&I&&M(N.children,S+1,w)}})};return M(x,0,!!_),v},[x,h,i]),C=async v=>{try{c(!0);const _=new Set(r.filter(T=>n.includes(T.id)&&T.is_folder).map(T=>T.id)),D=T=>{var N,A;let S=(N=r.find(I=>I.id===T))==null?void 0:N.folder_id,w=0;for(;S&&w<20;){if(_.has(S))return!0;S=(A=r.find(I=>I.id===S))==null?void 0:A.folder_id,w++}return!1},M=n.filter(T=>!D(T));await M2(M,v),v?be.success("Movido exitosamente a la carpeta."):be.success("Removido de la carpeta exitosamente."),s(),e()}catch(_){console.error("Error moving to folder:",_),be.error("Error al mover a la carpeta")}finally{c(!1)}},y=async v=>{try{c(!0),await Ud(v),be.success("Carpeta eliminada correctamente"),f(null),s()}catch(_){console.error("Error deleting folder:",_),be.error("Error al eliminar la carpeta")}finally{c(!1)}};return t?a.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-[70] p-4 animate-in fade-in duration-200",children:a.jsxs("div",{className:"bg-[#121212] rounded-2xl border border-gray-800 w-full max-w-4xl shadow-2xl overflow-hidden flex flex-col max-h-[90vh] min-h-[60vh]",children:[a.jsxs("div",{className:"bg-[#1a1a1a] border-b border-gray-800 px-6 py-4 flex items-center justify-between sticky top-0 z-10 flex-shrink-0",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-blue-500/10 rounded-lg text-blue-400",children:a.jsx(zx,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-xl font-bold text-white",children:"Mover a Carpeta"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Selecciona la carpeta de destino"})]})]}),a.jsx("button",{onClick:e,className:"text-gray-400 hover:text-white transition-colors p-2 hover:bg-white/5 rounded-lg",children:a.jsx(gt,{className:"w-5 h-5"})})]}),a.jsx("div",{className:"p-4 border-b border-gray-800 bg-[#121212] flex-shrink-0",children:a.jsxs("div",{className:"relative",children:[a.jsx(no,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400"}),a.jsx("input",{type:"text",value:i,onChange:v=>o(v.target.value),placeholder:"Buscar carpeta...",className:"w-full bg-[#1a1a1a] border border-gray-700 rounded-xl pl-10 pr-4 py-3 text-sm text-white focus:outline-none focus:border-blue-500 transition-colors"})]})}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-2 custom-scrollbar overscroll-contain",style:{contain:"content"},children:[a.jsxs("button",{onClick:()=>C(null),disabled:l,className:"w-full flex items-center gap-3 p-3 rounded-xl border border-dashed border-gray-700 hover:border-blue-500 hover:bg-blue-500/5 transition-colors text-left group",children:[a.jsx("div",{className:"w-10 h-10 rounded-lg bg-gray-800 flex items-center justify-center group-hover:bg-blue-500/20 transition-colors",children:a.jsx("span",{className:"text-lg",children:"🏠"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h3",{className:"text-sm font-semibold text-white",children:"Raíz (Pantalla principal)"}),a.jsx("p",{className:"text-xs text-gray-400 border-gray-700",children:"Sacar de cualquier carpeta"})]})]}),a.jsx("div",{className:"h-px bg-gray-800 my-4"}),E.map(({folder:v,level:_,hasChildren:D})=>{const M=!!i||h.has(v.id);return a.jsxs("div",{className:"w-full flex items-center gap-2",style:{contentVisibility:"auto",containIntrinsicSize:"0 64px"},children:[a.jsx("div",{style:{width:`${_*1.5}rem`},className:"flex-shrink-0"}),a.jsx("div",{className:"w-6 flex items-center justify-center flex-shrink-0",children:D&&a.jsx("button",{onClick:T=>p(T,v.id),className:"p-1 rounded hover:bg-gray-700 text-gray-400 hover:text-white transition-colors",children:M?a.jsx(RI,{className:"w-4 h-4"}):a.jsx(hc,{className:"w-4 h-4"})})}),a.jsxs("button",{onClick:()=>C(v.id),disabled:l,className:"flex-1 flex items-center gap-3 p-3 rounded-xl border border-gray-800 bg-[#1a1a1a] hover:border-blue-500 transition-colors text-left group",children:[a.jsx("div",{className:"w-10 h-10 rounded-lg bg-gray-800 flex items-center justify-center overflow-hidden flex-shrink-0",children:a.jsx(zx,{className:"w-5 h-5 text-gray-400 group-hover:text-blue-400 transition-colors"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("h3",{className:"text-sm font-semibold text-white group-hover:text-blue-400 transition-colors truncate",children:v.title}),a.jsx("p",{className:"text-xs text-gray-400",children:"Carpeta"})]})]}),a.jsx("button",{onClick:T=>{T.stopPropagation(),f(v.id)},disabled:l,className:"p-3 rounded-xl border border-gray-800 bg-[#1a1a1a] hover:bg-red-600 hover:border-red-500 transition-colors text-gray-400 hover:text-white flex items-center justify-center flex-shrink-0",title:"Eliminar carpeta",children:a.jsx(tn,{className:"w-5 h-5"})})]},v.id)}),E.length===0&&a.jsx("div",{className:"text-center py-8 text-gray-500",children:"No hay carpetas disponibles"})]}),u&&a.jsxs("div",{className:"absolute inset-0 bg-black/80 backdrop-blur-sm flex flex-col items-center justify-center gap-4 rounded-2xl z-[80] animate-in fade-in duration-200",children:[a.jsxs("p",{className:"text-white text-base font-semibold text-center px-6",children:["¿Seguro que deseas eliminar esta carpeta?",a.jsx("br",{}),a.jsx("span",{className:"text-gray-400 text-sm font-normal mt-2 block",children:"Los cómics dentro de ella volverán a la vista principal."})]}),a.jsxs("div",{className:"flex gap-3",children:[a.jsx("button",{onClick:v=>{v.stopPropagation(),f(null)},disabled:l,className:"bg-gray-700 hover:bg-gray-600 text-white px-5 py-2.5 rounded-xl text-sm font-semibold transition-all duration-200 transform hover:scale-105 active:scale-95",children:"Cancelar"}),a.jsx("button",{onClick:v=>{v.stopPropagation(),y(u)},disabled:l,className:"bg-red-600 hover:bg-red-700 text-white px-5 py-2.5 rounded-xl text-sm font-semibold transition-all duration-200 transform hover:scale-105 active:scale-95",children:l?"Eliminando...":"Eliminar"})]})]})]})}):null}function UT({className:t=""}){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:t,children:a.jsx("path",{d:"M12 0C5.373 0 0 5.373 0 12c0 6.628 5.373 12 12 12 6.628 0 12-5.373 12-12C24 5.373 18.628 0 12 0zm5.663 11.233c-.015.004-.37.108-1.077.306a4.426 4.426 0 00-2.316-1.527c1.332-.387 2.37-1.4 2.37-2.671 0-1.637-1.464-2.964-3.266-2.964-1.801 0-3.264 1.327-3.264 2.964 0 .918.461 1.745 1.189 2.29.076.057.155.112.235.163-.64.062-1.242.062-1.803.04l-.066-.003c-2.387-.145-3.593-1.603-3.615-1.636l-.612-.872-1.073.49s1.396 3.1 4.545 3.327c.489.034.996.035 1.503.003-.021.054-.04.11-.059.167-.718 1.956-1.248 3.906-1.264 3.966l-.161.642.553.376c1.037.706 2.308 1.08 3.611 1.08h.084c3.42 0 6.138-2.607 6.138-5.91 0-.916-.217-1.782-.6-2.553l-.052-.1zM11.964 5.568c1.139 0 2.064.881 2.064 1.964 0 .864-.593 1.6-1.405 1.86a4.576 4.576 0 00-1.318-1.583c.196-1.198.814-2.241 2.241-2.241z"})})}function t8({isOpen:t,onClose:e,selectedMangaIds:n,onSaveComplete:r,currentSection:s}){const[i,o]=L.useState(s==="flow"?"patreon":"flow"),[l,c]=L.useState(!1),u=async()=>{if(i===s){be.error("Gamba: Ya estás en esta sección");return}try{c(!0),await MD(n,i);let f="Flow";i==="patreon"&&(f="Patreon"),i==="onlyfans"&&(f="OnlyFans"),be.success(`${n.length} elementos movidos a ${f}`),r(),e()}catch(f){console.error("Error moving section:",f),be.error("Error al mover los elementos de sección")}finally{c(!1)}};return t?a.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-[70] p-4 animate-in fade-in duration-200",children:a.jsxs("div",{className:"bg-[#121212] rounded-2xl border border-gray-800 w-full max-w-sm shadow-2xl overflow-hidden flex flex-col",children:[a.jsxs("div",{className:"bg-[#1a1a1a] border-b border-gray-800 px-6 py-4 flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-indigo-500/10 rounded-lg text-indigo-400",children:a.jsx(Dg,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-xl font-bold text-white",children:"Mover a Sección"}),a.jsxs("p",{className:"text-xs text-gray-400",children:[n.length," elementos seleccionados"]})]})]}),a.jsx("button",{onClick:e,className:"text-gray-400 hover:text-white transition-colors p-2 hover:bg-white/5 rounded-lg",children:a.jsx(gt,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"p-6 space-y-4",children:[a.jsx("p",{className:"text-sm text-gray-300 text-center mb-4",children:"¿A qué sección deseas enviar estos elementos?"}),a.jsxs("button",{onClick:()=>o("flow"),disabled:s==="flow",className:`w-full flex items-center justify-between p-4 rounded-xl border transition-all ${s==="flow"?"border-gray-800 bg-[#121212] opacity-50 cursor-not-allowed":i==="flow"?"border-[#bb86fc] bg-[#bb86fc]/10 text-white":"border-gray-700 bg-[#1a1a1a] text-gray-400 hover:border-gray-500"}`,children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`p-2 rounded-lg ${s==="flow"?"bg-gray-800 text-gray-500":i==="flow"?"bg-[#bb86fc]/20 text-[#bb86fc]":"bg-gray-800 text-gray-400"}`,children:a.jsx(Wr,{className:"w-5 h-5"})}),a.jsxs("div",{className:"text-left",children:[a.jsx("h3",{className:"font-semibold text-sm",children:"Flow"}),a.jsx("p",{className:"text-xs opacity-70",children:"Galería principal"})]})]}),s==="flow"&&a.jsx("span",{className:"text-xs font-bold px-2 py-1 rounded bg-gray-800 text-gray-400",children:"Actual"})]}),a.jsxs("button",{onClick:()=>o("patreon"),disabled:s==="patreon",className:`w-full flex items-center justify-between p-4 rounded-xl border transition-all ${s==="patreon"?"border-gray-800 bg-[#121212] opacity-50 cursor-not-allowed":i==="patreon"?"border-[#f96854] bg-[#f96854]/10 text-white":"border-gray-700 bg-[#1a1a1a] text-gray-400 hover:border-gray-500"}`,children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`p-2 rounded-lg ${s==="patreon"?"bg-gray-800 text-gray-500":i==="patreon"?"bg-[#f96854]/20 text-[#f96854]":"bg-gray-800 text-gray-400"}`,children:a.jsx(sc,{className:"w-5 h-5"})}),a.jsxs("div",{className:"text-left",children:[a.jsx("h3",{className:"font-semibold text-sm",children:"Patreon"}),a.jsx("p",{className:"text-xs opacity-70",children:"Contenido exclusivo"})]})]}),s==="patreon"&&a.jsx("span",{className:"text-xs font-bold px-2 py-1 rounded bg-gray-800 text-gray-400",children:"Actual"})]}),a.jsxs("button",{onClick:()=>o("onlyfans"),disabled:s==="onlyfans",className:`w-full flex items-center justify-between p-4 rounded-xl border transition-all ${s==="onlyfans"?"border-gray-800 bg-[#121212] opacity-50 cursor-not-allowed":i==="onlyfans"?"border-[#00AFF0] bg-[#00AFF0]/10 text-white":"border-gray-700 bg-[#1a1a1a] text-gray-400 hover:border-gray-500"}`,children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`p-2 rounded-lg ${s==="onlyfans"?"bg-gray-800 text-gray-500":i==="onlyfans"?"bg-[#00AFF0]/20 text-[#00AFF0]":"bg-gray-800 text-gray-400"}`,children:a.jsx(UT,{className:"w-5 h-5"})}),a.jsxs("div",{className:"text-left",children:[a.jsx("h3",{className:"font-semibold text-sm",children:"OnlyFans"}),a.jsx("p",{className:"text-xs opacity-70",children:"Contenido premium"})]})]}),s==="onlyfans"&&a.jsx("span",{className:"text-xs font-bold px-2 py-1 rounded bg-gray-800 text-gray-400",children:"Actual"})]})]}),a.jsxs("div",{className:"bg-[#1a1a1a] border-t border-gray-800 px-6 py-4 flex justify-end gap-3",children:[a.jsx("button",{onClick:e,className:"px-4 py-2 text-sm font-semibold text-gray-300 hover:text-white transition-colors",disabled:l,children:"Cancelar"}),a.jsx("button",{onClick:u,disabled:l||i===s,className:"bg-indigo-600 hover:bg-indigo-700 disabled:opacity-50 disabled:cursor-not-allowed text-white px-6 py-2 rounded-lg text-sm font-bold shadow-lg shadow-indigo-500/20 transition-all flex items-center gap-2",children:l?"Moviendo...":"Mover"})]})]})}):null}function n8({isOpen:t,onClose:e,mangas:n}){const r=L.useMemo(()=>{const i=new Map;n.forEach(l=>{i.set(l.id,{item:l,children:[]})});const o=[];return n.forEach(l=>{const c=i.get(l.id);l.folder_id&&i.has(l.folder_id)?i.get(l.folder_id).children.push(c):o.push(c)}),o},[n]);if(!t)return null;const s=(i,o=0)=>{if(i.length===0)return null;const l=[...i].sort((c,u)=>c.item.is_folder&&!u.item.is_folder?-1:!c.item.is_folder&&u.item.is_folder?1:c.item.title.localeCompare(u.item.title));return a.jsxs("div",{className:"flex flex-col gap-3 relative",style:{marginLeft:o>0?"2.5rem":"0"},children:[o>0&&a.jsx("div",{className:"absolute -left-6 top-0 bottom-6 w-px bg-gray-700/50"}),l.map((c,u)=>{var m;const f=u===l.length-1,h=o===0&&c.item.is_folder;return a.jsxs("div",{className:"relative",children:[o>0&&a.jsx("div",{className:"absolute -left-6 top-6 w-6 h-px bg-gray-700/50"}),o>0&&f&&a.jsx("div",{className:"absolute -left-6 top-6 bottom-0 w-px bg-[#1a1a1a]"}),a.jsxs("div",{className:`p-4 rounded-xl border flex flex-col gap-3 transition-colors ${c.item.is_folder?h?"bg-purple-900/10 border-purple-500/30":"bg-blue-900/10 border-blue-500/20":"bg-gray-800/40 border-gray-700/50"}`,children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`p-2 rounded-lg ${c.item.is_folder?h?"bg-purple-500/20 text-purple-400":"bg-blue-500/20 text-blue-400":"bg-emerald-500/10 text-emerald-500"}`,children:c.item.is_folder?a.jsx(xr,{className:"w-5 h-5"}):a.jsx(Yp,{className:"w-5 h-5"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h4",{className:"text-sm font-bold text-white whitespace-normal",children:c.item.title}),a.jsx("span",{className:"text-xs text-gray-500",children:c.item.is_folder?`Carpeta (${c.children.length} elementos)`:`Manga (${((m=c.item.chapters)==null?void 0:m.length)||0} caps)`})]})]}),c.children.length>0&&a.jsx("div",{className:"mt-2",children:s(c.children,o+1)})]})]},c.item.id)})]})};return a.jsx("div",{className:"fixed inset-0 bg-black/80 backdrop-blur-md flex items-center justify-center z-[80] p-4 animate-in fade-in duration-200",children:a.jsxs("div",{className:"bg-[#121212] rounded-2xl border border-gray-800 w-full max-w-6xl shadow-2xl overflow-hidden flex flex-col h-[90vh]",children:[a.jsxs("div",{className:"bg-[#1a1a1a] border-b border-gray-800 px-6 py-4 flex items-center justify-between sticky top-0 z-10 flex-shrink-0",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-indigo-500/10 rounded-lg text-indigo-400",children:a.jsx(VI,{className:"w-6 h-6"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-xl font-bold text-white",children:"Mapa Mental de Organización"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Vista general de toda tu estructura de carpetas y mangas"})]})]}),a.jsx("button",{onClick:e,className:"text-gray-400 hover:text-white transition-colors p-2 hover:bg-white/5 rounded-lg border border-transparent hover:border-gray-700",children:a.jsx(gt,{className:"w-6 h-6"})})]}),a.jsx("div",{className:"flex-1 overflow-auto p-8 custom-scrollbar relative bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGNpcmNsZSBjeD0iMSIgY3k9IjEiIHI9IjEiIGZpbGw9IiMzMzMiLz48L3N2Zz4=')]",children:a.jsx("div",{className:"max-w-4xl mx-auto",children:s(r)})})]})})}function r8({isOpen:t,onClose:e,deletedMangas:n,onRestore:r,onPermanentDelete:s}){const[i,o]=L.useState(new Set);if(!t)return null;const l=async u=>{o(f=>new Set(f).add(u));try{await r(u),be.success("Elemento restaurado. Sus hijos también fueron recuperados si era una carpeta.")}catch{be.error("Error al restaurar elemento")}finally{o(f=>{const h=new Set(f);return h.delete(u),h})}},c=async u=>{if(window.confirm("¿ELIMINAR DEFINITIVAMENTE? Esta acción borrará el registro y los capítulos para siempre de la base de datos y no se puede deshacer.")){o(f=>new Set(f).add(u));try{await s(u),be.success("Elemento purgado de la base de datos.")}catch{be.error("Error purgando elemento")}finally{o(f=>{const h=new Set(f);return h.delete(u),h})}}};return a.jsx("div",{className:"fixed inset-0 bg-black/80 flex items-center justify-center z-50 p-4 sm:p-6 backdrop-blur-sm animate-[fadeIn_0.2s_ease-out]",children:a.jsxs("div",{className:"bg-[#121212] rounded-2xl w-full max-w-4xl max-h-[90vh] flex flex-col shadow-2xl border border-gray-800 animate-[scaleIn_0.2s_ease-out] relative overflow-hidden",children:[a.jsxs("div",{className:"flex items-center justify-between px-6 py-5 border-b border-gray-800/50 bg-[#1a1a1a]",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2.5 bg-red-500/10 rounded-xl text-red-500",children:a.jsx(tn,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-xl font-bold tracking-tight text-white flex items-center gap-2",children:"Papelera de Reciclaje"}),a.jsx("p",{className:"text-sm text-gray-400 mt-0.5",children:"Estos elementos están ocultos a los usuarios."})]})]}),a.jsx("button",{onClick:e,className:"p-2 hover:bg-white/10 rounded-xl transition-colors shrink-0 group right-4 absolute md:relative top-4 md:top-0",children:a.jsx(gt,{className:"w-5 h-5 text-gray-400 group-hover:text-white"})})]}),a.jsx("div",{className:"flex-1 overflow-y-auto p-4 sm:p-6 space-y-3 custom-scrollbar",children:n.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center h-48 text-gray-400 opacity-50",children:[a.jsx(tn,{className:"w-16 h-16 mb-4"}),a.jsx("p",{className:"text-lg font-medium",children:"La papelera está vacía"})]}):n.map(u=>a.jsxs("div",{className:"flex flex-col sm:flex-row items-center gap-4 bg-gray-900/50 p-3 sm:p-4 rounded-xl border border-gray-800 hover:border-gray-700 transition-colors",children:[a.jsx("div",{className:"w-16 h-16 shrink-0 bg-gray-800 rounded-lg overflow-hidden flex items-center justify-center",children:u.thumbnail_url||u.cover_url?a.jsx("img",{src:u.thumbnail_url||u.cover_url,alt:"",className:"w-full h-full object-cover opacity-70 grayscale hover:grayscale-0 transition-all"}):u.is_folder?a.jsx(xr,{className:"w-8 h-8 text-gray-500"}):a.jsx("div",{className:"w-6 h-6 bg-gray-700 rounded-sm"})}),a.jsxs("div",{className:"flex-1 min-w-0 w-full text-center sm:text-left",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1 justify-center sm:justify-start",children:[u.is_folder&&a.jsx(xr,{className:"w-3.5 h-3.5 text-blue-400"}),a.jsx("h3",{className:"font-bold text-white truncate text-sm sm:text-base",title:u.title,children:u.title})]}),a.jsxs("p",{className:"text-xs text-gray-400 truncate",children:[u.author||"Sin autor"," • Eliminado el ",new Date(u.updated_at).toLocaleDateString()]})]}),a.jsxs("div",{className:"flex items-center gap-2 w-full sm:w-auto",children:[a.jsxs("button",{onClick:()=>l(u.id),disabled:i.has(u.id),className:"flex-1 sm:flex-none flex items-center justify-center gap-1.5 px-3 py-2 bg-emerald-500/10 hover:bg-emerald-500/20 text-emerald-500 rounded-lg text-xs font-semibold transition-colors disabled:opacity-50",children:[a.jsx(FI,{className:"w-3.5 h-3.5"}),"Restaurar"]}),a.jsxs("button",{onClick:()=>c(u.id),disabled:i.has(u.id),className:"flex-1 sm:flex-none flex items-center justify-center gap-1.5 px-3 py-2 bg-red-500/10 hover:bg-red-500/20 text-red-500 rounded-lg text-xs font-semibold transition-colors disabled:opacity-50",children:[a.jsx(tn,{className:"w-3.5 h-3.5"}),"Purgar"]})]})]},u.id))})]})})}function s8({isOpen:t,onClose:e,mangaIds:n,onSaveComplete:r}){const[s,i]=L.useState(null),[o,l]=L.useState(null),[c,u]=L.useState([]),[f,h]=L.useState([]),[m,p]=L.useState(new Set),[x,E]=L.useState(new Set),[C,y]=L.useState(!1),[v,_]=L.useState(!1),[D,M]=L.useState({active:!1,selecting:!0,source:null});L.useEffect(()=>{const B=()=>M({active:!1,selecting:!0,source:null});return window.addEventListener("mouseup",B),()=>window.removeEventListener("mouseup",B)},[]),L.useEffect(()=>{t&&n.length===2?T():(i(null),l(null),u([]),h([]),p(new Set),E(new Set))},[t,n]);const T=async()=>{var B,z;_(!0);try{const[W,ee]=await Promise.all([Ni(n[0]),Ni(n[1])]);i(W),l(ee);let F=[];(B=W==null?void 0:W.chapters)==null||B.forEach(R=>F.push(...R.pages||[])),u(F);let K=[];(z=ee==null?void 0:ee.chapters)==null||z.forEach(R=>K.push(...R.pages||[])),h(K),p(new Set),E(new Set)}catch{be.error("Error al cargar los mangas")}finally{_(!1)}},S=()=>{if(m.size===0)return;const z=Array.from(m).sort((ee,F)=>ee-F).map(ee=>c[ee]),W=c.filter((ee,F)=>!m.has(F));u(W),h(ee=>[...ee,...z]),p(new Set)},w=()=>{if(x.size===0)return;const z=Array.from(x).sort((ee,F)=>ee-F).map(ee=>f[ee]),W=f.filter((ee,F)=>!x.has(F));h(W),u(ee=>[...ee,...z]),E(new Set)},N=(B,z)=>{const W=B==="A"?m.has(z):x.has(z);M({active:!0,selecting:!W,source:B}),A(B,z,!W)},A=(B,z,W)=>{if(!D.active&&W===void 0||D.source!==null&&D.source!==B&&W===void 0)return;const ee=W!==void 0?W:D.selecting;B==="A"?p(F=>{const K=new Set(F);return ee?K.add(z):K.delete(z),K}):E(F=>{const K=new Set(F);return ee?K.add(z):K.delete(z),K})},I=()=>{m.size===c.length?p(new Set):p(new Set(c.map((B,z)=>z)))},P=()=>{x.size===f.length?E(new Set):E(new Set(f.map((B,z)=>z)))},k=async()=>{if(!(!s||!o)){y(!0);try{await LD(s.id,o.id,c,f),be.success("Páginas transferidas correctamente."),r(),e()}catch(B){console.error(B),be.error("Ocurrió un error al guardar los cambios.")}finally{y(!1)}}};return t?a.jsx("div",{className:"fixed inset-0 bg-black/80 backdrop-blur-sm z-[70] flex items-center justify-center p-4 sm:p-6 animate-in fade-in duration-200",children:a.jsxs("div",{className:"bg-[#121212] border border-gray-700 w-full max-w-7xl h-[90vh] rounded-2xl shadow-2xl flex flex-col overflow-hidden animate-in zoom-in-95 duration-200",children:[a.jsxs("div",{className:"bg-[#1a1a1a] border-b border-gray-800 px-6 py-4 flex items-center justify-between shrink-0",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-amber-500/10 rounded-lg text-amber-500",children:a.jsx(LI,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-xl font-bold text-white",children:"Transferencia de Páginas"}),a.jsx("p",{className:"text-sm text-gray-400",children:"Mueve páginas de un manga a otro"})]})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("button",{onClick:k,disabled:C||v,className:"bg-emerald-600 hover:bg-emerald-700 disabled:opacity-50 disabled:cursor-not-allowed text-white px-4 py-2 rounded-lg font-semibold text-sm transition-all shadow-lg shadow-emerald-500/20 flex items-center gap-2",children:[C?a.jsx(Bx,{className:"w-4 h-4 animate-spin"}):a.jsx(Ea,{className:"w-4 h-4"}),"Guardar Cambios"]}),a.jsx("button",{onClick:e,className:"text-gray-400 hover:text-white transition-colors p-2 hover:bg-white/5 rounded-lg",children:a.jsx(gt,{className:"w-5 h-5"})})]})]}),v?a.jsx("div",{className:"flex-1 flex items-center justify-center",children:a.jsx(Bx,{className:"w-12 h-12 text-amber-500 animate-spin"})}):a.jsxs("div",{className:"flex-1 flex flex-col md:flex-row min-h-0",children:[a.jsxs("div",{className:"flex-1 flex flex-col min-h-0 border-r border-gray-800 bg-[#151515]",children:[a.jsxs("div",{className:"p-4 border-b border-gray-800 bg-[#1a1a1a] shrink-0 sticky top-0 z-10 flex flex-col gap-2",children:[a.jsx("h3",{className:"font-bold text-lg text-amber-400 truncate",title:s==null?void 0:s.title,children:(s==null?void 0:s.title)||"Cargando..."}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-sm text-gray-400",children:[c.length," páginas"]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{onClick:I,className:"text-xs text-blue-400 hover:text-blue-300",children:m.size===c.length&&c.length>0?"Deseleccionar todo":"Seleccionar todo"}),m.size>0&&a.jsxs("span",{className:"text-xs bg-amber-500/20 text-amber-300 px-2 py-0.5 rounded-full font-bold",children:[m.size," sel."]})]})]})]}),a.jsx("div",{className:"flex-1 overflow-y-auto p-4 custom-scrollbar",children:a.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3",children:[c.map((B,z)=>a.jsxs("div",{onMouseDown:W=>{W.preventDefault(),N("A",z)},onMouseEnter:()=>A("A",z),className:`relative aspect-[2/3] rounded-lg overflow-hidden cursor-pointer border-2 transition-all group select-none ${m.has(z)?"border-amber-500 shadow-[0_0_15px_rgba(245,158,11,0.4)]":"border-transparent hover:border-gray-500 bg-gray-800"}`,children:[a.jsx("img",{src:B,alt:`A-${z}`,className:"w-full h-full object-cover",loading:"lazy"}),a.jsx("div",{className:`absolute top-2 right-2 w-6 h-6 rounded-full border-2 flex items-center justify-center transition-colors ${m.has(z)?"bg-amber-500 border-amber-500":"bg-black/50 border-gray-300 group-hover:border-amber-500/50"}`,children:m.has(z)&&a.jsx("div",{className:"w-2.5 h-2.5 bg-white rounded-full"})}),a.jsx("div",{className:"absolute bottom-2 left-2 px-2 py-1 bg-black/70 text-xs font-bold text-white rounded backdrop-blur-md",children:z+1})]},`a-${z}`)),c.length===0&&a.jsx("div",{className:"col-span-full h-32 flex items-center justify-center text-gray-500 text-sm italic",children:"Vacío"})]})})]}),a.jsxs("div",{className:"w-full md:w-24 shrink-0 bg-[#0f0f0f] flex flex-row md:flex-col items-center justify-center gap-4 py-4 md:py-0 border-y md:border-y-0 border-gray-800",children:[a.jsxs("button",{onClick:S,disabled:m.size===0,className:"w-14 h-14 rounded-full bg-[#1a1a1a] hover:bg-amber-600 disabled:opacity-50 disabled:hover:bg-[#1a1a1a] border border-gray-700 flex items-center justify-center transition-colors text-white disabled:text-gray-600 shadow-xl group",title:"Mover selección a la derecha",children:[a.jsx(Ox,{className:"w-6 h-6 hidden md:block group-hover:scale-110 transition-transform"}),a.jsx(Ox,{className:"w-6 h-6 block md:hidden rotate-90 group-hover:scale-110 transition-transform"})]}),a.jsxs("button",{onClick:w,disabled:x.size===0,className:"w-14 h-14 rounded-full bg-[#1a1a1a] hover:bg-amber-600 disabled:opacity-50 disabled:hover:bg-[#1a1a1a] border border-gray-700 flex items-center justify-center transition-colors text-white disabled:text-gray-600 shadow-xl group",title:"Mover selección a la izquierda",children:[a.jsx(Is,{className:"w-6 h-6 hidden md:block group-hover:scale-110 transition-transform"}),a.jsx(Is,{className:"w-6 h-6 block md:hidden rotate-90 group-hover:scale-110 transition-transform"})]})]}),a.jsxs("div",{className:"flex-1 flex flex-col min-h-0 bg-[#151515]",children:[a.jsxs("div",{className:"p-4 border-b border-gray-800 bg-[#1a1a1a] shrink-0 sticky top-0 z-10 flex flex-col gap-2",children:[a.jsx("h3",{className:"font-bold text-lg text-amber-400 truncate",title:o==null?void 0:o.title,children:(o==null?void 0:o.title)||"Cargando..."}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-sm text-gray-400",children:[f.length," páginas"]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{onClick:P,className:"text-xs text-blue-400 hover:text-blue-300",children:x.size===f.length&&f.length>0?"Deseleccionar todo":"Seleccionar todo"}),x.size>0&&a.jsxs("span",{className:"text-xs bg-amber-500/20 text-amber-300 px-2 py-0.5 rounded-full font-bold",children:[x.size," sel."]})]})]})]}),a.jsx("div",{className:"flex-1 overflow-y-auto p-4 custom-scrollbar",children:a.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3",children:[f.map((B,z)=>a.jsxs("div",{onMouseDown:W=>{W.preventDefault(),N("B",z)},onMouseEnter:()=>A("B",z),className:`relative aspect-[2/3] rounded-lg overflow-hidden cursor-pointer border-2 transition-all group select-none ${x.has(z)?"border-amber-500 shadow-[0_0_15px_rgba(245,158,11,0.4)]":"border-transparent hover:border-gray-500 bg-gray-800"}`,children:[a.jsx("img",{src:B,alt:`B-${z}`,className:"w-full h-full object-cover",loading:"lazy"}),a.jsx("div",{className:`absolute top-2 right-2 w-6 h-6 rounded-full border-2 flex items-center justify-center transition-colors ${x.has(z)?"bg-amber-500 border-amber-500":"bg-black/50 border-gray-300 group-hover:border-amber-500/50"}`,children:x.has(z)&&a.jsx("div",{className:"w-2.5 h-2.5 bg-white rounded-full"})}),a.jsx("div",{className:"absolute bottom-2 left-2 px-2 py-1 bg-black/70 text-xs font-bold text-white rounded backdrop-blur-md",children:z+1})]},`b-${z}`)),f.length===0&&a.jsx("div",{className:"col-span-full h-32 flex items-center justify-center text-gray-500 text-sm italic",children:"Vacío"})]})})]})]})]})}):null}function i8({currentSection:t,onSectionChange:e}){const[n,r]=L.useState(!1);return a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>r(!0),className:"p-2 sm:p-2.5 hover:bg-white/10 rounded-full text-white transition-colors flex-shrink-0",children:a.jsx(OI,{className:"w-5 h-5 sm:w-6 sm:h-6"})}),a.jsx("div",{className:`fixed inset-0 bg-black/70 z-[45] transition-opacity duration-300 ${n?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none"}`,onClick:()=>r(!1)}),a.jsxs("div",{className:`fixed inset-y-0 left-0 w-72 bg-[#1a1a1a] shadow-2xl border-r border-[#333] z-50 transform transition-transform duration-300 ease-out will-change-transform ${n?"translate-x-0":"-translate-x-full"}`,children:[a.jsxs("div",{className:"p-4 sm:p-6 border-b border-gray-800 flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("img",{src:"/icons/icones.png",alt:"Logo",className:"w-8 h-8 sm:w-10 sm:h-10 object-contain"}),a.jsx("span",{className:"font-bold text-white text-lg",children:"Twisted Brody"})]}),a.jsx("button",{onClick:()=>r(!1),className:"p-2 text-gray-400 hover:text-white rounded-full hover:bg-white/10 transition-colors",children:a.jsx(gt,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"p-4 flex flex-col gap-2",children:[a.jsx("div",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2 px-2",children:"Navegación principal"}),a.jsxs("button",{onClick:()=>{e("flow"),r(!1)},className:`flex items-center gap-3 w-full p-3 rounded-xl font-semibold transition-all active:scale-95 ${t==="flow"?"bg-[#bb86fc]/10 text-[#bb86fc] border border-[#bb86fc]/20 hover:bg-[#bb86fc]/20":"text-gray-300 hover:bg-white/5 border border-transparent"}`,children:[a.jsx(Wr,{className:"w-5 h-5"}),"Flow"]}),a.jsxs("button",{onClick:()=>{e("patreon"),r(!1)},className:`flex items-center gap-3 w-full p-3 rounded-xl font-semibold transition-all active:scale-95 ${t==="patreon"?"bg-[#f96854]/10 text-[#f96854] border border-[#f96854]/20 hover:bg-[#f96854]/20":"text-gray-300 hover:bg-white/5 border border-transparent"}`,children:[a.jsx(sc,{className:"w-5 h-5"}),"Patreon"]}),a.jsxs("button",{onClick:()=>{e("onlyfans"),r(!1)},className:`flex items-center gap-3 w-full p-3 rounded-xl font-semibold transition-all active:scale-95 ${t==="onlyfans"?"bg-[#00AFF0]/10 text-[#00AFF0] border border-[#00AFF0]/20 hover:bg-[#00AFF0]/20":"text-gray-300 hover:bg-white/5 border border-transparent"}`,children:[a.jsx(UT,{className:"w-5 h-5"}),"OnlyFans"]})]})]})]})}const Ab={random:"Aleatorio",name:"Nombre",date:"Fecha de creación",modified:"Última modificación",pages:"Páginas",views:"Vistas"};function o8({value:t,onChange:e,placeholder:n="Buscar manga...",sortType:r="random",onSortTypeChange:s,sortDirection:i="asc",onSortDirectionChange:o,onOpenFilter:l}){const[c,u]=L.useState(!1),f=()=>{e("")},h=()=>{const x=["modified","name","date","pages","views","random"],C=(x.indexOf(r)+1)%x.length,y=x[C];s==null||s(y),window.innerWidth<640&&be.success(`Ordenado por: ${Ab[y]}`,{position:"top-center",duration:1500,className:"bg-purple-900/90 text-white border-purple-500/50"})},m=()=>{const x=i==="asc"?"desc":"asc";if(o==null||o(x),window.innerWidth<640){let E=x==="asc"?"Ascendente (A-Z)":"Descendente (Z-A)";r==="views"?E=x==="asc"?"Menos vistos primero":"Más vistos primero":r==="date"||r==="modified"?E=x==="asc"?"Más antiguos primero":"Más recientes primero":r==="pages"&&(E=x==="asc"?"Menos páginas":"Más páginas"),be.success(`Orden: ${E}`,{position:"top-center",duration:1500,className:"bg-purple-900/90 text-white border-purple-500/50"})}},p=()=>r==="views"?i==="asc"?"Menos vistos":"Más vistos":i==="asc"?"ASC":"DESC";return a.jsxs("div",{className:"w-full flex gap-2 items-center",children:[a.jsxs("div",{className:"relative flex-1",children:[a.jsx(no,{className:`absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 pointer-events-none ${c?"text-purple-400":"text-gray-400"}`}),a.jsx("input",{type:"text",placeholder:n,value:t,onChange:x=>e(x.target.value),onFocus:()=>u(!0),onBlur:()=>u(!1),className:"w-full bg-[#1a1a1a] text-white rounded-lg pl-10 pr-10 py-2.5 text-sm placeholder-gray-400 border border-gray-700/50 focus:border-purple-500 focus:outline-none"}),t&&a.jsx("button",{onClick:f,className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-400 hover:text-purple-400 transition-all p-1 hover:scale-125 hover:rotate-90 duration-300",title:"Limpiar búsqueda",children:a.jsx(gt,{className:"w-4 h-4"})})]}),a.jsx("button",{onClick:l,className:"bg-gray-800 hover:bg-gray-700 border border-gray-700 hover:border-purple-500/50 text-white p-2.5 rounded-lg transition-all duration-300 hover:shadow-lg hover:shadow-purple-500/10 group",title:"Filtrar por categorías",children:a.jsx(K_,{className:"w-4 h-4 text-gray-400 group-hover:text-purple-400 transition-colors"})}),a.jsxs("button",{onClick:h,className:"bg-gradient-to-r from-gray-700/40 to-gray-600/40 hover:from-gray-700/60 hover:to-gray-600/60 border border-gray-600/50 hover:border-purple-500/50 text-white px-2.5 py-2.5 rounded-lg flex items-center justify-center gap-1.5 font-medium text-xs transition-all duration-300 active:scale-95 whitespace-nowrap hover:scale-110 hover:shadow-lg hover:shadow-purple-500/20 hover:border-purple-500",title:"Cambiar tipo de ordenamiento",children:[a.jsx(DI,{className:"w-3.5 h-3.5 transition-transform duration-300 hover:rotate-180"}),a.jsx("span",{className:"hidden sm:inline",children:Ab[r]})]}),a.jsxs("button",{onClick:m,className:"bg-gradient-to-r from-gray-700/40 to-gray-600/40 hover:from-gray-700/60 hover:to-gray-600/60 border border-gray-600/50 hover:border-purple-500/50 text-white px-2.5 py-2.5 rounded-lg flex items-center justify-center gap-1.5 font-medium text-xs transition-all duration-300 active:scale-95 whitespace-nowrap hover:scale-110 hover:shadow-lg hover:shadow-purple-500/20 hover:border-purple-500",title:i==="asc"?"Cambiar a descendente":"Cambiar a ascendente",children:[a.jsx(jI,{className:`w-3.5 h-3.5 transition-all duration-500 ${i==="desc"?"rotate-180":""} hover:scale-125`}),a.jsx("span",{className:"hidden sm:inline text-[10px]",children:p()})]})]})}function a8(){return a.jsxs("div",{className:"flex flex-col w-full max-w-xs",children:[a.jsx("div",{className:"relative bg-black rounded-lg shadow-lg overflow-hidden aspect-[2/3] mb-2",children:a.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:a.jsx("div",{className:"rounded-full animate-spin",style:{width:"30px",height:"30px",borderWidth:"2px",borderStyle:"solid",borderColor:"rgba(187, 134, 252, 0.2)",borderTopColor:"#bb86fc",animation:"spin 0.6s linear infinite"}})})}),a.jsxs("div",{className:"flex flex-col gap-2 items-center animate-pulse",children:[a.jsx("div",{className:"h-4 bg-gray-800 rounded w-3/4"}),a.jsx("div",{className:"h-3 bg-gray-800 rounded w-1/2"})]})]})}const Zf=24;function BT(t,e,n=new Set){if(n.has(t))return[];n.add(t);const r=e.filter(i=>i.folder_id===t),s=[];for(const i of r){const o=i.cover_url||i.thumbnail_url;if(o&&!s.includes(o)&&s.push(o),i.is_folder){const l=BT(i.id,e,n);for(const c of l)s.includes(c)||s.push(c)}}return s}function l8(t,e,n=12){const r=e.filter(f=>f.folder_id===t),s=r.filter(f=>f.is_folder),i=r.filter(f=>!f.is_folder&&(f.cover_url||f.thumbnail_url)),o=[];for(const f of s){const h=BT(f.id,e,new Set);h.length>0&&o.push(h)}if(i.length>0){const f=i.map(h=>h.cover_url||h.thumbnail_url).filter(Boolean);f.length>0&&o.push(f)}const l=[];let c=!0,u=0;for(;c&&l.length=n)break;u{const w=()=>{p.isDragging&&x({isDragging:!1,action:null,startId:null,hasDragged:!1})};return window.addEventListener("mouseup",w),()=>window.removeEventListener("mouseup",w)},[p.isDragging]);const E=(w,N)=>{u&&u(w,N)},C=(w,N)=>{if(w.button!==0)return;const I=c.includes(N)?"deselect":"select";x({isDragging:!0,action:I,startId:N,hasDragged:!1})},y=w=>{!p.isDragging||!p.action||(!p.hasDragged&&p.startId&&(E(p.startId,p.action==="select"),x(N=>({...N,hasDragged:!0}))),E(w,p.action==="select"))},[v,_]=L.useState(()=>{const N=new URLSearchParams(window.location.search).get("page");return N?Math.max(1,Number(N)):1});L.useEffect(()=>{const w=()=>{const A=new URLSearchParams(window.location.search).get("page");_(A?Math.max(1,Number(A)):1)};return window.addEventListener("popstate",w),()=>window.removeEventListener("popstate",w)},[]);const D=Math.ceil(t.length/Zf);L.useEffect(()=>{if(D>0&&v>D){_(D);const w=new URL(window.location.href);w.searchParams.set("page",String(D)),window.history.replaceState({},"",w)}},[D,v]),L.useEffect(()=>{if(e){_(1);const w=new URL(window.location.href);w.searchParams.delete("page"),window.history.replaceState({},"",w)}},[e]);const M=t.slice((v-1)*Zf,v*Zf),T=w=>{_(w);const N=new URL(window.location.href);N.searchParams.set("page",String(w)),window.history.pushState({},"",N),window.scrollTo({top:0,behavior:"smooth"})},S=()=>{if(D<=1)return null;const w=[],N=5;let A=Math.max(1,v-Math.floor(N/2)),I=Math.min(D,A+N-1);I-A+1T(1),disabled:v===1,className:"p-2 rounded-lg bg-[#1a1a1a] text-white hover:bg-[#bb86fc] disabled:opacity-50 disabled:hover:bg-[#1a1a1a] transition-colors",title:"Primera página",children:a.jsx(q_,{className:"w-4 h-4"})}),a.jsx("button",{onClick:()=>T(v-1),disabled:v===1,className:"p-2 rounded-lg bg-[#1a1a1a] text-white hover:bg-[#bb86fc] disabled:opacity-50 disabled:hover:bg-[#1a1a1a] transition-colors",title:"Anterior",children:a.jsx(dh,{className:"w-4 h-4"})}),A>1&&a.jsx("span",{className:"text-gray-500 px-1",children:"..."}),w.map(P=>a.jsx("button",{onClick:()=>T(P),className:`w-8 h-8 rounded-lg text-sm font-medium transition-colors ${v===P?"bg-[#bb86fc] text-white":"bg-[#1a1a1a] text-gray-400 hover:bg-[#333] hover:text-white"}`,children:P},P)),IT(v+1),disabled:v===D,className:"p-2 rounded-lg bg-[#1a1a1a] text-white hover:bg-[#bb86fc] disabled:opacity-50 disabled:hover:bg-[#1a1a1a] transition-colors",title:"Siguiente",children:a.jsx(hc,{className:"w-4 h-4"})}),a.jsx("button",{onClick:()=>T(D),disabled:v===D,className:"p-2 rounded-lg bg-[#1a1a1a] text-white hover:bg-[#bb86fc] disabled:opacity-50 disabled:hover:bg-[#1a1a1a] transition-colors",title:"Última página",children:a.jsx(G_,{className:"w-4 h-4"})})]})};return n&&e?a.jsx("div",{className:"flex flex-col items-center justify-center py-16 animate-in fade-in duration-300",children:a.jsxs("div",{className:"text-gray-400 text-sm animate-pulse",children:['Buscando "',e,'"...']})}):o?a.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 2xl:grid-cols-6 gap-1.5 sm:gap-2 md:gap-3 justify-center items-start animate-in fade-in duration-300",children:Array.from({length:12}).map((w,N)=>a.jsx(a8,{},N))}):e&&t.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center py-16 animate-in fade-in duration-300",children:[a.jsx(fa,{className:"w-16 h-16 text-gray-600 mb-4 animate-bounce"}),a.jsx("p",{className:"text-gray-400 text-lg mb-2",children:"No se encontraron resultados"}),a.jsx("p",{className:"text-gray-500 text-sm",children:"Intenta con otros términos de búsqueda"})]}):!e&&t.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center py-20 animate-in fade-in duration-300",children:[a.jsx(fa,{className:"w-16 h-16 text-gray-600 mb-4 animate-bounce"}),a.jsx("p",{className:"text-gray-400 text-lg mb-2",children:"No hay mangas disponibles"}),a.jsx("p",{className:"text-gray-500 text-sm",children:'Crea tu primer manga usando el botón "Nuevo"'})]}):a.jsxs("div",{className:"flex flex-col gap-6",children:[a.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 2xl:grid-cols-6 gap-1.5 sm:gap-2 md:gap-3 justify-center items-start",children:M.map(w=>{var N,A,I;return a.jsx("div",{children:a.jsx(nT,{id:w.id,title:w.title,author:w.author,pageCount:w.pageCount,thumbnail:w.thumbnail,manga:w.manga,onSelect:()=>r(w.id),onEdit:s,onDelete:i?()=>i(w.id):void 0,isCategoryPlusEnabled:l,isSelected:c.includes(w.id),onMouseDown:P=>C(P,w.id),onMouseEnter:()=>y(w.id),dragStateParams:p,hasAnySelection:c.length>0,onToggleSelect:()=>E(w.id,!c.includes(w.id)),folderItemCount:(N=w.manga)!=null&&N.is_folder?f.filter(P=>P.folder_id===w.id).length:void 0,folderThumbnails:(A=w.manga)!=null&&A.is_folder?l8(w.id,f):void 0,hasSubfolders:(I=w.manga)!=null&&I.is_folder?f.some(P=>P.folder_id===w.id&&P.is_folder):!1,isFolderAnimationEnabled:h,currentSection:m})},w.id)})}),S()]})}function $o(t){return t.toLowerCase().trim().normalize("NFD").replace(/[\u0300-\u036f]/g,"")}function ep(t,e){const n=$o(t),r=$o(e);if(n===r)return 1;if(n.length<2||r.length<2)return n.includes(r)?.8:0;const s=n.length>r.length?n:r,i=n.length>r.length?r:n,o=u8(i,s);return(s.length-o)/s.length}function u8(t,e){const n=[];for(let r=0;r<=t.length;r++){let s=r;for(let i=0;i<=e.length;i++)if(r===0)n[i]=i;else if(i>0){let o=n[i-1];t.charAt(r-1)!==e.charAt(i-1)&&(o=Math.min(Math.min(o,s),n[i])+1),n[i-1]=s,s=o}r>0&&(n[e.length]=s)}return n[e.length]}function d8(t,e,n={}){const{minChars:r=1,fuzzyMatch:s=!0}=n;if(!e.trim()||e.length{let c=0;const u=ep(l.title,e),f=ep(l.author,e),h=$o(l.title).includes(i)?.3:0,m=$o(l.author).includes(i)?.2:0;let p=0,x=0;if(l.categories&&l.categories.length>0){const E=l.categories.map(y=>ep(y,e));p=Math.max(...E),x=l.categories.some(y=>$o(y).includes(i))?.3:0}return c=Math.max(u*.6+h,f*.4+m,p*.5+x),{item:l,score:c}}).filter(l=>s?l.score>.3:l.score>.7).sort((l,c)=>c.score-l.score).map(l=>l.item);return{items:o,query:e,resultCount:o.length}}function h8(){const[t,e]=L.useState(!1),[n,r]=L.useState(!1),[s,i]=L.useState(!1),[o,l]=L.useState(!1),[c,u]=L.useState(null),[f,h]=L.useState(!1),[m,p]=L.useState(!1),[x,E]=L.useState(!1),[C,y]=L.useState([]),[v,_]=L.useState(!1),[D,M]=L.useState(!1),[T,S]=L.useState(!1),[w,N]=L.useState(!1),[A,I]=L.useState(!1),[P,k]=L.useState(!1),[B,z]=L.useState(!1),[W,ee]=L.useState(!1),[F,K]=L.useState(!1),[R,ne]=L.useState(()=>localStorage.getItem("isFolderAnimationEnabled")==="true"),[pe,O]=L.useState(!1),[Q,oe]=L.useState(!1),[le,Ie]=L.useState(!1),[te,it]=L.useState(!1),[pt,Ot]=L.useState(!1),[st,yt]=L.useState(!1),[Vt,_n]=L.useState(!1),[xt,tt]=L.useState(null),[Bn,Ue]=L.useState(!1),[vt,Pn]=L.useState(!1),[jt,on]=L.useState(!1),[fn,wt]=L.useState(null),[G,ie]=L.useState([]),[_e,Se]=L.useState(null),[H,X]=L.useState([]),[se,de]=L.useState(()=>{const ue=new URLSearchParams(window.location.search).get("section");return ue==="flow"||ue==="patreon"||ue==="onlyfans"?ue:localStorage.getItem("currentSection")||"flow"}),[Le,$]=L.useState(!1),[J,me]=L.useState(!1),[ge,Ee]=L.useState(!0),[Ve,Be]=L.useState(""),[De,$n]=L.useState("all"),[we,Ze]=L.useState([]),[ot,$e]=L.useState([]),[He,ft]=L.useState(!1),[bt,ct]=L.useState(!1),[Ge,Bt]=L.useState(!1),[pn,Rn]=L.useState(()=>localStorage.getItem("sortType")||"modified"),[Ls,zr]=L.useState(()=>localStorage.getItem("sortDirection")||"desc");L.useEffect(()=>{const ue=new URLSearchParams(window.location.search).get("admin")==="true";l(ue)},[]),L.useEffect(()=>{localStorage.setItem("sortType",pn)},[pn]),L.useEffect(()=>{localStorage.setItem("isFolderAnimationEnabled",String(R))},[R]),L.useEffect(()=>{localStorage.setItem("sortDirection",Ls)},[Ls]),L.useEffect(()=>{localStorage.setItem("currentSection",se);const V=new URL(window.location.href);se==="patreon"||se==="onlyfans"?V.searchParams.set("section",se):V.searchParams.delete("section"),window.history.replaceState({},"",V.toString())},[se]),L.useEffect(()=>{var xe;(xe=window.Telegram)!=null&&xe.WebApp&&window.Telegram.WebApp.ready(),$t();const V=window.location.hash.slice(1);if(V&&V.startsWith("manga/"))if(V.endsWith("/hd")){const je=V.replace("manga/","").replace("/hd","");wt(je),$(!0)}else{const je=V.replace("manga/","");wt(je),$(!1)}else if(V&&V.startsWith("folder/")){const je=V.replace("folder/","");tt(je)}else V==="info"&&me(!0);const ue=()=>{const je=window.location.hash.slice(1);if(!je)wt(null),Se(null),me(!1),$(!1),tt(null);else if(je.startsWith("manga/")){if(je.endsWith("/hd")){const dt=je.replace("manga/","").replace("/hd","");wt(dt),$(!0)}else{const dt=je.replace("manga/","");wt(dt),$(!1)}Se(null),me(!1),tt(null)}else je.startsWith("folder/")?(tt(je.replace("folder/","")),wt(null),Se(null),me(!1),$(!1)):je==="info"&&(me(!0),wt(null),Se(null),tt(null))};return window.addEventListener("hashchange",ue),()=>window.removeEventListener("hashchange",ue)},[]),L.useEffect(()=>{},[]);async function $t(){try{Ee(!0);const V=await Mh();X(V)}catch(V){console.error("Error loading mangas:",V)}finally{Ee(!1)}}const kt=L.useMemo(()=>H.filter(V=>!V.is_deleted&&(V.section||"flow")===se),[H,se]),Ra=L.useMemo(()=>H.filter(V=>V.is_deleted),[H]),Da=L.useMemo(()=>{const V=new Map;return kt.forEach(ue=>{var xe;(xe=ue.categories)==null||xe.forEach(je=>{V.has(je.id)||V.set(je.id,je)})}),Array.from(V.values())},[kt]),ds=L.useMemo(()=>Ve.trim()?d8(kt.filter(V=>!V.is_folder).map(V=>({id:V.id,title:V.title,author:V.author,categories:V.categories?V.categories.map(ue=>ue.name):[]})),Ve,{fuzzyMatch:!0,minChars:1}):{items:kt,query:"",resultCount:kt.length},[kt,Ve]),Ma=L.useMemo(()=>{let V=ds.items.length>0?ds.items.map(ke=>kt.find(We=>We.id===ke.id)).filter(Boolean):[];we.length>0&&(V=V.filter(ke=>we.some(We=>{var qe;return(qe=ke.categories)==null?void 0:qe.some(Hn=>Hn.name===We)}))),ot.length>0&&(V=V.filter(ke=>ot.includes(ke.author))),He&&(V=V.filter(ke=>ke.is_decensored)),bt&&(V=V.filter(ke=>ke.is_bn)),Ge&&(V=V.filter(ke=>ke.is_color));const ue=[...V],xe=we.length>0||ot.length>0||He||bt||Ge,je=Ve.trim().length>0;let dt;if(xe)dt=ue;else if(je){const ke=new Set(ue.map(qe=>qe.id)),We=new Set;for(const qe of ue){let Hn=qe.folder_id,nt=0;for(;Hn&&nt<20;){We.add(Hn);const rr=kt.find(sr=>sr.id===Hn);if(rr)Hn=rr.folder_id;else break;nt++}}dt=kt.filter(qe=>(qe.folder_id&&kt.some(nt=>nt.id===qe.folder_id)?qe.folder_id:null)!==(xt||null)?!1:qe.is_folder?ke.has(qe.id)||We.has(qe.id):ke.has(qe.id))}else dt=ue.filter(ke=>(ke.folder_id&&kt.some(qe=>qe.id===ke.folder_id)?ke.folder_id:null)===(xt||null));let at=dt;return De==="mangas"?at=at.filter(ke=>!ke.is_folder):De==="folders"&&(at=at.filter(ke=>ke.is_folder)),pn==="random"?at.sort(()=>Math.random()-.5):(at.sort((ke,We)=>{var Hn,nt;let qe=0;if(pn==="name")qe=ke.title.localeCompare(We.title);else if(pn==="date"){const rr=new Date(ke.created_at||0).getTime(),sr=new Date(We.created_at||0).getTime();qe=rr-sr}else if(pn==="modified"){const rr=new Date(ke.updated_at||ke.created_at||0).getTime(),sr=new Date(We.updated_at||We.created_at||0).getTime();qe=rr-sr}else if(pn==="pages"){const rr=((Hn=ke.chapters)==null?void 0:Hn.reduce((hs,Va)=>{var Vs;return hs+(((Vs=Va.pages)==null?void 0:Vs.length)||0)},0))||0,sr=((nt=We.chapters)==null?void 0:nt.reduce((hs,Va)=>{var Vs;return hs+(((Vs=Va.pages)==null?void 0:Vs.length)||0)},0))||0;qe=rr-sr}else pn==="views"&&(qe=(ke.views||0)-(We.views||0));return Ls==="asc"?qe:-qe}),at)},[kt,Ve,ds.items,pn,Ls,we,ot,xt,De,He,bt,Ge]),jc=V=>{u(V),e(!0)},Pc=async V=>{try{await Ud(V),await $t()}catch(ue){console.error("Error deleting manga:",ue),alert("Error al eliminar el manga. Por favor intenta de nuevo.")}},vo=async()=>{const V=/\s*\[\d+\]\s*$/,ue=H.filter(xe=>V.test(xe.title)).map(xe=>{let je=xe.title.replace(V,"").trim();return je||(je=xe.title),{id:xe.id,title:je}}).filter(xe=>{var je;return xe.title!==((je=H.find(dt=>dt.id===xe.id))==null?void 0:je.title)});if(ue.length===0){be.info("No hay nombres con formato [ID] que requieran limpieza.");return}try{await O0(ue),be.success(`Se limpiaron ${ue.length} nombres correctamente.`),$t()}catch(xe){console.error(xe),be.error("Ocurrió un error al intentar limpiar los nombres.")}},Rc=()=>{let V=[];const ue=dt=>{let at=[];const ke=kt.filter(We=>We.folder_id===dt);for(const We of ke)at.push(We.id),We.is_folder&&(at=at.concat(ue(We.id)));return at};Ma.forEach(dt=>{V.push(dt.id),dt.is_folder&&(V=V.concat(ue(dt.id)))});const xe=Array.from(new Set(V)),je=xe.length>0&&xe.every(dt=>C.includes(dt));y(je?[]:xe)},wo=V=>{const ue=kt.find(xe=>xe.id===V);if(ue){if(ue.is_folder){const xe=at=>{let ke=[];const We=kt.filter(qe=>qe.folder_id===at);for(const qe of We)ke.push(qe.id),qe.is_folder&&(ke=ke.concat(xe(qe.id)));return ke},je=xe(V),dt=[V,...je];y(at=>{if(at.includes(V))return at.filter(We=>!dt.includes(We));{const We=[...at];return dt.forEach(qe=>{We.includes(qe)||We.push(qe)}),We}});return}y(xe=>xe.includes(V)?xe.filter(je=>je!==V):[...xe,V])}},Os=V=>{if(f||m||x||pe||Q||le||te||pt||st||Vt){wo(V);return}const ue=kt.find(xe=>xe.id===V);if(ue!=null&&ue.is_folder){window.location.hash=`folder/${V}`;return}window.location.hash=`manga/${V}`,wt(V),$(!1)},Jt=()=>{window.location.hash="",wt(null),me(!1)},La=V=>{fn&&ie([...G,fn]),window.location.hash=`manga/${V}`,wt(V)},Dc=V=>{Ze(ue=>ue.includes(V)?ue.filter(xe=>xe!==V):[...ue,V]),Jt()},Mc=V=>{Ze(ue=>ue.filter(xe=>xe!==V))},Lc=V=>{$e(ue=>ue.includes(V)?ue.filter(xe=>xe!==V):[...ue,V]),Jt()},Oc=V=>{$e(ue=>ue.filter(xe=>xe!==V))},Oa=L.useMemo(()=>Ma.map(V=>{var je,dt;const ue=((je=V.chapters)==null?void 0:je.length)||0,xe=((dt=V.chapters)==null?void 0:dt.reduce((at,ke)=>{var We;return at+(((We=ke.pages)==null?void 0:We.length)||0)},0))||0;return{id:V.id,title:V.title,author:V.author,chapterCount:ue,pageCount:xe,thumbnail:V.cover_url||V.thumbnail_url||void 0,manga:V}}),[Ma]);if(_e)return a.jsx(Z3,{manga:_e.manga,chapter:_e.chapter,onBack:()=>Se(null)});if(J)return a.jsx(HF,{onBack:Jt,isAdmin:o});if(fn!==null){let V=H.find(ue=>ue.id===fn);return Le&&V?a.jsx(BI,{manga:V,onBack:()=>{V&&(window.location.hash=`manga/${V.id}`),$(!1)}}):a.jsx(J3,{id:fn,onBack:()=>{if(G.length>0){const ue=G[G.length-1];ie(G.slice(0,-1)),window.location.hash=`manga/${ue}`,wt(ue)}else V!=null&&V.folder_id?(window.location.hash=`folder/${V.folder_id}`,tt(V.folder_id),wt(null)):Jt()},onReadChapter:ue=>{V&&Se({manga:V,chapter:ue})},onMangaLoaded:ue=>{V||(V=ue)},onNavigateToManga:La,onSelectCategory:Dc,onSelectAuthor:Lc,isAdmin:o})}return a.jsxs("div",{className:"min-h-screen bg-[#121212] text-white flex flex-col",children:[a.jsx("header",{className:"border-b border-gray-800/50 px-3 sm:px-6 md:px-12 py-4 sm:py-6 flex-shrink-0 transition-all duration-300",children:a.jsxs("div",{className:"max-w-[1800px] mx-auto flex items-center justify-between gap-2 sm:gap-0",children:[a.jsxs("div",{className:"flex items-center gap-1 sm:gap-3",children:[a.jsx(i8,{currentSection:se,onSectionChange:de}),a.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 group cursor-pointer",children:[a.jsx("img",{src:"/icons/icones.png",alt:"Twisted Brody Logo",className:"w-10 h-10 sm:w-14 sm:h-14 object-contain transition-all duration-300 group-hover:rotate-12 group-hover:scale-110"}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("h1",{className:"text-lg sm:text-2xl font-bold text-white transition-colors duration-300 group-hover:text-[#bb86fc]",children:"Twisted Brody MangaFlow"}),a.jsxs("div",{className:"hidden sm:flex items-center gap-1.5 bg-[#1a1a1a] border border-[#333] px-3 py-1 rounded-full shadow-inner",children:[a.jsxs("button",{onClick:()=>$n(V=>V==="mangas"?"all":"mangas"),className:`flex items-center gap-1.5 px-2 py-0.5 rounded-full transition-colors ${De==="mangas"?"bg-[#bb86fc]/20 border border-[#bb86fc]/50":"hover:bg-white/5 border border-transparent cursor-pointer"}`,children:[a.jsx(fa,{className:"w-4 h-4 text-[#bb86fc]"}),a.jsxs("span",{className:"text-sm font-bold text-gray-300",children:[kt.filter(V=>!V.is_folder).length," ",a.jsx("span",{className:"text-xs text-gray-500 font-normal",children:"mangas"})]})]}),a.jsx("span",{className:"text-gray-600 mx-1",children:"|"}),a.jsxs("button",{onClick:()=>$n(V=>V==="folders"?"all":"folders"),className:`flex items-center gap-1.5 px-2 py-0.5 rounded-full transition-colors ${De==="folders"?"bg-[#bb86fc]/20 border border-[#bb86fc]/50":"hover:bg-white/5 border border-transparent cursor-pointer"}`,children:[a.jsx(xr,{className:"w-4 h-4 text-[#bb86fc]"}),a.jsxs("span",{className:"text-sm font-bold text-gray-300",children:[kt.filter(V=>V.is_folder).length," ",a.jsx("span",{className:"text-xs text-gray-500 font-normal",children:"carpetas"})]})]})]})]})]})]}),a.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-3",children:[(f||m||x||pe||Q||le||te||pt||Vt)&&a.jsxs("div",{className:"hidden sm:flex items-center gap-2 mr-2 px-3 py-1.5 bg-purple-500/10 rounded-lg border border-purple-500/20",children:[a.jsx(Wr,{className:"w-4 h-4 text-purple-400"}),a.jsx("span",{className:"text-xs font-semibold text-purple-300",children:le?"Modo Etiquetar Activo":pt?"Portal Plus Activo":te?"Carpetas Plus Activo":Q?"Modo Nombres Activo":m?"Modo Copiar Activo":x?"Modo Eliminar Activo":pe?"Modo Minus Activo":Vt?"Transferencia Activa":"Modo Plus Activo"}),a.jsx("span",{className:"text-xs bg-purple-500/20 px-2 py-0.5 rounded text-purple-200",children:C.length})]}),o&&a.jsxs(a.Fragment,{children:[a.jsxs("button",{onClick:()=>r(!0),className:"bg-gray-800 hover:bg-gray-700 active:scale-95 text-white px-2 py-2 sm:px-4 sm:py-2.5 rounded-lg flex items-center gap-1.5 sm:gap-2 font-semibold transition-all duration-300 border border-gray-700/50 hover:border-gray-600 text-xs sm:text-sm hover:scale-110 hover:shadow-lg hover:shadow-700/50",title:"Ajustes y Admin",children:[a.jsx(Z_,{className:"w-4 h-4 sm:w-5 sm:h-5 transition-transform duration-300 hover:rotate-180"}),a.jsx("span",{className:"hidden sm:inline",children:"Ajustes"})]}),a.jsxs("button",{onClick:()=>e(!0),className:"bg-purple-600 hover:bg-purple-700 active:scale-95 text-white px-2 py-2 sm:px-4 sm:py-2.5 rounded-lg flex items-center gap-1.5 sm:gap-2 font-semibold transition-all duration-300 shadow-lg shadow-purple-600/30 hover:shadow-purple-600/50 text-xs sm:text-sm hover:scale-110",children:[a.jsx(Kr,{className:"w-4 h-4 sm:w-5 sm:h-5 transition-transform duration-300 hover:rotate-180"}),a.jsx("span",{className:"hidden sm:inline",children:se==="patreon"?"Subir Imágenes":se==="onlyfans"?"Subir Only":"Nuevo Manga"})]})]})]})]})}),a.jsxs("main",{className:"flex-1 px-4 sm:px-6 md:px-12 py-8",children:[a.jsx(pM,{isAdmin:o}),a.jsxs("div",{className:"max-w-[1800px] mx-auto mb-8 flex-shrink-0",children:[a.jsx(o8,{value:Ve,onChange:Be,placeholder:"Buscar por título, autor...",sortType:pn,onSortTypeChange:Rn,sortDirection:Ls,onSortDirectionChange:zr,onOpenFilter:()=>i(!0)}),Ve&&a.jsxs("div",{className:"mt-2 text-sm text-gray-400",children:[ds.resultCount," resultado",ds.resultCount!==1?"s":""," encontrado",ds.resultCount!==1?"s":""]}),(we.length>0||ot.length>0||He||bt||Ge)&&a.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-2 animate-in fade-in slide-in-from-top-2 duration-300",children:[a.jsx("span",{className:"text-sm text-gray-400",children:"Filtrado por:"}),we.map(V=>a.jsxs("button",{onClick:()=>Mc(V),className:"bg-purple-500/20 hover:bg-purple-500/30 text-purple-300 px-3 py-1 rounded-full text-sm font-medium flex items-center gap-2 border border-purple-500/30 hover:border-purple-500/50 transition-all group",children:[V,a.jsx("div",{className:"bg-purple-500/20 rounded-full p-0.5 group-hover:bg-purple-500/40 transition-colors",children:a.jsx(Kr,{className:"w-3 h-3 transform rotate-45"})})]},V)),ot.map(V=>a.jsxs("button",{onClick:()=>Oc(V),className:"bg-[#bb86fc]/20 hover:bg-[#bb86fc]/30 text-[#bb86fc] px-3 py-1 rounded-full text-sm font-medium flex items-center gap-2 border border-[#bb86fc]/30 hover:border-[#bb86fc]/50 transition-all group",children:[a.jsx(Lg,{size:14}),V,a.jsx("div",{className:"bg-[#bb86fc]/20 rounded-full p-0.5 group-hover:bg-[#bb86fc]/40 transition-colors",children:a.jsx(Kr,{className:"w-3 h-3 transform rotate-45"})})]},V)),He&&a.jsxs("button",{onClick:()=>{ft(!1),Jt()},className:"bg-purple-500/20 hover:bg-purple-500/30 text-purple-300 px-3 py-1 rounded-full text-sm font-medium flex items-center gap-2 border border-purple-500/30 hover:border-purple-500/50 transition-all group",children:["Sin censura",a.jsx("div",{className:"bg-purple-500/20 rounded-full p-0.5 group-hover:bg-purple-500/40 transition-colors",children:a.jsx(Kr,{className:"w-3 h-3 transform rotate-45"})})]}),bt&&a.jsxs("button",{onClick:()=>{ct(!1),Jt()},className:"bg-purple-500/20 hover:bg-purple-500/30 text-purple-300 px-3 py-1 rounded-full text-sm font-medium flex items-center gap-2 border border-purple-500/30 hover:border-purple-500/50 transition-all group",children:["B/N",a.jsx("div",{className:"bg-purple-500/20 rounded-full p-0.5 group-hover:bg-purple-500/40 transition-colors",children:a.jsx(Kr,{className:"w-3 h-3 transform rotate-45"})})]}),Ge&&a.jsxs("button",{onClick:()=>{Bt(!1),Jt()},className:"bg-purple-500/20 hover:bg-purple-500/30 text-purple-300 px-3 py-1 rounded-full text-sm font-medium flex items-center gap-2 border border-purple-500/30 hover:border-purple-500/50 transition-all group",children:["A color",a.jsx("div",{className:"bg-purple-500/20 rounded-full p-0.5 group-hover:bg-purple-500/40 transition-colors",children:a.jsx(Kr,{className:"w-3 h-3 transform rotate-45"})})]}),(we.length>0||ot.length>0||He||bt||Ge)&&a.jsx("button",{onClick:()=>{Ze([]),$e([]),ft(!1),ct(!1),Bt(!1)},className:"text-xs text-gray-400 hover:text-white underline decoration-gray-600 hover:decoration-white transition-colors ml-2",children:"Limpiar todo"})]})]}),a.jsxs("div",{className:"max-w-[1800px] mx-auto",children:[xt&&(()=>{const V=H.find(ue=>ue.id===xt);return V?a.jsxs("div",{className:"mb-6 flex items-center gap-4 bg-[#1a1a1a] p-4 rounded-xl border border-gray-800 animate-in slide-in-from-top-2",children:[a.jsx("button",{onClick:()=>{V.folder_id?window.location.hash=`folder/${V.folder_id}`:window.location.hash=""},className:"p-2 hover:bg-gray-800 rounded-lg text-white transition-colors",children:a.jsx(Is,{className:"w-5 h-5"})}),a.jsx("div",{className:"w-10 h-10 rounded-lg bg-gray-800 flex items-center justify-center",children:!V.folder_id&&V.title.toLowerCase().includes("patreon")?a.jsx(sc,{className:"w-6 h-6 text-white"}):a.jsx(xr,{className:"w-6 h-6 text-purple-400"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-xl font-bold text-white uppercase tracking-wider",children:V.title}),a.jsxs("p",{className:"text-sm text-gray-400",children:["Carpeta • ",kt.filter(ue=>ue.folder_id===V.id).length," elementos"]})]})]}):null})(),a.jsx(c8,{items:Oa,searchTerm:Ve,isSearching:!1,isLoading:ge,onSelectComic:Os,onEditManga:o?jc:void 0,onDeleteManga:o?Pc:void 0,isCategoryPlusEnabled:f||m||x||pe||Q||le||te||pt||st||Vt,selectedMangaIds:C,onToggleSelectManga:wo,allMangas:kt,isFolderAnimationEnabled:R,currentSection:se})]})]}),C.length>0&&a.jsx("div",{className:"fixed bottom-6 left-1/2 transform -translate-x-1/2 z-40 animate-in slide-in-from-bottom-4 duration-200",children:a.jsxs("div",{className:"bg-[#1a1a1a] border border-gray-700/50 shadow-2xl rounded-xl px-6 py-3 flex items-center gap-4",children:[a.jsxs("div",{className:"flex flex-col",children:[a.jsx("span",{className:"text-sm font-bold text-white",children:(()=>{const V=C.filter(je=>{var dt;return(dt=H.find(at=>at.id===je))==null?void 0:dt.is_folder}).length,ue=C.length-V,xe=[];return ue>0&&xe.push(`${ue} manga${ue!==1?"s":""}`),V>0&&xe.push(`${V} carpeta${V!==1?"s":""}`),xe.length>0?xe.join(" y ")+" seleccionad"+(V>0&&ue===0?"as":"os"):"0 seleccionados"})()}),a.jsx("button",{onClick:Rc,className:"text-xs text-[#bb86fc] hover:text-white transition-colors text-left mt-0.5 underline decoration-[#bb86fc]/30 underline-offset-2",children:"Seleccionar todo"})]}),a.jsx("div",{className:"h-8 w-px bg-gray-700"}),a.jsxs("div",{className:"flex gap-2",children:[te?a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{onClick:()=>Pn(!0),className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg text-sm font-bold shadow-lg shadow-blue-500/20 transition-all transform hover:scale-105 active:scale-95",children:"Mover a Carpeta"}),!xt&&a.jsx("button",{onClick:()=>Ue(!0),className:"bg-indigo-600 hover:bg-indigo-700 text-white px-4 py-2 rounded-lg text-sm font-bold shadow-lg shadow-indigo-500/20 transition-all transform hover:scale-105 active:scale-95",children:"Crear Carpeta"})]}):pt?a.jsxs("button",{onClick:()=>on(!0),className:"bg-indigo-600 hover:bg-indigo-700 text-white px-4 py-2 rounded-lg text-sm font-bold shadow-lg shadow-indigo-500/20 transition-all transform hover:scale-105 active:scale-95 flex items-center gap-2",children:[a.jsx(Dg,{className:"w-4 h-4"}),"Mover de Sección"]}):f?a.jsx("button",{onClick:()=>_(!0),className:"bg-[#bb86fc] hover:bg-[#9966dd] text-white px-4 py-2 rounded-lg text-sm font-bold shadow-lg shadow-purple-500/20 transition-all transform hover:scale-105 active:scale-95",children:"Aplicar Categorías"}):le?a.jsxs("button",{onClick:()=>N(!0),className:"bg-[#bb86fc] hover:bg-[#9966dd] text-white px-4 py-2 rounded-lg text-sm font-bold shadow-lg shadow-[#bb86fc]/20 transition-all transform hover:scale-105 active:scale-95 flex items-center gap-2",children:[a.jsx(vd,{className:"w-4 h-4"}),"Etiquetar"]}):pe?a.jsx("button",{onClick:()=>M(!0),className:"bg-orange-500 hover:bg-orange-600 text-white px-4 py-2 rounded-lg text-sm font-bold shadow-lg shadow-orange-500/20 transition-all transform hover:scale-105 active:scale-95",children:"Remover Categorías"}):Q?a.jsxs("button",{onClick:()=>S(!0),className:"bg-pink-500 hover:bg-pink-600 text-white px-4 py-2 rounded-lg text-sm font-bold shadow-lg shadow-pink-500/20 transition-all transform hover:scale-105 active:scale-95 flex items-center gap-2",children:[a.jsx(Yo,{className:"w-4 h-4"}),"Editar Nombres"]}):m?a.jsxs("button",{onClick:()=>{const V=C.filter(ue=>{var xe;return!((xe=H.find(je=>je.id===ue))!=null&&xe.is_folder)});navigator.clipboard.writeText(V.join(", ")),be.success(`Se copiaron ${V.length} IDs`),y([])},className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg text-sm font-bold shadow-lg shadow-blue-500/20 transition-all transform hover:scale-105 active:scale-95 flex items-center gap-2",children:[a.jsx(W_,{className:"w-4 h-4"}),"Copiar IDs"]}):x?a.jsx("button",{onClick:async()=>{if(window.confirm(`¿Seguro que quieres eliminar ${C.length} elementos?`))try{for(const V of C)await Ud(V);be.success(`Se eliminaron ${C.length} elementos.`),y([]),$t()}catch{be.error("Error al eliminar")}},className:"bg-red-600 hover:bg-red-700 text-white px-4 py-2 rounded-lg text-sm font-bold shadow-lg shadow-red-500/20 transition-all transform hover:scale-105 active:scale-95",children:"Eliminar Selección"}):st?a.jsxs("button",{onClick:async()=>{const V=C.filter(ue=>{var xe;return!((xe=H.find(je=>je.id===ue))!=null&&xe.is_folder)});if(V.length<2){be.error("Debes seleccionar al menos 2 mangas para unirlos (las carpetas son ignoradas).");return}if(window.confirm(`¿Seguro que quieres unir ${V.length} mangas en uno solo? Los originales serán eliminados.`))try{await Tw(V),be.success(`Se fusionaron ${V.length} mangas correctamente.`),y([]),$t()}catch{be.error("Error al unir mangas")}},className:"bg-emerald-600 hover:bg-emerald-700 text-white px-4 py-2 rounded-lg text-sm font-bold shadow-lg shadow-emerald-500/20 transition-all transform hover:scale-105 active:scale-95 flex items-center gap-2",children:[a.jsx(xd,{className:"w-4 h-4"}),"Unir Mangas"]}):a.jsxs(a.Fragment,{children:[C.filter(V=>{var ue;return!((ue=H.find(xe=>xe.id===V))!=null&&ue.is_folder)}).length===2&&a.jsxs("button",{onClick:()=>ee(!0),className:"bg-amber-600 hover:bg-amber-700 text-white px-4 py-2 rounded-lg text-sm font-bold shadow-lg shadow-amber-500/20 transition-all transform hover:scale-105 active:scale-95 flex items-center gap-2",children:[a.jsx(Wr,{className:"w-4 h-4"}),"Transferir Páginas"]}),C.filter(V=>{var ue;return!((ue=H.find(xe=>xe.id===V))!=null&&ue.is_folder)}).length>1&&a.jsxs("button",{onClick:async()=>{const V=C.filter(ue=>{var xe;return!((xe=H.find(je=>je.id===ue))!=null&&xe.is_folder)});if(window.confirm(`¿Seguro que quieres unir ${V.length} mangas en uno solo? Los originales serán eliminados.`))try{await Tw(V),be.success(`Se fusionaron ${V.length} mangas correctamente.`),y([]),$t()}catch{be.error("Error al unir mangas")}},className:"bg-emerald-600 hover:bg-emerald-700 text-white px-4 py-2 rounded-lg text-sm font-bold shadow-lg shadow-emerald-500/20 transition-all transform hover:scale-105 active:scale-95 flex items-center gap-2",children:[a.jsx(xd,{className:"w-4 h-4"}),"Unir Mangas"]})]}),a.jsx("button",{onClick:()=>y([]),className:"text-gray-400 hover:text-white text-sm font-semibold transition-colors px-2",children:"Cancelar"})]})]})}),a.jsx(hh,{isAdmin:o,onOpenTrash:()=>z(!0)}),a.jsx(uM,{currentSection:se,isOpen:t,onClose:()=>{e(!1),u(null)},editingManga:c,onMangaCreated:V=>{$t(),u(null),V&&!c&&setTimeout(()=>{Os(V)},500)},onDelete:o?Pc:void 0}),a.jsx(GF,{isOpen:v,onClose:()=>_(!1),selectedMangaIds:C,onSaveComplete:()=>{$t(),y([])}}),a.jsx(WF,{isOpen:D,onClose:()=>M(!1),selectedMangaIds:C,onSaveComplete:()=>{$t(),y([])}}),a.jsx(XF,{isOpen:T,onClose:()=>S(!1),mangas:H,selectedMangaIds:C,onSaveComplete:()=>{$t(),y([])}}),a.jsx(JF,{isOpen:w,onClose:()=>N(!1),selectedMangaIds:C,onSaveComplete:()=>{$t(),y([])}}),a.jsx(ZF,{isOpen:Bn,onClose:()=>Ue(!1),selectedMangaIds:C,onSaveComplete:()=>{$t(),y([])},currentFolderId:xt,currentSection:se}),a.jsx(e8,{isOpen:vt,onClose:()=>Pn(!1),selectedMangaIds:C,mangas:kt,onSaveComplete:()=>{$t(),y([])}}),a.jsx(t8,{isOpen:jt,onClose:()=>on(!1),selectedMangaIds:C,currentSection:se,onSaveComplete:()=>{$t(),y([])}}),a.jsx(fM,{isOpen:n,onClose:()=>r(!1),isAdmin:o,onAdminChange:l,isCategoryPlusEnabled:f,onCategoryPlusChange:h,isCopyIdsEnabled:m,onCopyIdsChange:p,isDeletePlusEnabled:x,onDeletePlusChange:E,isCategoryMinusEnabled:pe,onCategoryMinusChange:O,isEditTitlePlusEnabled:Q,onEditTitlePlusChange:oe,isEtiquetadoraEnabled:le,onEtiquetadoraChange:Ie,isFolderPlusEnabled:te,onFolderPlusChange:V=>{it(V),V||y([])},isPortalPlusEnabled:pt,onPortalPlusChange:V=>{Ot(V),V||y([])},isMergePlusEnabled:st,onMergePlusChange:V=>{yt(V),V||y([])},isTransferPlusEnabled:Vt,onTransferPlusChange:V=>{_n(V),V||y([])},isFolderAnimationEnabled:R,onFolderAnimationChange:ne,onOpenTitleManager:()=>I(!0),onOpenFolderMap:()=>k(!0),onCleanKemonoTitles:()=>K(!0)}),a.jsx(YF,{isOpen:A,onClose:()=>I(!1),mangas:H,onSaveComplete:()=>$t()}),a.jsx(QF,{isOpen:s,onClose:()=>i(!1),categories:Da,selectedCategories:we,onToggleCategory:Dc,onClearFilters:()=>{Ze([]),ft(!1),ct(!1),Bt(!1),Jt()},filterDecensored:He,setFilterDecensored:V=>{ft(V),Jt()},filterBN:bt,setFilterBN:V=>{ct(V),Jt()},filterColor:Ge,setFilterColor:V=>{Bt(V),Jt()}}),a.jsx(n8,{isOpen:P,onClose:()=>k(!1),mangas:kt}),a.jsx(Nm,{isOpen:F,onClose:()=>K(!1),onConfirm:vo,title:"Limpiar IDs de Kemono",message:"¿Seguro que quieres eliminar las etiquetas [Numeros] del final de todos los mangas y carpetas? Esta acción se aplicará automáticamente a toda la base de datos.",confirmText:"Sí, limpiar nombres",cancelText:"Cancelar",variant:"warning"}),a.jsx(r8,{isOpen:B,onClose:()=>z(!1),deletedMangas:Ra,onRestore:async V=>{await kD(V),await $t()},onPermanentDelete:async V=>{await ID(V),await $t()}}),a.jsx(s8,{isOpen:W,onClose:()=>{ee(!1),y([])},mangaIds:C.filter(V=>{var ue;return!((ue=H.find(xe=>xe.id===V))!=null&&ue.is_folder)}).slice(0,2),onSaveComplete:()=>{$t(),y([])}}),a.jsx(cM,{position:"top-center",richColors:!0,theme:"dark"})]})}H_(document.getElementById("root")).render(a.jsx(L.StrictMode,{children:a.jsx(h8,{})})); diff --git a/dist/assets/index-DfHziy0I.css b/dist/assets/index-DfHziy0I.css new file mode 100644 index 0000000000000000000000000000000000000000..a144f9fafabc7ed954807f853733d8aabebf8797 --- /dev/null +++ b/dist/assets/index-DfHziy0I.css @@ -0,0 +1 @@ +*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.visible{visibility:visible}.invisible{visibility:hidden}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.inset-x-0{left:0;right:0}.bottom-0{bottom:0}.bottom-2{bottom:.5rem}.bottom-6{bottom:1.5rem}.left-0{left:0}.left-1\.5{left:.375rem}.left-1\/2{left:50%}.left-2{left:.5rem}.left-3{left:.75rem}.left-4{left:1rem}.left-6{left:1.5rem}.right-0{right:0}.right-2{right:.5rem}.right-3{right:.75rem}.right-4{right:1rem}.right-6{right:1.5rem}.right-8{right:2rem}.top-0{top:0}.top-1\.5{top:.375rem}.top-1\/2{top:50%}.top-2{top:.5rem}.top-6{top:1.5rem}.top-8{top:2rem}.top-full{top:100%}.z-10{z-index:10}.z-20{z-index:20}.z-40{z-index:40}.z-50{z-index:50}.mx-1{margin-left:.25rem;margin-right:.25rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-auto{margin-left:auto;margin-right:auto}.my-1{margin-top:.25rem;margin-bottom:.25rem}.my-4{margin-top:1rem;margin-bottom:1rem}.my-6{margin-top:1.5rem;margin-bottom:1.5rem}.my-8{margin-top:2rem;margin-bottom:2rem}.mb-0\.5{margin-bottom:.125rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-2\.5{margin-bottom:.625rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-5{margin-bottom:1.25rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-2{margin-left:.5rem}.ml-auto{margin-left:auto}.mr-2{margin-right:.5rem}.mr-auto{margin-right:auto}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-8{margin-top:2rem}.mt-auto{margin-top:auto}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.block{display:block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.grid{display:grid}.hidden{display:none}.aspect-\[2\/3\]{aspect-ratio:2/3}.aspect-\[3\/4\]{aspect-ratio:3/4}.h-1{height:.25rem}.h-1\/3{height:33.333333%}.h-10{height:2.5rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-16{height:4rem}.h-2{height:.5rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-\[500px\]{height:500px}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.max-h-40{max-height:10rem}.max-h-60{max-height:15rem}.max-h-\[80vh\]{max-height:80vh}.max-h-\[85vh\]{max-height:85vh}.max-h-\[90vh\]{max-height:90vh}.max-h-screen{max-height:100vh}.min-h-\[100px\]{min-height:100px}.min-h-screen{min-height:100vh}.w-1{width:.25rem}.w-1\/2{width:50%}.w-1\/3{width:33.333333%}.w-10{width:2.5rem}.w-11{width:2.75rem}.w-12{width:3rem}.w-14{width:3.5rem}.w-16{width:4rem}.w-2{width:.5rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-3\/4{width:75%}.w-4{width:1rem}.w-5{width:1.25rem}.w-56{width:14rem}.w-6{width:1.5rem}.w-64{width:16rem}.w-7{width:1.75rem}.w-8{width:2rem}.w-\[300\%\]{width:300%}.w-full{width:100%}.w-px{width:1px}.min-w-0{min-width:0px}.min-w-\[200px\]{min-width:200px}.min-w-\[3ch\]{min-width:3ch}.max-w-2xl{max-width:42rem}.max-w-4xl{max-width:56rem}.max-w-5xl{max-width:64rem}.max-w-7xl{max-width:80rem}.max-w-\[150px\]{max-width:150px}.max-w-\[1800px\]{max-width:1800px}.max-w-\[1920px\]{max-width:1920px}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-none{max-width:none}.max-w-sm{max-width:24rem}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.flex-shrink-0{flex-shrink:0}.origin-left{transform-origin:left}.origin-right{transform-origin:right}.-translate-x-1\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-45{--tw-rotate: 45deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-100{--tw-scale-x: 1;--tw-scale-y: 1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-95{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform-gpu{transform:translate3d(var(--tw-translate-x),var(--tw-translate-y),0) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.animate-\[fadeIn_0\.7s_ease-out_forwards\]{animation:fadeIn .7s ease-out forwards}@keyframes bounce{0%,to{transform:translateY(-25%);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;animation-timing-function:cubic-bezier(0,0,.2,1)}}.animate-bounce{animation:bounce 1s infinite}@keyframes ping{75%,to{transform:scale(2);opacity:0}}.animate-ping{animation:ping 1s cubic-bezier(0,0,.2,1) infinite}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.cursor-move{cursor:move}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-none{resize:none}.resize{resize:both}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-3\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.875rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.875rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-xl{border-radius:.75rem}.rounded-r-lg{border-top-right-radius:.5rem;border-bottom-right-radius:.5rem}.border{border-width:1px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-l{border-left-width:1px}.border-l-4{border-left-width:4px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-\[\#bb86fc\]{--tw-border-opacity: 1;border-color:rgb(187 134 252 / var(--tw-border-opacity, 1))}.border-\[\#bb86fc\]\/30{border-color:#bb86fc4d}.border-\[\#bb86fc\]\/40{border-color:#bb86fc66}.border-\[\#bb86fc\]\/50{border-color:#bb86fc80}.border-blue-500\/30{border-color:#3b82f64d}.border-gray-500\/30{border-color:#6b72804d}.border-gray-600{--tw-border-opacity: 1;border-color:rgb(75 85 99 / var(--tw-border-opacity, 1))}.border-gray-600\/50{border-color:#4b556380}.border-gray-700{--tw-border-opacity: 1;border-color:rgb(55 65 81 / var(--tw-border-opacity, 1))}.border-gray-700\/30{border-color:#3741514d}.border-gray-700\/40{border-color:#37415166}.border-gray-700\/50{border-color:#37415180}.border-gray-700\/60{border-color:#37415199}.border-gray-800{--tw-border-opacity: 1;border-color:rgb(31 41 55 / var(--tw-border-opacity, 1))}.border-gray-800\/50{border-color:#1f293780}.border-gray-900{--tw-border-opacity: 1;border-color:rgb(17 24 39 / var(--tw-border-opacity, 1))}.border-green-500{--tw-border-opacity: 1;border-color:rgb(34 197 94 / var(--tw-border-opacity, 1))}.border-green-500\/20{border-color:#22c55e33}.border-green-500\/30{border-color:#22c55e4d}.border-pink-500\/30{border-color:#ec48994d}.border-purple-500{--tw-border-opacity: 1;border-color:rgb(168 85 247 / var(--tw-border-opacity, 1))}.border-purple-500\/20{border-color:#a855f733}.border-purple-500\/30{border-color:#a855f74d}.border-purple-500\/50{border-color:#a855f780}.border-red-500\/20{border-color:#ef444433}.border-red-500\/30{border-color:#ef44444d}.border-transparent{border-color:transparent}.border-white\/50{border-color:#ffffff80}.border-t-transparent{border-top-color:transparent}.bg-\[\#050505\]{--tw-bg-opacity: 1;background-color:rgb(5 5 5 / var(--tw-bg-opacity, 1))}.bg-\[\#0a0a0a\]{--tw-bg-opacity: 1;background-color:rgb(10 10 10 / var(--tw-bg-opacity, 1))}.bg-\[\#0f0f0f\]{--tw-bg-opacity: 1;background-color:rgb(15 15 15 / var(--tw-bg-opacity, 1))}.bg-\[\#121212\]{--tw-bg-opacity: 1;background-color:rgb(18 18 18 / var(--tw-bg-opacity, 1))}.bg-\[\#121212\]\/90{background-color:#121212e6}.bg-\[\#151515\]{--tw-bg-opacity: 1;background-color:rgb(21 21 21 / var(--tw-bg-opacity, 1))}.bg-\[\#1a1a1a\]{--tw-bg-opacity: 1;background-color:rgb(26 26 26 / var(--tw-bg-opacity, 1))}.bg-\[\#1f1f1f\]{--tw-bg-opacity: 1;background-color:rgb(31 31 31 / var(--tw-bg-opacity, 1))}.bg-\[\#252525\]{--tw-bg-opacity: 1;background-color:rgb(37 37 37 / var(--tw-bg-opacity, 1))}.bg-\[\#bb86fc\]{--tw-bg-opacity: 1;background-color:rgb(187 134 252 / var(--tw-bg-opacity, 1))}.bg-\[\#bb86fc\]\/10{background-color:#bb86fc1a}.bg-\[\#bb86fc\]\/20{background-color:#bb86fc33}.bg-\[\#bb86fc\]\/90{background-color:#bb86fce6}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-black\/30{background-color:#0000004d}.bg-black\/40{background-color:#0006}.bg-black\/50{background-color:#00000080}.bg-black\/60{background-color:#0009}.bg-black\/70{background-color:#000000b3}.bg-black\/80{background-color:#000c}.bg-black\/95{background-color:#000000f2}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.bg-blue-500\/10{background-color:#3b82f61a}.bg-blue-500\/20{background-color:#3b82f633}.bg-gray-500\/20{background-color:#6b728033}.bg-gray-600{--tw-bg-opacity: 1;background-color:rgb(75 85 99 / var(--tw-bg-opacity, 1))}.bg-gray-700{--tw-bg-opacity: 1;background-color:rgb(55 65 81 / var(--tw-bg-opacity, 1))}.bg-gray-700\/40{background-color:#37415166}.bg-gray-800{--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.bg-green-500\/10{background-color:#22c55e1a}.bg-green-500\/20{background-color:#22c55e33}.bg-green-600\/90{background-color:#16a34ae6}.bg-pink-500\/20{background-color:#ec489933}.bg-purple-500{--tw-bg-opacity: 1;background-color:rgb(168 85 247 / var(--tw-bg-opacity, 1))}.bg-purple-500\/10{background-color:#a855f71a}.bg-purple-500\/20{background-color:#a855f733}.bg-purple-600{--tw-bg-opacity: 1;background-color:rgb(147 51 234 / var(--tw-bg-opacity, 1))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-500\/10{background-color:#ef44441a}.bg-red-600{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.bg-red-600\/80{background-color:#dc2626cc}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-white\/10{background-color:#ffffff1a}.bg-white\/20{background-color:#fff3}.bg-gradient-to-b{background-image:linear-gradient(to bottom,var(--tw-gradient-stops))}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.bg-gradient-to-t{background-image:linear-gradient(to top,var(--tw-gradient-stops))}.from-\[\#1a1a1a\]{--tw-gradient-from: #1a1a1a var(--tw-gradient-from-position);--tw-gradient-to: rgb(26 26 26 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-\[\#1f1f1f\]{--tw-gradient-from: #1f1f1f var(--tw-gradient-from-position);--tw-gradient-to: rgb(31 31 31 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-\[\#1f1f1f\]\/80{--tw-gradient-from: rgb(31 31 31 / .8) var(--tw-gradient-from-position);--tw-gradient-to: rgb(31 31 31 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-\[\#242424\]{--tw-gradient-from: #242424 var(--tw-gradient-from-position);--tw-gradient-to: rgb(36 36 36 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-\[\#2a2a2a\]{--tw-gradient-from: #2a2a2a var(--tw-gradient-from-position);--tw-gradient-to: rgb(42 42 42 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-\[\#2a2a2a\]\/80{--tw-gradient-from: rgb(42 42 42 / .8) var(--tw-gradient-from-position);--tw-gradient-to: rgb(42 42 42 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-\[\#9966dd\]{--tw-gradient-from: #9966dd var(--tw-gradient-from-position);--tw-gradient-to: rgb(153 102 221 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-\[\#bb86fc\]{--tw-gradient-from: #bb86fc var(--tw-gradient-from-position);--tw-gradient-to: rgb(187 134 252 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-\[\#bb86fc\]\/20{--tw-gradient-from: rgb(187 134 252 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(187 134 252 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-black\/60{--tw-gradient-from: rgb(0 0 0 / .6) var(--tw-gradient-from-position);--tw-gradient-to: rgb(0 0 0 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-gray-700\/40{--tw-gradient-from: rgb(55 65 81 / .4) var(--tw-gradient-from-position);--tw-gradient-to: rgb(55 65 81 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-gray-800{--tw-gradient-from: #1f2937 var(--tw-gradient-from-position);--tw-gradient-to: rgb(31 41 55 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-transparent{--tw-gradient-from: transparent var(--tw-gradient-from-position);--tw-gradient-to: rgb(0 0 0 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-white{--tw-gradient-from: #fff var(--tw-gradient-from-position);--tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.via-\[\#9966dd\]{--tw-gradient-to: rgb(153 102 221 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), #9966dd var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-white\/20{--tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), rgb(255 255 255 / .2) var(--tw-gradient-via-position), var(--tw-gradient-to)}.to-\[\#0f0f0f\]{--tw-gradient-to: #0f0f0f var(--tw-gradient-to-position)}.to-\[\#121212\]{--tw-gradient-to: #121212 var(--tw-gradient-to-position)}.to-\[\#1a1a1a\]{--tw-gradient-to: #1a1a1a var(--tw-gradient-to-position)}.to-\[\#1a1a1a\]\/80{--tw-gradient-to: rgb(26 26 26 / .8) var(--tw-gradient-to-position)}.to-\[\#1f1f1f\]\/80{--tw-gradient-to: rgb(31 31 31 / .8) var(--tw-gradient-to-position)}.to-\[\#252525\]{--tw-gradient-to: #252525 var(--tw-gradient-to-position)}.to-\[\#7744cc\]{--tw-gradient-to: #7744cc var(--tw-gradient-to-position)}.to-\[\#9966dd\]{--tw-gradient-to: #9966dd var(--tw-gradient-to-position)}.to-\[\#bb86fc\]{--tw-gradient-to: #bb86fc var(--tw-gradient-to-position)}.to-gray-400{--tw-gradient-to: #9ca3af var(--tw-gradient-to-position)}.to-gray-600\/40{--tw-gradient-to: rgb(75 85 99 / .4) var(--tw-gradient-to-position)}.to-gray-900{--tw-gradient-to: #111827 var(--tw-gradient-to-position)}.to-transparent{--tw-gradient-to: transparent var(--tw-gradient-to-position)}.bg-clip-text{-webkit-background-clip:text;background-clip:text}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.object-left{-o-object-position:left;object-position:left}.object-right{-o-object-position:right;object-position:right}.p-0\.5{padding:.125rem}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-2{padding:.5rem}.p-2\.5{padding:.625rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-0{padding-left:0;padding-right:0}.px-1{padding-left:.25rem;padding-right:.25rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-8{padding-left:2rem;padding-right:2rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-16{padding-top:4rem;padding-bottom:4rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-20{padding-top:5rem;padding-bottom:5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-2{padding-bottom:.5rem}.pb-8{padding-bottom:2rem}.pl-10{padding-left:2.5rem}.pl-2{padding-left:.5rem}.pl-4{padding-left:1rem}.pr-1{padding-right:.25rem}.pr-10{padding-right:2.5rem}.pr-3{padding-right:.75rem}.pr-4{padding-right:1rem}.pt-2{padding-top:.5rem}.pt-4{padding-top:1rem}.pt-6{padding-top:1.5rem}.pt-8{padding-top:2rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-\[10px\]{font-size:10px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.italic{font-style:italic}.leading-relaxed{line-height:1.625}.tracking-wide{letter-spacing:.025em}.tracking-wider{letter-spacing:.05em}.text-\[\#bb86fc\]{--tw-text-opacity: 1;color:rgb(187 134 252 / var(--tw-text-opacity, 1))}.text-blue-300{--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.text-gray-200{--tw-text-opacity: 1;color:rgb(229 231 235 / var(--tw-text-opacity, 1))}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.text-green-300{--tw-text-opacity: 1;color:rgb(134 239 172 / var(--tw-text-opacity, 1))}.text-green-400{--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.text-pink-300{--tw-text-opacity: 1;color:rgb(249 168 212 / var(--tw-text-opacity, 1))}.text-pink-400{--tw-text-opacity: 1;color:rgb(244 114 182 / var(--tw-text-opacity, 1))}.text-purple-100{--tw-text-opacity: 1;color:rgb(243 232 255 / var(--tw-text-opacity, 1))}.text-purple-200{--tw-text-opacity: 1;color:rgb(233 213 255 / var(--tw-text-opacity, 1))}.text-purple-300{--tw-text-opacity: 1;color:rgb(216 180 254 / var(--tw-text-opacity, 1))}.text-purple-400{--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-transparent{color:transparent}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-white\/40{color:#fff6}.text-white\/70{color:#ffffffb3}.underline{text-decoration-line:underline}.no-underline{text-decoration-line:none}.decoration-gray-600{text-decoration-color:#4b5563}.placeholder-gray-400::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(156 163 175 / var(--tw-placeholder-opacity, 1))}.placeholder-gray-400::placeholder{--tw-placeholder-opacity: 1;color:rgb(156 163 175 / var(--tw-placeholder-opacity, 1))}.placeholder-gray-500::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(107 114 128 / var(--tw-placeholder-opacity, 1))}.placeholder-gray-500::placeholder{--tw-placeholder-opacity: 1;color:rgb(107 114 128 / var(--tw-placeholder-opacity, 1))}.placeholder-gray-600::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(75 85 99 / var(--tw-placeholder-opacity, 1))}.placeholder-gray-600::placeholder{--tw-placeholder-opacity: 1;color:rgb(75 85 99 / var(--tw-placeholder-opacity, 1))}.accent-\[\#bb86fc\]{accent-color:#bb86fc}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\[0_0_15px_-3px_rgba\(168\,85\,247\,0\.3\)\]{--tw-shadow: 0 0 15px -3px rgba(168,85,247,.3);--tw-shadow-colored: 0 0 15px -3px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-inner{--tw-shadow: inset 0 2px 4px 0 rgb(0 0 0 / .05);--tw-shadow-colored: inset 0 2px 4px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\[\#bb86fc\]\/10{--tw-shadow-color: rgb(187 134 252 / .1);--tw-shadow: var(--tw-shadow-colored)}.shadow-\[\#bb86fc\]\/20{--tw-shadow-color: rgb(187 134 252 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-\[\#bb86fc\]\/30{--tw-shadow-color: rgb(187 134 252 / .3);--tw-shadow: var(--tw-shadow-colored)}.shadow-\[\#bb86fc\]\/40{--tw-shadow-color: rgb(187 134 252 / .4);--tw-shadow: var(--tw-shadow-colored)}.shadow-black\/50{--tw-shadow-color: rgb(0 0 0 / .5);--tw-shadow: var(--tw-shadow-colored)}.shadow-green-500\/40{--tw-shadow-color: rgb(34 197 94 / .4);--tw-shadow: var(--tw-shadow-colored)}.shadow-purple-500\/20{--tw-shadow-color: rgb(168 85 247 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-purple-600\/30{--tw-shadow-color: rgb(147 51 234 / .3);--tw-shadow: var(--tw-shadow-colored)}.shadow-purple-900\/20{--tw-shadow-color: rgb(88 28 135 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-red-500\/20{--tw-shadow-color: rgb(239 68 68 / .2);--tw-shadow: var(--tw-shadow-colored)}.ring-4{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-\[\#bb86fc\]{--tw-ring-opacity: 1;--tw-ring-color: rgb(187 134 252 / var(--tw-ring-opacity, 1))}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-md{--tw-backdrop-blur: blur(12px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-1000{transition-duration:1s}.duration-150{transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}.duration-700{transition-duration:.7s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.ease-linear{transition-timing-function:linear}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}@keyframes fadeIn{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}@keyframes fadeOut{0%{opacity:1}to{opacity:0}}@keyframes fadeInUp{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}@keyframes quickFadeIn{0%{opacity:0;transform:scale(.98)}to{opacity:1;transform:scale(1)}}.animate-quick-fade-in{animation:quickFadeIn .15s ease-out forwards}@keyframes smoothFadeIn{0%{opacity:0;transform:scale(.98)}50%{opacity:.5}to{opacity:1;transform:scale(1)}}.animate-smooth-fade-in{animation:smoothFadeIn 1.2s ease-out forwards}.masonry-container{-moz-column-count:2;column-count:2;-moz-column-gap:4px;column-gap:4px}@media (min-width: 640px){.masonry-container{-moz-column-count:3;column-count:3}}@media (min-width: 768px){.masonry-container{-moz-column-count:4;column-count:4}}@media (min-width: 1024px){.masonry-container{-moz-column-count:5;column-count:5}}@media (min-width: 1280px){.masonry-container{-moz-column-count:6;column-count:6}}@keyframes shimmer{0%{background-position:-1000px 0}to{background-position:1000px 0}}.animate-shimmer{animation:shimmer 2.5s infinite}.masonry-item{-moz-column-break-inside:avoid;break-inside:avoid;margin-bottom:4px;display:inline-block;width:100%}@keyframes slideInUp{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}@keyframes slideInDown{0%{opacity:0;transform:translateY(-20px)}to{opacity:1;transform:translateY(0)}}@keyframes slideInLeft{0%{opacity:0;transform:translate(-20px)}to{opacity:1;transform:translate(0)}}@keyframes slideInRight{0%{opacity:0;transform:translate(20px)}to{opacity:1;transform:translate(0)}}@keyframes glow{0%,to{box-shadow:0 0 5px #8b5cf61a}50%{box-shadow:0 0 20px #8b5cf64d}}@keyframes pulse-color{0%,to{color:currentColor}50%{color:#8b5cf699}}.animate-slide-in-up{animation:slideInUp .5s ease-out forwards}.animate-slide-in-down{animation:slideInDown .5s ease-out forwards}.animate-slide-in-left{animation:slideInLeft .5s ease-out forwards}.animate-slide-in-right{animation:slideInRight .5s ease-out forwards}.animate-glow{animation:glow 2s ease-in-out infinite}.animate-pulse-color{animation:pulse-color 2s ease-in-out infinite}.after\:absolute:after{content:var(--tw-content);position:absolute}.after\:left-\[2px\]:after{content:var(--tw-content);left:2px}.after\:top-\[2px\]:after{content:var(--tw-content);top:2px}.after\:h-5:after{content:var(--tw-content);height:1.25rem}.after\:w-5:after{content:var(--tw-content);width:1.25rem}.after\:rounded-full:after{content:var(--tw-content);border-radius:9999px}.after\:border:after{content:var(--tw-content);border-width:1px}.after\:border-gray-300:after{content:var(--tw-content);--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.after\:bg-white:after{content:var(--tw-content);--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.after\:transition-all:after{content:var(--tw-content);transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.after\:content-\[\'\'\]:after{--tw-content: "";content:var(--tw-content)}.hover\:rotate-180:hover{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:rotate-90:hover{--tw-rotate: 90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:scale-105:hover{--tw-scale-x: 1.05;--tw-scale-y: 1.05;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:scale-110:hover{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:scale-125:hover{--tw-scale-x: 1.25;--tw-scale-y: 1.25;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:scale-\[1\.02\]:hover{--tw-scale-x: 1.02;--tw-scale-y: 1.02;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:border-\[\#24A1DE\]:hover{--tw-border-opacity: 1;border-color:rgb(36 161 222 / var(--tw-border-opacity, 1))}.hover\:border-\[\#FF424D\]:hover{--tw-border-opacity: 1;border-color:rgb(255 66 77 / var(--tw-border-opacity, 1))}.hover\:border-\[\#bb86fc\]:hover{--tw-border-opacity: 1;border-color:rgb(187 134 252 / var(--tw-border-opacity, 1))}.hover\:border-\[\#bb86fc\]\/50:hover{border-color:#bb86fc80}.hover\:border-gray-400:hover{--tw-border-opacity: 1;border-color:rgb(156 163 175 / var(--tw-border-opacity, 1))}.hover\:border-gray-500:hover{--tw-border-opacity: 1;border-color:rgb(107 114 128 / var(--tw-border-opacity, 1))}.hover\:border-gray-600:hover{--tw-border-opacity: 1;border-color:rgb(75 85 99 / var(--tw-border-opacity, 1))}.hover\:border-gray-600\/70:hover{border-color:#4b5563b3}.hover\:border-gray-700:hover{--tw-border-opacity: 1;border-color:rgb(55 65 81 / var(--tw-border-opacity, 1))}.hover\:border-gray-700\/60:hover{border-color:#37415199}.hover\:border-purple-500:hover{--tw-border-opacity: 1;border-color:rgb(168 85 247 / var(--tw-border-opacity, 1))}.hover\:border-purple-500\/50:hover{border-color:#a855f780}.hover\:border-red-500\/40:hover{border-color:#ef444466}.hover\:border-white:hover{--tw-border-opacity: 1;border-color:rgb(255 255 255 / var(--tw-border-opacity, 1))}.hover\:bg-\[\#1f1f1f\]:hover{--tw-bg-opacity: 1;background-color:rgb(31 31 31 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#242424\]:hover{--tw-bg-opacity: 1;background-color:rgb(36 36 36 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#2a2a2a\]:hover{--tw-bg-opacity: 1;background-color:rgb(42 42 42 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#333\]:hover{--tw-bg-opacity: 1;background-color:rgb(51 51 51 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#9966dd\]:hover{--tw-bg-opacity: 1;background-color:rgb(153 102 221 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#bb86fc\]:hover{--tw-bg-opacity: 1;background-color:rgb(187 134 252 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#bb86fc\]\/10:hover{background-color:#bb86fc1a}.hover\:bg-\[\#bb86fc\]\/20:hover{background-color:#bb86fc33}.hover\:bg-\[\#bb86fc\]\/30:hover{background-color:#bb86fc4d}.hover\:bg-\[\#bb86fc\]\/5:hover{background-color:#bb86fc0d}.hover\:bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-700:hover{--tw-bg-opacity: 1;background-color:rgb(55 65 81 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-800:hover{--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.hover\:bg-purple-500\/30:hover{background-color:#a855f74d}.hover\:bg-purple-600:hover{--tw-bg-opacity: 1;background-color:rgb(147 51 234 / var(--tw-bg-opacity, 1))}.hover\:bg-purple-700:hover{--tw-bg-opacity: 1;background-color:rgb(126 34 206 / var(--tw-bg-opacity, 1))}.hover\:bg-red-500\/20:hover{background-color:#ef444433}.hover\:bg-red-600:hover{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.hover\:bg-red-700:hover{--tw-bg-opacity: 1;background-color:rgb(185 28 28 / var(--tw-bg-opacity, 1))}.hover\:bg-white\/10:hover{background-color:#ffffff1a}.hover\:bg-white\/20:hover{background-color:#fff3}.hover\:bg-white\/5:hover{background-color:#ffffff0d}.hover\:from-\[\#9966dd\]:hover{--tw-gradient-from: #9966dd var(--tw-gradient-from-position);--tw-gradient-to: rgb(153 102 221 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.hover\:from-gray-700\/60:hover{--tw-gradient-from: rgb(55 65 81 / .6) var(--tw-gradient-from-position);--tw-gradient-to: rgb(55 65 81 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.hover\:to-\[\#7744cc\]:hover{--tw-gradient-to: #7744cc var(--tw-gradient-to-position)}.hover\:to-gray-600\/60:hover{--tw-gradient-to: rgb(75 85 99 / .6) var(--tw-gradient-to-position)}.hover\:text-\[\#24A1DE\]:hover{--tw-text-opacity: 1;color:rgb(36 161 222 / var(--tw-text-opacity, 1))}.hover\:text-\[\#FF424D\]:hover{--tw-text-opacity: 1;color:rgb(255 66 77 / var(--tw-text-opacity, 1))}.hover\:text-\[\#bb86fc\]:hover{--tw-text-opacity: 1;color:rgb(187 134 252 / var(--tw-text-opacity, 1))}.hover\:text-purple-400:hover{--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.hover\:text-red-400:hover{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.hover\:text-white:hover{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:decoration-white:hover{text-decoration-color:#fff}.hover\:opacity-100:hover{opacity:1}.hover\:opacity-80:hover{opacity:.8}.hover\:shadow-lg:hover{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-\[\#bb86fc\]\/60:hover{--tw-shadow-color: rgb(187 134 252 / .6);--tw-shadow: var(--tw-shadow-colored)}.hover\:shadow-purple-500\/10:hover{--tw-shadow-color: rgb(168 85 247 / .1);--tw-shadow: var(--tw-shadow-colored)}.hover\:shadow-purple-500\/20:hover{--tw-shadow-color: rgb(168 85 247 / .2);--tw-shadow: var(--tw-shadow-colored)}.hover\:shadow-purple-600\/50:hover{--tw-shadow-color: rgb(147 51 234 / .5);--tw-shadow: var(--tw-shadow-colored)}.focus\:border-\[\#bb86fc\]:focus{--tw-border-opacity: 1;border-color:rgb(187 134 252 / var(--tw-border-opacity, 1))}.focus\:border-purple-500:focus{--tw-border-opacity: 1;border-color:rgb(168 85 247 / var(--tw-border-opacity, 1))}.focus\:border-purple-500\/50:focus{border-color:#a855f780}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-\[\#bb86fc\]:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(187 134 252 / var(--tw-ring-opacity, 1))}.focus\:ring-\[\#bb86fc\]\/30:focus{--tw-ring-color: rgb(187 134 252 / .3)}.focus\:ring-purple-500\/50:focus{--tw-ring-color: rgb(168 85 247 / .5)}.active\:scale-95:active{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.disabled\:opacity-70:disabled{opacity:.7}.disabled\:hover\:border-gray-700:hover:disabled{--tw-border-opacity: 1;border-color:rgb(55 65 81 / var(--tw-border-opacity, 1))}.disabled\:hover\:bg-\[\#1a1a1a\]:hover:disabled{--tw-bg-opacity: 1;background-color:rgb(26 26 26 / var(--tw-bg-opacity, 1))}.disabled\:hover\:text-gray-500:hover:disabled{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:-translate-x-1{--tw-translate-x: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:rotate-12{--tw-rotate: 12deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:scale-110{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:scale-\[1\.08\]{--tw-scale-x: 1.08;--tw-scale-y: 1.08;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:scale-\[1\.10\]{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:bg-purple-500\/40{background-color:#a855f766}.group:hover .group-hover\:text-\[\#bb86fc\]{--tw-text-opacity: 1;color:rgb(187 134 252 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-purple-400{--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-white\/60{color:#fff9}.group:hover .group-hover\:opacity-100{opacity:1}.group:hover .group-hover\:shadow-\[\#bb86fc\]\/30{--tw-shadow-color: rgb(187 134 252 / .3);--tw-shadow: var(--tw-shadow-colored)}.group:hover .group-hover\:shadow-\[\#bb86fc\]\/60{--tw-shadow-color: rgb(187 134 252 / .6);--tw-shadow: var(--tw-shadow-colored)}.peer:checked~.peer-checked\:bg-\[\#bb86fc\]{--tw-bg-opacity: 1;background-color:rgb(187 134 252 / var(--tw-bg-opacity, 1))}.peer:checked~.peer-checked\:after\:translate-x-full:after{content:var(--tw-content);--tw-translate-x: 100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.peer:checked~.peer-checked\:after\:border-white:after{content:var(--tw-content);--tw-border-opacity: 1;border-color:rgb(255 255 255 / var(--tw-border-opacity, 1))}.peer:focus~.peer-focus\:outline-none{outline:2px solid transparent;outline-offset:2px}.peer:focus~.peer-focus\:ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.peer:focus~.peer-focus\:ring-purple-300{--tw-ring-opacity: 1;--tw-ring-color: rgb(216 180 254 / var(--tw-ring-opacity, 1))}@media (min-width: 640px){.sm\:left-8{left:2rem}.sm\:right-8{right:2rem}.sm\:mx-0{margin-left:0;margin-right:0}.sm\:mb-4{margin-bottom:1rem}.sm\:mb-6{margin-bottom:1.5rem}.sm\:mt-12{margin-top:3rem}.sm\:mt-2{margin-top:.5rem}.sm\:mt-8{margin-top:2rem}.sm\:inline-block{display:inline-block}.sm\:inline{display:inline}.sm\:flex{display:flex}.sm\:hidden{display:none}.sm\:h-10{height:2.5rem}.sm\:h-14{height:3.5rem}.sm\:h-4{height:1rem}.sm\:h-5{height:1.25rem}.sm\:w-10{width:2.5rem}.sm\:w-14{width:3.5rem}.sm\:w-4{width:1rem}.sm\:w-5{width:1.25rem}.sm\:w-64{width:16rem}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:gap-0{gap:0px}.sm\:gap-1\.5{gap:.375rem}.sm\:gap-2{gap:.5rem}.sm\:gap-3{gap:.75rem}.sm\:gap-4{gap:1rem}.sm\:gap-6{gap:1.5rem}.sm\:p-12{padding:3rem}.sm\:p-2{padding:.5rem}.sm\:p-4{padding:1rem}.sm\:p-6{padding:1.5rem}.sm\:px-10{padding-left:2.5rem;padding-right:2.5rem}.sm\:px-3{padding-left:.75rem;padding-right:.75rem}.sm\:px-4{padding-left:1rem;padding-right:1rem}.sm\:px-6{padding-left:1.5rem;padding-right:1.5rem}.sm\:py-2{padding-top:.5rem;padding-bottom:.5rem}.sm\:py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.sm\:py-4{padding-top:1rem;padding-bottom:1rem}.sm\:py-6{padding-top:1.5rem;padding-bottom:1.5rem}.sm\:py-8{padding-top:2rem;padding-bottom:2rem}.sm\:pt-12{padding-top:3rem}.sm\:pt-8{padding-top:2rem}.sm\:text-2xl{font-size:1.5rem;line-height:2rem}.sm\:text-4xl{font-size:2.25rem;line-height:2.5rem}.sm\:text-lg{font-size:1.125rem;line-height:1.75rem}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}}@media (min-width: 768px){.md\:absolute{position:absolute}.md\:right-8{right:2rem}.md\:flex{display:flex}.md\:hidden{display:none}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:gap-3{gap:.75rem}.md\:p-12{padding:3rem}.md\:px-12{padding-left:3rem;padding-right:3rem}}@media (min-width: 1024px){.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.lg\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}}@media (min-width: 1280px){.xl\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.xl\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}}@media (min-width: 1536px){.\32xl\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}}@media (prefers-color-scheme: dark){.dark\:border-gray-600{--tw-border-opacity: 1;border-color:rgb(75 85 99 / var(--tw-border-opacity, 1))}.dark\:bg-gray-700{--tw-bg-opacity: 1;background-color:rgb(55 65 81 / var(--tw-bg-opacity, 1))}.peer:focus~.dark\:peer-focus\:ring-purple-800{--tw-ring-opacity: 1;--tw-ring-color: rgb(107 33 168 / var(--tw-ring-opacity, 1))}} diff --git a/dist/assets/index-Dr1m_Ajn.js b/dist/assets/index-Dr1m_Ajn.js new file mode 100644 index 0000000000000000000000000000000000000000..bf09653271715fc1d92f3ed9eef62310569227bc --- /dev/null +++ b/dist/assets/index-Dr1m_Ajn.js @@ -0,0 +1,3696 @@ +(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var Wu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Kd(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var jb={exports:{}},Qd={},Pb={exports:{}},Qe={};/** + * @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 oc=Symbol.for("react.element"),nN=Symbol.for("react.portal"),rN=Symbol.for("react.fragment"),sN=Symbol.for("react.strict_mode"),iN=Symbol.for("react.profiler"),oN=Symbol.for("react.provider"),aN=Symbol.for("react.context"),lN=Symbol.for("react.forward_ref"),cN=Symbol.for("react.suspense"),uN=Symbol.for("react.memo"),dN=Symbol.for("react.lazy"),Iy=Symbol.iterator;function hN(t){return t===null||typeof t!="object"?null:(t=Iy&&t[Iy]||t["@@iterator"],typeof t=="function"?t:null)}var Rb={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Db=Object.assign,Mb={};function wa(t,e,n){this.props=t,this.context=e,this.refs=Mb,this.updater=n||Rb}wa.prototype.isReactComponent={};wa.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=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,t,e,"setState")};wa.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function Lb(){}Lb.prototype=wa.prototype;function zm(t,e,n){this.props=t,this.context=e,this.refs=Mb,this.updater=n||Rb}var Um=zm.prototype=new Lb;Um.constructor=zm;Db(Um,wa.prototype);Um.isPureReactComponent=!0;var Cy=Array.isArray,Ob=Object.prototype.hasOwnProperty,Bm={current:null},Vb={key:!0,ref:!0,__self:!0,__source:!0};function Fb(t,e,n){var r,s={},i=null,o=null;if(e!=null)for(r in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(i=""+e.key),e)Ob.call(e,r)&&!Vb.hasOwnProperty(r)&&(s[r]=e[r]);var l=arguments.length-2;if(l===1)s.children=n;else if(1>>1,pe=F[ne];if(0>>1;nes(oe,R))ces(Ie,oe)?(F[ne]=Ie,F[ce]=R,ne=ce):(F[ne]=oe,F[Q]=R,ne=Q);else if(ces(Ie,R))F[ne]=Ie,F[ce]=R,ne=ce;else break e}}return K}function s(F,K){var R=F.sortIndex-K.sortIndex;return R!==0?R:F.id-K.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;t.unstable_now=function(){return i.now()}}else{var o=Date,l=o.now();t.unstable_now=function(){return o.now()-l}}var c=[],u=[],h=1,f=null,m=3,p=!1,y=!1,_=!1,C=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function E(F){for(var K=n(u);K!==null;){if(K.callback===null)r(u);else if(K.startTime<=F)r(u),K.sortIndex=K.expirationTime,e(c,K);else break;K=n(u)}}function D(F){if(_=!1,E(F),!y)if(n(c)!==null)y=!0,W(M);else{var K=n(u);K!==null&&ee(D,K.startTime-F)}}function M(F,K){y=!1,_&&(_=!1,v(x),x=-1),p=!0;var R=m;try{for(E(K),f=n(c);f!==null&&(!(f.expirationTime>K)||F&&!I());){var ne=f.callback;if(typeof ne=="function"){f.callback=null,m=f.priorityLevel;var pe=ne(f.expirationTime<=K);K=t.unstable_now(),typeof pe=="function"?f.callback=pe:f===n(c)&&r(c),E(K)}else r(c);f=n(c)}if(f!==null)var O=!0;else{var Q=n(u);Q!==null&&ee(D,Q.startTime-K),O=!1}return O}finally{f=null,m=R,p=!1}}var T=!1,S=null,x=-1,N=5,A=-1;function I(){return!(t.unstable_now()-AF||125ne?(F.sortIndex=R,e(u,F),n(c)===null&&F===n(u)&&(_?(v(x),x=-1):_=!0,ee(D,R-ne))):(F.sortIndex=pe,e(c,F),y||p||(y=!0,W(M))),F},t.unstable_shouldYield=I,t.unstable_wrapCallback=function(F){var K=m;return function(){var R=m;m=K;try{return F.apply(this,arguments)}finally{m=R}}}})(Hb);$b.exports=Hb;var EN=$b.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 SN=L,pr=EN;function ae(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),tp=Object.prototype.hasOwnProperty,TN=/^[: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]*$/,jy={},Py={};function NN(t){return tp.call(Py,t)?!0:tp.call(jy,t)?!1:TN.test(t)?Py[t]=!0:(jy[t]=!0,!1)}function kN(t,e,n,r){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function IN(t,e,n,r){if(e===null||typeof e>"u"||kN(t,e,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function zn(t,e,n,r,s,i,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=i,this.removeEmptyString=o}var vn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){vn[t]=new zn(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];vn[e]=new zn(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){vn[t]=new zn(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){vn[t]=new zn(t,2,!1,t,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(t){vn[t]=new zn(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){vn[t]=new zn(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){vn[t]=new zn(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){vn[t]=new zn(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){vn[t]=new zn(t,5,!1,t.toLowerCase(),null,!1,!1)});var Hm=/[\-:]([a-z])/g;function qm(t){return t[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(t){var e=t.replace(Hm,qm);vn[e]=new zn(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(Hm,qm);vn[e]=new zn(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(Hm,qm);vn[e]=new zn(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){vn[t]=new zn(t,1,!1,t.toLowerCase(),null,!1,!1)});vn.xlinkHref=new zn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){vn[t]=new zn(t,1,!1,t.toLowerCase(),null,!0,!0)});function Gm(t,e,n,r){var s=vn.hasOwnProperty(e)?vn[e]:null;(s!==null?s.type!==0:r||!(2l||s[o]!==i[l]){var c=` +`+s[o].replace(" at new "," at ");return t.displayName&&c.includes("")&&(c=c.replace("",t.displayName)),c}while(1<=o&&0<=l);break}}}finally{Qh=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?rl(t):""}function CN(t){switch(t.tag){case 5:return rl(t.type);case 16:return rl("Lazy");case 13:return rl("Suspense");case 19:return rl("SuspenseList");case 0:case 2:case 15:return t=Yh(t.type,!1),t;case 11:return t=Yh(t.type.render,!1),t;case 1:return t=Yh(t.type,!0),t;default:return""}}function ip(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case jo:return"Fragment";case Ao:return"Portal";case np:return"Profiler";case Wm:return"StrictMode";case rp:return"Suspense";case sp:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case Wb:return(t.displayName||"Context")+".Consumer";case Gb:return(t._context.displayName||"Context")+".Provider";case Km:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Qm:return e=t.displayName||null,e!==null?e:ip(t.type)||"Memo";case Gs:e=t._payload,t=t._init;try{return ip(t(e))}catch{}}return null}function AN(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ip(e);case 8:return e===Wm?"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 e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function yi(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Qb(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function jN(t){var e=Qb(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,i=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return s.call(this)},set:function(o){r=""+o,i.call(this,o)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function Wc(t){t._valueTracker||(t._valueTracker=jN(t))}function Yb(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=Qb(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function Ku(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function op(t,e){var n=e.checked;return Lt({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function Dy(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=yi(e.value!=null?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function Xb(t,e){e=e.checked,e!=null&&Gm(t,"checked",e,!1)}function ap(t,e){Xb(t,e);var n=yi(e.value),r=e.type;if(n!=null)r==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?lp(t,e.type,n):e.hasOwnProperty("defaultValue")&&lp(t,e.type,yi(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function My(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function lp(t,e,n){(e!=="number"||Ku(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var sl=Array.isArray;function Ho(t,e,n,r){if(t=t.options,e){e={};for(var s=0;s"+e.valueOf().toString()+"",e=Kc.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Al(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var dl={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},PN=["Webkit","ms","Moz","O"];Object.keys(dl).forEach(function(t){PN.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),dl[e]=dl[t]})});function t1(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||dl.hasOwnProperty(t)&&dl[t]?(""+e).trim():e+"px"}function n1(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=t1(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,s):t[n]=s}}var RN=Lt({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 dp(t,e){if(e){if(RN[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(ae(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(ae(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(ae(61))}if(e.style!=null&&typeof e.style!="object")throw Error(ae(62))}}function hp(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){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 fp=null;function Ym(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var pp=null,qo=null,Go=null;function Vy(t){if(t=cc(t)){if(typeof pp!="function")throw Error(ae(280));var e=t.stateNode;e&&(e=eh(e),pp(t.stateNode,t.type,e))}}function r1(t){qo?Go?Go.push(t):Go=[t]:qo=t}function s1(){if(qo){var t=qo,e=Go;if(Go=qo=null,Vy(t),e)for(t=0;t>>=0,t===0?32:31-(HN(t)/qN|0)|0}var Qc=64,Yc=4194304;function il(t){switch(t&-t){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 t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Ju(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,s=t.suspendedLanes,i=t.pingedLanes,o=n&268435455;if(o!==0){var l=o&~s;l!==0?r=il(l):(i&=o,i!==0&&(r=il(i)))}else o=n&~s,o!==0?r=il(o):i!==0&&(r=il(i));if(r===0)return 0;if(e!==0&&e!==r&&!(e&s)&&(s=r&-r,i=e&-e,s>=i||s===16&&(i&4194240)!==0))return e;if(r&4&&(r|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0n;n++)e.push(t);return e}function ac(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Lr(e),t[e]=n}function QN(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var r=t.eventTimes;for(t=t.expirationTimes;0=fl),Wy=" ",Ky=!1;function S1(t,e){switch(t){case"keyup":return Ek.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function T1(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Po=!1;function Tk(t,e){switch(t){case"compositionend":return T1(e);case"keypress":return e.which!==32?null:(Ky=!0,Wy);case"textInput":return t=e.data,t===Wy&&Ky?null:t;default:return null}}function Nk(t,e){if(Po)return t==="compositionend"||!sg&&S1(t,e)?(t=_1(),Tu=tg=ei=null,Po=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Jy(n)}}function C1(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?C1(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function A1(){for(var t=window,e=Ku();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=Ku(t.document)}return e}function ig(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function Mk(t){var e=A1(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&C1(n.ownerDocument.documentElement,n)){if(r!==null&&ig(n)){if(e=r.start,t=r.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var s=n.textContent.length,i=Math.min(r.start,s);r=r.end===void 0?i:Math.min(r.end,s),!t.extend&&i>r&&(s=r,r=i,i=s),s=Zy(n,i);var o=Zy(n,r);s&&o&&(t.rangeCount!==1||t.anchorNode!==s.node||t.anchorOffset!==s.offset||t.focusNode!==o.node||t.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(s.node,s.offset),t.removeAllRanges(),i>r?(t.addRange(e),t.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Ro=null,wp=null,ml=null,bp=!1;function ex(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;bp||Ro==null||Ro!==Ku(r)||(r=Ro,"selectionStart"in r&&ig(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),ml&&Ll(ml,r)||(ml=r,r=td(wp,"onSelect"),0Lo||(t.current=kp[Lo],kp[Lo]=null,Lo--)}function St(t,e){Lo++,kp[Lo]=t.current,t.current=e}var xi={},Cn=Ii(xi),Xn=Ii(!1),Xi=xi;function aa(t,e){var n=t.type.contextTypes;if(!n)return xi;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var s={},i;for(i in n)s[i]=e[i];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=s),s}function Jn(t){return t=t.childContextTypes,t!=null}function rd(){Ct(Xn),Ct(Cn)}function ax(t,e,n){if(Cn.current!==xi)throw Error(ae(168));St(Cn,e),St(Xn,n)}function F1(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in e))throw Error(ae(108,AN(t)||"Unknown",s));return Lt({},n,r)}function sd(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||xi,Xi=Cn.current,St(Cn,t),St(Xn,Xn.current),!0}function lx(t,e,n){var r=t.stateNode;if(!r)throw Error(ae(169));n?(t=F1(t,e,Xi),r.__reactInternalMemoizedMergedChildContext=t,Ct(Xn),Ct(Cn),St(Cn,t)):Ct(Xn),St(Xn,n)}var ms=null,th=!1,df=!1;function z1(t){ms===null?ms=[t]:ms.push(t)}function Wk(t){th=!0,z1(t)}function Ci(){if(!df&&ms!==null){df=!0;var t=0,e=ht;try{var n=ms;for(ht=1;t>=o,s-=o,ys=1<<32-Lr(e)+s|n<x?(N=S,S=null):N=S.sibling;var A=m(v,S,E[x],D);if(A===null){S===null&&(S=N);break}t&&S&&A.alternate===null&&e(v,S),w=i(A,w,x),T===null?M=A:T.sibling=A,T=A,S=N}if(x===E.length)return n(v,S),At&&Vi(v,x),M;if(S===null){for(;xx?(N=S,S=null):N=S.sibling;var I=m(v,S,A.value,D);if(I===null){S===null&&(S=N);break}t&&S&&I.alternate===null&&e(v,S),w=i(I,w,x),T===null?M=I:T.sibling=I,T=I,S=N}if(A.done)return n(v,S),At&&Vi(v,x),M;if(S===null){for(;!A.done;x++,A=E.next())A=f(v,A.value,D),A!==null&&(w=i(A,w,x),T===null?M=A:T.sibling=A,T=A);return At&&Vi(v,x),M}for(S=r(v,S);!A.done;x++,A=E.next())A=p(S,v,x,A.value,D),A!==null&&(t&&A.alternate!==null&&S.delete(A.key===null?x:A.key),w=i(A,w,x),T===null?M=A:T.sibling=A,T=A);return t&&S.forEach(function(P){return e(v,P)}),At&&Vi(v,x),M}function C(v,w,E,D){if(typeof E=="object"&&E!==null&&E.type===jo&&E.key===null&&(E=E.props.children),typeof E=="object"&&E!==null){switch(E.$$typeof){case Gc:e:{for(var M=E.key,T=w;T!==null;){if(T.key===M){if(M=E.type,M===jo){if(T.tag===7){n(v,T.sibling),w=s(T,E.props.children),w.return=v,v=w;break e}}else if(T.elementType===M||typeof M=="object"&&M!==null&&M.$$typeof===Gs&&dx(M)===T.type){n(v,T.sibling),w=s(T,E.props),w.ref=Qa(v,T,E),w.return=v,v=w;break e}n(v,T);break}else e(v,T);T=T.sibling}E.type===jo?(w=Wi(E.props.children,v.mode,D,E.key),w.return=v,v=w):(D=Ru(E.type,E.key,E.props,null,v.mode,D),D.ref=Qa(v,w,E),D.return=v,v=D)}return o(v);case Ao:e:{for(T=E.key;w!==null;){if(w.key===T)if(w.tag===4&&w.stateNode.containerInfo===E.containerInfo&&w.stateNode.implementation===E.implementation){n(v,w.sibling),w=s(w,E.children||[]),w.return=v,v=w;break e}else{n(v,w);break}else e(v,w);w=w.sibling}w=vf(E,v.mode,D),w.return=v,v=w}return o(v);case Gs:return T=E._init,C(v,w,T(E._payload),D)}if(sl(E))return y(v,w,E,D);if(Ha(E))return _(v,w,E,D);ru(v,E)}return typeof E=="string"&&E!==""||typeof E=="number"?(E=""+E,w!==null&&w.tag===6?(n(v,w.sibling),w=s(w,E),w.return=v,v=w):(n(v,w),w=xf(E,v.mode,D),w.return=v,v=w),o(v)):n(v,w)}return C}var ca=H1(!0),q1=H1(!1),ad=Ii(null),ld=null,Fo=null,cg=null;function ug(){cg=Fo=ld=null}function dg(t){var e=ad.current;Ct(ad),t._currentValue=e}function Ap(t,e,n){for(;t!==null;){var r=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),t===n)break;t=t.return}}function Ko(t,e){ld=t,cg=Fo=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(Yn=!0),t.firstContext=null)}function Nr(t){var e=t._currentValue;if(cg!==t)if(t={context:t,memoizedValue:e,next:null},Fo===null){if(ld===null)throw Error(ae(308));Fo=t,ld.dependencies={lanes:0,firstContext:t}}else Fo=Fo.next=t;return e}var $i=null;function hg(t){$i===null?$i=[t]:$i.push(t)}function G1(t,e,n,r){var s=e.interleaved;return s===null?(n.next=n,hg(e)):(n.next=s.next,s.next=n),e.interleaved=n,Ns(t,r)}function Ns(t,e){t.lanes|=e;var n=t.alternate;for(n!==null&&(n.lanes|=e),n=t,t=t.return;t!==null;)t.childLanes|=e,n=t.alternate,n!==null&&(n.childLanes|=e),n=t,t=t.return;return n.tag===3?n.stateNode:null}var Ws=!1;function fg(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function W1(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function _s(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function ci(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,rt&2){var s=r.pending;return s===null?e.next=e:(e.next=s.next,s.next=e),r.pending=e,Ns(t,n)}return s=r.interleaved,s===null?(e.next=e,hg(r)):(e.next=s.next,s.next=e),r.interleaved=e,Ns(t,n)}function ku(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,Jm(t,n)}}function hx(t,e){var n=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?s=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?s=i=e:i=i.next=e}else s=i=e;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:r.shared,effects:r.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function cd(t,e,n,r){var s=t.updateQueue;Ws=!1;var i=s.firstBaseUpdate,o=s.lastBaseUpdate,l=s.shared.pending;if(l!==null){s.shared.pending=null;var c=l,u=c.next;c.next=null,o===null?i=u:o.next=u,o=c;var h=t.alternate;h!==null&&(h=h.updateQueue,l=h.lastBaseUpdate,l!==o&&(l===null?h.firstBaseUpdate=u:l.next=u,h.lastBaseUpdate=c))}if(i!==null){var f=s.baseState;o=0,h=u=c=null,l=i;do{var m=l.lane,p=l.eventTime;if((r&m)===m){h!==null&&(h=h.next={eventTime:p,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var y=t,_=l;switch(m=e,p=n,_.tag){case 1:if(y=_.payload,typeof y=="function"){f=y.call(p,f,m);break e}f=y;break e;case 3:y.flags=y.flags&-65537|128;case 0:if(y=_.payload,m=typeof y=="function"?y.call(p,f,m):y,m==null)break e;f=Lt({},f,m);break e;case 2:Ws=!0}}l.callback!==null&&l.lane!==0&&(t.flags|=64,m=s.effects,m===null?s.effects=[l]:m.push(l))}else p={eventTime:p,lane:m,tag:l.tag,payload:l.payload,callback:l.callback,next:null},h===null?(u=h=p,c=f):h=h.next=p,o|=m;if(l=l.next,l===null){if(l=s.shared.pending,l===null)break;m=l,l=m.next,m.next=null,s.lastBaseUpdate=m,s.shared.pending=null}}while(!0);if(h===null&&(c=f),s.baseState=c,s.firstBaseUpdate=u,s.lastBaseUpdate=h,e=s.shared.interleaved,e!==null){s=e;do o|=s.lane,s=s.next;while(s!==e)}else i===null&&(s.shared.lanes=0);eo|=o,t.lanes=o,t.memoizedState=f}}function fx(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;en?n:4,t(!0);var r=ff.transition;ff.transition={};try{t(!1),e()}finally{ht=n,ff.transition=r}}function u_(){return kr().memoizedState}function Xk(t,e,n){var r=di(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},d_(t))h_(e,n);else if(n=G1(t,e,n,r),n!==null){var s=Mn();Or(n,t,r,s),f_(n,e,r)}}function Jk(t,e,n){var r=di(t),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(d_(t))h_(e,s);else{var i=t.alternate;if(t.lanes===0&&(i===null||i.lanes===0)&&(i=e.lastRenderedReducer,i!==null))try{var o=e.lastRenderedState,l=i(o,n);if(s.hasEagerState=!0,s.eagerState=l,Fr(l,o)){var c=e.interleaved;c===null?(s.next=s,hg(e)):(s.next=c.next,c.next=s),e.interleaved=s;return}}catch{}finally{}n=G1(t,e,s,r),n!==null&&(s=Mn(),Or(n,t,r,s),f_(n,e,r))}}function d_(t){var e=t.alternate;return t===Dt||e!==null&&e===Dt}function h_(t,e){gl=dd=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function f_(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,Jm(t,n)}}var hd={readContext:Nr,useCallback:En,useContext:En,useEffect:En,useImperativeHandle:En,useInsertionEffect:En,useLayoutEffect:En,useMemo:En,useReducer:En,useRef:En,useState:En,useDebugValue:En,useDeferredValue:En,useTransition:En,useMutableSource:En,useSyncExternalStore:En,useId:En,unstable_isNewReconciler:!1},Zk={readContext:Nr,useCallback:function(t,e){return qr().memoizedState=[t,e===void 0?null:e],t},useContext:Nr,useEffect:mx,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,Cu(4194308,4,i_.bind(null,e,t),n)},useLayoutEffect:function(t,e){return Cu(4194308,4,t,e)},useInsertionEffect:function(t,e){return Cu(4,2,t,e)},useMemo:function(t,e){var n=qr();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=qr();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=Xk.bind(null,Dt,t),[r.memoizedState,t]},useRef:function(t){var e=qr();return t={current:t},e.memoizedState=t},useState:px,useDebugValue:bg,useDeferredValue:function(t){return qr().memoizedState=t},useTransition:function(){var t=px(!1),e=t[0];return t=Yk.bind(null,t[1]),qr().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=Dt,s=qr();if(At){if(n===void 0)throw Error(ae(407));n=n()}else{if(n=e(),dn===null)throw Error(ae(349));Zi&30||X1(r,e,n)}s.memoizedState=n;var i={value:n,getSnapshot:e};return s.queue=i,mx(Z1.bind(null,r,i,t),[t]),r.flags|=2048,Hl(9,J1.bind(null,r,i,n,e),void 0,null),n},useId:function(){var t=qr(),e=dn.identifierPrefix;if(At){var n=xs,r=ys;n=(r&~(1<<32-Lr(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=Bl++,0<\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=o.createElement(n,{is:r.is}):(t=o.createElement(n),n==="select"&&(o=t,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):t=o.createElementNS(t,n),t[Qr]=e,t[Fl]=r,E_(t,e,!1,!1),e.stateNode=t;e:{switch(o=hp(n,r),n){case"dialog":It("cancel",t),It("close",t),s=r;break;case"iframe":case"object":case"embed":It("load",t),s=r;break;case"video":case"audio":for(s=0;sha&&(e.flags|=128,r=!0,Ya(i,!1),e.lanes=4194304)}else{if(!r)if(t=ud(o),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),Ya(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!At)return Sn(e),null}else 2*qt()-i.renderingStartTime>ha&&n!==1073741824&&(e.flags|=128,r=!0,Ya(i,!1),e.lanes=4194304);i.isBackwards?(o.sibling=e.child,e.child=o):(n=i.last,n!==null?n.sibling=o:e.child=o,i.last=o)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=qt(),e.sibling=null,n=Rt.current,St(Rt,r?n&1|2:n&1),e):(Sn(e),null);case 22:case 23:return kg(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?ar&1073741824&&(Sn(e),e.subtreeFlags&6&&(e.flags|=8192)):Sn(e),null;case 24:return null;case 25:return null}throw Error(ae(156,e.tag))}function aI(t,e){switch(ag(e),e.tag){case 1:return Jn(e.type)&&rd(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return ua(),Ct(Xn),Ct(Cn),gg(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return mg(e),null;case 13:if(Ct(Rt),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(ae(340));la()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return Ct(Rt),null;case 4:return ua(),null;case 10:return dg(e.type._context),null;case 22:case 23:return kg(),null;case 24:return null;default:return null}}var iu=!1,kn=!1,lI=typeof WeakSet=="function"?WeakSet:Set,ve=null;function zo(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){zt(t,e,r)}else n.current=null}function Fp(t,e,n){try{n()}catch(r){zt(t,e,r)}}var Nx=!1;function cI(t,e){if(_p=Zu,t=A1(),ig(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,l=-1,c=-1,u=0,h=0,f=t,m=null;t:for(;;){for(var p;f!==n||s!==0&&f.nodeType!==3||(l=o+s),f!==i||r!==0&&f.nodeType!==3||(c=o+r),f.nodeType===3&&(o+=f.nodeValue.length),(p=f.firstChild)!==null;)m=f,f=p;for(;;){if(f===t)break t;if(m===n&&++u===s&&(l=o),m===i&&++h===r&&(c=o),(p=f.nextSibling)!==null)break;f=m,m=f.parentNode}f=p}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(Ep={focusedElem:t,selectionRange:n},Zu=!1,ve=e;ve!==null;)if(e=ve,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,ve=t;else for(;ve!==null;){e=ve;try{var y=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(y!==null){var _=y.memoizedProps,C=y.memoizedState,v=e.stateNode,w=v.getSnapshotBeforeUpdate(e.elementType===e.type?_:Cr(e.type,_),C);v.__reactInternalSnapshotBeforeUpdate=w}break;case 3:var E=e.stateNode.containerInfo;E.nodeType===1?E.textContent="":E.nodeType===9&&E.documentElement&&E.removeChild(E.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(ae(163))}}catch(D){zt(e,e.return,D)}if(t=e.sibling,t!==null){t.return=e.return,ve=t;break}ve=e.return}return y=Nx,Nx=!1,y}function yl(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&t)===t){var i=s.destroy;s.destroy=void 0,i!==void 0&&Fp(e,n,i)}s=s.next}while(s!==r)}}function sh(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function zp(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function N_(t){var e=t.alternate;e!==null&&(t.alternate=null,N_(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[Qr],delete e[Fl],delete e[Np],delete e[qk],delete e[Gk])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function k_(t){return t.tag===5||t.tag===3||t.tag===4}function kx(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||k_(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Up(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=nd));else if(r!==4&&(t=t.child,t!==null))for(Up(t,e,n),t=t.sibling;t!==null;)Up(t,e,n),t=t.sibling}function Bp(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(Bp(t,e,n),t=t.sibling;t!==null;)Bp(t,e,n),t=t.sibling}var mn=null,Ar=!1;function $s(t,e,n){for(n=n.child;n!==null;)I_(t,e,n),n=n.sibling}function I_(t,e,n){if(Xr&&typeof Xr.onCommitFiberUnmount=="function")try{Xr.onCommitFiberUnmount(Yd,n)}catch{}switch(n.tag){case 5:kn||zo(n,e);case 6:var r=mn,s=Ar;mn=null,$s(t,e,n),mn=r,Ar=s,mn!==null&&(Ar?(t=mn,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):mn.removeChild(n.stateNode));break;case 18:mn!==null&&(Ar?(t=mn,n=n.stateNode,t.nodeType===8?uf(t.parentNode,n):t.nodeType===1&&uf(t,n),Dl(t)):uf(mn,n.stateNode));break;case 4:r=mn,s=Ar,mn=n.stateNode.containerInfo,Ar=!0,$s(t,e,n),mn=r,Ar=s;break;case 0:case 11:case 14:case 15:if(!kn&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var i=s,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&Fp(n,e,o),s=s.next}while(s!==r)}$s(t,e,n);break;case 1:if(!kn&&(zo(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){zt(n,e,l)}$s(t,e,n);break;case 21:$s(t,e,n);break;case 22:n.mode&1?(kn=(r=kn)||n.memoizedState!==null,$s(t,e,n),kn=r):$s(t,e,n);break;default:$s(t,e,n)}}function Ix(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new lI),e.forEach(function(r){var s=xI.bind(null,t,r);n.has(r)||(n.add(r),r.then(s,s))})}}function Ir(t,e){var n=e.deletions;if(n!==null)for(var r=0;rs&&(s=o),r&=~i}if(r=s,r=qt()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*dI(r/1960))-r,10t?16:t,ti===null)var r=!1;else{if(t=ti,ti=null,md=0,rt&6)throw Error(ae(331));var s=rt;for(rt|=4,ve=t.current;ve!==null;){var i=ve,o=i.child;if(ve.flags&16){var l=i.deletions;if(l!==null){for(var c=0;cqt()-Tg?Gi(t,0):Sg|=n),Zn(t,e)}function L_(t,e){e===0&&(t.mode&1?(e=Yc,Yc<<=1,!(Yc&130023424)&&(Yc=4194304)):e=1);var n=Mn();t=Ns(t,e),t!==null&&(ac(t,e,n),Zn(t,n))}function yI(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),L_(t,n)}function xI(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,s=t.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(ae(314))}r!==null&&r.delete(e),L_(t,n)}var O_;O_=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||Xn.current)Yn=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return Yn=!1,iI(t,e,n);Yn=!!(t.flags&131072)}else Yn=!1,At&&e.flags&1048576&&U1(e,od,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;Au(t,e),t=e.pendingProps;var s=aa(e,Cn.current);Ko(e,n),s=xg(null,e,r,t,s,n);var i=vg();return e.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Jn(r)?(i=!0,sd(e)):i=!1,e.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,fg(e),s.updater=rh,e.stateNode=s,s._reactInternals=e,Pp(e,r,t,n),e=Mp(null,e,r,!0,i,n)):(e.tag=0,At&&i&&og(e),Dn(null,e,s,n),e=e.child),e;case 16:r=e.elementType;e:{switch(Au(t,e),t=e.pendingProps,s=r._init,r=s(r._payload),e.type=r,s=e.tag=wI(r),t=Cr(r,t),s){case 0:e=Dp(null,e,r,t,n);break e;case 1:e=Ex(null,e,r,t,n);break e;case 11:e=bx(null,e,r,t,n);break e;case 14:e=_x(null,e,r,Cr(r.type,t),n);break e}throw Error(ae(306,r,""))}return e;case 0:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:Cr(r,s),Dp(t,e,r,s,n);case 1:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:Cr(r,s),Ex(t,e,r,s,n);case 3:e:{if(w_(e),t===null)throw Error(ae(387));r=e.pendingProps,i=e.memoizedState,s=i.element,W1(t,e),cd(e,r,null,n);var o=e.memoizedState;if(r=o.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=i,e.memoizedState=i,e.flags&256){s=da(Error(ae(423)),e),e=Sx(t,e,r,n,s);break e}else if(r!==s){s=da(Error(ae(424)),e),e=Sx(t,e,r,n,s);break e}else for(cr=li(e.stateNode.containerInfo.firstChild),hr=e,At=!0,jr=null,n=q1(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(la(),r===s){e=ks(t,e,n);break e}Dn(t,e,r,n)}e=e.child}return e;case 5:return K1(e),t===null&&Cp(e),r=e.type,s=e.pendingProps,i=t!==null?t.memoizedProps:null,o=s.children,Sp(r,s)?o=null:i!==null&&Sp(r,i)&&(e.flags|=32),v_(t,e),Dn(t,e,o,n),e.child;case 6:return t===null&&Cp(e),null;case 13:return b_(t,e,n);case 4:return pg(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=ca(e,null,r,n):Dn(t,e,r,n),e.child;case 11:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:Cr(r,s),bx(t,e,r,s,n);case 7:return Dn(t,e,e.pendingProps,n),e.child;case 8:return Dn(t,e,e.pendingProps.children,n),e.child;case 12:return Dn(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,s=e.pendingProps,i=e.memoizedProps,o=s.value,St(ad,r._currentValue),r._currentValue=o,i!==null)if(Fr(i.value,o)){if(i.children===s.children&&!Xn.current){e=ks(t,e,n);break e}}else for(i=e.child,i!==null&&(i.return=e);i!==null;){var l=i.dependencies;if(l!==null){o=i.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(i.tag===1){c=_s(-1,n&-n),c.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var h=u.pending;h===null?c.next=c:(c.next=h.next,h.next=c),u.pending=c}}i.lanes|=n,c=i.alternate,c!==null&&(c.lanes|=n),Ap(i.return,n,e),l.lanes|=n;break}c=c.next}}else if(i.tag===10)o=i.type===e.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(ae(341));o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Ap(o,n,e),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===e){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}Dn(t,e,s.children,n),e=e.child}return e;case 9:return s=e.type,r=e.pendingProps.children,Ko(e,n),s=Nr(s),r=r(s),e.flags|=1,Dn(t,e,r,n),e.child;case 14:return r=e.type,s=Cr(r,e.pendingProps),s=Cr(r.type,s),_x(t,e,r,s,n);case 15:return y_(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:Cr(r,s),Au(t,e),e.tag=1,Jn(r)?(t=!0,sd(e)):t=!1,Ko(e,n),p_(e,r,s),Pp(e,r,s,n),Mp(null,e,r,!0,t,n);case 19:return __(t,e,n);case 22:return x_(t,e,n)}throw Error(ae(156,e.tag))};function V_(t,e){return d1(t,e)}function vI(t,e,n,r){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Er(t,e,n,r){return new vI(t,e,n,r)}function Cg(t){return t=t.prototype,!(!t||!t.isReactComponent)}function wI(t){if(typeof t=="function")return Cg(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Km)return 11;if(t===Qm)return 14}return 2}function hi(t,e){var n=t.alternate;return n===null?(n=Er(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function Ru(t,e,n,r,s,i){var o=2;if(r=t,typeof t=="function")Cg(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case jo:return Wi(n.children,s,i,e);case Wm:o=8,s|=8;break;case np:return t=Er(12,n,e,s|2),t.elementType=np,t.lanes=i,t;case rp:return t=Er(13,n,e,s),t.elementType=rp,t.lanes=i,t;case sp:return t=Er(19,n,e,s),t.elementType=sp,t.lanes=i,t;case Kb:return oh(n,s,i,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case Gb:o=10;break e;case Wb:o=9;break e;case Km:o=11;break e;case Qm:o=14;break e;case Gs:o=16,r=null;break e}throw Error(ae(130,t==null?t:typeof t,""))}return e=Er(o,n,e,s),e.elementType=t,e.type=r,e.lanes=i,e}function Wi(t,e,n,r){return t=Er(7,t,r,e),t.lanes=n,t}function oh(t,e,n,r){return t=Er(22,t,r,e),t.elementType=Kb,t.lanes=n,t.stateNode={isHidden:!1},t}function xf(t,e,n){return t=Er(6,t,null,e),t.lanes=n,t}function vf(t,e,n){return e=Er(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function bI(t,e,n,r,s){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Jh(0),this.expirationTimes=Jh(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Jh(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function Ag(t,e,n,r,s,i,o,l,c){return t=new bI(t,e,n,l,c),e===1?(e=1,i===!0&&(e|=8)):e=0,i=Er(3,null,null,e),t.current=i,i.stateNode=t,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},fg(i),t}function _I(t,e,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(B_)}catch(t){console.error(t)}}B_(),Bb.exports=gr;var $_=Bb.exports;const kI=Kd($_);var H_,Lx=$_;H_=Lx.createRoot,Lx.hydrateRoot;/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */var II={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"};/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const CI=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),Te=(t,e)=>{const n=L.forwardRef(({color:r="currentColor",size:s=24,strokeWidth:i=2,absoluteStrokeWidth:o,className:l="",children:c,...u},h)=>L.createElement("svg",{ref:h,...II,width:s,height:s,stroke:r,strokeWidth:o?Number(i)*24/Number(s):i,className:["lucide",`lucide-${CI(t)}`,l].join(" "),...u},[...e.map(([f,m])=>L.createElement(f,m)),...Array.isArray(c)?c:[c]]));return n.displayName=`${t}`,n};/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const AI=Te("AlertCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const jI=Te("AlertTriangle",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z",key:"c3ski4"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Is=Te("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ox=Te("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const PI=Te("ArrowUpDown",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Vx=Te("BookMarked",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H20v20H6.5a2.5 2.5 0 0 1 0-5H20",key:"t4utmx"}],["polyline",{points:"10 2 10 10 13 7 16 10 16 2",key:"13o6vz"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const fa=Te("BookOpen",[["path",{d:"M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z",key:"vv98re"}],["path",{d:"M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z",key:"1cyq3y"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const RI=Te("Book",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H20v20H6.5a2.5 2.5 0 0 1 0-5H20",key:"t4utmx"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const dc=Te("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const DI=Te("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const dh=Te("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const hc=Te("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const q_=Te("ChevronsLeft",[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const G_=Te("ChevronsRight",[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const MI=Te("ChevronsUpDown",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const LI=Te("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const W_=Te("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ja=Te("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Fx=Te("Eraser",[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Dg=Te("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Wp=Te("Eye",[["path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z",key:"rwhkz3"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Za=Te("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const K_=Te("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const zx=Te("FolderInput",[["path",{d:"M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1",key:"fm4g5t"}],["path",{d:"M2 13h10",key:"pgb2dq"}],["path",{d:"m9 16 3-3-3-3",key:"6m91ic"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Q_=Te("FolderPlus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const xr=Te("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Kp=Te("Grid2x2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M12 3v18",key:"108xh3"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Qp=Te("Grid3x3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ux=Te("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const OI=Te("ImagePlus",[["path",{d:"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7",key:"31hg93"}],["line",{x1:"16",x2:"22",y1:"5",y2:"5",key:"ez7e4s"}],["line",{x1:"19",x2:"19",y1:"2",y2:"8",key:"1gkr8c"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Yp=Te("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Y_=Te("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Pr=Te("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const xd=Te("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Bx=Te("Loader2",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const X_=Te("Megaphone",[["path",{d:"m3 11 18-5v12L3 14v-3z",key:"n962bs"}],["path",{d:"M11.6 16.8a3 3 0 1 1-5.8-1.6",key:"1yl0tm"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const VI=Te("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const FI=Te("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Yo=Te("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z",key:"ymcmye"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const J_=Te("Pen",[["path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z",key:"5qss01"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Kr=Te("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const zI=Te("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Mg=Te("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Xp=Te("Rows2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 12h18",key:"1i2n21"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Ea=Te("Save",[["path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z",key:"1owoqh"}],["polyline",{points:"17 21 17 13 7 13 7 21",key:"1md35c"}],["polyline",{points:"7 3 7 8 15 8",key:"8nz8an"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const no=Te("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const UI=Te("Send",[["path",{d:"m22 2-7 20-4-9-9-4Z",key:"1q3vgg"}],["path",{d:"M22 2 11 13",key:"nzbqef"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const $x=Te("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Z_=Te("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const vd=Te("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const BI=Te("Timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const tn=Te("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Lg=Te("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const gt=Te("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Og=Te("ZoomIn",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Vg=Te("ZoomOut",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]),wf=new Set;function un({src:t,alt:e,className:n="",imgClassName:r="",objectFit:s="contain",aspectRatio:i,loading:o,draggable:l,showControls:c=!1}){const u=wf.has(t),[h,f]=L.useState(u),[m,p]=L.useState(!1),[y,_]=L.useState(0);L.useEffect(()=>{wf.has(t)?(f(!0),p(!1)):(f(!1),p(!1)),_(0)},[t]);const C=()=>{p(!1),f(!1),_(D=>D+1)},v=()=>{f(!0),p(!1),wf.add(t)},w=y>0?`${t}${t.includes("?")?"&":"?"}retry=${y}`:t,E=w.includes("format=mp4")||w.toLowerCase().endsWith(".mp4")||w.toLowerCase().endsWith(".webm");return a.jsxs("div",{className:`relative w-full h-full overflow-hidden ${m?"bg-[#1a1a1a]/50 rounded-lg min-h-[300px]":""} ${n}`,style:i&&i!=="auto"?{aspectRatio:i}:void 0,children:[a.jsx("div",{className:`absolute inset-0 flex items-center justify-center transition-opacity duration-500 ${h?"opacity-0 pointer-events-none":"opacity-100"}`,children:m?a.jsxs("div",{className:"flex flex-col items-center justify-center p-6 text-center max-w-sm w-full h-full",children:[a.jsx("div",{className:"w-12 h-12 rounded-full bg-red-500/10 flex items-center justify-center mb-3",children:a.jsx(AI,{className:"w-6 h-6 text-red-500"})}),a.jsx("p",{className:"text-sm text-gray-400 mb-4",children:"La imagen no cargó. El servidor podría tener problemas."}),a.jsxs("button",{onClick:C,className:"flex items-center justify-center gap-2 px-4 py-2 bg-gray-800 hover:bg-gray-700 text-white rounded-lg transition-colors border border-gray-700 w-full max-w-[200px]",children:[a.jsx(Mg,{className:"w-4 h-4"}),a.jsxs("span",{children:["Reintentar (",y,")"]})]})]}):a.jsx("div",{className:"w-8 h-8 border-2 border-[#bb86fc] border-t-transparent rounded-full animate-spin"})}),!m&&(E?a.jsx("video",{src:w,autoPlay:!c,loop:!c,muted:!c,playsInline:!0,controls:c,className:`w-full h-full object-${s} transition-all duration-1000 ease-linear ${r} ${h?"opacity-100":"opacity-0"}`,onLoadedData:v,onError:()=>{p(!0),f(!1)}}):a.jsx("img",{src:w,alt:e,loading:o,draggable:l,className:`w-full h-full object-${s} transition-all duration-1000 ease-linear ${r} ${h?"opacity-100":"opacity-0"}`,onLoad:v,onError:()=>{p(!0),f(!1)}}))]})}function eE({images:t,initialIndex:e,onClose:n}){const[r,s]=L.useState(e),[i,o]=L.useState(!1),[l,c]=L.useState(0),[u,h]=L.useState(1),[f,m]=L.useState({x:0,y:0}),[p,y]=L.useState(!1),[_,C]=L.useState({x:0,y:0}),[v,w]=L.useState(null),[E,D]=L.useState(1),M=L.useRef(null);L.useEffect(()=>(document.body.style.overflow="hidden",()=>{document.body.style.overflow="unset"}),[]);const T=Q=>{const oe=t.length;return(Q%oe+oe)%oe},S=Q=>Math.hypot(Q[0].clientX-Q[1].clientX,Q[0].clientY-Q[1].clientY),x=(Q,oe)=>{const ce=window.innerWidth,Ie=window.innerHeight,te=(ce*oe-ce)/2,it=(Ie*oe-Ie)/2;return{x:Math.min(Math.max(Q.x,-te),te),y:Math.min(Math.max(Q.y,-it),it)}},N=i?2:1,A=()=>{s(Q=>T(Q-N)),c(0),h(1),m({x:0,y:0})},I=()=>{s(Q=>T(Q+N)),c(0),h(1),m({x:0,y:0})},P=(Q,oe)=>{y(!0),C({x:Q,y:oe})},k=(Q,oe)=>{if(p)if(u>1){const ce=Q-_.x,Ie=oe-_.y;m(te=>({x:te.x+ce,y:te.y+Ie})),C({x:Q,y:oe})}else{const ce=Q-_.x;c(ce)}},B=()=>{var ce;if(y(!1),w(null),u>1)return;const oe=(((ce=M.current)==null?void 0:ce.clientWidth)||window.innerWidth)*.25;Math.abs(l)>oe?l>0?A():I():c(0)},z=Q=>{Q.preventDefault(),P(Q.clientX,Q.clientY)},W=Q=>{Q.preventDefault(),k(Q.clientX,Q.clientY)},ee=()=>B(),F=Q=>{if(Q.touches.length===2){const oe=S(Q.touches);w(oe),D(u),y(!1)}else Q.touches.length===1&&P(Q.touches[0].clientX,Q.touches[0].clientY)},K=Q=>{if(Q.touches.length===2&&v!==null){const ce=S(Q.touches)/v,Ie=Math.min(Math.max(E*ce,1),4);h(Ie),m(te=>x(te,Ie))}else Q.touches.length===1&&k(Q.touches[0].clientX,Q.touches[0].clientY)},R=Q=>{if(v!==null&&Q.touches.length<2){w(null);return}B()};L.useEffect(()=>{function Q(oe){oe.key==="Escape"?n():oe.key==="ArrowLeft"?A():oe.key==="ArrowRight"?I():oe.key==="+"||oe.key==="="?h(ce=>{const Ie=Math.min(ce+.5,4);return m(te=>x(te,Ie)),Ie}):oe.key==="-"&&h(ce=>{const Ie=Math.max(ce-.5,1);return m(te=>x(te,Ie)),Ie})}return window.addEventListener("keydown",Q),()=>window.removeEventListener("keydown",Q)},[u,i]);let ne=`translateX(calc(-33.333333% + ${l}px))`,pe=p?"none":"transform 0.1s ease-out";l===0&&(pe="none");const O=Q=>{const oe=T(Q);if(i){const ce=T(Q+1);return a.jsxs("div",{className:"flex w-full h-full items-center justify-center px-2 sm:px-10",children:[a.jsx("div",{className:"flex-1 h-full flex items-center justify-end",children:a.jsx(un,{src:t[oe],alt:`Página ${oe+1}`,aspectRatio:"auto",objectFit:"contain",loading:"lazy",draggable:!1,imgClassName:"max-w-full max-h-screen object-contain select-none shadow-lg origin-right object-right transition-none",showControls:!0})}),a.jsx("div",{className:"flex-1 h-full flex items-center justify-start",children:a.jsx(un,{src:t[ce],alt:`Página ${ce+1}`,aspectRatio:"auto",objectFit:"contain",loading:"lazy",draggable:!1,imgClassName:"max-w-full max-h-screen object-contain select-none shadow-lg origin-left object-left transition-none",showControls:!0})})]})}else return a.jsx(un,{src:t[oe],alt:`Página ${oe+1}`,aspectRatio:"auto",objectFit:"contain",loading:"lazy",draggable:!1,imgClassName:"max-w-full max-h-screen object-contain select-none shadow-2xl transition-none",showControls:!0})};return a.jsxs("div",{className:"fixed inset-0 bg-black/95 flex items-center justify-center z-50 select-none touch-none overflow-hidden",style:{touchAction:"none"},ref:M,onWheel:Q=>{Q.stopPropagation();const oe=Q.deltaY<0?.5:-.5;h(ce=>{const Ie=Math.min(Math.max(ce+oe,1),4);return m(te=>x(te,Ie)),Ie})},onMouseDown:z,onMouseMove:W,onMouseUp:ee,onMouseLeave:()=>{y(!1),u===1&&c(0)},onTouchStart:F,onTouchMove:K,onTouchEnd:R,children:[a.jsxs("div",{className:"absolute top-6 right-6 flex items-center gap-4 z-50",children:[a.jsxs("div",{className:"flex items-center gap-2 bg-black/50 rounded-lg p-1",children:[a.jsx("button",{onClick:()=>o(!i),className:`p-2 transition-colors ${i?"text-[#bb86fc]":"text-white hover:text-[#bb86fc]"}`,title:i?"Vista Individual":"Vista de Libro",children:i?a.jsx(fa,{className:"w-5 h-5"}):a.jsx(RI,{className:"w-5 h-5"})}),a.jsx("div",{className:"w-px h-4 bg-white/20 mx-1"}),a.jsx("button",{onClick:()=>h(Q=>{const oe=Math.max(Q-.5,1);return m(ce=>x(ce,oe)),oe}),className:"p-2 text-white hover:text-[#bb86fc] transition-colors",children:a.jsx(Vg,{className:"w-5 h-5"})}),a.jsxs("span",{className:"text-white text-sm min-w-[3ch] text-center",children:[Math.round(u*100),"%"]}),a.jsx("button",{onClick:()=>h(Q=>{const oe=Math.min(Q+.5,4);return m(ce=>x(ce,oe)),oe}),className:"p-2 text-white hover:text-[#bb86fc] transition-colors",children:a.jsx(Og,{className:"w-5 h-5"})})]}),a.jsx("button",{onClick:n,className:"p-2 rounded-lg bg-white/10 hover:bg-white/20 text-white transition-all duration-200",children:a.jsx(gt,{className:"w-6 h-6"})})]}),a.jsxs("div",{className:"flex h-full w-[300%] absolute top-0 left-0",style:{transform:ne,transition:pe},children:[a.jsx("div",{className:"w-1/3 h-full flex items-center justify-center relative",children:O(r-N)}),a.jsx("div",{className:"w-1/3 h-full flex items-center justify-center relative",children:a.jsx("div",{className:"relative flex items-center justify-center w-full h-full",style:{transform:`translate(${f.x}px, ${f.y}px) scale(${u})`,transition:p?"none":"transform 0.1s ease-out",cursor:u>1?p?"grabbing":"grab":"default"},onDoubleClick:Q=>{Q.stopPropagation(),h(oe=>oe>1?1:2.5),m({x:0,y:0})},children:O(r)})}),a.jsx("div",{className:"w-1/3 h-full flex items-center justify-center relative",children:O(r+N)})]}),u===1&&a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:Q=>{Q.stopPropagation(),A()},className:"absolute left-4 sm:left-8 top-1/2 -translate-y-1/2 p-3 sm:p-4 rounded-lg text-white opacity-40 hover:opacity-100 transition-opacity duration-200 z-40",children:a.jsx(dh,{className:"w-8 h-8 sm:w-10 sm:h-10"})}),a.jsx("button",{onClick:Q=>{Q.stopPropagation(),I()},className:"absolute right-4 sm:right-8 top-1/2 -translate-y-1/2 p-3 sm:p-4 rounded-lg text-white opacity-40 hover:opacity-100 transition-opacity duration-200 z-40",children:a.jsx(hc,{className:"w-8 h-8 sm:w-10 sm:h-10"})})]}),a.jsx("div",{className:"absolute bottom-6 left-1/2 -translate-x-1/2 bg-black/60 text-white px-4 py-2 rounded-lg text-sm font-medium z-40 pointer-events-none",children:i?`${r+1}-${Math.min(r+2,t.length)} / ${t.length}`:`${r+1} / ${t.length}`})]})}function hh({isAdmin:t,onOpenTrash:e}){return a.jsxs("footer",{className:"py-6 border-t border-gray-800/50 flex flex-col md:flex-row items-center justify-between gap-4 text-gray-400 text-sm mt-auto w-full px-8 relative",children:[a.jsxs("div",{className:"flex flex-wrap justify-center gap-6 mx-auto",children:[a.jsxs("a",{href:"https://t.me/twistedbrody",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 hover:text-[#bb86fc] transition-colors",children:[a.jsx("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"currentColor",children:a.jsx("path",{d:"M12 0C5.373 0 0 5.373 0 12s5.373 12 12 12 12-5.373 12-12S18.627 0 12 0zm5.894 8.221l-1.97 9.28c-.145.658-.537.818-1.084.508l-3-2.21-1.446 1.394c-.16.16-.295.295-.605.295l.213-3.054 5.56-5.022c.242-.213-.054-.333-.373-.121l-6.869 4.326-2.96-.924c-.64-.203-.658-.64.135-.954l11.566-4.458c.538-.196 1.006.128.832.941z"})}),"Twisted Brody"]}),a.jsxs("a",{href:"https://t.me/+CmmZFHM9hpViYzMx",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 hover:text-[#bb86fc] transition-colors",children:[a.jsx("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"currentColor",children:a.jsx("path",{d:"M12 0C5.373 0 0 5.373 0 12s5.373 12 12 12 12-5.373 12-12S18.627 0 12 0zm5.894 8.221l-1.97 9.28c-.145.658-.537.818-1.084.508l-3-2.21-1.446 1.394c-.16.16-.295.295-.605.295l.213-3.054 5.56-5.022c.242-.213-.054-.333-.373-.121l-6.869 4.326-2.96-.924c-.64-.203-.658-.64.135-.954l11.566-4.458c.538-.196 1.006.128.832.941z"})}),"Canal Hub"]}),a.jsxs("a",{href:"https://x.com/TwistedBrody",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 hover:text-[#bb86fc] transition-colors",children:[a.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:a.jsx("path",{d:"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"})}),"X"]}),a.jsxs("a",{href:"https://www.patreon.com/cw/Twistedbrody",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 hover:text-[#bb86fc] transition-colors",children:[a.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:a.jsx("path",{d:"M0 .48v23.04h4.22V.48zm15.385 0c-4.764 0-8.641 3.88-8.641 8.65 0 4.755 3.877 8.623 8.641 8.623 4.75 0 8.615-3.868 8.615-8.623C24 4.36 20.136.48 15.385.48z"})}),"Patreon"]}),a.jsxs("button",{onClick:()=>{window.location.hash="info"},className:"flex items-center gap-2 hover:text-[#bb86fc] transition-colors",children:[a.jsx(Y_,{className:"w-4 h-4"}),a.jsx("span",{children:"Info"})]}),t&&e&&a.jsxs("button",{onClick:e,className:"flex items-center gap-2 text-gray-400 hover:text-red-400 transition-colors",children:[a.jsx(tn,{className:"w-4 h-4"}),a.jsx("span",{children:"Papelera"})]})]}),a.jsxs("div",{className:"md:absolute md:right-8 text-xs opacity-50",children:["Twisted Brody MangaFlow © ",new Date().getFullYear()]})]})}function tE({children:t,rootMargin:e="150% 0px 150% 0px",minHeight:n,className:r=""}){const s=L.useRef(null),[i,o]=L.useState(!1);return L.useEffect(()=>{if(i)return;const l=new IntersectionObserver(c=>{const[u]=c;u.isIntersecting&&o(!0)},{rootMargin:e});return s.current&&l.observe(s.current),()=>{l.disconnect()}},[i,e]),a.jsx("div",{ref:s,style:n?{minHeight:n}:void 0,className:`w-full flex items-center justify-center ${r}`,children:i?t(!0):null})}function $I({manga:t,onBack:e}){const n=t.chapters&&t.chapters.length>0?t.chapters[0]:null,r=n?n.original_pages&&n.original_pages.length>0?n.original_pages:n.pages:[],[s,i]=L.useState("vertical"),[o,l]=L.useState(1),[c,u]=L.useState(!1),[h,f]=L.useState(0);if(!r||r.length===0)return a.jsxs("div",{className:"min-h-screen bg-[#121212] flex flex-col items-center justify-center",children:[a.jsx("button",{onClick:e,className:"absolute top-6 left-6 p-2 hover:bg-[#333] rounded-lg transition-colors text-white",children:a.jsx(Is,{className:"w-6 h-6"})}),a.jsx("div",{className:"text-gray-400 text-lg",children:"No hay páginas disponibles"})]});const m=()=>l(_=>Math.min(_+.25,3)),p=()=>l(_=>Math.max(_-.25,.5)),y=()=>l(1);return a.jsxs("div",{className:"min-h-screen flex flex-col bg-[#121212]",children:[a.jsxs("header",{className:"sticky top-0 z-50 bg-[#121212]/90 backdrop-blur-md border-b border-gray-800 px-4 py-3 flex items-center justify-between gap-4",children:[a.jsx("div",{className:"flex items-center gap-2 flex-shrink-0",children:a.jsxs("button",{onClick:e,className:"p-2 hover:bg-[#333] rounded-lg transition-colors text-white flex items-center gap-2",children:[a.jsx(Is,{className:"w-5 h-5"}),a.jsx("span",{className:"font-semibold text-sm hidden sm:inline",children:"Volver"})]})}),a.jsx("div",{className:"flex-1 flex justify-center min-w-0",children:a.jsxs("h1",{className:"text-white font-bold truncate text-center max-w-full",children:[t.title," ",a.jsx("span",{className:"text-[#bb86fc] text-xs ml-2 border border-[#bb86fc] px-1 rounded",children:"HD"})]})}),a.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[a.jsxs("div",{className:"flex items-center gap-1 bg-[#0a0a0a] border border-gray-800 rounded-lg p-1 hidden md:flex",children:[a.jsx("button",{onClick:()=>i("vertical"),className:`p-2 rounded-md transition-all duration-200 ${s==="vertical"?"bg-[#bb86fc] text-white":"text-gray-400 hover:text-white"}`,title:"Vertical",children:a.jsx(Xp,{className:"w-4 h-4"})}),a.jsx("button",{onClick:()=>i("gallery"),className:`p-2 rounded-md transition-all duration-200 ${s==="gallery"?"bg-[#bb86fc] text-white":"text-gray-400 hover:text-white"}`,title:"Galería",children:a.jsx(Kp,{className:"w-4 h-4"})}),a.jsx("button",{onClick:()=>i("grid"),className:`p-2 rounded-md transition-all duration-200 ${s==="grid"?"bg-[#bb86fc] text-white":"text-gray-400 hover:text-white"}`,title:"Cuadrícula",children:a.jsx(Qp,{className:"w-4 h-4"})})]}),s==="vertical"&&a.jsxs("div",{className:"flex items-center gap-1 bg-[#0a0a0a] border border-gray-800 rounded-lg p-1",children:[a.jsx("button",{onClick:p,className:"p-2 text-gray-400 hover:text-white hover:bg-[#333] rounded",children:a.jsx(Vg,{className:"w-4 h-4"})}),a.jsxs("span",{className:"text-xs text-gray-300 w-8 text-center",children:[Math.round(o*100),"%"]}),a.jsx("button",{onClick:m,className:"p-2 text-gray-400 hover:text-white hover:bg-[#333] rounded",children:a.jsx(Og,{className:"w-4 h-4"})}),a.jsx("button",{onClick:y,className:"p-2 text-gray-400 hover:text-white hover:bg-[#333] rounded",title:"Reset",children:a.jsx(Mg,{className:"w-3 h-3"})})]})]})]}),a.jsx("div",{className:"md:hidden px-4 py-2 border-b border-gray-800 bg-[#121212] flex justify-center",children:a.jsxs("div",{className:"flex items-center gap-1 bg-[#0a0a0a] border border-gray-800 rounded-lg p-1",children:[a.jsxs("button",{onClick:()=>i("vertical"),className:`px-3 py-1.5 rounded-md flex items-center gap-2 text-xs font-medium ${s==="vertical"?"bg-[#bb86fc] text-white":"text-gray-400"}`,children:[a.jsx(Xp,{className:"w-3 h-3"})," Vertical"]}),a.jsxs("button",{onClick:()=>i("gallery"),className:`px-3 py-1.5 rounded-md flex items-center gap-2 text-xs font-medium ${s==="gallery"?"bg-[#bb86fc] text-white":"text-gray-400"}`,children:[a.jsx(Kp,{className:"w-3 h-3"})," Galería"]}),a.jsxs("button",{onClick:()=>i("grid"),className:`px-3 py-1.5 rounded-md flex items-center gap-2 text-xs font-medium ${s==="grid"?"bg-[#bb86fc] text-white":"text-gray-400"}`,children:[a.jsx(Qp,{className:"w-3 h-3"})," Cuadrícula"]})]})}),a.jsx("main",{className:"flex-1 w-full max-w-[1920px] mx-auto px-0 sm:px-4 py-0 sm:py-6",children:a.jsx("div",{className:` + bg-[#050505] min-h-screen transition-all duration-150 ease-out + ${s==="vertical"?"flex flex-col items-center gap-0 sm:gap-1":""} + ${s==="gallery"?"masonry-container p-2":""} + ${s==="grid"?"grid grid-cols-3 md:grid-cols-5 gap-2 p-2":""} + `,children:r.map((_,C)=>{const v=_;return s==="vertical"?a.jsx("div",{className:"relative transition-all duration-200",style:{width:o===1?"100%":`${100*o}%`,maxWidth:o>1?"none":"80rem"},children:a.jsx("div",{className:`mx-auto ${o<=1?"max-w-5xl":""}`,children:a.jsx(tE,{minHeight:"50vh",children:()=>a.jsx(un,{src:v,alt:`Página ${C+1}`,aspectRatio:"auto",objectFit:"contain",loading:"eager",className:"w-full h-auto",imgClassName:"w-full h-auto block",showControls:!0})})})},C):a.jsx("div",{className:` + group cursor-pointer relative bg-black rounded-lg shadow-lg overflow-hidden transition-transform duration-300 hover:scale-[1.02] + ${s==="gallery"?"masonry-item":""} + `,onClick:()=>{f(C),u(!0)},children:a.jsx(un,{src:v,alt:`Página ${C+1}`,aspectRatio:s==="grid"?"1/1":"auto",objectFit:s==="grid"?"cover":"contain",loading:C<5?"eager":"lazy",className:"w-full h-auto rounded-lg",imgClassName:"group-hover:scale-110"})},C)})})}),a.jsx(hh,{}),c&&a.jsx(eE,{images:r,initialIndex:h,onClose:()=>u(!1)})]})}async function HI(t,e,n){const r=await qI(t),s=GI(t);try{const i=await fetch("/api/process-image",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({image:r,name:t.name,index:e,total:n})});if(!i.ok)throw new Error(`Server processing failed: ${i.statusText}`);const o=await i.json();if(!o.success||!o.data)throw new Error("Invalid response from processing server");return{thumbnail:o.data.thumbnail,original:r,webpDisplay:o.data.webp,webpCover:o.data.webp,originalFormat:s,originalBase64:r,originalUnmodified:r}}catch(i){throw console.error("Error processing image on server, falling back to local:",i),i}}async function qI(t){return new Promise((e,n)=>{const r=new FileReader;r.onload=s=>{var i;return e((i=s.target)==null?void 0:i.result)},r.onerror=()=>n(new Error("Failed to read file")),r.readAsDataURL(t)})}function GI(t){var r;const e=t.type;if(e==="image/png")return"png";if(e==="image/jpeg")return"jpg";if(e==="image/gif")return"gif";if(e==="image/webp")return"webp";const n=(r=t.name.split(".").pop())==null?void 0:r.toLowerCase();return n&&["png","jpg","jpeg","gif","webp"].includes(n)?n==="jpeg"?"jpg":n:"jpg"}async function WI(t){return new Promise((e,n)=>{const r=new Image;r.crossOrigin="anonymous",r.onload=()=>{const s=r.width/r.height;s<.9?e("portrait"):s>1.1?e("landscape"):e("square")},r.onerror=()=>n(new Error("Failed to load image")),r.src=t})}const nE="imageBatchSize",Hx=10;function lu(t){if(t<0)throw new Error("El tamaño del lote no puede ser negativo");localStorage.setItem(nE,t.toString())}function rE(){const t=localStorage.getItem(nE);if(!t)return Hx;const e=parseInt(t,10);return isNaN(e)||e<0?Hx:e>=999999?0:e}const KI="https://codebydante-brodyfilestreambot.hf.space/upload";function QI(t,e){const n=t.split(","),r=n[0].match(/:(.*?);/),s=r?r[1]:"image/jpeg",i=atob(n[n.length-1]);let o=i.length;const l=new Uint8Array(o);for(;o--;)l[o]=i.charCodeAt(o);return new File([l],e,{type:s})}const Jp=t=>new Promise(e=>setTimeout(e,t));async function Zp(t,e,n=3){var l,c,u;const r=e?`${e}.jpg`:"image.jpg",s=QI(t,r),i=new FormData;i.append("file",s);let o=0;for(;oh.abort(),6e4);try{const m=await fetch(KI,{method:"POST",body:i,signal:h.signal});if(clearTimeout(f),!m.ok){const y=await m.text();if(m.status>=500&&o=n)throw m}}throw new Error("No se pudo subir la imagen tras varios intentos.")}async function cu(t,e,n){const r=rE()||5,s=[];for(let i=0;i{const f=i+h,m=e?`${e}_${f+1}`:void 0;return Zp(u,m)}),c=await Promise.all(l);s.push(...c),n&&n(Math.min(i+r,t.length),t.length),i+r{};var qx={};/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const sE=function(t){const e=[];let n=0;for(let r=0;r>6|192,e[n++]=s&63|128):(s&64512)===55296&&r+1>18|240,e[n++]=s>>12&63|128,e[n++]=s>>6&63|128,e[n++]=s&63|128):(e[n++]=s>>12|224,e[n++]=s>>6&63|128,e[n++]=s&63|128)}return e},XI=function(t){const e=[];let n=0,r=0;for(;n191&&s<224){const i=t[n++];e[r++]=String.fromCharCode((s&31)<<6|i&63)}else if(s>239&&s<365){const i=t[n++],o=t[n++],l=t[n++],c=((s&7)<<18|(i&63)<<12|(o&63)<<6|l&63)-65536;e[r++]=String.fromCharCode(55296+(c>>10)),e[r++]=String.fromCharCode(56320+(c&1023))}else{const i=t[n++],o=t[n++];e[r++]=String.fromCharCode((s&15)<<12|(i&63)<<6|o&63)}}return e.join("")},iE={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let s=0;s>2,f=(i&3)<<4|l>>4;let m=(l&15)<<2|u>>6,p=u&63;c||(p=64,o||(m=64)),r.push(n[h],n[f],n[m],n[p])}return r.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(sE(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):XI(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();const n=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let s=0;s>4;if(r.push(m),u!==64){const p=l<<4&240|u>>2;if(r.push(p),f!==64){const y=u<<6&192|f;r.push(y)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let t=0;t=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}};class JI extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const ZI=function(t){const e=sE(t);return iE.encodeByteArray(e,!0)},wd=function(t){return ZI(t).replace(/\./g,"")},oE=function(t){try{return iE.decodeString(t,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};/** + * @license + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function eC(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}/** + * @license + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const tC=()=>eC().__FIREBASE_DEFAULTS__,nC=()=>{if(typeof process>"u"||typeof qx>"u")return;const t=qx.__FIREBASE_DEFAULTS__;if(t)return JSON.parse(t)},rC=()=>{if(typeof document>"u")return;let t;try{t=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const e=t&&oE(t[1]);return e&&JSON.parse(e)},fh=()=>{try{return YI()||tC()||nC()||rC()}catch(t){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${t}`);return}},aE=t=>{var e,n;return(n=(e=fh())==null?void 0:e.emulatorHosts)==null?void 0:n[t]},lE=t=>{const e=aE(t);if(!e)return;const n=e.lastIndexOf(":");if(n<=0||n+1===e.length)throw new Error(`Invalid host ${e} with no separate hostname and port!`);const r=parseInt(e.substring(n+1),10);return e[0]==="["?[e.substring(1,n-1),r]:[e.substring(0,n),r]},cE=()=>{var t;return(t=fh())==null?void 0:t.config},uE=t=>{var e;return(e=fh())==null?void 0:e[`_${t}`]};/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class sC{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}wrapCallback(e){return(n,r)=>{n?this.reject(n):this.resolve(r),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(n):e(n,r))}}}/** + * @license + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function dE(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const n={alg:"none",type:"JWT"},r=e||"demo-project",s=t.iat||0,i=t.sub||t.user_id;if(!i)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const o={iss:`https://securetoken.google.com/${r}`,aud:r,iat:s,exp:s+3600,auth_time:s,sub:i,user_id:i,firebase:{sign_in_provider:"custom",identities:{}},...t};return[wd(JSON.stringify(n)),wd(JSON.stringify(o)),""].join(".")}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function An(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function iC(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(An())}function oC(){var e;const t=(e=fh())==null?void 0:e.forceEnvironment;if(t==="node")return!0;if(t==="browser")return!1;try{return Object.prototype.toString.call(global.process)==="[object process]"}catch{return!1}}function aC(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function lC(){const t=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof t=="object"&&t.id!==void 0}function cC(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function uC(){const t=An();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0}function dC(){return!oC()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}function hC(){try{return typeof indexedDB=="object"}catch{return!1}}function fC(){return new Promise((t,e)=>{try{let n=!0;const r="validate-browser-context-for-indexeddb-analytics-module",s=self.indexedDB.open(r);s.onsuccess=()=>{s.result.close(),n||self.indexedDB.deleteDatabase(r),t(!0)},s.onupgradeneeded=()=>{n=!1},s.onerror=()=>{var i;e(((i=s.error)==null?void 0:i.message)||"")}}catch(n){e(n)}})}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const pC="FirebaseError";class cs extends Error{constructor(e,n,r){super(n),this.code=e,this.customData=r,this.name=pC,Object.setPrototypeOf(this,cs.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,fc.prototype.create)}}class fc{constructor(e,n,r){this.service=e,this.serviceName=n,this.errors=r}create(e,...n){const r=n[0]||{},s=`${this.service}/${e}`,i=this.errors[e],o=i?mC(i,r):"Error",l=`${this.serviceName}: ${o} (${s}).`;return new cs(s,l,r)}}function mC(t,e){return t.replace(gC,(n,r)=>{const s=e[r];return s!=null?String(s):`<${r}?>`})}const gC=/\{\$([^}]+)}/g;function yC(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}function ro(t,e){if(t===e)return!0;const n=Object.keys(t),r=Object.keys(e);for(const s of n){if(!r.includes(s))return!1;const i=t[s],o=e[s];if(Gx(i)&&Gx(o)){if(!ro(i,o))return!1}else if(i!==o)return!1}for(const s of r)if(!n.includes(s))return!1;return!0}function Gx(t){return t!==null&&typeof t=="object"}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function pc(t){const e=[];for(const[n,r]of Object.entries(t))Array.isArray(r)?r.forEach(s=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(s))}):e.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return e.length?"&"+e.join("&"):""}function xC(t,e){const n=new vC(t,e);return n.subscribe.bind(n)}class vC{constructor(e,n){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=n,this.task.then(()=>{e(this)}).catch(r=>{this.error(r)})}next(e){this.forEachObserver(n=>{n.next(e)})}error(e){this.forEachObserver(n=>{n.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,n,r){let s;if(e===void 0&&n===void 0&&r===void 0)throw new Error("Missing Observer.");wC(e,["next","error","complete"])?s=e:s={next:e,error:n,complete:r},s.next===void 0&&(s.next=bf),s.error===void 0&&(s.error=bf),s.complete===void 0&&(s.complete=bf);const i=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?s.error(this.finalError):s.complete()}catch{}}),this.observers.push(s),i}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let n=0;n{if(this.observers!==void 0&&this.observers[e]!==void 0)try{n(this.observers[e])}catch(r){typeof console<"u"&&console.error&&console.error(r)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}}function wC(t,e){if(typeof t!="object"||t===null)return!1;for(const n of e)if(n in t&&typeof t[n]=="function")return!0;return!1}function bf(){}/** + * @license + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function sn(t){return t&&t._delegate?t._delegate:t}/** + * @license + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Sa(t){try{return(t.startsWith("http://")||t.startsWith("https://")?new URL(t).hostname:t).endsWith(".cloudworkstations.dev")}catch{return!1}}async function Fg(t){return(await fetch(t,{credentials:"include"})).ok}class vi{constructor(e,n,r){this.name=e,this.instanceFactory=n,this.type=r,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const zi="[DEFAULT]";/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class bC{constructor(e,n){this.name=e,this.container=n,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){const n=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(n)){const r=new sC;if(this.instancesDeferred.set(n,r),this.isInitialized(n)||this.shouldAutoInitialize())try{const s=this.getOrInitializeService({instanceIdentifier:n});s&&r.resolve(s)}catch{}}return this.instancesDeferred.get(n).promise}getImmediate(e){const n=this.normalizeInstanceIdentifier(e==null?void 0:e.identifier),r=(e==null?void 0:e.optional)??!1;if(this.isInitialized(n)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:n})}catch(s){if(r)return null;throw s}else{if(r)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,!!this.shouldAutoInitialize()){if(EC(e))try{this.getOrInitializeService({instanceIdentifier:zi})}catch{}for(const[n,r]of this.instancesDeferred.entries()){const s=this.normalizeInstanceIdentifier(n);try{const i=this.getOrInitializeService({instanceIdentifier:s});r.resolve(i)}catch{}}}}clearInstance(e=zi){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){const e=Array.from(this.instances.values());await Promise.all([...e.filter(n=>"INTERNAL"in n).map(n=>n.INTERNAL.delete()),...e.filter(n=>"_delete"in n).map(n=>n._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=zi){return this.instances.has(e)}getOptions(e=zi){return this.instancesOptions.get(e)||{}}initialize(e={}){const{options:n={}}=e,r=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(r))throw Error(`${this.name}(${r}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const s=this.getOrInitializeService({instanceIdentifier:r,options:n});for(const[i,o]of this.instancesDeferred.entries()){const l=this.normalizeInstanceIdentifier(i);r===l&&o.resolve(s)}return s}onInit(e,n){const r=this.normalizeInstanceIdentifier(n),s=this.onInitCallbacks.get(r)??new Set;s.add(e),this.onInitCallbacks.set(r,s);const i=this.instances.get(r);return i&&e(i,r),()=>{s.delete(e)}}invokeOnInitCallbacks(e,n){const r=this.onInitCallbacks.get(n);if(r)for(const s of r)try{s(e,n)}catch{}}getOrInitializeService({instanceIdentifier:e,options:n={}}){let r=this.instances.get(e);if(!r&&this.component&&(r=this.component.instanceFactory(this.container,{instanceIdentifier:_C(e),options:n}),this.instances.set(e,r),this.instancesOptions.set(e,n),this.invokeOnInitCallbacks(r,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,r)}catch{}return r||null}normalizeInstanceIdentifier(e=zi){return this.component?this.component.multipleInstances?e:zi:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function _C(t){return t===zi?void 0:t}function EC(t){return t.instantiationMode==="EAGER"}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class SC{constructor(e){this.name=e,this.providers=new Map}addComponent(e){const n=this.getProvider(e.name);if(n.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);n.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);const n=new bC(e,this);return this.providers.set(e,n),n}getProviders(){return Array.from(this.providers.values())}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */var Ye;(function(t){t[t.DEBUG=0]="DEBUG",t[t.VERBOSE=1]="VERBOSE",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.SILENT=5]="SILENT"})(Ye||(Ye={}));const TC={debug:Ye.DEBUG,verbose:Ye.VERBOSE,info:Ye.INFO,warn:Ye.WARN,error:Ye.ERROR,silent:Ye.SILENT},NC=Ye.INFO,kC={[Ye.DEBUG]:"log",[Ye.VERBOSE]:"log",[Ye.INFO]:"info",[Ye.WARN]:"warn",[Ye.ERROR]:"error"},IC=(t,e,...n)=>{if(ee.some(n=>t instanceof n);let Wx,Kx;function AC(){return Wx||(Wx=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function jC(){return Kx||(Kx=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const hE=new WeakMap,em=new WeakMap,fE=new WeakMap,_f=new WeakMap,Ug=new WeakMap;function PC(t){const e=new Promise((n,r)=>{const s=()=>{t.removeEventListener("success",i),t.removeEventListener("error",o)},i=()=>{n(fi(t.result)),s()},o=()=>{r(t.error),s()};t.addEventListener("success",i),t.addEventListener("error",o)});return e.then(n=>{n instanceof IDBCursor&&hE.set(n,t)}).catch(()=>{}),Ug.set(e,t),e}function RC(t){if(em.has(t))return;const e=new Promise((n,r)=>{const s=()=>{t.removeEventListener("complete",i),t.removeEventListener("error",o),t.removeEventListener("abort",o)},i=()=>{n(),s()},o=()=>{r(t.error||new DOMException("AbortError","AbortError")),s()};t.addEventListener("complete",i),t.addEventListener("error",o),t.addEventListener("abort",o)});em.set(t,e)}let tm={get(t,e,n){if(t instanceof IDBTransaction){if(e==="done")return em.get(t);if(e==="objectStoreNames")return t.objectStoreNames||fE.get(t);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return fi(t[e])},set(t,e,n){return t[e]=n,!0},has(t,e){return t instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in t}};function DC(t){tm=t(tm)}function MC(t){return t===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...n){const r=t.call(Ef(this),e,...n);return fE.set(r,e.sort?e.sort():[e]),fi(r)}:jC().includes(t)?function(...e){return t.apply(Ef(this),e),fi(hE.get(this))}:function(...e){return fi(t.apply(Ef(this),e))}}function LC(t){return typeof t=="function"?MC(t):(t instanceof IDBTransaction&&RC(t),CC(t,AC())?new Proxy(t,tm):t)}function fi(t){if(t instanceof IDBRequest)return PC(t);if(_f.has(t))return _f.get(t);const e=LC(t);return e!==t&&(_f.set(t,e),Ug.set(e,t)),e}const Ef=t=>Ug.get(t);function OC(t,e,{blocked:n,upgrade:r,blocking:s,terminated:i}={}){const o=indexedDB.open(t,e),l=fi(o);return r&&o.addEventListener("upgradeneeded",c=>{r(fi(o.result),c.oldVersion,c.newVersion,fi(o.transaction),c)}),n&&o.addEventListener("blocked",c=>n(c.oldVersion,c.newVersion,c)),l.then(c=>{i&&c.addEventListener("close",()=>i()),s&&c.addEventListener("versionchange",u=>s(u.oldVersion,u.newVersion,u))}).catch(()=>{}),l}const VC=["get","getKey","getAll","getAllKeys","count"],FC=["put","add","delete","clear"],Sf=new Map;function Qx(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(Sf.get(e))return Sf.get(e);const n=e.replace(/FromIndex$/,""),r=e!==n,s=FC.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(s||VC.includes(n)))return;const i=async function(o,...l){const c=this.transaction(o,s?"readwrite":"readonly");let u=c.store;return r&&(u=u.index(l.shift())),(await Promise.all([u[n](...l),s&&c.done]))[0]};return Sf.set(e,i),i}DC(t=>({...t,get:(e,n,r)=>Qx(e,n)||t.get(e,n,r),has:(e,n)=>!!Qx(e,n)||t.has(e,n)}));/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class zC{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(UC(n)){const r=n.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(n=>n).join(" ")}}function UC(t){const e=t.getComponent();return(e==null?void 0:e.type)==="VERSION"}const nm="@firebase/app",Yx="0.14.10";/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Cs=new zg("@firebase/app"),BC="@firebase/app-compat",$C="@firebase/analytics-compat",HC="@firebase/analytics",qC="@firebase/app-check-compat",GC="@firebase/app-check",WC="@firebase/auth",KC="@firebase/auth-compat",QC="@firebase/database",YC="@firebase/data-connect",XC="@firebase/database-compat",JC="@firebase/functions",ZC="@firebase/functions-compat",eA="@firebase/installations",tA="@firebase/installations-compat",nA="@firebase/messaging",rA="@firebase/messaging-compat",sA="@firebase/performance",iA="@firebase/performance-compat",oA="@firebase/remote-config",aA="@firebase/remote-config-compat",lA="@firebase/storage",cA="@firebase/storage-compat",uA="@firebase/firestore",dA="@firebase/ai",hA="@firebase/firestore-compat",fA="firebase",pA="12.11.0";/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const rm="[DEFAULT]",mA={[nm]:"fire-core",[BC]:"fire-core-compat",[HC]:"fire-analytics",[$C]:"fire-analytics-compat",[GC]:"fire-app-check",[qC]:"fire-app-check-compat",[WC]:"fire-auth",[KC]:"fire-auth-compat",[QC]:"fire-rtdb",[YC]:"fire-data-connect",[XC]:"fire-rtdb-compat",[JC]:"fire-fn",[ZC]:"fire-fn-compat",[eA]:"fire-iid",[tA]:"fire-iid-compat",[nA]:"fire-fcm",[rA]:"fire-fcm-compat",[sA]:"fire-perf",[iA]:"fire-perf-compat",[oA]:"fire-rc",[aA]:"fire-rc-compat",[lA]:"fire-gcs",[cA]:"fire-gcs-compat",[uA]:"fire-fst",[hA]:"fire-fst-compat",[dA]:"fire-vertex","fire-js":"fire-js",[fA]:"fire-js-all"};/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const bd=new Map,gA=new Map,sm=new Map;function Xx(t,e){try{t.container.addComponent(e)}catch(n){Cs.debug(`Component ${e.name} failed to register with FirebaseApp ${t.name}`,n)}}function so(t){const e=t.name;if(sm.has(e))return Cs.debug(`There were multiple attempts to register component ${e}.`),!1;sm.set(e,t);for(const n of bd.values())Xx(n,t);for(const n of gA.values())Xx(n,t);return!0}function ph(t,e){const n=t.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),t.container.getProvider(e)}function Rr(t){return t==null?!1:t.settings!==void 0}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const yA={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},pi=new fc("app","Firebase",yA);/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class xA{constructor(e,n,r){this._isDeleted=!1,this._options={...e},this._config={...n},this._name=n.name,this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new vi("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw pi.create("app-deleted",{appName:this._name})}}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const po=pA;function pE(t,e={}){let n=t;typeof e!="object"&&(e={name:e});const r={name:rm,automaticDataCollectionEnabled:!0,...e},s=r.name;if(typeof s!="string"||!s)throw pi.create("bad-app-name",{appName:String(s)});if(n||(n=cE()),!n)throw pi.create("no-options");const i=bd.get(s);if(i){if(ro(n,i.options)&&ro(r,i.config))return i;throw pi.create("duplicate-app",{appName:s})}const o=new SC(s);for(const c of sm.values())o.addComponent(c);const l=new xA(n,r,o);return bd.set(s,l),l}function Bg(t=rm){const e=bd.get(t);if(!e&&t===rm&&cE())return pE();if(!e)throw pi.create("no-app",{appName:t});return e}function Zr(t,e,n){let r=mA[t]??t;n&&(r+=`-${n}`);const s=r.match(/\s|\//),i=e.match(/\s|\//);if(s||i){const o=[`Unable to register library "${r}" with version "${e}":`];s&&o.push(`library name "${r}" contains illegal characters (whitespace or "/")`),s&&i&&o.push("and"),i&&o.push(`version name "${e}" contains illegal characters (whitespace or "/")`),Cs.warn(o.join(" "));return}so(new vi(`${r}-version`,()=>({library:r,version:e}),"VERSION"))}/** + * @license + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const vA="firebase-heartbeat-database",wA=1,Gl="firebase-heartbeat-store";let Tf=null;function mE(){return Tf||(Tf=OC(vA,wA,{upgrade:(t,e)=>{switch(e){case 0:try{t.createObjectStore(Gl)}catch(n){console.warn(n)}}}}).catch(t=>{throw pi.create("idb-open",{originalErrorMessage:t.message})})),Tf}async function bA(t){try{const n=(await mE()).transaction(Gl),r=await n.objectStore(Gl).get(gE(t));return await n.done,r}catch(e){if(e instanceof cs)Cs.warn(e.message);else{const n=pi.create("idb-get",{originalErrorMessage:e==null?void 0:e.message});Cs.warn(n.message)}}}async function Jx(t,e){try{const r=(await mE()).transaction(Gl,"readwrite");await r.objectStore(Gl).put(e,gE(t)),await r.done}catch(n){if(n instanceof cs)Cs.warn(n.message);else{const r=pi.create("idb-set",{originalErrorMessage:n==null?void 0:n.message});Cs.warn(r.message)}}}function gE(t){return`${t.name}!${t.options.appId}`}/** + * @license + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const _A=1024,EA=30;class SA{constructor(e){this.container=e,this._heartbeatsCache=null;const n=this.container.getProvider("app").getImmediate();this._storage=new NA(n),this._heartbeatsCachePromise=this._storage.read().then(r=>(this._heartbeatsCache=r,r))}async triggerHeartbeat(){var e,n;try{const s=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),i=Zx();if(((e=this._heartbeatsCache)==null?void 0:e.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((n=this._heartbeatsCache)==null?void 0:n.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===i||this._heartbeatsCache.heartbeats.some(o=>o.date===i))return;if(this._heartbeatsCache.heartbeats.push({date:i,agent:s}),this._heartbeatsCache.heartbeats.length>EA){const o=kA(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(o,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(r){Cs.warn(r)}}async getHeartbeatsHeader(){var e;try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((e=this._heartbeatsCache)==null?void 0:e.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";const n=Zx(),{heartbeatsToSend:r,unsentEntries:s}=TA(this._heartbeatsCache.heartbeats),i=wd(JSON.stringify({version:2,heartbeats:r}));return this._heartbeatsCache.lastSentHeartbeatDate=n,s.length>0?(this._heartbeatsCache.heartbeats=s,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),i}catch(n){return Cs.warn(n),""}}}function Zx(){return new Date().toISOString().substring(0,10)}function TA(t,e=_A){const n=[];let r=t.slice();for(const s of t){const i=n.find(o=>o.agent===s.agent);if(i){if(i.dates.push(s.date),ev(n)>e){i.dates.pop();break}}else if(n.push({agent:s.agent,dates:[s.date]}),ev(n)>e){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}class NA{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return hC()?fC().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const n=await bA(this.app);return n!=null&&n.heartbeats?n:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){if(await this._canUseIndexedDBPromise){const r=await this.read();return Jx(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){if(await this._canUseIndexedDBPromise){const r=await this.read();return Jx(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:[...r.heartbeats,...e.heartbeats]})}else return}}function ev(t){return wd(JSON.stringify({version:2,heartbeats:t})).length}function kA(t){if(t.length===0)return-1;let e=0,n=t[0].date;for(let r=1;rnew zC(e),"PRIVATE")),so(new vi("heartbeat",e=>new SA(e),"PRIVATE")),Zr(nm,Yx,t),Zr(nm,Yx,"esm2020"),Zr("fire-js","")}IA("");var CA="firebase",AA="12.11.0";/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */Zr(CA,AA,"app");var tv=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/** @license +Copyright The Closure Library Authors. +SPDX-License-Identifier: Apache-2.0 +*/var mi,yE;(function(){var t;/** @license + + Copyright The Closure Library Authors. + SPDX-License-Identifier: Apache-2.0 +*/function e(S,x){function N(){}N.prototype=x.prototype,S.F=x.prototype,S.prototype=new N,S.prototype.constructor=S,S.D=function(A,I,P){for(var k=Array(arguments.length-2),B=2;B>>25),k=P+(I^x&(N^I))+A[1]+3905402710&4294967295,P=x+(k<<12&4294967295|k>>>20),k=I+(N^P&(x^N))+A[2]+606105819&4294967295,I=P+(k<<17&4294967295|k>>>15),k=N+(x^I&(P^x))+A[3]+3250441966&4294967295,N=I+(k<<22&4294967295|k>>>10),k=x+(P^N&(I^P))+A[4]+4118548399&4294967295,x=N+(k<<7&4294967295|k>>>25),k=P+(I^x&(N^I))+A[5]+1200080426&4294967295,P=x+(k<<12&4294967295|k>>>20),k=I+(N^P&(x^N))+A[6]+2821735955&4294967295,I=P+(k<<17&4294967295|k>>>15),k=N+(x^I&(P^x))+A[7]+4249261313&4294967295,N=I+(k<<22&4294967295|k>>>10),k=x+(P^N&(I^P))+A[8]+1770035416&4294967295,x=N+(k<<7&4294967295|k>>>25),k=P+(I^x&(N^I))+A[9]+2336552879&4294967295,P=x+(k<<12&4294967295|k>>>20),k=I+(N^P&(x^N))+A[10]+4294925233&4294967295,I=P+(k<<17&4294967295|k>>>15),k=N+(x^I&(P^x))+A[11]+2304563134&4294967295,N=I+(k<<22&4294967295|k>>>10),k=x+(P^N&(I^P))+A[12]+1804603682&4294967295,x=N+(k<<7&4294967295|k>>>25),k=P+(I^x&(N^I))+A[13]+4254626195&4294967295,P=x+(k<<12&4294967295|k>>>20),k=I+(N^P&(x^N))+A[14]+2792965006&4294967295,I=P+(k<<17&4294967295|k>>>15),k=N+(x^I&(P^x))+A[15]+1236535329&4294967295,N=I+(k<<22&4294967295|k>>>10),k=x+(I^P&(N^I))+A[1]+4129170786&4294967295,x=N+(k<<5&4294967295|k>>>27),k=P+(N^I&(x^N))+A[6]+3225465664&4294967295,P=x+(k<<9&4294967295|k>>>23),k=I+(x^N&(P^x))+A[11]+643717713&4294967295,I=P+(k<<14&4294967295|k>>>18),k=N+(P^x&(I^P))+A[0]+3921069994&4294967295,N=I+(k<<20&4294967295|k>>>12),k=x+(I^P&(N^I))+A[5]+3593408605&4294967295,x=N+(k<<5&4294967295|k>>>27),k=P+(N^I&(x^N))+A[10]+38016083&4294967295,P=x+(k<<9&4294967295|k>>>23),k=I+(x^N&(P^x))+A[15]+3634488961&4294967295,I=P+(k<<14&4294967295|k>>>18),k=N+(P^x&(I^P))+A[4]+3889429448&4294967295,N=I+(k<<20&4294967295|k>>>12),k=x+(I^P&(N^I))+A[9]+568446438&4294967295,x=N+(k<<5&4294967295|k>>>27),k=P+(N^I&(x^N))+A[14]+3275163606&4294967295,P=x+(k<<9&4294967295|k>>>23),k=I+(x^N&(P^x))+A[3]+4107603335&4294967295,I=P+(k<<14&4294967295|k>>>18),k=N+(P^x&(I^P))+A[8]+1163531501&4294967295,N=I+(k<<20&4294967295|k>>>12),k=x+(I^P&(N^I))+A[13]+2850285829&4294967295,x=N+(k<<5&4294967295|k>>>27),k=P+(N^I&(x^N))+A[2]+4243563512&4294967295,P=x+(k<<9&4294967295|k>>>23),k=I+(x^N&(P^x))+A[7]+1735328473&4294967295,I=P+(k<<14&4294967295|k>>>18),k=N+(P^x&(I^P))+A[12]+2368359562&4294967295,N=I+(k<<20&4294967295|k>>>12),k=x+(N^I^P)+A[5]+4294588738&4294967295,x=N+(k<<4&4294967295|k>>>28),k=P+(x^N^I)+A[8]+2272392833&4294967295,P=x+(k<<11&4294967295|k>>>21),k=I+(P^x^N)+A[11]+1839030562&4294967295,I=P+(k<<16&4294967295|k>>>16),k=N+(I^P^x)+A[14]+4259657740&4294967295,N=I+(k<<23&4294967295|k>>>9),k=x+(N^I^P)+A[1]+2763975236&4294967295,x=N+(k<<4&4294967295|k>>>28),k=P+(x^N^I)+A[4]+1272893353&4294967295,P=x+(k<<11&4294967295|k>>>21),k=I+(P^x^N)+A[7]+4139469664&4294967295,I=P+(k<<16&4294967295|k>>>16),k=N+(I^P^x)+A[10]+3200236656&4294967295,N=I+(k<<23&4294967295|k>>>9),k=x+(N^I^P)+A[13]+681279174&4294967295,x=N+(k<<4&4294967295|k>>>28),k=P+(x^N^I)+A[0]+3936430074&4294967295,P=x+(k<<11&4294967295|k>>>21),k=I+(P^x^N)+A[3]+3572445317&4294967295,I=P+(k<<16&4294967295|k>>>16),k=N+(I^P^x)+A[6]+76029189&4294967295,N=I+(k<<23&4294967295|k>>>9),k=x+(N^I^P)+A[9]+3654602809&4294967295,x=N+(k<<4&4294967295|k>>>28),k=P+(x^N^I)+A[12]+3873151461&4294967295,P=x+(k<<11&4294967295|k>>>21),k=I+(P^x^N)+A[15]+530742520&4294967295,I=P+(k<<16&4294967295|k>>>16),k=N+(I^P^x)+A[2]+3299628645&4294967295,N=I+(k<<23&4294967295|k>>>9),k=x+(I^(N|~P))+A[0]+4096336452&4294967295,x=N+(k<<6&4294967295|k>>>26),k=P+(N^(x|~I))+A[7]+1126891415&4294967295,P=x+(k<<10&4294967295|k>>>22),k=I+(x^(P|~N))+A[14]+2878612391&4294967295,I=P+(k<<15&4294967295|k>>>17),k=N+(P^(I|~x))+A[5]+4237533241&4294967295,N=I+(k<<21&4294967295|k>>>11),k=x+(I^(N|~P))+A[12]+1700485571&4294967295,x=N+(k<<6&4294967295|k>>>26),k=P+(N^(x|~I))+A[3]+2399980690&4294967295,P=x+(k<<10&4294967295|k>>>22),k=I+(x^(P|~N))+A[10]+4293915773&4294967295,I=P+(k<<15&4294967295|k>>>17),k=N+(P^(I|~x))+A[1]+2240044497&4294967295,N=I+(k<<21&4294967295|k>>>11),k=x+(I^(N|~P))+A[8]+1873313359&4294967295,x=N+(k<<6&4294967295|k>>>26),k=P+(N^(x|~I))+A[15]+4264355552&4294967295,P=x+(k<<10&4294967295|k>>>22),k=I+(x^(P|~N))+A[6]+2734768916&4294967295,I=P+(k<<15&4294967295|k>>>17),k=N+(P^(I|~x))+A[13]+1309151649&4294967295,N=I+(k<<21&4294967295|k>>>11),k=x+(I^(N|~P))+A[4]+4149444226&4294967295,x=N+(k<<6&4294967295|k>>>26),k=P+(N^(x|~I))+A[11]+3174756917&4294967295,P=x+(k<<10&4294967295|k>>>22),k=I+(x^(P|~N))+A[2]+718787259&4294967295,I=P+(k<<15&4294967295|k>>>17),k=N+(P^(I|~x))+A[9]+3951481745&4294967295,S.g[0]=S.g[0]+x&4294967295,S.g[1]=S.g[1]+(I+(k<<21&4294967295|k>>>11))&4294967295,S.g[2]=S.g[2]+I&4294967295,S.g[3]=S.g[3]+P&4294967295}r.prototype.v=function(S,x){x===void 0&&(x=S.length);const N=x-this.blockSize,A=this.C;let I=this.h,P=0;for(;P>>A&255;return S};function i(S,x){var N=l;return Object.prototype.hasOwnProperty.call(N,S)?N[S]:N[S]=x(S)}function o(S,x){this.h=x;const N=[];let A=!0;for(let I=S.length-1;I>=0;I--){const P=S[I]|0;A&&P==x||(N[I]=P,A=!1)}this.g=N}var l={};function c(S){return-128<=S&&S<128?i(S,function(x){return new o([x|0],x<0?-1:0)}):new o([S|0],S<0?-1:0)}function u(S){if(isNaN(S)||!isFinite(S))return f;if(S<0)return C(u(-S));const x=[];let N=1;for(let A=0;S>=N;A++)x[A]=S/N|0,N*=4294967296;return new o(x,0)}function h(S,x){if(S.length==0)throw Error("number format error: empty string");if(x=x||10,x<2||36=0)throw Error('number format error: interior "-" character');const N=u(Math.pow(x,8));let A=f;for(let P=0;P=0?A:4294967296+A)*x,x*=4294967296}return S},t.toString=function(S){if(S=S||10,S<2||360?N.g[0]:N.h)>>>0).toString(S);if(N=I,y(N))return P+A;for(;P.length<6;)P="0"+P;A=P+A}},t.i=function(S){return S<0?0:S>>16)+(this.i(I)>>>16)+(S.i(I)>>>16);A=k>>>16,P&=65535,k&=65535,N[I]=k<<16|P}return new o(N,N[N.length-1]&-2147483648?-1:0)};function v(S,x){return S.add(C(x))}t.j=function(S){if(y(this)||y(S))return f;if(_(this))return _(S)?C(this).j(C(S)):C(C(this).j(S));if(_(S))return C(this.j(C(S)));if(this.l(p)<0&&S.l(p)<0)return u(this.m()*S.m());const x=this.g.length+S.g.length,N=[];for(var A=0;A<2*x;A++)N[A]=0;for(A=0;A>>16,k=this.i(A)&65535,B=S.i(I)>>>16,z=S.i(I)&65535;N[2*A+2*I]+=k*z,w(N,2*A+2*I),N[2*A+2*I+1]+=P*z,w(N,2*A+2*I+1),N[2*A+2*I+1]+=k*B,w(N,2*A+2*I+1),N[2*A+2*I+2]+=P*B,w(N,2*A+2*I+2)}for(S=0;S>>16,S[x]&=65535,x++}function E(S,x){this.g=S,this.h=x}function D(S,x){if(y(x))throw Error("division by zero");if(y(S))return new E(f,f);if(_(S))return x=D(C(S),x),new E(C(x.g),C(x.h));if(_(x))return x=D(S,C(x)),new E(C(x.g),x.h);if(S.g.length>30){if(_(S)||_(x))throw Error("slowDivide_ only works with positive integers.");for(var N=m,A=x;A.l(S)<=0;)N=M(N),A=M(A);var I=T(N,1),P=T(A,1);for(A=T(A,2),N=T(N,2);!y(A);){var k=P.add(A);k.l(S)<=0&&(I=I.add(N),P=k),A=T(A,1),N=T(N,1)}return x=v(S,I.j(x)),new E(I,x)}for(I=f;S.l(x)>=0;){for(N=Math.max(1,Math.floor(S.m()/x.m())),A=Math.ceil(Math.log(N)/Math.LN2),A=A<=48?1:Math.pow(2,A-48),P=u(N),k=P.j(x);_(k)||k.l(S)>0;)N-=A,P=u(N),k=P.j(x);y(P)&&(P=m),I=I.add(P),S=v(S,k)}return new E(I,S)}t.B=function(S){return D(this,S).h},t.and=function(S){const x=Math.max(this.g.length,S.g.length),N=[];for(let A=0;A>>31;return new o(N,S.h)}function T(S,x){const N=x>>5;x%=32;const A=S.g.length-N,I=[];for(let P=0;P0?S.i(P+N)>>>x|S.i(P+N+1)<<32-x:S.i(P+N);return new o(I,S.h)}r.prototype.digest=r.prototype.A,r.prototype.reset=r.prototype.u,r.prototype.update=r.prototype.v,yE=r,o.prototype.add=o.prototype.add,o.prototype.multiply=o.prototype.j,o.prototype.modulo=o.prototype.B,o.prototype.compare=o.prototype.l,o.prototype.toNumber=o.prototype.m,o.prototype.toString=o.prototype.toString,o.prototype.getBits=o.prototype.i,o.fromNumber=u,o.fromString=h,mi=o}).apply(typeof tv<"u"?tv:typeof self<"u"?self:typeof window<"u"?window:{});var uu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/** @license +Copyright The Closure Library Authors. +SPDX-License-Identifier: Apache-2.0 +*/var xE,al,vE,Du,im,wE,bE,_E;(function(){var t,e=Object.defineProperty;function n(d){d=[typeof globalThis=="object"&&globalThis,d,typeof window=="object"&&window,typeof self=="object"&&self,typeof uu=="object"&&uu];for(var g=0;gd&&AsyncContext.Snapshot.wrap(d):d=>d;function p(d){const g=d.length;if(g>0){const b=Array(g);for(let j=0;j0?(this.h--,g=this.g,this.g=g.next,g.next=null):g=this.i(),g}}function C(d){o.setTimeout(()=>{throw d},0)}function v(){var d=S;let g=null;return d.g&&(g=d.g,d.g=d.g.next,d.g||(d.h=null),g.next=null),g}class w{constructor(){this.h=this.g=null}add(g,b){const j=E.get();j.set(g,b),this.h?this.h.next=j:this.g=j,this.h=j}}var E=new _(()=>new D,d=>d.reset());class D{constructor(){this.next=this.g=this.h=null}set(g,b){this.h=g,this.g=b,this.next=null}reset(){this.next=this.g=this.h=null}}let M,T=!1,S=new w,x=()=>{const d=Promise.resolve(void 0);M=()=>{d.then(N)}};function N(){for(var d;d=v();){try{d.h.call(d.g)}catch(b){C(b)}var g=E;g.j(d),g.h<100&&(g.h++,d.next=g.g,g.g=d)}T=!1}function A(){this.u=this.u,this.C=this.C}A.prototype.u=!1,A.prototype.dispose=function(){this.u||(this.u=!0,this.N())},A.prototype[Symbol.dispose]=function(){this.dispose()},A.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()};function I(d,g){this.type=d,this.g=this.target=g,this.defaultPrevented=!1}I.prototype.h=function(){this.defaultPrevented=!0};var P=function(){if(!o.addEventListener||!Object.defineProperty)return!1;var d=!1,g=Object.defineProperty({},"passive",{get:function(){d=!0}});try{const b=()=>{};o.addEventListener("test",b,g),o.removeEventListener("test",b,g)}catch{}return d}();function k(d){return/^[\s\xa0]*$/.test(d)}function B(d,g){I.call(this,d?d.type:""),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType="",this.i=null,d&&this.init(d,g)}f(B,I),B.prototype.init=function(d,g){const b=this.type=d.type,j=d.changedTouches&&d.changedTouches.length?d.changedTouches[0]:null;this.target=d.target||d.srcElement,this.g=g,g=d.relatedTarget,g||(b=="mouseover"?g=d.fromElement:b=="mouseout"&&(g=d.toElement)),this.relatedTarget=g,j?(this.clientX=j.clientX!==void 0?j.clientX:j.pageX,this.clientY=j.clientY!==void 0?j.clientY:j.pageY,this.screenX=j.screenX||0,this.screenY=j.screenY||0):(this.clientX=d.clientX!==void 0?d.clientX:d.pageX,this.clientY=d.clientY!==void 0?d.clientY:d.pageY,this.screenX=d.screenX||0,this.screenY=d.screenY||0),this.button=d.button,this.key=d.key||"",this.ctrlKey=d.ctrlKey,this.altKey=d.altKey,this.shiftKey=d.shiftKey,this.metaKey=d.metaKey,this.pointerId=d.pointerId||0,this.pointerType=d.pointerType,this.state=d.state,this.i=d,d.defaultPrevented&&B.Z.h.call(this)},B.prototype.h=function(){B.Z.h.call(this);const d=this.i;d.preventDefault?d.preventDefault():d.returnValue=!1};var z="closure_listenable_"+(Math.random()*1e6|0),W=0;function ee(d,g,b,j,U){this.listener=d,this.proxy=null,this.src=g,this.type=b,this.capture=!!j,this.ha=U,this.key=++W,this.da=this.fa=!1}function F(d){d.da=!0,d.listener=null,d.proxy=null,d.src=null,d.ha=null}function K(d,g,b){for(const j in d)g.call(b,d[j],j,d)}function R(d,g){for(const b in d)g.call(void 0,d[b],b,d)}function ne(d){const g={};for(const b in d)g[b]=d[b];return g}const pe="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function O(d,g){let b,j;for(let U=1;U-1?(g=d[he],b||(g.fa=!1)):(g=new ee(g,this.src,q,!!j,U),g.fa=b,d.push(g)),g};function oe(d,g){const b=g.type;if(b in d.g){var j=d.g[b],U=Array.prototype.indexOf.call(j,g,void 0),q;(q=U>=0)&&Array.prototype.splice.call(j,U,1),q&&(F(g),d.g[b].length==0&&(delete d.g[b],d.h--))}}function ce(d,g,b,j){for(let U=0;U-1&&(F(g[b]),Array.prototype.splice.call(g,b,1),g.length==0&&(delete d.g[q],d.h--)))):d&&(d=xt(d))&&(g=d.g[g.toString()],d=-1,g&&(d=ce(g,b,j,U)),(b=d>-1?g[d]:null)&&yt(b))}function yt(d){if(typeof d!="number"&&d&&!d.da){var g=d.src;if(g&&g[z])oe(g.i,d);else{var b=d.type,j=d.proxy;g.removeEventListener?g.removeEventListener(b,j,d.capture):g.detachEvent?g.detachEvent(jt(b),j):g.addListener&&g.removeListener&&g.removeListener(j),(b=xt(g))?(oe(b,d),b.h==0&&(b.src=null,g[Ie]=null)):F(d)}}}function jt(d){return d in te?te[d]:te[d]="on"+d}function _n(d,g){if(d.da)d=!0;else{g=new B(g,this);const b=d.listener,j=d.ha||d.src;d.fa&&yt(d),d=b.call(j,g)}return d}function xt(d){return d=d[Ie],d instanceof Q?d:null}var tt="__closure_events_fn_"+(Math.random()*1e9>>>0);function Bn(d){return typeof d=="function"?d:(d[tt]||(d[tt]=function(g){return d.handleEvent(g)}),d[tt])}function Ue(){A.call(this),this.i=new Q(this),this.M=this,this.G=null}f(Ue,A),Ue.prototype[z]=!0,Ue.prototype.removeEventListener=function(d,g,b,j){st(this,d,g,b,j)};function vt(d,g){var b,j=d.G;if(j)for(b=[];j;j=j.G)b.push(j);if(d=d.M,j=g.type||g,typeof g=="string")g=new I(g,d);else if(g instanceof I)g.target=g.target||d;else{var U=g;g=new I(j,d),O(g,U)}U=!0;let q,he;if(b)for(he=b.length-1;he>=0;he--)q=g.g=b[he],U=Pn(q,j,!0,g)&&U;if(q=g.g=d,U=Pn(q,j,!0,g)&&U,U=Pn(q,j,!1,g)&&U,b)for(he=0;he2147483647?-1:o.setTimeout(d,g||0)}function on(d){d.g=Pt(()=>{d.g=null,d.i&&(d.i=!1,on(d))},d.l);const g=d.h;d.h=null,d.m.apply(null,g)}class fn extends A{constructor(g,b){super(),this.m=g,this.l=b,this.h=null,this.i=!1,this.g=null}j(g){this.h=arguments,this.g?this.i=!0:on(this)}N(){super.N(),this.g&&(o.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function wt(d){A.call(this),this.h=d,this.g={}}f(wt,A);var G=[];function ie(d){K(d.g,function(g,b){this.g.hasOwnProperty(b)&&yt(g)},d),d.g={}}wt.prototype.N=function(){wt.Z.N.call(this),ie(this)},wt.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var _e=o.JSON.stringify,Se=o.JSON.parse,$=class{stringify(d){return o.JSON.stringify(d,void 0)}parse(d){return o.JSON.parse(d,void 0)}};function X(){}function re(){}var de={OPEN:"a",hb:"b",ERROR:"c",tb:"d"};function Le(){I.call(this,"d")}f(Le,I);function H(){I.call(this,"c")}f(H,I);var J={},me=null;function ye(){return me=me||new Ue}J.Ia="serverreachability";function Ee(d){I.call(this,J.Ia,d)}f(Ee,I);function Ve(d){const g=ye();vt(g,new Ee(g))}J.STAT_EVENT="statevent";function Be(d,g){I.call(this,J.STAT_EVENT,d),this.stat=g}f(Be,I);function De(d){const g=ye();vt(g,new Be(g,d))}J.Ja="timingevent";function $n(d,g){I.call(this,J.Ja,d),this.size=g}f($n,I);function be(d,g){if(typeof d!="function")throw Error("Fn must not be null and must be a function");return o.setTimeout(function(){d()},g)}function Ze(){this.g=!0}Ze.prototype.ua=function(){this.g=!1};function ot(d,g,b,j,U,q){d.info(function(){if(d.g)if(q){var he="",ze=q.split("&");for(let mt=0;mt1){const an=Zt[0];Zt=Zt[1];const Br=an.split("_");he=Br.length>=2&&Br[1]=="type"?he+(an+"="+Zt+"&"):he+(an+"=redacted&")}}}else he=null;else he=q;return"XMLHTTP REQ ("+j+") [attempt "+U+"]: "+g+` +`+b+` +`+he})}function $e(d,g,b,j,U,q,he){d.info(function(){return"XMLHTTP RESP ("+j+") [ attempt "+U+"]: "+g+` +`+b+` +`+q+" "+he})}function He(d,g,b,j){d.info(function(){return"XMLHTTP TEXT ("+g+"): "+bt(d,b)+(j?" "+j:"")})}function ft(d,g){d.info(function(){return"TIMEOUT: "+g})}Ze.prototype.info=function(){};function bt(d,g){if(!d.g)return g;if(!g)return null;try{const q=JSON.parse(g);if(q){for(d=0;d0&&d.length;)b.push(d.shift()),g--;return d.length&&b.push(d.join(":")),b}function Ur(d,g,b,j){this.j=d,this.i=g,this.l=b,this.S=j||1,this.V=new wt(this),this.H=45e3,this.J=null,this.o=!1,this.u=this.B=this.A=this.M=this.F=this.T=this.D=null,this.G=[],this.g=null,this.C=0,this.m=this.v=null,this.X=-1,this.K=!1,this.P=0,this.O=null,this.W=this.L=this.U=this.R=!1,this.h=new $t}function $t(){this.i=null,this.g="",this.h=!1}var kt={},Ra={};function Da(d,g,b){d.M=1,d.A=rr(ke(g)),d.u=b,d.R=!0,ds(d,null)}function ds(d,g){d.F=Date.now(),vo(d),d.B=ke(d.A);var b=d.B,j=d.S;Array.isArray(j)||(j=[String(j)]),oy(b.i,"t",j),d.C=0,b=d.j.L,d.h=new $t,d.g=Sy(d.j,b?g:null,!d.u),d.P>0&&(d.O=new fn(u(d.Y,d,d.g),d.P)),g=d.V,b=d.g,j=d.ba;var U="readystatechange";Array.isArray(U)||(U&&(G[0]=U.toString()),U=G);for(let q=0;q0&&!this.W){this.W=!0;var he=this.j;he.g==this&&he.aa&&!he.P&&(he.j.info("Great, no buffering proxy detected. Bytes received: "+b.length),qh(he),he.P=!0,De(11))}}else He(this.i,this.l,b,null),La(this,b);ze==4&&Jt(this),this.o&&!this.K&&(ze==4?wy(this.j,this):(this.o=!1,vo(this)))}else eN(this.g),g==400&&b.indexOf("Unknown SID")>0?(this.m=3,De(12)):(this.m=0,De(13)),Jt(this),Os(this)}}}catch{}finally{}};function Ma(d){if(!jc(d))return d.g.la();const g=fy(d.g);if(g==="")return"";let b="";const j=g.length,U=zs(d.g)==4;if(!d.h.i){if(typeof TextDecoder>"u")return Jt(d),Os(d),"";d.h.i=new o.TextDecoder}for(let q=0;qg.length?Ra:(g=g.slice(j,j+b),d.C=j+b,g)))}Ur.prototype.cancel=function(){this.K=!0,Jt(this)};function vo(d){d.T=Date.now()+d.H,Rc(d,d.H)}function Rc(d,g){if(d.D!=null)throw Error("WatchDog timer not null");d.D=be(u(d.aa,d),g)}function wo(d){d.D&&(o.clearTimeout(d.D),d.D=null)}Ur.prototype.aa=function(){this.D=null;const d=Date.now();d-this.T>=0?(ft(this.i,this.B),this.M!=2&&(Ve(),De(17)),Jt(this),this.m=2,Os(this)):Rc(this,this.T-d)};function Os(d){d.j.I==0||d.K||wy(d.j,d)}function Jt(d){wo(d);var g=d.O;g&&typeof g.dispose=="function"&&g.dispose(),d.O=null,ie(d.V),d.g&&(g=d.g,d.g=null,g.abort(),g.dispose())}function La(d,g){try{var b=d.j;if(b.I!=0&&(b.g==d||Oa(b.h,d))){if(!d.L&&Oa(b.h,d)&&b.I==3){try{var j=b.Ba.g.parse(g)}catch{j=null}if(Array.isArray(j)&&j.length==3){var U=j;if(U[0]==0){e:if(!b.v){if(b.g)if(b.g.F+3e30&&(j=1.5*Us,b.O=j,b.j.info("backChannelRequestTimeoutMs_="+j)),j=b;const Bs=d.g;if(Bs){const Hc=Bs.g?Bs.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(Hc){var q=j.h;q.g||Hc.indexOf("spdy")==-1&&Hc.indexOf("quic")==-1&&Hc.indexOf("h2")==-1||(q.j=q.l,q.g=new Set,q.h&&(V(q,q.h),q.h=null))}if(j.G){const Gh=Bs.g?Bs.g.getResponseHeader("X-HTTP-Session-Id"):null;Gh&&(j.wa=Gh,nt(j.J,j.G,Gh))}}b.I=3,b.l&&b.l.ra(),b.aa&&(b.T=Date.now()-d.F,b.j.info("Handshake RTT: "+b.T+"ms")),j=b;var he=d;if(j.na=Ey(j,j.L?j.ba:null,j.W),he.L){le(j.h,he);var ze=he,Zt=j.O;Zt&&(ze.H=Zt),ze.D&&(wo(ze),vo(ze)),j.g=he}else xy(j);b.i.length>0&&Uc(b)}else mt[0]!="stop"&&mt[0]!="close"||Li(b,7);else b.I==3&&(mt[0]=="stop"||mt[0]=="close"?mt[0]=="stop"?Li(b,7):$h(b):mt[0]!="noop"&&b.l&&b.l.qa(mt),b.A=0)}}Ve(4)}catch{}}var Dc=class{constructor(d,g){this.g=d,this.map=g}};function Mc(d){this.l=d||10,o.PerformanceNavigationTiming?(d=o.performance.getEntriesByType("navigation"),d=d.length>0&&(d[0].nextHopProtocol=="hq"||d[0].nextHopProtocol=="h2")):d=!!(o.chrome&&o.chrome.loadTimes&&o.chrome.loadTimes()&&o.chrome.loadTimes().wasFetchedViaSpdy),this.j=d?this.l:1,this.g=null,this.j>1&&(this.g=new Set),this.h=null,this.i=[]}function Lc(d){return d.h?!0:d.g?d.g.size>=d.j:!1}function Oc(d){return d.h?1:d.g?d.g.size:0}function Oa(d,g){return d.h?d.h==g:d.g?d.g.has(g):!1}function V(d,g){d.g?d.g.add(g):d.h=g}function le(d,g){d.h&&d.h==g?d.h=null:d.g&&d.g.has(g)&&d.g.delete(g)}Mc.prototype.cancel=function(){if(this.i=ge(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&this.g.size!==0){for(const d of this.g.values())d.cancel();this.g.clear()}};function ge(d){if(d.h!=null)return d.i.concat(d.h.G);if(d.g!=null&&d.g.size!==0){let g=d.i;for(const b of d.g.values())g=g.concat(b.G);return g}return p(d.i)}var Ce=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function dt(d,g){if(d){d=d.split("&");for(let b=0;b=0?(U=d[b].substring(0,j),q=d[b].substring(j+1)):U=d[b],g(U,q?decodeURIComponent(q.replace(/\+/g," ")):"")}}}function at(d){this.g=this.o=this.j="",this.u=null,this.m=this.h="",this.l=!1;let g;d instanceof at?(this.l=d.l,We(this,d.j),this.o=d.o,this.g=d.g,qe(this,d.u),this.h=d.h,Hn(this,ay(d.i)),this.m=d.m):d&&(g=String(d).match(Ce))?(this.l=!1,We(this,g[1]||"",!0),this.o=sr(g[2]||""),this.g=sr(g[3]||"",!0),qe(this,g[4]),this.h=sr(g[5]||"",!0),Hn(this,g[6]||"",!0),this.m=sr(g[7]||"")):(this.l=!1,this.i=new Fa(null,this.l))}at.prototype.toString=function(){const d=[];var g=this.j;g&&d.push(hs(g,Vs,!0),":");var b=this.g;return(b||g=="file")&&(d.push("//"),(g=this.o)&&d.push(hs(g,Vs,!0),"@"),d.push(Rn(b).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),b=this.u,b!=null&&d.push(":",String(b))),(b=this.h)&&(this.g&&b.charAt(0)!="/"&&d.push("/"),d.push(hs(b,b.charAt(0)=="/"?qT:HT,!0))),(b=this.i.toString())&&d.push("?",b),(b=this.m)&&d.push("#",hs(b,WT)),d.join("")},at.prototype.resolve=function(d){const g=ke(this);let b=!!d.j;b?We(g,d.j):b=!!d.o,b?g.o=d.o:b=!!d.g,b?g.g=d.g:b=d.u!=null;var j=d.h;if(b)qe(g,d.u);else if(b=!!d.h){if(j.charAt(0)!="/")if(this.g&&!this.h)j="/"+j;else{var U=g.h.lastIndexOf("/");U!=-1&&(j=g.h.slice(0,U+1)+j)}if(U=j,U==".."||U==".")j="";else if(U.indexOf("./")!=-1||U.indexOf("/.")!=-1){j=U.lastIndexOf("/",0)==0,U=U.split("/");const q=[];for(let he=0;he1||q.length==1&&q[0]!="")&&q.pop(),j&&he==U.length&&q.push("")):(q.push(ze),j=!0)}j=q.join("/")}else j=U}return b?g.h=j:b=d.i.toString()!=="",b?Hn(g,ay(d.i)):b=!!d.m,b&&(g.m=d.m),g};function ke(d){return new at(d)}function We(d,g,b){d.j=b?sr(g,!0):g,d.j&&(d.j=d.j.replace(/:$/,""))}function qe(d,g){if(g){if(g=Number(g),isNaN(g)||g<0)throw Error("Bad port number "+g);d.u=g}else d.u=null}function Hn(d,g,b){g instanceof Fa?(d.i=g,KT(d.i,d.l)):(b||(g=hs(g,GT)),d.i=new Fa(g,d.l))}function nt(d,g,b){d.i.set(g,b)}function rr(d){return nt(d,"zx",Math.floor(Math.random()*2147483648).toString(36)+Math.abs(Math.floor(Math.random()*2147483648)^Date.now()).toString(36)),d}function sr(d,g){return d?g?decodeURI(d.replace(/%25/g,"%2525")):decodeURIComponent(d):""}function hs(d,g,b){return typeof d=="string"?(d=encodeURI(d).replace(g,Va),b&&(d=d.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),d):null}function Va(d){return d=d.charCodeAt(0),"%"+(d>>4&15).toString(16)+(d&15).toString(16)}var Vs=/[#\/\?@]/g,HT=/[#\?:]/g,qT=/[#\?]/g,GT=/[#\?@]/g,WT=/#/g;function Fa(d,g){this.h=this.g=null,this.i=d||null,this.j=!!g}function Mi(d){d.g||(d.g=new Map,d.h=0,d.i&&dt(d.i,function(g,b){d.add(decodeURIComponent(g.replace(/\+/g," ")),b)}))}t=Fa.prototype,t.add=function(d,g){Mi(this),this.i=null,d=bo(this,d);let b=this.g.get(d);return b||this.g.set(d,b=[]),b.push(g),this.h+=1,this};function ry(d,g){Mi(d),g=bo(d,g),d.g.has(g)&&(d.i=null,d.h-=d.g.get(g).length,d.g.delete(g))}function sy(d,g){return Mi(d),g=bo(d,g),d.g.has(g)}t.forEach=function(d,g){Mi(this),this.g.forEach(function(b,j){b.forEach(function(U){d.call(g,U,j,this)},this)},this)};function iy(d,g){Mi(d);let b=[];if(typeof g=="string")sy(d,g)&&(b=b.concat(d.g.get(bo(d,g))));else for(d=Array.from(d.g.values()),g=0;g0?String(d[0]):g):g};function oy(d,g,b){ry(d,g),b.length>0&&(d.i=null,d.g.set(bo(d,g),p(b)),d.h+=b.length)}t.toString=function(){if(this.i)return this.i;if(!this.g)return"";const d=[],g=Array.from(this.g.keys());for(let j=0;j{j.abort(),Fs(b,"TestPingServer: timeout",!1,g)},1e4);fetch(d,{signal:j.signal}).then(q=>{clearTimeout(U),q.ok?Fs(b,"TestPingServer: ok",!0,g):Fs(b,"TestPingServer: server error",!1,g)}).catch(()=>{clearTimeout(U),Fs(b,"TestPingServer: error",!1,g)})}function Fs(d,g,b,j,U){try{U&&(U.onload=null,U.onerror=null,U.onabort=null,U.ontimeout=null),j(b)}catch{}}function XT(){this.g=new $}function Uh(d){this.i=d.Sb||null,this.h=d.ab||!1}f(Uh,X),Uh.prototype.g=function(){return new Vc(this.i,this.h)};function Vc(d,g){Ue.call(this),this.H=d,this.o=g,this.m=void 0,this.status=this.readyState=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.A=new Headers,this.h=null,this.F="GET",this.D="",this.g=!1,this.B=this.j=this.l=null,this.v=new AbortController}f(Vc,Ue),t=Vc.prototype,t.open=function(d,g){if(this.readyState!=0)throw this.abort(),Error("Error reopening a connection");this.F=d,this.D=g,this.readyState=1,Ua(this)},t.send=function(d){if(this.readyState!=1)throw this.abort(),Error("need to call open() first. ");if(this.v.signal.aborted)throw this.abort(),Error("Request was aborted.");this.g=!0;const g={headers:this.A,method:this.F,credentials:this.m,cache:void 0,signal:this.v.signal};d&&(g.body=d),(this.H||o).fetch(new Request(this.D,g)).then(this.Pa.bind(this),this.ga.bind(this))},t.abort=function(){this.response=this.responseText="",this.A=new Headers,this.status=0,this.v.abort(),this.j&&this.j.cancel("Request was aborted.").catch(()=>{}),this.readyState>=1&&this.g&&this.readyState!=4&&(this.g=!1,za(this)),this.readyState=0},t.Pa=function(d){if(this.g&&(this.l=d,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=d.headers,this.readyState=2,Ua(this)),this.g&&(this.readyState=3,Ua(this),this.g)))if(this.responseType==="arraybuffer")d.arrayBuffer().then(this.Na.bind(this),this.ga.bind(this));else if(typeof o.ReadableStream<"u"&&"body"in d){if(this.j=d.body.getReader(),this.o){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.B=new TextDecoder;ly(this)}else d.text().then(this.Oa.bind(this),this.ga.bind(this))};function ly(d){d.j.read().then(d.Ma.bind(d)).catch(d.ga.bind(d))}t.Ma=function(d){if(this.g){if(this.o&&d.value)this.response.push(d.value);else if(!this.o){var g=d.value?d.value:new Uint8Array(0);(g=this.B.decode(g,{stream:!d.done}))&&(this.response=this.responseText+=g)}d.done?za(this):Ua(this),this.readyState==3&&ly(this)}},t.Oa=function(d){this.g&&(this.response=this.responseText=d,za(this))},t.Na=function(d){this.g&&(this.response=d,za(this))},t.ga=function(){this.g&&za(this)};function za(d){d.readyState=4,d.l=null,d.j=null,d.B=null,Ua(d)}t.setRequestHeader=function(d,g){this.A.append(d,g)},t.getResponseHeader=function(d){return this.h&&this.h.get(d.toLowerCase())||""},t.getAllResponseHeaders=function(){if(!this.h)return"";const d=[],g=this.h.entries();for(var b=g.next();!b.done;)b=b.value,d.push(b[0]+": "+b[1]),b=g.next();return d.join(`\r +`)};function Ua(d){d.onreadystatechange&&d.onreadystatechange.call(d)}Object.defineProperty(Vc.prototype,"withCredentials",{get:function(){return this.m==="include"},set:function(d){this.m=d?"include":"same-origin"}});function cy(d){let g="";return K(d,function(b,j){g+=j,g+=":",g+=b,g+=`\r +`}),g}function Bh(d,g,b){e:{for(j in b){var j=!1;break e}j=!0}j||(b=cy(b),typeof d=="string"?b!=null&&Rn(b):nt(d,g,b))}function Ft(d){Ue.call(this),this.headers=new Map,this.L=d||null,this.h=!1,this.g=null,this.D="",this.o=0,this.l="",this.j=this.B=this.v=this.A=!1,this.m=null,this.F="",this.H=!1}f(Ft,Ue);var JT=/^https?$/i,ZT=["POST","PUT"];t=Ft.prototype,t.Fa=function(d){this.H=d},t.ea=function(d,g,b,j){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+d);g=g?g.toUpperCase():"GET",this.D=d,this.l="",this.o=0,this.A=!1,this.h=!0,this.g=this.L?this.L.g():Bt.g(),this.g.onreadystatechange=m(u(this.Ca,this));try{this.B=!0,this.g.open(g,String(d),!0),this.B=!1}catch(q){uy(this,q);return}if(d=b||"",b=new Map(this.headers),j)if(Object.getPrototypeOf(j)===Object.prototype)for(var U in j)b.set(U,j[U]);else if(typeof j.keys=="function"&&typeof j.get=="function")for(const q of j.keys())b.set(q,j.get(q));else throw Error("Unknown input type for opt_headers: "+String(j));j=Array.from(b.keys()).find(q=>q.toLowerCase()=="content-type"),U=o.FormData&&d instanceof o.FormData,!(Array.prototype.indexOf.call(ZT,g,void 0)>=0)||j||U||b.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(const[q,he]of b)this.g.setRequestHeader(q,he);this.F&&(this.g.responseType=this.F),"withCredentials"in this.g&&this.g.withCredentials!==this.H&&(this.g.withCredentials=this.H);try{this.m&&(clearTimeout(this.m),this.m=null),this.v=!0,this.g.send(d),this.v=!1}catch(q){uy(this,q)}};function uy(d,g){d.h=!1,d.g&&(d.j=!0,d.g.abort(),d.j=!1),d.l=g,d.o=5,dy(d),Fc(d)}function dy(d){d.A||(d.A=!0,vt(d,"complete"),vt(d,"error"))}t.abort=function(d){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.o=d||7,vt(this,"complete"),vt(this,"abort"),Fc(this))},t.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),Fc(this,!0)),Ft.Z.N.call(this)},t.Ca=function(){this.u||(this.B||this.v||this.j?hy(this):this.Xa())},t.Xa=function(){hy(this)};function hy(d){if(d.h&&typeof i<"u"){if(d.v&&zs(d)==4)setTimeout(d.Ca.bind(d),0);else if(vt(d,"readystatechange"),zs(d)==4){d.h=!1;try{const q=d.ca();e:switch(q){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var g=!0;break e;default:g=!1}var b;if(!(b=g)){var j;if(j=q===0){let he=String(d.D).match(Ce)[1]||null;!he&&o.self&&o.self.location&&(he=o.self.location.protocol.slice(0,-1)),j=!JT.test(he?he.toLowerCase():"")}b=j}if(b)vt(d,"complete"),vt(d,"success");else{d.o=6;try{var U=zs(d)>2?d.g.statusText:""}catch{U=""}d.l=U+" ["+d.ca()+"]",dy(d)}}finally{Fc(d)}}}}function Fc(d,g){if(d.g){d.m&&(clearTimeout(d.m),d.m=null);const b=d.g;d.g=null,g||vt(d,"ready");try{b.onreadystatechange=null}catch{}}}t.isActive=function(){return!!this.g};function zs(d){return d.g?d.g.readyState:0}t.ca=function(){try{return zs(this)>2?this.g.status:-1}catch{return-1}},t.la=function(){try{return this.g?this.g.responseText:""}catch{return""}},t.La=function(d){if(this.g){var g=this.g.responseText;return d&&g.indexOf(d)==0&&(g=g.substring(d.length)),Se(g)}};function fy(d){try{if(!d.g)return null;if("response"in d.g)return d.g.response;switch(d.F){case"":case"text":return d.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in d.g)return d.g.mozResponseArrayBuffer}return null}catch{return null}}function eN(d){const g={};d=(d.g&&zs(d)>=2&&d.g.getAllResponseHeaders()||"").split(`\r +`);for(let j=0;j0&&(this.ia=d.longPollingTimeout),this.ta=void 0,this.T=0,this.P=!1,this.ja=this.B=null}t=py.prototype,t.ka=8,t.I=1,t.connect=function(d,g,b,j){De(0),this.W=d,this.H=g||{},b&&j!==void 0&&(this.H.OSID=b,this.H.OAID=j),this.F=this.X,this.J=Ey(this,null,this.W),Uc(this)};function $h(d){if(my(d),d.I==3){var g=d.V++,b=ke(d.J);if(nt(b,"SID",d.M),nt(b,"RID",g),nt(b,"TYPE","terminate"),$a(d,b),g=new Ur(d,d.j,g),g.M=2,g.A=rr(ke(b)),b=!1,o.navigator&&o.navigator.sendBeacon)try{b=o.navigator.sendBeacon(g.A.toString(),"")}catch{}!b&&o.Image&&(new Image().src=g.A,b=!0),b||(g.g=Sy(g.j,null),g.g.ea(g.A)),g.F=Date.now(),vo(g)}_y(d)}function zc(d){d.g&&(qh(d),d.g.cancel(),d.g=null)}function my(d){zc(d),d.v&&(o.clearTimeout(d.v),d.v=null),Bc(d),d.h.cancel(),d.m&&(typeof d.m=="number"&&o.clearTimeout(d.m),d.m=null)}function Uc(d){if(!Lc(d.h)&&!d.m){d.m=!0;var g=d.Ea;M||x(),T||(M(),T=!0),S.add(g,d),d.D=0}}function tN(d,g){return Oc(d.h)>=d.h.j-(d.m?1:0)?!1:d.m?(d.i=g.G.concat(d.i),!0):d.I==1||d.I==2||d.D>=(d.Sa?0:d.Ta)?!1:(d.m=be(u(d.Ea,d,g),by(d,d.D)),d.D++,!0)}t.Ea=function(d){if(this.m)if(this.m=null,this.I==1){if(!d){this.V=Math.floor(Math.random()*1e5),d=this.V++;const U=new Ur(this,this.j,d);let q=this.o;if(this.U&&(q?(q=ne(q),O(q,this.U)):q=this.U),this.u!==null||this.R||(U.J=q,q=null),this.S)e:{for(var g=0,b=0;b4096){g=b;break e}if(g===4096||b===this.i.length-1){g=b+1;break e}}g=1e3}else g=1e3;g=yy(this,U,g),b=ke(this.J),nt(b,"RID",d),nt(b,"CVER",22),this.G&&nt(b,"X-HTTP-Session-Id",this.G),$a(this,b),q&&(this.R?g="headers="+Rn(cy(q))+"&"+g:this.u&&Bh(b,this.u,q)),V(this.h,U),this.Ra&&nt(b,"TYPE","init"),this.S?(nt(b,"$req",g),nt(b,"SID","null"),U.U=!0,Da(U,b,null)):Da(U,b,g),this.I=2}}else this.I==3&&(d?gy(this,d):this.i.length==0||Lc(this.h)||gy(this))};function gy(d,g){var b;g?b=g.l:b=d.V++;const j=ke(d.J);nt(j,"SID",d.M),nt(j,"RID",b),nt(j,"AID",d.K),$a(d,j),d.u&&d.o&&Bh(j,d.u,d.o),b=new Ur(d,d.j,b,d.D+1),d.u===null&&(b.J=d.o),g&&(d.i=g.G.concat(d.i)),g=yy(d,b,1e3),b.H=Math.round(d.va*.5)+Math.round(d.va*.5*Math.random()),V(d.h,b),Da(b,j,g)}function $a(d,g){d.H&&K(d.H,function(b,j){nt(g,j,b)}),d.l&&K({},function(b,j){nt(g,j,b)})}function yy(d,g,b){b=Math.min(d.i.length,b);const j=d.l?u(d.l.Ka,d.l,d):null;e:{var U=d.i;let ze=-1;for(;;){const Zt=["count="+b];ze==-1?b>0?(ze=U[0].g,Zt.push("ofs="+ze)):ze=0:Zt.push("ofs="+ze);let mt=!0;for(let an=0;an=3?!1:(d.Y++,d.v=be(u(d.Da,d),by(d,d.A)),d.A++,!0)}t.Da=function(){if(this.v=null,vy(this),this.aa&&!(this.P||this.g==null||this.T<=0)){var d=4*this.T;this.j.info("BP detection timer enabled: "+d),this.B=be(u(this.Wa,this),d)}},t.Wa=function(){this.B&&(this.B=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.F=!1,this.P=!0,De(10),zc(this),vy(this))};function qh(d){d.B!=null&&(o.clearTimeout(d.B),d.B=null)}function vy(d){d.g=new Ur(d,d.j,"rpc",d.Y),d.u===null&&(d.g.J=d.o),d.g.P=0;var g=ke(d.na);nt(g,"RID","rpc"),nt(g,"SID",d.M),nt(g,"AID",d.K),nt(g,"CI",d.F?"0":"1"),!d.F&&d.ia&&nt(g,"TO",d.ia),nt(g,"TYPE","xmlhttp"),$a(d,g),d.u&&d.o&&Bh(g,d.u,d.o),d.O&&(d.g.H=d.O);var b=d.g;d=d.ba,b.M=1,b.A=rr(ke(g)),b.u=null,b.R=!0,ds(b,d)}t.Va=function(){this.C!=null&&(this.C=null,zc(this),Hh(this),De(19))};function Bc(d){d.C!=null&&(o.clearTimeout(d.C),d.C=null)}function wy(d,g){var b=null;if(d.g==g){Bc(d),qh(d),d.g=null;var j=2}else if(Oa(d.h,g))b=g.G,le(d.h,g),j=1;else return;if(d.I!=0){if(g.o)if(j==1){b=g.u?g.u.length:0,g=Date.now()-g.F;var U=d.D;j=ye(),vt(j,new $n(j,b)),Uc(d)}else xy(d);else if(U=g.m,U==3||U==0&&g.X>0||!(j==1&&tN(d,g)||j==2&&Hh(d)))switch(b&&b.length>0&&(g=d.h,g.i=g.i.concat(b)),U){case 1:Li(d,5);break;case 4:Li(d,10);break;case 3:Li(d,6);break;default:Li(d,2)}}}function by(d,g){let b=d.Qa+Math.floor(Math.random()*d.Za);return d.isActive()||(b*=2),b*g}function Li(d,g){if(d.j.info("Error code "+g),g==2){var b=u(d.bb,d),j=d.Ua;const U=!j;j=new at(j||"//www.google.com/images/cleardot.gif"),o.location&&o.location.protocol=="http"||We(j,"https"),rr(j),U?QT(j.toString(),b):YT(j.toString(),b)}else De(2);d.I=0,d.l&&d.l.pa(g),_y(d),my(d)}t.bb=function(d){d?(this.j.info("Successfully pinged google.com"),De(2)):(this.j.info("Failed to ping google.com"),De(1))};function _y(d){if(d.I=0,d.ja=[],d.l){const g=ge(d.h);(g.length!=0||d.i.length!=0)&&(y(d.ja,g),y(d.ja,d.i),d.h.i.length=0,p(d.i),d.i.length=0),d.l.oa()}}function Ey(d,g,b){var j=b instanceof at?ke(b):new at(b);if(j.g!="")g&&(j.g=g+"."+j.g),qe(j,j.u);else{var U=o.location;j=U.protocol,g=g?g+"."+U.hostname:U.hostname,U=+U.port;const q=new at(null);j&&We(q,j),g&&(q.g=g),U&&qe(q,U),b&&(q.h=b),j=q}return b=d.G,g=d.wa,b&&g&&nt(j,b,g),nt(j,"VER",d.ka),$a(d,j),j}function Sy(d,g,b){if(g&&!d.L)throw Error("Can't create secondary domain capable XhrIo object.");return g=d.Aa&&!d.ma?new Ft(new Uh({ab:b})):new Ft(d.ma),g.Fa(d.L),g}t.isActive=function(){return!!this.l&&this.l.isActive(this)};function Ty(){}t=Ty.prototype,t.ra=function(){},t.qa=function(){},t.pa=function(){},t.oa=function(){},t.isActive=function(){return!0},t.Ka=function(){};function $c(){}$c.prototype.g=function(d,g){return new ir(d,g)};function ir(d,g){Ue.call(this),this.g=new py(g),this.l=d,this.h=g&&g.messageUrlParams||null,d=g&&g.messageHeaders||null,g&&g.clientProtocolHeaderRequired&&(d?d["X-Client-Protocol"]="webchannel":d={"X-Client-Protocol":"webchannel"}),this.g.o=d,d=g&&g.initMessageHeaders||null,g&&g.messageContentType&&(d?d["X-WebChannel-Content-Type"]=g.messageContentType:d={"X-WebChannel-Content-Type":g.messageContentType}),g&&g.sa&&(d?d["X-WebChannel-Client-Profile"]=g.sa:d={"X-WebChannel-Client-Profile":g.sa}),this.g.U=d,(d=g&&g.Qb)&&!k(d)&&(this.g.u=d),this.A=g&&g.supportsCrossDomainXhr||!1,this.v=g&&g.sendRawJson||!1,(g=g&&g.httpSessionIdParam)&&!k(g)&&(this.g.G=g,d=this.h,d!==null&&g in d&&(d=this.h,g in d&&delete d[g])),this.j=new _o(this)}f(ir,Ue),ir.prototype.m=function(){this.g.l=this.j,this.A&&(this.g.L=!0),this.g.connect(this.l,this.h||void 0)},ir.prototype.close=function(){$h(this.g)},ir.prototype.o=function(d){var g=this.g;if(typeof d=="string"){var b={};b.__data__=d,d=b}else this.v&&(b={},b.__data__=_e(d),d=b);g.i.push(new Dc(g.Ya++,d)),g.I==3&&Uc(g)},ir.prototype.N=function(){this.g.l=null,delete this.j,$h(this.g),delete this.g,ir.Z.N.call(this)};function Ny(d){Le.call(this),d.__headers__&&(this.headers=d.__headers__,this.statusCode=d.__status__,delete d.__headers__,delete d.__status__);var g=d.__sm__;if(g){e:{for(const b in g){d=b;break e}d=void 0}(this.i=d)&&(d=this.i,g=g!==null&&d in g?g[d]:void 0),this.data=g}else this.data=d}f(Ny,Le);function ky(){H.call(this),this.status=1}f(ky,H);function _o(d){this.g=d}f(_o,Ty),_o.prototype.ra=function(){vt(this.g,"a")},_o.prototype.qa=function(d){vt(this.g,new Ny(d))},_o.prototype.pa=function(d){vt(this.g,new ky)},_o.prototype.oa=function(){vt(this.g,"b")},$c.prototype.createWebChannel=$c.prototype.g,ir.prototype.send=ir.prototype.o,ir.prototype.open=ir.prototype.m,ir.prototype.close=ir.prototype.close,_E=function(){return new $c},bE=function(){return ye()},wE=J,im={jb:0,mb:1,nb:2,Hb:3,Mb:4,Jb:5,Kb:6,Ib:7,Gb:8,Lb:9,PROXY:10,NOPROXY:11,Eb:12,Ab:13,Bb:14,zb:15,Cb:16,Db:17,fb:18,eb:19,gb:20},ct.NO_ERROR=0,ct.TIMEOUT=8,ct.HTTP_ERROR=6,Du=ct,Ge.COMPLETE="complete",vE=Ge,re.EventType=de,de.OPEN="a",de.CLOSE="b",de.ERROR="c",de.MESSAGE="d",Ue.prototype.listen=Ue.prototype.J,al=re,Ft.prototype.listenOnce=Ft.prototype.K,Ft.prototype.getLastError=Ft.prototype.Ha,Ft.prototype.getLastErrorCode=Ft.prototype.ya,Ft.prototype.getStatus=Ft.prototype.ca,Ft.prototype.getResponseJson=Ft.prototype.La,Ft.prototype.getResponseText=Ft.prototype.la,Ft.prototype.send=Ft.prototype.ea,Ft.prototype.setWithCredentials=Ft.prototype.Fa,xE=Ft}).apply(typeof uu<"u"?uu:typeof self<"u"?self:typeof window<"u"?window:{});/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Nn{constructor(e){this.uid=e}isAuthenticated(){return this.uid!=null}toKey(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}isEqual(e){return e.uid===this.uid}}Nn.UNAUTHENTICATED=new Nn(null),Nn.GOOGLE_CREDENTIALS=new Nn("google-credentials-uid"),Nn.FIRST_PARTY=new Nn("first-party-uid"),Nn.MOCK_USER=new Nn("mock-user");/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */let Ta="12.11.0";function jA(t){Ta=t}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *//** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const io=new zg("@firebase/firestore");function No(){return io.logLevel}function xe(t,...e){if(io.logLevel<=Ye.DEBUG){const n=e.map($g);io.debug(`Firestore (${Ta}): ${t}`,...n)}}function As(t,...e){if(io.logLevel<=Ye.ERROR){const n=e.map($g);io.error(`Firestore (${Ta}): ${t}`,...n)}}function oo(t,...e){if(io.logLevel<=Ye.WARN){const n=e.map($g);io.warn(`Firestore (${Ta}): ${t}`,...n)}}function $g(t){if(typeof t=="string")return t;try{return function(n){return JSON.stringify(n)}(t)}catch{return t}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Ae(t,e,n){let r="Unexpected state";typeof e=="string"?r=e:n=e,EE(t,r,n)}function EE(t,e,n){let r=`FIRESTORE (${Ta}) INTERNAL ASSERTION FAILED: ${e} (ID: ${t.toString(16)})`;if(n!==void 0)try{r+=" CONTEXT: "+JSON.stringify(n)}catch{r+=" CONTEXT: "+n}throw As(r),new Error(r)}function ut(t,e,n,r){let s="Unexpected state";typeof n=="string"?s=n:r=n,t||EE(e,s,r)}function Oe(t,e){return t}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Y={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENTED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"};class fe extends cs{constructor(e,n){super(e,n),this.code=e,this.message=n,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Es{constructor(){this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class SE{constructor(e,n){this.user=n,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}}class PA{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,n){e.enqueueRetryable(()=>n(Nn.UNAUTHENTICATED))}shutdown(){}}class RA{constructor(e){this.token=e,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(e,n){this.changeListener=n,e.enqueueRetryable(()=>n(this.token.user))}shutdown(){this.changeListener=null}}class DA{constructor(e){this.t=e,this.currentUser=Nn.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,n){ut(this.o===void 0,42304);let r=this.i;const s=c=>this.i!==r?(r=this.i,n(c)):Promise.resolve();let i=new Es;this.o=()=>{this.i++,this.currentUser=this.u(),i.resolve(),i=new Es,e.enqueueRetryable(()=>s(this.currentUser))};const o=()=>{const c=i;e.enqueueRetryable(async()=>{await c.promise,await s(this.currentUser)})},l=c=>{xe("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=c,this.o&&(this.auth.addAuthTokenListener(this.o),o())};this.t.onInit(c=>l(c)),setTimeout(()=>{if(!this.auth){const c=this.t.getImmediate({optional:!0});c?l(c):(xe("FirebaseAuthCredentialsProvider","Auth not yet detected"),i.resolve(),i=new Es)}},0),o()}getToken(){const e=this.i,n=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(n).then(r=>this.i!==e?(xe("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):r?(ut(typeof r.accessToken=="string",31837,{l:r}),new SE(r.accessToken,this.currentUser)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.o&&this.auth.removeAuthTokenListener(this.o),this.o=void 0}u(){const e=this.auth&&this.auth.getUid();return ut(e===null||typeof e=="string",2055,{h:e}),new Nn(e)}}class MA{constructor(e,n,r){this.P=e,this.T=n,this.I=r,this.type="FirstParty",this.user=Nn.FIRST_PARTY,this.R=new Map}A(){return this.I?this.I():null}get headers(){this.R.set("X-Goog-AuthUser",this.P);const e=this.A();return e&&this.R.set("Authorization",e),this.T&&this.R.set("X-Goog-Iam-Authorization-Token",this.T),this.R}}class LA{constructor(e,n,r){this.P=e,this.T=n,this.I=r}getToken(){return Promise.resolve(new MA(this.P,this.T,this.I))}start(e,n){e.enqueueRetryable(()=>n(Nn.FIRST_PARTY))}shutdown(){}invalidateToken(){}}class nv{constructor(e){this.value=e,this.type="AppCheck",this.headers=new Map,e&&e.length>0&&this.headers.set("x-firebase-appcheck",this.value)}}class OA{constructor(e,n){this.V=n,this.forceRefresh=!1,this.appCheck=null,this.m=null,this.p=null,Rr(e)&&e.settings.appCheckToken&&(this.p=e.settings.appCheckToken)}start(e,n){ut(this.o===void 0,3512);const r=i=>{i.error!=null&&xe("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${i.error.message}`);const o=i.token!==this.m;return this.m=i.token,xe("FirebaseAppCheckTokenProvider",`Received ${o?"new":"existing"} token.`),o?n(i.token):Promise.resolve()};this.o=i=>{e.enqueueRetryable(()=>r(i))};const s=i=>{xe("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=i,this.o&&this.appCheck.addTokenListener(this.o)};this.V.onInit(i=>s(i)),setTimeout(()=>{if(!this.appCheck){const i=this.V.getImmediate({optional:!0});i?s(i):xe("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}},0)}getToken(){if(this.p)return Promise.resolve(new nv(this.p));const e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then(n=>n?(ut(typeof n.token=="string",44558,{tokenResult:n}),this.m=n.token,new nv(n.token)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.o&&this.appCheck.removeTokenListener(this.o),this.o=void 0}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function VA(t){const e=typeof self<"u"&&(self.crypto||self.msCrypto),n=new Uint8Array(t);if(e&&typeof e.getRandomValues=="function")e.getRandomValues(n);else for(let r=0;re?1:0}function om(t,e){const n=Math.min(t.length,e.length);for(let r=0;r=FA&&e<=zA}function pa(t,e,n){return t.length===e.length&&t.every((r,s)=>n(r,e[s]))}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const rv="__name__";class Wr{constructor(e,n,r){n===void 0?n=0:n>e.length&&Ae(637,{offset:n,range:e.length}),r===void 0?r=e.length-n:r>e.length-n&&Ae(1746,{length:r,range:e.length-n}),this.segments=e,this.offset=n,this.len=r}get length(){return this.len}isEqual(e){return Wr.comparator(this,e)===0}child(e){const n=this.segments.slice(this.offset,this.limit());return e instanceof Wr?e.forEach(r=>{n.push(r)}):n.push(e),this.construct(n)}limit(){return this.offset+this.length}popFirst(e){return e=e===void 0?1:e,this.construct(this.segments,this.offset+e,this.length-e)}popLast(){return this.construct(this.segments,this.offset,this.length-1)}firstSegment(){return this.segments[this.offset]}lastSegment(){return this.get(this.length-1)}get(e){return this.segments[this.offset+e]}isEmpty(){return this.length===0}isPrefixOf(e){if(e.length=0)throw new fe(Y.INVALID_ARGUMENT,`Invalid segment (${r}). Paths must not contain // in them.`);n.push(...r.split("/").filter(s=>s.length>0))}return new Et(n)}static emptyPath(){return new Et([])}}const UA=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class yn extends Wr{construct(e,n,r){return new yn(e,n,r)}static isValidIdentifier(e){return UA.test(e)}canonicalString(){return this.toArray().map(e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),yn.isValidIdentifier(e)||(e="`"+e+"`"),e)).join(".")}toString(){return this.canonicalString()}isKeyField(){return this.length===1&&this.get(0)===rv}static keyField(){return new yn([rv])}static fromServerFormat(e){const n=[];let r="",s=0;const i=()=>{if(r.length===0)throw new fe(Y.INVALID_ARGUMENT,`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);n.push(r),r=""};let o=!1;for(;s=2&&this.path.get(this.path.length-2)===e}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(e){return e!==null&&Et.comparator(this.path,e.path)===0}toString(){return this.path.toString()}static comparator(e,n){return Et.comparator(e.path,n.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new Ne(new Et(e.slice()))}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function TE(t,e,n){if(!n)throw new fe(Y.INVALID_ARGUMENT,`Function ${t}() cannot be called with an empty ${e}.`)}function BA(t,e,n,r){if(e===!0&&r===!0)throw new fe(Y.INVALID_ARGUMENT,`${t} and ${n} cannot be used together.`)}function sv(t){if(!Ne.isDocumentKey(t))throw new fe(Y.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`)}function iv(t){if(Ne.isDocumentKey(t))throw new fe(Y.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`)}function NE(t){return typeof t=="object"&&t!==null&&(Object.getPrototypeOf(t)===Object.prototype||Object.getPrototypeOf(t)===null)}function mh(t){if(t===void 0)return"undefined";if(t===null)return"null";if(typeof t=="string")return t.length>20&&(t=`${t.substring(0,20)}...`),JSON.stringify(t);if(typeof t=="number"||typeof t=="boolean")return""+t;if(typeof t=="object"){if(t instanceof Array)return"an array";{const e=function(r){return r.constructor?r.constructor.name:null}(t);return e?`a custom ${e} object`:"an object"}}return typeof t=="function"?"a function":Ae(12329,{type:typeof t})}function Ln(t,e){if("_delegate"in t&&(t=t._delegate),!(t instanceof e)){if(e.name===t.constructor.name)throw new fe(Y.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const n=mh(t);throw new fe(Y.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${n}`)}}return t}/** + * @license + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Xt(t,e){const n={typeString:t};return e&&(n.value=e),n}function mc(t,e){if(!NE(t))throw new fe(Y.INVALID_ARGUMENT,"JSON must be an object");let n;for(const r in e)if(e[r]){const s=e[r].typeString,i="value"in e[r]?{value:e[r].value}:void 0;if(!(r in t)){n=`JSON missing required field: '${r}'`;break}const o=t[r];if(s&&typeof o!==s){n=`JSON field '${r}' must be a ${s}.`;break}if(i!==void 0&&o!==i.value){n=`Expected '${r}' field to equal '${i.value}'`;break}}if(n)throw new fe(Y.INVALID_ARGUMENT,n);return!0}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const ov=-62135596800,av=1e6;class Ke{static now(){return Ke.fromMillis(Date.now())}static fromDate(e){return Ke.fromMillis(e.getTime())}static fromMillis(e){const n=Math.floor(e/1e3),r=Math.floor((e-1e3*n)*av);return new Ke(n,r)}constructor(e,n){if(this.seconds=e,this.nanoseconds=n,n<0)throw new fe(Y.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+n);if(n>=1e9)throw new fe(Y.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+n);if(e=253402300800)throw new fe(Y.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/av}_compareTo(e){return this.seconds===e.seconds?Xe(this.nanoseconds,e.nanoseconds):Xe(this.seconds,e.seconds)}isEqual(e){return e.seconds===this.seconds&&e.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{type:Ke._jsonSchemaVersion,seconds:this.seconds,nanoseconds:this.nanoseconds}}static fromJSON(e){if(mc(e,Ke._jsonSchema))return new Ke(e.seconds,e.nanoseconds)}valueOf(){const e=this.seconds-ov;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}Ke._jsonSchemaVersion="firestore/timestamp/1.0",Ke._jsonSchema={type:Xt("string",Ke._jsonSchemaVersion),seconds:Xt("number"),nanoseconds:Xt("number")};/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Me{static fromTimestamp(e){return new Me(e)}static min(){return new Me(new Ke(0,0))}static max(){return new Me(new Ke(253402300799,999999999))}constructor(e){this.timestamp=e}compareTo(e){return this.timestamp._compareTo(e.timestamp)}isEqual(e){return this.timestamp.isEqual(e.timestamp)}toMicroseconds(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}toString(){return"SnapshotVersion("+this.timestamp.toString()+")"}toTimestamp(){return this.timestamp}}/** + * @license + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Wl=-1;function $A(t,e){const n=t.toTimestamp().seconds,r=t.toTimestamp().nanoseconds+1,s=Me.fromTimestamp(r===1e9?new Ke(n+1,0):new Ke(n,r));return new wi(s,Ne.empty(),e)}function HA(t){return new wi(t.readTime,t.key,Wl)}class wi{constructor(e,n,r){this.readTime=e,this.documentKey=n,this.largestBatchId=r}static min(){return new wi(Me.min(),Ne.empty(),Wl)}static max(){return new wi(Me.max(),Ne.empty(),Wl)}}function qA(t,e){let n=t.readTime.compareTo(e.readTime);return n!==0?n:(n=Ne.comparator(t.documentKey,e.documentKey),n!==0?n:Xe(t.largestBatchId,e.largestBatchId))}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const GA="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.";class WA{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach(e=>e())}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function Na(t){if(t.code!==Y.FAILED_PRECONDITION||t.message!==GA)throw t;xe("LocalStore","Unexpectedly lost primary lease")}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Z{constructor(e){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,e(n=>{this.isDone=!0,this.result=n,this.nextCallback&&this.nextCallback(n)},n=>{this.isDone=!0,this.error=n,this.catchCallback&&this.catchCallback(n)})}catch(e){return this.next(void 0,e)}next(e,n){return this.callbackAttached&&Ae(59440),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(n,this.error):this.wrapSuccess(e,this.result):new Z((r,s)=>{this.nextCallback=i=>{this.wrapSuccess(e,i).next(r,s)},this.catchCallback=i=>{this.wrapFailure(n,i).next(r,s)}})}toPromise(){return new Promise((e,n)=>{this.next(e,n)})}wrapUserFunction(e){try{const n=e();return n instanceof Z?n:Z.resolve(n)}catch(n){return Z.reject(n)}}wrapSuccess(e,n){return e?this.wrapUserFunction(()=>e(n)):Z.resolve(n)}wrapFailure(e,n){return e?this.wrapUserFunction(()=>e(n)):Z.reject(n)}static resolve(e){return new Z((n,r)=>{n(e)})}static reject(e){return new Z((n,r)=>{r(e)})}static waitFor(e){return new Z((n,r)=>{let s=0,i=0,o=!1;e.forEach(l=>{++s,l.next(()=>{++i,o&&i===s&&n()},c=>r(c))}),o=!0,i===s&&n()})}static or(e){let n=Z.resolve(!1);for(const r of e)n=n.next(s=>s?Z.resolve(s):r());return n}static forEach(e,n){const r=[];return e.forEach((s,i)=>{r.push(n.call(this,s,i))}),this.waitFor(r)}static mapArray(e,n){return new Z((r,s)=>{const i=e.length,o=new Array(i);let l=0;for(let c=0;c{o[u]=h,++l,l===i&&r(o)},h=>s(h))}})}static doWhile(e,n){return new Z((r,s)=>{const i=()=>{e()===!0?n().next(()=>{i()},s):r()};i()})}}function KA(t){const e=t.match(/Android ([\d.]+)/i),n=e?e[1].split(".").slice(0,2).join("."):"-1";return Number(n)}function ka(t){return t.name==="IndexedDbTransactionError"}/** + * @license + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class gh{constructor(e,n){this.previousValue=e,n&&(n.sequenceNumberHandler=r=>this.ae(r),this.ue=r=>n.writeSequenceNumber(r))}ae(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){const e=++this.previousValue;return this.ue&&this.ue(e),e}}gh.ce=-1;/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const qg=-1;function yh(t){return t==null}function _d(t){return t===0&&1/t==-1/0}function QA(t){return typeof t=="number"&&Number.isInteger(t)&&!_d(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const kE="";function YA(t){let e="";for(let n=0;n0&&(e=lv(e)),e=XA(t.get(n),e);return lv(e)}function XA(t,e){let n=e;const r=t.length;for(let s=0;s0&&(n=n.right)}return null}indexOf(e){let n=0,r=this.root;for(;!r.isEmpty();){const s=this.comparator(e,r.key);if(s===0)return n+r.left.size;s<0?r=r.left:(n+=r.left.size+1,r=r.right)}return-1}isEmpty(){return this.root.isEmpty()}get size(){return this.root.size}minKey(){return this.root.minKey()}maxKey(){return this.root.maxKey()}inorderTraversal(e){return this.root.inorderTraversal(e)}forEach(e){this.inorderTraversal((n,r)=>(e(n,r),!1))}toString(){const e=[];return this.inorderTraversal((n,r)=>(e.push(`${n}:${r}`),!1)),`{${e.join(", ")}}`}reverseTraversal(e){return this.root.reverseTraversal(e)}getIterator(){return new du(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new du(this.root,e,this.comparator,!1)}getReverseIterator(){return new du(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new du(this.root,e,this.comparator,!0)}}class du{constructor(e,n,r,s){this.isReverse=s,this.nodeStack=[];let i=1;for(;!e.isEmpty();)if(i=n?r(e.key,n):1,n&&s&&(i*=-1),i<0)e=this.isReverse?e.left:e.right;else{if(i===0){this.nodeStack.push(e);break}this.nodeStack.push(e),e=this.isReverse?e.right:e.left}}getNext(){let e=this.nodeStack.pop();const n={key:e.key,value:e.value};if(this.isReverse)for(e=e.left;!e.isEmpty();)this.nodeStack.push(e),e=e.right;else for(e=e.right;!e.isEmpty();)this.nodeStack.push(e),e=e.left;return n}hasNext(){return this.nodeStack.length>0}peek(){if(this.nodeStack.length===0)return null;const e=this.nodeStack[this.nodeStack.length-1];return{key:e.key,value:e.value}}}class gn{constructor(e,n,r,s,i){this.key=e,this.value=n,this.color=r??gn.RED,this.left=s??gn.EMPTY,this.right=i??gn.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,n,r,s,i){return new gn(e??this.key,n??this.value,r??this.color,s??this.left,i??this.right)}isEmpty(){return!1}inorderTraversal(e){return this.left.inorderTraversal(e)||e(this.key,this.value)||this.right.inorderTraversal(e)}reverseTraversal(e){return this.right.reverseTraversal(e)||e(this.key,this.value)||this.left.reverseTraversal(e)}min(){return this.left.isEmpty()?this:this.left.min()}minKey(){return this.min().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(e,n,r){let s=this;const i=r(e,s.key);return s=i<0?s.copy(null,null,null,s.left.insert(e,n,r),null):i===0?s.copy(null,n,null,null,null):s.copy(null,null,null,null,s.right.insert(e,n,r)),s.fixUp()}removeMin(){if(this.left.isEmpty())return gn.EMPTY;let e=this;return e.left.isRed()||e.left.left.isRed()||(e=e.moveRedLeft()),e=e.copy(null,null,null,e.left.removeMin(),null),e.fixUp()}remove(e,n){let r,s=this;if(n(e,s.key)<0)s.left.isEmpty()||s.left.isRed()||s.left.left.isRed()||(s=s.moveRedLeft()),s=s.copy(null,null,null,s.left.remove(e,n),null);else{if(s.left.isRed()&&(s=s.rotateRight()),s.right.isEmpty()||s.right.isRed()||s.right.left.isRed()||(s=s.moveRedRight()),n(e,s.key)===0){if(s.right.isEmpty())return gn.EMPTY;r=s.right.min(),s=s.copy(r.key,r.value,null,null,s.right.removeMin())}s=s.copy(null,null,null,null,s.right.remove(e,n))}return s.fixUp()}isRed(){return this.color}fixUp(){let e=this;return e.right.isRed()&&!e.left.isRed()&&(e=e.rotateLeft()),e.left.isRed()&&e.left.left.isRed()&&(e=e.rotateRight()),e.left.isRed()&&e.right.isRed()&&(e=e.colorFlip()),e}moveRedLeft(){let e=this.colorFlip();return e.right.left.isRed()&&(e=e.copy(null,null,null,null,e.right.rotateRight()),e=e.rotateLeft(),e=e.colorFlip()),e}moveRedRight(){let e=this.colorFlip();return e.left.left.isRed()&&(e=e.rotateRight(),e=e.colorFlip()),e}rotateLeft(){const e=this.copy(null,null,gn.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){const e=this.copy(null,null,gn.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)}colorFlip(){const e=this.left.copy(null,null,!this.left.color,null,null),n=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,n)}checkMaxDepth(){const e=this.check();return Math.pow(2,e)<=this.size+1}check(){if(this.isRed()&&this.left.isRed())throw Ae(43730,{key:this.key,value:this.value});if(this.right.isRed())throw Ae(14113,{key:this.key,value:this.value});const e=this.left.check();if(e!==this.right.check())throw Ae(27949);return e+(this.isRed()?0:1)}}gn.EMPTY=null,gn.RED=!0,gn.BLACK=!1;gn.EMPTY=new class{constructor(){this.size=0}get key(){throw Ae(57766)}get value(){throw Ae(16141)}get color(){throw Ae(16727)}get left(){throw Ae(29726)}get right(){throw Ae(36894)}copy(e,n,r,s,i){return this}insert(e,n,r){return new gn(e,n)}remove(e,n){return this}isEmpty(){return!0}inorderTraversal(e){return!1}reverseTraversal(e){return!1}minKey(){return null}maxKey(){return null}isRed(){return!1}checkMaxDepth(){return!0}check(){return 0}};/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class rn{constructor(e){this.comparator=e,this.data=new Ot(this.comparator)}has(e){return this.data.get(e)!==null}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(e){return this.data.indexOf(e)}forEach(e){this.data.inorderTraversal((n,r)=>(e(n),!1))}forEachInRange(e,n){const r=this.data.getIteratorFrom(e[0]);for(;r.hasNext();){const s=r.getNext();if(this.comparator(s.key,e[1])>=0)return;n(s.key)}}forEachWhile(e,n){let r;for(r=n!==void 0?this.data.getIteratorFrom(n):this.data.getIterator();r.hasNext();)if(!e(r.getNext().key))return}firstAfterOrEqual(e){const n=this.data.getIteratorFrom(e);return n.hasNext()?n.getNext().key:null}getIterator(){return new uv(this.data.getIterator())}getIteratorFrom(e){return new uv(this.data.getIteratorFrom(e))}add(e){return this.copy(this.data.remove(e).insert(e,!0))}delete(e){return this.has(e)?this.copy(this.data.remove(e)):this}isEmpty(){return this.data.isEmpty()}unionWith(e){let n=this;return n.size{n=n.add(r)}),n}isEqual(e){if(!(e instanceof rn)||this.size!==e.size)return!1;const n=this.data.getIterator(),r=e.data.getIterator();for(;n.hasNext();){const s=n.getNext().key,i=r.getNext().key;if(this.comparator(s,i)!==0)return!1}return!0}toArray(){const e=[];return this.forEach(n=>{e.push(n)}),e}toString(){const e=[];return this.forEach(n=>e.push(n)),"SortedSet("+e.toString()+")"}copy(e){const n=new rn(this.comparator);return n.data=e,n}}class uv{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class ur{constructor(e){this.fields=e,e.sort(yn.comparator)}static empty(){return new ur([])}unionWith(e){let n=new rn(yn.comparator);for(const r of this.fields)n=n.add(r);for(const r of e)n=n.add(r);return new ur(n.toArray())}covers(e){for(const n of this.fields)if(n.isPrefixOf(e))return!0;return!1}isEqual(e){return pa(this.fields,e.fields,(n,r)=>n.isEqual(r))}}/** + * @license + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class CE extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class wn{constructor(e){this.binaryString=e}static fromBase64String(e){const n=function(s){try{return atob(s)}catch(i){throw typeof DOMException<"u"&&i instanceof DOMException?new CE("Invalid base64 string: "+i):i}}(e);return new wn(n)}static fromUint8Array(e){const n=function(s){let i="";for(let o=0;oeis(n,e))!==void 0}function ma(t,e){if(t===e)return 0;const n=Ei(t),r=Ei(e);if(n!==r)return Xe(n,r);switch(n){case 0:case 9007199254740991:return 0;case 1:return Xe(t.booleanValue,e.booleanValue);case 2:return function(i,o){const l=Ht(i.integerValue||i.doubleValue),c=Ht(o.integerValue||o.doubleValue);return lc?1:l===c?0:isNaN(l)?isNaN(c)?0:-1:1}(t,e);case 3:return dv(t.timestampValue,e.timestampValue);case 4:return dv(Kl(t),Kl(e));case 5:return om(t.stringValue,e.stringValue);case 6:return function(i,o){const l=_i(i),c=_i(o);return l.compareTo(c)}(t.bytesValue,e.bytesValue);case 7:return function(i,o){const l=i.split("/"),c=o.split("/");for(let u=0;us+Mu(i),0)}(t.arrayValue);case 10:case 11:return function(r){let s=0;return Ai(r.fields,(i,o)=>{s+=i.length+Mu(o)}),s}(t.mapValue);default:throw Ae(13486,{value:t})}}function fv(t,e){return{referenceValue:`projects/${t.projectId}/databases/${t.database}/documents/${e.path.canonicalString()}`}}function lm(t){return!!t&&"integerValue"in t}function Wg(t){return!!t&&"arrayValue"in t}function pv(t){return!!t&&"nullValue"in t}function mv(t){return!!t&&"doubleValue"in t&&isNaN(Number(t.doubleValue))}function Lu(t){return!!t&&"mapValue"in t}function nj(t){var n,r;return((r=(((n=t==null?void 0:t.mapValue)==null?void 0:n.fields)||{})[DE])==null?void 0:r.stringValue)===ME}function wl(t){if(t.geoPointValue)return{geoPointValue:{...t.geoPointValue}};if(t.timestampValue&&typeof t.timestampValue=="object")return{timestampValue:{...t.timestampValue}};if(t.mapValue){const e={mapValue:{fields:{}}};return Ai(t.mapValue.fields,(n,r)=>e.mapValue.fields[n]=wl(r)),e}if(t.arrayValue){const e={arrayValue:{values:[]}};for(let n=0;n<(t.arrayValue.values||[]).length;++n)e.arrayValue.values[n]=wl(t.arrayValue.values[n]);return e}return{...t}}function rj(t){return(((t.mapValue||{}).fields||{}).__type__||{}).stringValue===tj}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Qn{constructor(e){this.value=e}static empty(){return new Qn({mapValue:{}})}field(e){if(e.isEmpty())return this.value;{let n=this.value;for(let r=0;r{if(!n.isImmediateParentOf(l)){const c=this.getFieldsMap(n);this.applyChanges(c,r,s),r={},s=[],n=l.popLast()}o?r[l.lastSegment()]=wl(o):s.push(l.lastSegment())});const i=this.getFieldsMap(n);this.applyChanges(i,r,s)}delete(e){const n=this.field(e.popLast());Lu(n)&&n.mapValue.fields&&delete n.mapValue.fields[e.lastSegment()]}isEqual(e){return is(this.value,e.value)}getFieldsMap(e){let n=this.value;n.mapValue.fields||(n.mapValue={fields:{}});for(let r=0;re[s]=i);for(const s of r)delete e[s]}clone(){return new Qn(wl(this.value))}}function LE(t){const e=[];return Ai(t.fields,(n,r)=>{const s=new yn([n]);if(Lu(r)){const i=LE(r.mapValue).fields;if(i.length===0)e.push(s);else for(const o of i)e.push(s.child(o))}else e.push(s)}),new ur(e)}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class In{constructor(e,n,r,s,i,o,l){this.key=e,this.documentType=n,this.version=r,this.readTime=s,this.createTime=i,this.data=o,this.documentState=l}static newInvalidDocument(e){return new In(e,0,Me.min(),Me.min(),Me.min(),Qn.empty(),0)}static newFoundDocument(e,n,r,s){return new In(e,1,n,Me.min(),r,s,0)}static newNoDocument(e,n){return new In(e,2,n,Me.min(),Me.min(),Qn.empty(),0)}static newUnknownDocument(e,n){return new In(e,3,n,Me.min(),Me.min(),Qn.empty(),2)}convertToFoundDocument(e,n){return!this.createTime.isEqual(Me.min())||this.documentType!==2&&this.documentType!==0||(this.createTime=e),this.version=e,this.documentType=1,this.data=n,this.documentState=0,this}convertToNoDocument(e){return this.version=e,this.documentType=2,this.data=Qn.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=Qn.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=Me.min(),this}setReadTime(e){return this.readTime=e,this}get hasLocalMutations(){return this.documentState===1}get hasCommittedMutations(){return this.documentState===2}get hasPendingWrites(){return this.hasLocalMutations||this.hasCommittedMutations}isValidDocument(){return this.documentType!==0}isFoundDocument(){return this.documentType===1}isNoDocument(){return this.documentType===2}isUnknownDocument(){return this.documentType===3}isEqual(e){return e instanceof In&&this.key.isEqual(e.key)&&this.version.isEqual(e.version)&&this.documentType===e.documentType&&this.documentState===e.documentState&&this.data.isEqual(e.data)}mutableCopy(){return new In(this.key,this.documentType,this.version,this.readTime,this.createTime,this.data.clone(),this.documentState)}toString(){return`Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {createTime: ${this.createTime}}), {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`}}/** + * @license + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Td{constructor(e,n){this.position=e,this.inclusive=n}}function gv(t,e,n){let r=0;for(let s=0;s":return e>0;case">=":return e>=0;default:return Ae(47266,{operator:this.op})}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}}class zr extends OE{constructor(e,n){super(),this.filters=e,this.op=n,this.Pe=null}static create(e,n){return new zr(e,n)}matches(e){return VE(this)?this.filters.find(n=>!n.matches(e))===void 0:this.filters.find(n=>n.matches(e))!==void 0}getFlattenedFilters(){return this.Pe!==null||(this.Pe=this.filters.reduce((e,n)=>e.concat(n.getFlattenedFilters()),[])),this.Pe}getFilters(){return Object.assign([],this.filters)}}function VE(t){return t.op==="and"}function FE(t){return ij(t)&&VE(t)}function ij(t){for(const e of t.filters)if(e instanceof zr)return!1;return!0}function cm(t){if(t instanceof Yt)return t.field.canonicalString()+t.op.toString()+ga(t.value);if(FE(t))return t.filters.map(e=>cm(e)).join(",");{const e=t.filters.map(n=>cm(n)).join(",");return`${t.op}(${e})`}}function zE(t,e){return t instanceof Yt?function(r,s){return s instanceof Yt&&r.op===s.op&&r.field.isEqual(s.field)&&is(r.value,s.value)}(t,e):t instanceof zr?function(r,s){return s instanceof zr&&r.op===s.op&&r.filters.length===s.filters.length?r.filters.reduce((i,o,l)=>i&&zE(o,s.filters[l]),!0):!1}(t,e):void Ae(19439)}function UE(t){return t instanceof Yt?function(n){return`${n.field.canonicalString()} ${n.op} ${ga(n.value)}`}(t):t instanceof zr?function(n){return n.op.toString()+" {"+n.getFilters().map(UE).join(" ,")+"}"}(t):"Filter"}class oj extends Yt{constructor(e,n,r){super(e,n,r),this.key=Ne.fromName(r.referenceValue)}matches(e){const n=Ne.comparator(e.key,this.key);return this.matchesComparison(n)}}class aj extends Yt{constructor(e,n){super(e,"in",n),this.keys=BE("in",n)}matches(e){return this.keys.some(n=>n.isEqual(e.key))}}class lj extends Yt{constructor(e,n){super(e,"not-in",n),this.keys=BE("not-in",n)}matches(e){return!this.keys.some(n=>n.isEqual(e.key))}}function BE(t,e){var n;return(((n=e.arrayValue)==null?void 0:n.values)||[]).map(r=>Ne.fromName(r.referenceValue))}class cj extends Yt{constructor(e,n){super(e,"array-contains",n)}matches(e){const n=e.data.field(this.field);return Wg(n)&&Yl(n.arrayValue,this.value)}}class uj extends Yt{constructor(e,n){super(e,"in",n)}matches(e){const n=e.data.field(this.field);return n!==null&&Yl(this.value.arrayValue,n)}}class dj extends Yt{constructor(e,n){super(e,"not-in",n)}matches(e){if(Yl(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const n=e.data.field(this.field);return n!==null&&n.nullValue===void 0&&!Yl(this.value.arrayValue,n)}}class hj extends Yt{constructor(e,n){super(e,"array-contains-any",n)}matches(e){const n=e.data.field(this.field);return!(!Wg(n)||!n.arrayValue.values)&&n.arrayValue.values.some(r=>Yl(this.value.arrayValue,r))}}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class fj{constructor(e,n=null,r=[],s=[],i=null,o=null,l=null){this.path=e,this.collectionGroup=n,this.orderBy=r,this.filters=s,this.limit=i,this.startAt=o,this.endAt=l,this.Te=null}}function xv(t,e=null,n=[],r=[],s=null,i=null,o=null){return new fj(t,e,n,r,s,i,o)}function Kg(t){const e=Oe(t);if(e.Te===null){let n=e.path.canonicalString();e.collectionGroup!==null&&(n+="|cg:"+e.collectionGroup),n+="|f:",n+=e.filters.map(r=>cm(r)).join(","),n+="|ob:",n+=e.orderBy.map(r=>function(i){return i.field.canonicalString()+i.dir}(r)).join(","),yh(e.limit)||(n+="|l:",n+=e.limit),e.startAt&&(n+="|lb:",n+=e.startAt.inclusive?"b:":"a:",n+=e.startAt.position.map(r=>ga(r)).join(",")),e.endAt&&(n+="|ub:",n+=e.endAt.inclusive?"a:":"b:",n+=e.endAt.position.map(r=>ga(r)).join(",")),e.Te=n}return e.Te}function Qg(t,e){if(t.limit!==e.limit||t.orderBy.length!==e.orderBy.length)return!1;for(let n=0;n0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc";(function(o){let l=new rn(yn.comparator);return o.filters.forEach(c=>{c.getFlattenedFilters().forEach(u=>{u.isInequality()&&(l=l.add(u.field))})}),l})(e).forEach(i=>{n.has(i.canonicalString())||i.isKeyField()||e.Ee.push(new Xl(i,r))}),n.has(yn.keyField().canonicalString())||e.Ee.push(new Xl(yn.keyField(),r))}return e.Ee}function es(t){const e=Oe(t);return e.Ie||(e.Ie=gj(e,bl(t))),e.Ie}function gj(t,e){if(t.limitType==="F")return xv(t.path,t.collectionGroup,e,t.filters,t.limit,t.startAt,t.endAt);{e=e.map(s=>{const i=s.dir==="desc"?"asc":"desc";return new Xl(s.field,i)});const n=t.endAt?new Td(t.endAt.position,t.endAt.inclusive):null,r=t.startAt?new Td(t.startAt.position,t.startAt.inclusive):null;return xv(t.path,t.collectionGroup,e,t.filters,t.limit,n,r)}}function dm(t,e){const n=t.filters.concat([e]);return new Ia(t.path,t.collectionGroup,t.explicitOrderBy.slice(),n,t.limit,t.limitType,t.startAt,t.endAt)}function yj(t,e){const n=t.explicitOrderBy.concat([e]);return new Ia(t.path,t.collectionGroup,n,t.filters.slice(),t.limit,t.limitType,t.startAt,t.endAt)}function hm(t,e,n){return new Ia(t.path,t.collectionGroup,t.explicitOrderBy.slice(),t.filters.slice(),e,n,t.startAt,t.endAt)}function wh(t,e){return Qg(es(t),es(e))&&t.limitType===e.limitType}function HE(t){return`${Kg(es(t))}|lt:${t.limitType}`}function ko(t){return`Query(target=${function(n){let r=n.path.canonicalString();return n.collectionGroup!==null&&(r+=" collectionGroup="+n.collectionGroup),n.filters.length>0&&(r+=`, filters: [${n.filters.map(s=>UE(s)).join(", ")}]`),yh(n.limit)||(r+=", limit: "+n.limit),n.orderBy.length>0&&(r+=`, orderBy: [${n.orderBy.map(s=>function(o){return`${o.field.canonicalString()} (${o.dir})`}(s)).join(", ")}]`),n.startAt&&(r+=", startAt: ",r+=n.startAt.inclusive?"b:":"a:",r+=n.startAt.position.map(s=>ga(s)).join(",")),n.endAt&&(r+=", endAt: ",r+=n.endAt.inclusive?"a:":"b:",r+=n.endAt.position.map(s=>ga(s)).join(",")),`Target(${r})`}(es(t))}; limitType=${t.limitType})`}function bh(t,e){return e.isFoundDocument()&&function(r,s){const i=s.key.path;return r.collectionGroup!==null?s.key.hasCollectionId(r.collectionGroup)&&r.path.isPrefixOf(i):Ne.isDocumentKey(r.path)?r.path.isEqual(i):r.path.isImmediateParentOf(i)}(t,e)&&function(r,s){for(const i of bl(r))if(!i.field.isKeyField()&&s.data.field(i.field)===null)return!1;return!0}(t,e)&&function(r,s){for(const i of r.filters)if(!i.matches(s))return!1;return!0}(t,e)&&function(r,s){return!(r.startAt&&!function(o,l,c){const u=gv(o,l,c);return o.inclusive?u<=0:u<0}(r.startAt,bl(r),s)||r.endAt&&!function(o,l,c){const u=gv(o,l,c);return o.inclusive?u>=0:u>0}(r.endAt,bl(r),s))}(t,e)}function xj(t){return t.collectionGroup||(t.path.length%2==1?t.path.lastSegment():t.path.get(t.path.length-2))}function qE(t){return(e,n)=>{let r=!1;for(const s of bl(t)){const i=vj(s,e,n);if(i!==0)return i;r=r||s.field.isKeyField()}return 0}}function vj(t,e,n){const r=t.field.isKeyField()?Ne.comparator(e.key,n.key):function(i,o,l){const c=o.data.field(i),u=l.data.field(i);return c!==null&&u!==null?ma(c,u):Ae(42886)}(t.field,e,n);switch(t.dir){case"asc":return r;case"desc":return-1*r;default:return Ae(19790,{direction:t.dir})}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class mo{constructor(e,n){this.mapKeyFn=e,this.equalsFn=n,this.inner={},this.innerSize=0}get(e){const n=this.mapKeyFn(e),r=this.inner[n];if(r!==void 0){for(const[s,i]of r)if(this.equalsFn(s,e))return i}}has(e){return this.get(e)!==void 0}set(e,n){const r=this.mapKeyFn(e),s=this.inner[r];if(s===void 0)return this.inner[r]=[[e,n]],void this.innerSize++;for(let i=0;i{for(const[s,i]of r)e(s,i)})}isEmpty(){return IE(this.inner)}size(){return this.innerSize}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const wj=new Ot(Ne.comparator);function js(){return wj}const GE=new Ot(Ne.comparator);function ll(...t){let e=GE;for(const n of t)e=e.insert(n.key,n);return e}function WE(t){let e=GE;return t.forEach((n,r)=>e=e.insert(n,r.overlayedDocument)),e}function qi(){return _l()}function KE(){return _l()}function _l(){return new mo(t=>t.toString(),(t,e)=>t.isEqual(e))}const bj=new Ot(Ne.comparator),_j=new rn(Ne.comparator);function Je(...t){let e=_j;for(const n of t)e=e.add(n);return e}const Ej=new rn(Xe);function Sj(){return Ej}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Yg(t,e){if(t.useProto3Json){if(isNaN(e))return{doubleValue:"NaN"};if(e===1/0)return{doubleValue:"Infinity"};if(e===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:_d(e)?"-0":e}}function QE(t){return{integerValue:""+t}}function YE(t,e){return QA(e)?QE(e):Yg(t,e)}/** + * @license + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class _h{constructor(){this._=void 0}}function Tj(t,e,n){return t instanceof Nd?function(s,i){const o={fields:{[jE]:{stringValue:AE},[RE]:{timestampValue:{seconds:s.seconds,nanos:s.nanoseconds}}}};return i&&Gg(i)&&(i=xh(i)),i&&(o.fields[PE]=i),{mapValue:o}}(n,e):t instanceof Jl?JE(t,e):t instanceof Zl?ZE(t,e):function(s,i){const o=XE(s,i),l=wv(o)+wv(s.Ae);return lm(o)&&lm(s.Ae)?QE(l):Yg(s.serializer,l)}(t,e)}function Nj(t,e,n){return t instanceof Jl?JE(t,e):t instanceof Zl?ZE(t,e):n}function XE(t,e){return t instanceof ec?function(r){return lm(r)||function(i){return!!i&&"doubleValue"in i}(r)}(e)?e:{integerValue:0}:null}class Nd extends _h{}class Jl extends _h{constructor(e){super(),this.elements=e}}function JE(t,e){const n=eS(e);for(const r of t.elements)n.some(s=>is(s,r))||n.push(r);return{arrayValue:{values:n}}}class Zl extends _h{constructor(e){super(),this.elements=e}}function ZE(t,e){let n=eS(e);for(const r of t.elements)n=n.filter(s=>!is(s,r));return{arrayValue:{values:n}}}class ec extends _h{constructor(e,n){super(),this.serializer=e,this.Ae=n}}function wv(t){return Ht(t.integerValue||t.doubleValue)}function eS(t){return Wg(t)&&t.arrayValue.values?t.arrayValue.values.slice():[]}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class kj{constructor(e,n){this.field=e,this.transform=n}}function Ij(t,e){return t.field.isEqual(e.field)&&function(r,s){return r instanceof Jl&&s instanceof Jl||r instanceof Zl&&s instanceof Zl?pa(r.elements,s.elements,is):r instanceof ec&&s instanceof ec?is(r.Ae,s.Ae):r instanceof Nd&&s instanceof Nd}(t.transform,e.transform)}class Cj{constructor(e,n){this.version=e,this.transformResults=n}}class On{constructor(e,n){this.updateTime=e,this.exists=n}static none(){return new On}static exists(e){return new On(void 0,e)}static updateTime(e){return new On(e)}get isNone(){return this.updateTime===void 0&&this.exists===void 0}isEqual(e){return this.exists===e.exists&&(this.updateTime?!!e.updateTime&&this.updateTime.isEqual(e.updateTime):!e.updateTime)}}function Ou(t,e){return t.updateTime!==void 0?e.isFoundDocument()&&e.version.isEqual(t.updateTime):t.exists===void 0||t.exists===e.isFoundDocument()}class Eh{}function tS(t,e){if(!t.hasLocalMutations||e&&e.fields.length===0)return null;if(e===null)return t.isNoDocument()?new Sh(t.key,On.none()):new gc(t.key,t.data,On.none());{const n=t.data,r=Qn.empty();let s=new rn(yn.comparator);for(let i of e.fields)if(!s.has(i)){let o=n.field(i);o===null&&i.length>1&&(i=i.popLast(),o=n.field(i)),o===null?r.delete(i):r.set(i,o),s=s.add(i)}return new ji(t.key,r,new ur(s.toArray()),On.none())}}function Aj(t,e,n){t instanceof gc?function(s,i,o){const l=s.value.clone(),c=_v(s.fieldTransforms,i,o.transformResults);l.setAll(c),i.convertToFoundDocument(o.version,l).setHasCommittedMutations()}(t,e,n):t instanceof ji?function(s,i,o){if(!Ou(s.precondition,i))return void i.convertToUnknownDocument(o.version);const l=_v(s.fieldTransforms,i,o.transformResults),c=i.data;c.setAll(nS(s)),c.setAll(l),i.convertToFoundDocument(o.version,c).setHasCommittedMutations()}(t,e,n):function(s,i,o){i.convertToNoDocument(o.version).setHasCommittedMutations()}(0,e,n)}function El(t,e,n,r){return t instanceof gc?function(i,o,l,c){if(!Ou(i.precondition,o))return l;const u=i.value.clone(),h=Ev(i.fieldTransforms,c,o);return u.setAll(h),o.convertToFoundDocument(o.version,u).setHasLocalMutations(),null}(t,e,n,r):t instanceof ji?function(i,o,l,c){if(!Ou(i.precondition,o))return l;const u=Ev(i.fieldTransforms,c,o),h=o.data;return h.setAll(nS(i)),h.setAll(u),o.convertToFoundDocument(o.version,h).setHasLocalMutations(),l===null?null:l.unionWith(i.fieldMask.fields).unionWith(i.fieldTransforms.map(f=>f.field))}(t,e,n,r):function(i,o,l){return Ou(i.precondition,o)?(o.convertToNoDocument(o.version).setHasLocalMutations(),null):l}(t,e,n)}function jj(t,e){let n=null;for(const r of t.fieldTransforms){const s=e.data.field(r.field),i=XE(r.transform,s||null);i!=null&&(n===null&&(n=Qn.empty()),n.set(r.field,i))}return n||null}function bv(t,e){return t.type===e.type&&!!t.key.isEqual(e.key)&&!!t.precondition.isEqual(e.precondition)&&!!function(r,s){return r===void 0&&s===void 0||!(!r||!s)&&pa(r,s,(i,o)=>Ij(i,o))}(t.fieldTransforms,e.fieldTransforms)&&(t.type===0?t.value.isEqual(e.value):t.type!==1||t.data.isEqual(e.data)&&t.fieldMask.isEqual(e.fieldMask))}class gc extends Eh{constructor(e,n,r,s=[]){super(),this.key=e,this.value=n,this.precondition=r,this.fieldTransforms=s,this.type=0}getFieldMask(){return null}}class ji extends Eh{constructor(e,n,r,s,i=[]){super(),this.key=e,this.data=n,this.fieldMask=r,this.precondition=s,this.fieldTransforms=i,this.type=1}getFieldMask(){return this.fieldMask}}function nS(t){const e=new Map;return t.fieldMask.fields.forEach(n=>{if(!n.isEmpty()){const r=t.data.field(n);e.set(n,r)}}),e}function _v(t,e,n){const r=new Map;ut(t.length===n.length,32656,{Ve:n.length,de:t.length});for(let s=0;s{const i=e.get(s.key),o=i.overlayedDocument;let l=this.applyToLocalView(o,i.mutatedFields);l=n.has(s.key)?null:l;const c=tS(o,l);c!==null&&r.set(s.key,c),o.isValidDocument()||o.convertToNoDocument(Me.min())}),r}keys(){return this.mutations.reduce((e,n)=>e.add(n.key),Je())}isEqual(e){return this.batchId===e.batchId&&pa(this.mutations,e.mutations,(n,r)=>bv(n,r))&&pa(this.baseMutations,e.baseMutations,(n,r)=>bv(n,r))}}class Xg{constructor(e,n,r,s){this.batch=e,this.commitVersion=n,this.mutationResults=r,this.docVersions=s}static from(e,n,r){ut(e.mutations.length===r.length,58842,{me:e.mutations.length,fe:r.length});let s=function(){return bj}();const i=e.mutations;for(let o=0;o=8)throw new cl(`Invalid padding: ${n}`);if(r<0)throw new cl(`Invalid hash count: ${r}`);if(e.length>0&&this.hashCount===0)throw new cl(`Invalid hash count: ${r}`);if(e.length===0&&n!==0)throw new cl(`Invalid padding when bitmap length is 0: ${n}`);this.ge=8*e.length-n,this.pe=mi.fromNumber(this.ge)}ye(e,n,r){let s=e.add(n.multiply(mi.fromNumber(r)));return s.compare(Vj)===1&&(s=new mi([s.getBits(0),s.getBits(1)],0)),s.modulo(this.pe).toNumber()}we(e){return!!(this.bitmap[Math.floor(e/8)]&1<o.insert(l)),o}insert(e){if(this.ge===0)return;const n=Sv(e),[r,s]=Tv(n);for(let i=0;i0&&(this.Oe=!0,this.Me=e)}ke(){let e=Je(),n=Je(),r=Je();return this.Fe.forEach((s,i)=>{switch(i){case 0:e=e.add(s);break;case 2:n=n.add(s);break;case 1:r=r.add(s);break;default:Ae(38017,{changeType:i})}}),new yc(this.Me,this.xe,e,n,r)}qe(){this.Oe=!1,this.Fe=kv()}Ke(e,n){this.Oe=!0,this.Fe=this.Fe.insert(e,n)}Ue(e){this.Oe=!0,this.Fe=this.Fe.remove(e)}$e(){this.ve+=1}We(){this.ve-=1,ut(this.ve>=0,3241,{ve:this.ve})}Qe(){this.Oe=!0,this.xe=!0}}class Fj{constructor(e){this.Ge=e,this.ze=new Map,this.je=js(),this.Je=fu(),this.He=fu(),this.Ze=new Ot(Xe)}Xe(e){for(const n of e.be)e.De&&e.De.isFoundDocument()?this.Ye(n,e.De):this.et(n,e.key,e.De);for(const n of e.removedTargetIds)this.et(n,e.key,e.De)}tt(e){this.forEachTarget(e,n=>{const r=this.nt(n);switch(e.state){case 0:this.rt(n)&&r.Le(e.resumeToken);break;case 1:r.We(),r.Ne||r.qe(),r.Le(e.resumeToken);break;case 2:r.We(),r.Ne||this.removeTarget(n);break;case 3:this.rt(n)&&(r.Qe(),r.Le(e.resumeToken));break;case 4:this.rt(n)&&(this.it(n),r.Le(e.resumeToken));break;default:Ae(56790,{state:e.state})}})}forEachTarget(e,n){e.targetIds.length>0?e.targetIds.forEach(n):this.ze.forEach((r,s)=>{this.rt(s)&&n(s)})}st(e){const n=e.targetId,r=e.Ce.count,s=this.ot(n);if(s){const i=s.target;if(um(i))if(r===0){const o=new Ne(i.path);this.et(n,o,In.newNoDocument(o,Me.min()))}else ut(r===1,20013,{expectedCount:r});else{const o=this._t(n);if(o!==r){const l=this.ut(e),c=l?this.ct(l,e,o):1;if(c!==0){this.it(n);const u=c===2?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.Ze=this.Ze.insert(n,u)}}}}}ut(e){const n=e.Ce.unchangedNames;if(!n||!n.bits)return null;const{bits:{bitmap:r="",padding:s=0},hashCount:i=0}=n;let o,l;try{o=_i(r).toUint8Array()}catch(c){if(c instanceof CE)return oo("Decoding the base64 bloom filter in existence filter failed ("+c.message+"); ignoring the bloom filter and falling back to full re-query."),null;throw c}try{l=new Jg(o,s,i)}catch(c){return oo(c instanceof cl?"BloomFilter error: ":"Applying bloom filter failed: ",c),null}return l.ge===0?null:l}ct(e,n,r){return n.Ce.count===r-this.Pt(e,n.targetId)?0:2}Pt(e,n){const r=this.Ge.getRemoteKeysForTarget(n);let s=0;return r.forEach(i=>{const o=this.Ge.ht(),l=`projects/${o.projectId}/databases/${o.database}/documents/${i.path.canonicalString()}`;e.mightContain(l)||(this.et(n,i,null),s++)}),s}Tt(e){const n=new Map;this.ze.forEach((i,o)=>{const l=this.ot(o);if(l){if(i.current&&um(l.target)){const c=new Ne(l.target.path);this.Et(c).has(o)||this.It(o,c)||this.et(o,c,In.newNoDocument(c,e))}i.Be&&(n.set(o,i.ke()),i.qe())}});let r=Je();this.He.forEach((i,o)=>{let l=!0;o.forEachWhile(c=>{const u=this.ot(c);return!u||u.purpose==="TargetPurposeLimboResolution"||(l=!1,!1)}),l&&(r=r.add(i))}),this.je.forEach((i,o)=>o.setReadTime(e));const s=new Th(e,n,this.Ze,this.je,r);return this.je=js(),this.Je=fu(),this.He=fu(),this.Ze=new Ot(Xe),s}Ye(e,n){if(!this.rt(e))return;const r=this.It(e,n.key)?2:0;this.nt(e).Ke(n.key,r),this.je=this.je.insert(n.key,n),this.Je=this.Je.insert(n.key,this.Et(n.key).add(e)),this.He=this.He.insert(n.key,this.Rt(n.key).add(e))}et(e,n,r){if(!this.rt(e))return;const s=this.nt(e);this.It(e,n)?s.Ke(n,1):s.Ue(n),this.He=this.He.insert(n,this.Rt(n).delete(e)),this.He=this.He.insert(n,this.Rt(n).add(e)),r&&(this.je=this.je.insert(n,r))}removeTarget(e){this.ze.delete(e)}_t(e){const n=this.nt(e).ke();return this.Ge.getRemoteKeysForTarget(e).size+n.addedDocuments.size-n.removedDocuments.size}$e(e){this.nt(e).$e()}nt(e){let n=this.ze.get(e);return n||(n=new Nv,this.ze.set(e,n)),n}Rt(e){let n=this.He.get(e);return n||(n=new rn(Xe),this.He=this.He.insert(e,n)),n}Et(e){let n=this.Je.get(e);return n||(n=new rn(Xe),this.Je=this.Je.insert(e,n)),n}rt(e){const n=this.ot(e)!==null;return n||xe("WatchChangeAggregator","Detected inactive target",e),n}ot(e){const n=this.ze.get(e);return n&&n.Ne?null:this.Ge.At(e)}it(e){this.ze.set(e,new Nv),this.Ge.getRemoteKeysForTarget(e).forEach(n=>{this.et(e,n,null)})}It(e,n){return this.Ge.getRemoteKeysForTarget(e).has(n)}}function fu(){return new Ot(Ne.comparator)}function kv(){return new Ot(Ne.comparator)}const zj={asc:"ASCENDING",desc:"DESCENDING"},Uj={"<":"LESS_THAN","<=":"LESS_THAN_OR_EQUAL",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","!=":"NOT_EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","not-in":"NOT_IN","array-contains-any":"ARRAY_CONTAINS_ANY"},Bj={and:"AND",or:"OR"};class $j{constructor(e,n){this.databaseId=e,this.useProto3Json=n}}function fm(t,e){return t.useProto3Json||yh(e)?e:{value:e}}function kd(t,e){return t.useProto3Json?`${new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+e.nanoseconds).slice(-9)}Z`:{seconds:""+e.seconds,nanos:e.nanoseconds}}function oS(t,e){return t.useProto3Json?e.toBase64():e.toUint8Array()}function Hj(t,e){return kd(t,e.toTimestamp())}function ts(t){return ut(!!t,49232),Me.fromTimestamp(function(n){const r=bi(n);return new Ke(r.seconds,r.nanos)}(t))}function Zg(t,e){return pm(t,e).canonicalString()}function pm(t,e){const n=function(s){return new Et(["projects",s.projectId,"databases",s.database])}(t).child("documents");return e===void 0?n:n.child(e)}function aS(t){const e=Et.fromString(t);return ut(hS(e),10190,{key:e.toString()}),e}function mm(t,e){return Zg(t.databaseId,e.path)}function kf(t,e){const n=aS(e);if(n.get(1)!==t.databaseId.projectId)throw new fe(Y.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+n.get(1)+" vs "+t.databaseId.projectId);if(n.get(3)!==t.databaseId.database)throw new fe(Y.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+t.databaseId.database);return new Ne(cS(n))}function lS(t,e){return Zg(t.databaseId,e)}function qj(t){const e=aS(t);return e.length===4?Et.emptyPath():cS(e)}function gm(t){return new Et(["projects",t.databaseId.projectId,"databases",t.databaseId.database]).canonicalString()}function cS(t){return ut(t.length>4&&t.get(4)==="documents",29091,{key:t.toString()}),t.popFirst(5)}function Iv(t,e,n){return{name:mm(t,e),fields:n.value.mapValue.fields}}function Gj(t,e){let n;if("targetChange"in e){e.targetChange;const r=function(u){return u==="NO_CHANGE"?0:u==="ADD"?1:u==="REMOVE"?2:u==="CURRENT"?3:u==="RESET"?4:Ae(39313,{state:u})}(e.targetChange.targetChangeType||"NO_CHANGE"),s=e.targetChange.targetIds||[],i=function(u,h){return u.useProto3Json?(ut(h===void 0||typeof h=="string",58123),wn.fromBase64String(h||"")):(ut(h===void 0||h instanceof Buffer||h instanceof Uint8Array,16193),wn.fromUint8Array(h||new Uint8Array))}(t,e.targetChange.resumeToken),o=e.targetChange.cause,l=o&&function(u){const h=u.code===void 0?Y.UNKNOWN:rS(u.code);return new fe(h,u.message||"")}(o);n=new iS(r,s,i,l||null)}else if("documentChange"in e){e.documentChange;const r=e.documentChange;r.document,r.document.name,r.document.updateTime;const s=kf(t,r.document.name),i=ts(r.document.updateTime),o=r.document.createTime?ts(r.document.createTime):Me.min(),l=new Qn({mapValue:{fields:r.document.fields}}),c=In.newFoundDocument(s,i,o,l),u=r.targetIds||[],h=r.removedTargetIds||[];n=new Vu(u,h,c.key,c)}else if("documentDelete"in e){e.documentDelete;const r=e.documentDelete;r.document;const s=kf(t,r.document),i=r.readTime?ts(r.readTime):Me.min(),o=In.newNoDocument(s,i),l=r.removedTargetIds||[];n=new Vu([],l,o.key,o)}else if("documentRemove"in e){e.documentRemove;const r=e.documentRemove;r.document;const s=kf(t,r.document),i=r.removedTargetIds||[];n=new Vu([],i,s,null)}else{if(!("filter"in e))return Ae(11601,{Vt:e});{e.filter;const r=e.filter;r.targetId;const{count:s=0,unchangedNames:i}=r,o=new Mj(s,i),l=r.targetId;n=new sS(l,o)}}return n}function Wj(t,e){let n;if(e instanceof gc)n={update:Iv(t,e.key,e.value)};else if(e instanceof Sh)n={delete:mm(t,e.key)};else if(e instanceof ji)n={update:Iv(t,e.key,e.data),updateMask:nP(e.fieldMask)};else{if(!(e instanceof Pj))return Ae(16599,{dt:e.type});n={verify:mm(t,e.key)}}return e.fieldTransforms.length>0&&(n.updateTransforms=e.fieldTransforms.map(r=>function(i,o){const l=o.transform;if(l instanceof Nd)return{fieldPath:o.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(l instanceof Jl)return{fieldPath:o.field.canonicalString(),appendMissingElements:{values:l.elements}};if(l instanceof Zl)return{fieldPath:o.field.canonicalString(),removeAllFromArray:{values:l.elements}};if(l instanceof ec)return{fieldPath:o.field.canonicalString(),increment:l.Ae};throw Ae(20930,{transform:o.transform})}(0,r))),e.precondition.isNone||(n.currentDocument=function(s,i){return i.updateTime!==void 0?{updateTime:Hj(s,i.updateTime)}:i.exists!==void 0?{exists:i.exists}:Ae(27497)}(t,e.precondition)),n}function Kj(t,e){return t&&t.length>0?(ut(e!==void 0,14353),t.map(n=>function(s,i){let o=s.updateTime?ts(s.updateTime):ts(i);return o.isEqual(Me.min())&&(o=ts(i)),new Cj(o,s.transformResults||[])}(n,e))):[]}function Qj(t,e){return{documents:[lS(t,e.path)]}}function Yj(t,e){const n={structuredQuery:{}},r=e.path;let s;e.collectionGroup!==null?(s=r,n.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(s=r.popLast(),n.structuredQuery.from=[{collectionId:r.lastSegment()}]),n.parent=lS(t,s);const i=function(u){if(u.length!==0)return dS(zr.create(u,"and"))}(e.filters);i&&(n.structuredQuery.where=i);const o=function(u){if(u.length!==0)return u.map(h=>function(m){return{field:Io(m.field),direction:Zj(m.dir)}}(h))}(e.orderBy);o&&(n.structuredQuery.orderBy=o);const l=fm(t,e.limit);return l!==null&&(n.structuredQuery.limit=l),e.startAt&&(n.structuredQuery.startAt=function(u){return{before:u.inclusive,values:u.position}}(e.startAt)),e.endAt&&(n.structuredQuery.endAt=function(u){return{before:!u.inclusive,values:u.position}}(e.endAt)),{ft:n,parent:s}}function Xj(t){let e=qj(t.parent);const n=t.structuredQuery,r=n.from?n.from.length:0;let s=null;if(r>0){ut(r===1,65062);const h=n.from[0];h.allDescendants?s=h.collectionId:e=e.child(h.collectionId)}let i=[];n.where&&(i=function(f){const m=uS(f);return m instanceof zr&&FE(m)?m.getFilters():[m]}(n.where));let o=[];n.orderBy&&(o=function(f){return f.map(m=>function(y){return new Xl(Co(y.field),function(C){switch(C){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(y.direction))}(m))}(n.orderBy));let l=null;n.limit&&(l=function(f){let m;return m=typeof f=="object"?f.value:f,yh(m)?null:m}(n.limit));let c=null;n.startAt&&(c=function(f){const m=!!f.before,p=f.values||[];return new Td(p,m)}(n.startAt));let u=null;return n.endAt&&(u=function(f){const m=!f.before,p=f.values||[];return new Td(p,m)}(n.endAt)),pj(e,s,o,i,l,"F",c,u)}function Jj(t,e){const n=function(s){switch(s){case"TargetPurposeListen":return null;case"TargetPurposeExistenceFilterMismatch":return"existence-filter-mismatch";case"TargetPurposeExistenceFilterMismatchBloom":return"existence-filter-mismatch-bloom";case"TargetPurposeLimboResolution":return"limbo-document";default:return Ae(28987,{purpose:s})}}(e.purpose);return n==null?null:{"goog-listen-tags":n}}function uS(t){return t.unaryFilter!==void 0?function(n){switch(n.unaryFilter.op){case"IS_NAN":const r=Co(n.unaryFilter.field);return Yt.create(r,"==",{doubleValue:NaN});case"IS_NULL":const s=Co(n.unaryFilter.field);return Yt.create(s,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const i=Co(n.unaryFilter.field);return Yt.create(i,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const o=Co(n.unaryFilter.field);return Yt.create(o,"!=",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":return Ae(61313);default:return Ae(60726)}}(t):t.fieldFilter!==void 0?function(n){return Yt.create(Co(n.fieldFilter.field),function(s){switch(s){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";case"OPERATOR_UNSPECIFIED":return Ae(58110);default:return Ae(50506)}}(n.fieldFilter.op),n.fieldFilter.value)}(t):t.compositeFilter!==void 0?function(n){return zr.create(n.compositeFilter.filters.map(r=>uS(r)),function(s){switch(s){case"AND":return"and";case"OR":return"or";default:return Ae(1026)}}(n.compositeFilter.op))}(t):Ae(30097,{filter:t})}function Zj(t){return zj[t]}function eP(t){return Uj[t]}function tP(t){return Bj[t]}function Io(t){return{fieldPath:t.canonicalString()}}function Co(t){return yn.fromServerFormat(t.fieldPath)}function dS(t){return t instanceof Yt?function(n){if(n.op==="=="){if(mv(n.value))return{unaryFilter:{field:Io(n.field),op:"IS_NAN"}};if(pv(n.value))return{unaryFilter:{field:Io(n.field),op:"IS_NULL"}}}else if(n.op==="!="){if(mv(n.value))return{unaryFilter:{field:Io(n.field),op:"IS_NOT_NAN"}};if(pv(n.value))return{unaryFilter:{field:Io(n.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:Io(n.field),op:eP(n.op),value:n.value}}}(t):t instanceof zr?function(n){const r=n.getFilters().map(s=>dS(s));return r.length===1?r[0]:{compositeFilter:{op:tP(n.op),filters:r}}}(t):Ae(54877,{filter:t})}function nP(t){const e=[];return t.fields.forEach(n=>e.push(n.canonicalString())),{fieldPaths:e}}function hS(t){return t.length>=4&&t.get(0)==="projects"&&t.get(2)==="databases"}function fS(t){return!!t&&typeof t._toProto=="function"&&t._protoValueType==="ProtoValue"}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class ni{constructor(e,n,r,s,i=Me.min(),o=Me.min(),l=wn.EMPTY_BYTE_STRING,c=null){this.target=e,this.targetId=n,this.purpose=r,this.sequenceNumber=s,this.snapshotVersion=i,this.lastLimboFreeSnapshotVersion=o,this.resumeToken=l,this.expectedCount=c}withSequenceNumber(e){return new ni(this.target,this.targetId,this.purpose,e,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(e,n){return new ni(this.target,this.targetId,this.purpose,this.sequenceNumber,n,this.lastLimboFreeSnapshotVersion,e,null)}withExpectedCount(e){return new ni(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,e)}withLastLimboFreeSnapshotVersion(e){return new ni(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,e,this.resumeToken,this.expectedCount)}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class rP{constructor(e){this.yt=e}}function sP(t){const e=Xj({parent:t.parent,structuredQuery:t.structuredQuery});return t.limitType==="LAST"?hm(e,e.limit,"L"):e}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class iP{constructor(){this.bn=new oP}addToCollectionParentIndex(e,n){return this.bn.add(n),Z.resolve()}getCollectionParents(e,n){return Z.resolve(this.bn.getEntries(n))}addFieldIndex(e,n){return Z.resolve()}deleteFieldIndex(e,n){return Z.resolve()}deleteAllFieldIndexes(e){return Z.resolve()}createTargetIndexes(e,n){return Z.resolve()}getDocumentsMatchingTarget(e,n){return Z.resolve(null)}getIndexType(e,n){return Z.resolve(0)}getFieldIndexes(e,n){return Z.resolve([])}getNextCollectionGroupToUpdate(e){return Z.resolve(null)}getMinOffset(e,n){return Z.resolve(wi.min())}getMinOffsetFromCollectionGroup(e,n){return Z.resolve(wi.min())}updateCollectionGroup(e,n,r){return Z.resolve()}updateIndexEntries(e,n){return Z.resolve()}}class oP{constructor(){this.index={}}add(e){const n=e.lastSegment(),r=e.popLast(),s=this.index[n]||new rn(Et.comparator),i=!s.has(r);return this.index[n]=s.add(r),i}has(e){const n=e.lastSegment(),r=e.popLast(),s=this.index[n];return s&&s.has(r)}getEntries(e){return(this.index[e]||new rn(Et.comparator)).toArray()}}/** + * @license + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Cv={didRun:!1,sequenceNumbersCollected:0,targetsRemoved:0,documentsRemoved:0},pS=41943040;class Wn{static withCacheSize(e){return new Wn(e,Wn.DEFAULT_COLLECTION_PERCENTILE,Wn.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}constructor(e,n,r){this.cacheSizeCollectionThreshold=e,this.percentileToCollect=n,this.maximumSequenceNumbersToCollect=r}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */Wn.DEFAULT_COLLECTION_PERCENTILE=10,Wn.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,Wn.DEFAULT=new Wn(pS,Wn.DEFAULT_COLLECTION_PERCENTILE,Wn.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),Wn.DISABLED=new Wn(-1,0,0);/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class ya{constructor(e){this.sr=e}next(){return this.sr+=2,this.sr}static _r(){return new ya(0)}static ar(){return new ya(-1)}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Av="LruGarbageCollector",aP=1048576;function jv([t,e],[n,r]){const s=Xe(t,n);return s===0?Xe(e,r):s}class lP{constructor(e){this.Pr=e,this.buffer=new rn(jv),this.Tr=0}Er(){return++this.Tr}Ir(e){const n=[e,this.Er()];if(this.buffer.size{this.Rr=null;try{await this.localStore.collectGarbage(this.garbageCollector)}catch(n){ka(n)?xe(Av,"Ignoring IndexedDB error during garbage collection: ",n):await Na(n)}await this.Ar(3e5)})}}class uP{constructor(e,n){this.Vr=e,this.params=n}calculateTargetCount(e,n){return this.Vr.dr(e).next(r=>Math.floor(n/100*r))}nthSequenceNumber(e,n){if(n===0)return Z.resolve(gh.ce);const r=new lP(n);return this.Vr.forEachTarget(e,s=>r.Ir(s.sequenceNumber)).next(()=>this.Vr.mr(e,s=>r.Ir(s))).next(()=>r.maxValue)}removeTargets(e,n,r){return this.Vr.removeTargets(e,n,r)}removeOrphanedDocuments(e,n){return this.Vr.removeOrphanedDocuments(e,n)}collect(e,n){return this.params.cacheSizeCollectionThreshold===-1?(xe("LruGarbageCollector","Garbage collection skipped; disabled"),Z.resolve(Cv)):this.getCacheSize(e).next(r=>r(f>this.params.maximumSequenceNumbersToCollect?(xe("LruGarbageCollector",`Capping sequence numbers to collect down to the maximum of ${this.params.maximumSequenceNumbersToCollect} from ${f}`),s=this.params.maximumSequenceNumbersToCollect):s=f,o=Date.now(),this.nthSequenceNumber(e,s))).next(f=>(r=f,l=Date.now(),this.removeTargets(e,r,n))).next(f=>(i=f,c=Date.now(),this.removeOrphanedDocuments(e,r))).next(f=>(u=Date.now(),No()<=Ye.DEBUG&&xe("LruGarbageCollector",`LRU Garbage Collection + Counted targets in ${o-h}ms + Determined least recently used ${s} in `+(l-o)+`ms + Removed ${i} targets in `+(c-l)+`ms + Removed ${f} documents in `+(u-c)+`ms +Total Duration: ${u-h}ms`),Z.resolve({didRun:!0,sequenceNumbersCollected:s,targetsRemoved:i,documentsRemoved:f})))}}function dP(t,e){return new uP(t,e)}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class hP{constructor(){this.changes=new mo(e=>e.toString(),(e,n)=>e.isEqual(n)),this.changesApplied=!1}addEntry(e){this.assertNotApplied(),this.changes.set(e.key,e)}removeEntry(e,n){this.assertNotApplied(),this.changes.set(e,In.newInvalidDocument(e).setReadTime(n))}getEntry(e,n){this.assertNotApplied();const r=this.changes.get(n);return r!==void 0?Z.resolve(r):this.getFromCache(e,n)}getEntries(e,n){return this.getAllFromCache(e,n)}apply(e){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(e)}assertNotApplied(){}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *//** + * @license + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class fP{constructor(e,n){this.overlayedDocument=e,this.mutatedFields=n}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class pP{constructor(e,n,r,s){this.remoteDocumentCache=e,this.mutationQueue=n,this.documentOverlayCache=r,this.indexManager=s}getDocument(e,n){let r=null;return this.documentOverlayCache.getOverlay(e,n).next(s=>(r=s,this.remoteDocumentCache.getEntry(e,n))).next(s=>(r!==null&&El(r.mutation,s,ur.empty(),Ke.now()),s))}getDocuments(e,n){return this.remoteDocumentCache.getEntries(e,n).next(r=>this.getLocalViewOfDocuments(e,r,Je()).next(()=>r))}getLocalViewOfDocuments(e,n,r=Je()){const s=qi();return this.populateOverlays(e,s,n).next(()=>this.computeViews(e,n,s,r).next(i=>{let o=ll();return i.forEach((l,c)=>{o=o.insert(l,c.overlayedDocument)}),o}))}getOverlayedDocuments(e,n){const r=qi();return this.populateOverlays(e,r,n).next(()=>this.computeViews(e,n,r,Je()))}populateOverlays(e,n,r){const s=[];return r.forEach(i=>{n.has(i)||s.push(i)}),this.documentOverlayCache.getOverlays(e,s).next(i=>{i.forEach((o,l)=>{n.set(o,l)})})}computeViews(e,n,r,s){let i=js();const o=_l(),l=function(){return _l()}();return n.forEach((c,u)=>{const h=r.get(u.key);s.has(u.key)&&(h===void 0||h.mutation instanceof ji)?i=i.insert(u.key,u):h!==void 0?(o.set(u.key,h.mutation.getFieldMask()),El(h.mutation,u,h.mutation.getFieldMask(),Ke.now())):o.set(u.key,ur.empty())}),this.recalculateAndSaveOverlays(e,i).next(c=>(c.forEach((u,h)=>o.set(u,h)),n.forEach((u,h)=>l.set(u,new fP(h,o.get(u)??null))),l))}recalculateAndSaveOverlays(e,n){const r=_l();let s=new Ot((o,l)=>o-l),i=Je();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,n).next(o=>{for(const l of o)l.keys().forEach(c=>{const u=n.get(c);if(u===null)return;let h=r.get(c)||ur.empty();h=l.applyToLocalView(u,h),r.set(c,h);const f=(s.get(l.batchId)||Je()).add(c);s=s.insert(l.batchId,f)})}).next(()=>{const o=[],l=s.getReverseIterator();for(;l.hasNext();){const c=l.getNext(),u=c.key,h=c.value,f=KE();h.forEach(m=>{if(!i.has(m)){const p=tS(n.get(m),r.get(m));p!==null&&f.set(m,p),i=i.add(m)}}),o.push(this.documentOverlayCache.saveOverlays(e,u,f))}return Z.waitFor(o)}).next(()=>r)}recalculateAndSaveOverlaysForDocumentKeys(e,n){return this.remoteDocumentCache.getEntries(e,n).next(r=>this.recalculateAndSaveOverlays(e,r))}getDocumentsMatchingQuery(e,n,r,s){return mj(n)?this.getDocumentsMatchingDocumentQuery(e,n.path):$E(n)?this.getDocumentsMatchingCollectionGroupQuery(e,n,r,s):this.getDocumentsMatchingCollectionQuery(e,n,r,s)}getNextDocuments(e,n,r,s){return this.remoteDocumentCache.getAllFromCollectionGroup(e,n,r,s).next(i=>{const o=s-i.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,n,r.largestBatchId,s-i.size):Z.resolve(qi());let l=Wl,c=i;return o.next(u=>Z.forEach(u,(h,f)=>(l{c=c.insert(h,m)}))).next(()=>this.populateOverlays(e,u,i)).next(()=>this.computeViews(e,c,u,Je())).next(h=>({batchId:l,changes:WE(h)})))})}getDocumentsMatchingDocumentQuery(e,n){return this.getDocument(e,new Ne(n)).next(r=>{let s=ll();return r.isFoundDocument()&&(s=s.insert(r.key,r)),s})}getDocumentsMatchingCollectionGroupQuery(e,n,r,s){const i=n.collectionGroup;let o=ll();return this.indexManager.getCollectionParents(e,i).next(l=>Z.forEach(l,c=>{const u=function(f,m){return new Ia(m,null,f.explicitOrderBy.slice(),f.filters.slice(),f.limit,f.limitType,f.startAt,f.endAt)}(n,c.child(i));return this.getDocumentsMatchingCollectionQuery(e,u,r,s).next(h=>{h.forEach((f,m)=>{o=o.insert(f,m)})})}).next(()=>o))}getDocumentsMatchingCollectionQuery(e,n,r,s){let i;return this.documentOverlayCache.getOverlaysForCollection(e,n.path,r.largestBatchId).next(o=>(i=o,this.remoteDocumentCache.getDocumentsMatchingQuery(e,n,r,i,s))).next(o=>{i.forEach((c,u)=>{const h=u.getKey();o.get(h)===null&&(o=o.insert(h,In.newInvalidDocument(h)))});let l=ll();return o.forEach((c,u)=>{const h=i.get(c);h!==void 0&&El(h.mutation,u,ur.empty(),Ke.now()),bh(n,u)&&(l=l.insert(c,u))}),l})}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class mP{constructor(e){this.serializer=e,this.Nr=new Map,this.Br=new Map}getBundleMetadata(e,n){return Z.resolve(this.Nr.get(n))}saveBundleMetadata(e,n){return this.Nr.set(n.id,function(s){return{id:s.id,version:s.version,createTime:ts(s.createTime)}}(n)),Z.resolve()}getNamedQuery(e,n){return Z.resolve(this.Br.get(n))}saveNamedQuery(e,n){return this.Br.set(n.name,function(s){return{name:s.name,query:sP(s.bundledQuery),readTime:ts(s.readTime)}}(n)),Z.resolve()}}/** + * @license + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class gP{constructor(){this.overlays=new Ot(Ne.comparator),this.Lr=new Map}getOverlay(e,n){return Z.resolve(this.overlays.get(n))}getOverlays(e,n){const r=qi();return Z.forEach(n,s=>this.getOverlay(e,s).next(i=>{i!==null&&r.set(s,i)})).next(()=>r)}saveOverlays(e,n,r){return r.forEach((s,i)=>{this.St(e,n,i)}),Z.resolve()}removeOverlaysForBatchId(e,n,r){const s=this.Lr.get(r);return s!==void 0&&(s.forEach(i=>this.overlays=this.overlays.remove(i)),this.Lr.delete(r)),Z.resolve()}getOverlaysForCollection(e,n,r){const s=qi(),i=n.length+1,o=new Ne(n.child("")),l=this.overlays.getIteratorFrom(o);for(;l.hasNext();){const c=l.getNext().value,u=c.getKey();if(!n.isPrefixOf(u.path))break;u.path.length===i&&c.largestBatchId>r&&s.set(c.getKey(),c)}return Z.resolve(s)}getOverlaysForCollectionGroup(e,n,r,s){let i=new Ot((u,h)=>u-h);const o=this.overlays.getIterator();for(;o.hasNext();){const u=o.getNext().value;if(u.getKey().getCollectionGroup()===n&&u.largestBatchId>r){let h=i.get(u.largestBatchId);h===null&&(h=qi(),i=i.insert(u.largestBatchId,h)),h.set(u.getKey(),u)}}const l=qi(),c=i.getIterator();for(;c.hasNext()&&(c.getNext().value.forEach((u,h)=>l.set(u,h)),!(l.size()>=s)););return Z.resolve(l)}St(e,n,r){const s=this.overlays.get(r.key);if(s!==null){const o=this.Lr.get(s.largestBatchId).delete(r.key);this.Lr.set(s.largestBatchId,o)}this.overlays=this.overlays.insert(r.key,new Dj(n,r));let i=this.Lr.get(n);i===void 0&&(i=Je(),this.Lr.set(n,i)),this.Lr.set(n,i.add(r.key))}}/** + * @license + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class yP{constructor(){this.sessionToken=wn.EMPTY_BYTE_STRING}getSessionToken(e){return Z.resolve(this.sessionToken)}setSessionToken(e,n){return this.sessionToken=n,Z.resolve()}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class e0{constructor(){this.kr=new rn(ln.qr),this.Kr=new rn(ln.Ur)}isEmpty(){return this.kr.isEmpty()}addReference(e,n){const r=new ln(e,n);this.kr=this.kr.add(r),this.Kr=this.Kr.add(r)}$r(e,n){e.forEach(r=>this.addReference(r,n))}removeReference(e,n){this.Wr(new ln(e,n))}Qr(e,n){e.forEach(r=>this.removeReference(r,n))}Gr(e){const n=new Ne(new Et([])),r=new ln(n,e),s=new ln(n,e+1),i=[];return this.Kr.forEachInRange([r,s],o=>{this.Wr(o),i.push(o.key)}),i}zr(){this.kr.forEach(e=>this.Wr(e))}Wr(e){this.kr=this.kr.delete(e),this.Kr=this.Kr.delete(e)}jr(e){const n=new Ne(new Et([])),r=new ln(n,e),s=new ln(n,e+1);let i=Je();return this.Kr.forEachInRange([r,s],o=>{i=i.add(o.key)}),i}containsKey(e){const n=new ln(e,0),r=this.kr.firstAfterOrEqual(n);return r!==null&&e.isEqual(r.key)}}class ln{constructor(e,n){this.key=e,this.Jr=n}static qr(e,n){return Ne.comparator(e.key,n.key)||Xe(e.Jr,n.Jr)}static Ur(e,n){return Xe(e.Jr,n.Jr)||Ne.comparator(e.key,n.key)}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class xP{constructor(e,n){this.indexManager=e,this.referenceDelegate=n,this.mutationQueue=[],this.Yn=1,this.Hr=new rn(ln.qr)}checkEmpty(e){return Z.resolve(this.mutationQueue.length===0)}addMutationBatch(e,n,r,s){const i=this.Yn;this.Yn++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const o=new Rj(i,n,r,s);this.mutationQueue.push(o);for(const l of s)this.Hr=this.Hr.add(new ln(l.key,i)),this.indexManager.addToCollectionParentIndex(e,l.key.path.popLast());return Z.resolve(o)}lookupMutationBatch(e,n){return Z.resolve(this.Zr(n))}getNextMutationBatchAfterBatchId(e,n){const r=n+1,s=this.Xr(r),i=s<0?0:s;return Z.resolve(this.mutationQueue.length>i?this.mutationQueue[i]:null)}getHighestUnacknowledgedBatchId(){return Z.resolve(this.mutationQueue.length===0?qg:this.Yn-1)}getAllMutationBatches(e){return Z.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,n){const r=new ln(n,0),s=new ln(n,Number.POSITIVE_INFINITY),i=[];return this.Hr.forEachInRange([r,s],o=>{const l=this.Zr(o.Jr);i.push(l)}),Z.resolve(i)}getAllMutationBatchesAffectingDocumentKeys(e,n){let r=new rn(Xe);return n.forEach(s=>{const i=new ln(s,0),o=new ln(s,Number.POSITIVE_INFINITY);this.Hr.forEachInRange([i,o],l=>{r=r.add(l.Jr)})}),Z.resolve(this.Yr(r))}getAllMutationBatchesAffectingQuery(e,n){const r=n.path,s=r.length+1;let i=r;Ne.isDocumentKey(i)||(i=i.child(""));const o=new ln(new Ne(i),0);let l=new rn(Xe);return this.Hr.forEachWhile(c=>{const u=c.key.path;return!!r.isPrefixOf(u)&&(u.length===s&&(l=l.add(c.Jr)),!0)},o),Z.resolve(this.Yr(l))}Yr(e){const n=[];return e.forEach(r=>{const s=this.Zr(r);s!==null&&n.push(s)}),n}removeMutationBatch(e,n){ut(this.ei(n.batchId,"removed")===0,55003),this.mutationQueue.shift();let r=this.Hr;return Z.forEach(n.mutations,s=>{const i=new ln(s.key,n.batchId);return r=r.delete(i),this.referenceDelegate.markPotentiallyOrphaned(e,s.key)}).next(()=>{this.Hr=r})}nr(e){}containsKey(e,n){const r=new ln(n,0),s=this.Hr.firstAfterOrEqual(r);return Z.resolve(n.isEqual(s&&s.key))}performConsistencyCheck(e){return this.mutationQueue.length,Z.resolve()}ei(e,n){return this.Xr(e)}Xr(e){return this.mutationQueue.length===0?0:e-this.mutationQueue[0].batchId}Zr(e){const n=this.Xr(e);return n<0||n>=this.mutationQueue.length?null:this.mutationQueue[n]}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class vP{constructor(e){this.ti=e,this.docs=function(){return new Ot(Ne.comparator)}(),this.size=0}setIndexManager(e){this.indexManager=e}addEntry(e,n){const r=n.key,s=this.docs.get(r),i=s?s.size:0,o=this.ti(n);return this.docs=this.docs.insert(r,{document:n.mutableCopy(),size:o}),this.size+=o-i,this.indexManager.addToCollectionParentIndex(e,r.path.popLast())}removeEntry(e){const n=this.docs.get(e);n&&(this.docs=this.docs.remove(e),this.size-=n.size)}getEntry(e,n){const r=this.docs.get(n);return Z.resolve(r?r.document.mutableCopy():In.newInvalidDocument(n))}getEntries(e,n){let r=js();return n.forEach(s=>{const i=this.docs.get(s);r=r.insert(s,i?i.document.mutableCopy():In.newInvalidDocument(s))}),Z.resolve(r)}getDocumentsMatchingQuery(e,n,r,s){let i=js();const o=n.path,l=new Ne(o.child("__id-9223372036854775808__")),c=this.docs.getIteratorFrom(l);for(;c.hasNext();){const{key:u,value:{document:h}}=c.getNext();if(!o.isPrefixOf(u.path))break;u.path.length>o.length+1||qA(HA(h),r)<=0||(s.has(h.key)||bh(n,h))&&(i=i.insert(h.key,h.mutableCopy()))}return Z.resolve(i)}getAllFromCollectionGroup(e,n,r,s){Ae(9500)}ni(e,n){return Z.forEach(this.docs,r=>n(r))}newChangeBuffer(e){return new wP(this)}getSize(e){return Z.resolve(this.size)}}class wP extends hP{constructor(e){super(),this.Mr=e}applyChanges(e){const n=[];return this.changes.forEach((r,s)=>{s.isValidDocument()?n.push(this.Mr.addEntry(e,s)):this.Mr.removeEntry(r)}),Z.waitFor(n)}getFromCache(e,n){return this.Mr.getEntry(e,n)}getAllFromCache(e,n){return this.Mr.getEntries(e,n)}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class bP{constructor(e){this.persistence=e,this.ri=new mo(n=>Kg(n),Qg),this.lastRemoteSnapshotVersion=Me.min(),this.highestTargetId=0,this.ii=0,this.si=new e0,this.targetCount=0,this.oi=ya._r()}forEachTarget(e,n){return this.ri.forEach((r,s)=>n(s)),Z.resolve()}getLastRemoteSnapshotVersion(e){return Z.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return Z.resolve(this.ii)}allocateTargetId(e){return this.highestTargetId=this.oi.next(),Z.resolve(this.highestTargetId)}setTargetsMetadata(e,n,r){return r&&(this.lastRemoteSnapshotVersion=r),n>this.ii&&(this.ii=n),Z.resolve()}lr(e){this.ri.set(e.target,e);const n=e.targetId;n>this.highestTargetId&&(this.oi=new ya(n),this.highestTargetId=n),e.sequenceNumber>this.ii&&(this.ii=e.sequenceNumber)}addTargetData(e,n){return this.lr(n),this.targetCount+=1,Z.resolve()}updateTargetData(e,n){return this.lr(n),Z.resolve()}removeTargetData(e,n){return this.ri.delete(n.target),this.si.Gr(n.targetId),this.targetCount-=1,Z.resolve()}removeTargets(e,n,r){let s=0;const i=[];return this.ri.forEach((o,l)=>{l.sequenceNumber<=n&&r.get(l.targetId)===null&&(this.ri.delete(o),i.push(this.removeMatchingKeysForTargetId(e,l.targetId)),s++)}),Z.waitFor(i).next(()=>s)}getTargetCount(e){return Z.resolve(this.targetCount)}getTargetData(e,n){const r=this.ri.get(n)||null;return Z.resolve(r)}addMatchingKeys(e,n,r){return this.si.$r(n,r),Z.resolve()}removeMatchingKeys(e,n,r){this.si.Qr(n,r);const s=this.persistence.referenceDelegate,i=[];return s&&n.forEach(o=>{i.push(s.markPotentiallyOrphaned(e,o))}),Z.waitFor(i)}removeMatchingKeysForTargetId(e,n){return this.si.Gr(n),Z.resolve()}getMatchingKeysForTargetId(e,n){const r=this.si.jr(n);return Z.resolve(r)}containsKey(e,n){return Z.resolve(this.si.containsKey(n))}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class mS{constructor(e,n){this._i={},this.overlays={},this.ai=new gh(0),this.ui=!1,this.ui=!0,this.ci=new yP,this.referenceDelegate=e(this),this.li=new bP(this),this.indexManager=new iP,this.remoteDocumentCache=function(s){return new vP(s)}(r=>this.referenceDelegate.hi(r)),this.serializer=new rP(n),this.Pi=new mP(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.ui=!1,Promise.resolve()}get started(){return this.ui}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let n=this.overlays[e.toKey()];return n||(n=new gP,this.overlays[e.toKey()]=n),n}getMutationQueue(e,n){let r=this._i[e.toKey()];return r||(r=new xP(n,this.referenceDelegate),this._i[e.toKey()]=r),r}getGlobalsCache(){return this.ci}getTargetCache(){return this.li}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.Pi}runTransaction(e,n,r){xe("MemoryPersistence","Starting transaction:",e);const s=new _P(this.ai.next());return this.referenceDelegate.Ti(),r(s).next(i=>this.referenceDelegate.Ei(s).next(()=>i)).toPromise().then(i=>(s.raiseOnCommittedEvent(),i))}Ii(e,n){return Z.or(Object.values(this._i).map(r=>()=>r.containsKey(e,n)))}}class _P extends WA{constructor(e){super(),this.currentSequenceNumber=e}}class t0{constructor(e){this.persistence=e,this.Ri=new e0,this.Ai=null}static Vi(e){return new t0(e)}get di(){if(this.Ai)return this.Ai;throw Ae(60996)}addReference(e,n,r){return this.Ri.addReference(r,n),this.di.delete(r.toString()),Z.resolve()}removeReference(e,n,r){return this.Ri.removeReference(r,n),this.di.add(r.toString()),Z.resolve()}markPotentiallyOrphaned(e,n){return this.di.add(n.toString()),Z.resolve()}removeTarget(e,n){this.Ri.Gr(n.targetId).forEach(s=>this.di.add(s.toString()));const r=this.persistence.getTargetCache();return r.getMatchingKeysForTargetId(e,n.targetId).next(s=>{s.forEach(i=>this.di.add(i.toString()))}).next(()=>r.removeTargetData(e,n))}Ti(){this.Ai=new Set}Ei(e){const n=this.persistence.getRemoteDocumentCache().newChangeBuffer();return Z.forEach(this.di,r=>{const s=Ne.fromPath(r);return this.mi(e,s).next(i=>{i||n.removeEntry(s,Me.min())})}).next(()=>(this.Ai=null,n.apply(e)))}updateLimboDocument(e,n){return this.mi(e,n).next(r=>{r?this.di.delete(n.toString()):this.di.add(n.toString())})}hi(e){return 0}mi(e,n){return Z.or([()=>Z.resolve(this.Ri.containsKey(n)),()=>this.persistence.getTargetCache().containsKey(e,n),()=>this.persistence.Ii(e,n)])}}class Id{constructor(e,n){this.persistence=e,this.fi=new mo(r=>YA(r.path),(r,s)=>r.isEqual(s)),this.garbageCollector=dP(this,n)}static Vi(e,n){return new Id(e,n)}Ti(){}Ei(e){return Z.resolve()}forEachTarget(e,n){return this.persistence.getTargetCache().forEachTarget(e,n)}dr(e){const n=this.pr(e);return this.persistence.getTargetCache().getTargetCount(e).next(r=>n.next(s=>r+s))}pr(e){let n=0;return this.mr(e,r=>{n++}).next(()=>n)}mr(e,n){return Z.forEach(this.fi,(r,s)=>this.wr(e,r,s).next(i=>i?Z.resolve():n(s)))}removeTargets(e,n,r){return this.persistence.getTargetCache().removeTargets(e,n,r)}removeOrphanedDocuments(e,n){let r=0;const s=this.persistence.getRemoteDocumentCache(),i=s.newChangeBuffer();return s.ni(e,o=>this.wr(e,o,n).next(l=>{l||(r++,i.removeEntry(o,Me.min()))})).next(()=>i.apply(e)).next(()=>r)}markPotentiallyOrphaned(e,n){return this.fi.set(n,e.currentSequenceNumber),Z.resolve()}removeTarget(e,n){const r=n.withSequenceNumber(e.currentSequenceNumber);return this.persistence.getTargetCache().updateTargetData(e,r)}addReference(e,n,r){return this.fi.set(r,e.currentSequenceNumber),Z.resolve()}removeReference(e,n,r){return this.fi.set(r,e.currentSequenceNumber),Z.resolve()}updateLimboDocument(e,n){return this.fi.set(n,e.currentSequenceNumber),Z.resolve()}hi(e){let n=e.key.toString().length;return e.isFoundDocument()&&(n+=Mu(e.data.value)),n}wr(e,n,r){return Z.or([()=>this.persistence.Ii(e,n),()=>this.persistence.getTargetCache().containsKey(e,n),()=>{const s=this.fi.get(n);return Z.resolve(s!==void 0&&s>r)}])}getCacheSize(e){return this.persistence.getRemoteDocumentCache().getSize(e)}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class n0{constructor(e,n,r,s){this.targetId=e,this.fromCache=n,this.Ts=r,this.Es=s}static Is(e,n){let r=Je(),s=Je();for(const i of n.docChanges)switch(i.type){case 0:r=r.add(i.doc.key);break;case 1:s=s.add(i.doc.key)}return new n0(e,n.fromCache,r,s)}}/** + * @license + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class EP{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class SP{constructor(){this.Rs=!1,this.As=!1,this.Vs=100,this.ds=function(){return dC()?8:KA(An())>0?6:4}()}initialize(e,n){this.fs=e,this.indexManager=n,this.Rs=!0}getDocumentsMatchingQuery(e,n,r,s){const i={result:null};return this.gs(e,n).next(o=>{i.result=o}).next(()=>{if(!i.result)return this.ps(e,n,s,r).next(o=>{i.result=o})}).next(()=>{if(i.result)return;const o=new EP;return this.ys(e,n,o).next(l=>{if(i.result=l,this.As)return this.ws(e,n,o,l.size)})}).next(()=>i.result)}ws(e,n,r,s){return r.documentReadCountthis.ds*s?(No()<=Ye.DEBUG&&xe("QueryEngine","The SDK decides to create cache indexes for query:",ko(n),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(e,es(n))):Z.resolve())}gs(e,n){if(vv(n))return Z.resolve(null);let r=es(n);return this.indexManager.getIndexType(e,r).next(s=>s===0?null:(n.limit!==null&&s===1&&(n=hm(n,null,"F"),r=es(n)),this.indexManager.getDocumentsMatchingTarget(e,r).next(i=>{const o=Je(...i);return this.fs.getDocuments(e,o).next(l=>this.indexManager.getMinOffset(e,r).next(c=>{const u=this.Ss(n,l);return this.bs(n,u,o,c.readTime)?this.gs(e,hm(n,null,"F")):this.Ds(e,u,n,c)}))})))}ps(e,n,r,s){return vv(n)||s.isEqual(Me.min())?Z.resolve(null):this.fs.getDocuments(e,r).next(i=>{const o=this.Ss(n,i);return this.bs(n,o,r,s)?Z.resolve(null):(No()<=Ye.DEBUG&&xe("QueryEngine","Re-using previous result from %s to execute query: %s",s.toString(),ko(n)),this.Ds(e,o,n,$A(s,Wl)).next(l=>l))})}Ss(e,n){let r=new rn(qE(e));return n.forEach((s,i)=>{bh(e,i)&&(r=r.add(i))}),r}bs(e,n,r,s){if(e.limit===null)return!1;if(r.size!==n.size)return!0;const i=e.limitType==="F"?n.last():n.first();return!!i&&(i.hasPendingWrites||i.version.compareTo(s)>0)}ys(e,n,r){return No()<=Ye.DEBUG&&xe("QueryEngine","Using full collection scan to execute query:",ko(n)),this.fs.getDocumentsMatchingQuery(e,n,wi.min(),r)}Ds(e,n,r,s){return this.fs.getDocumentsMatchingQuery(e,r,s).next(i=>(n.forEach(o=>{i=i.insert(o.key,o)}),i))}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const r0="LocalStore",TP=3e8;class NP{constructor(e,n,r,s){this.persistence=e,this.Cs=n,this.serializer=s,this.vs=new Ot(Xe),this.Fs=new mo(i=>Kg(i),Qg),this.Ms=new Map,this.xs=e.getRemoteDocumentCache(),this.li=e.getTargetCache(),this.Pi=e.getBundleCache(),this.Os(r)}Os(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new pP(this.xs,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.xs.setIndexManager(this.indexManager),this.Cs.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction("Collect garbage","readwrite-primary",n=>e.collect(n,this.vs))}}function kP(t,e,n,r){return new NP(t,e,n,r)}async function gS(t,e){const n=Oe(t);return await n.persistence.runTransaction("Handle user change","readonly",r=>{let s;return n.mutationQueue.getAllMutationBatches(r).next(i=>(s=i,n.Os(e),n.mutationQueue.getAllMutationBatches(r))).next(i=>{const o=[],l=[];let c=Je();for(const u of s){o.push(u.batchId);for(const h of u.mutations)c=c.add(h.key)}for(const u of i){l.push(u.batchId);for(const h of u.mutations)c=c.add(h.key)}return n.localDocuments.getDocuments(r,c).next(u=>({Ns:u,removedBatchIds:o,addedBatchIds:l}))})})}function IP(t,e){const n=Oe(t);return n.persistence.runTransaction("Acknowledge batch","readwrite-primary",r=>{const s=e.batch.keys(),i=n.xs.newChangeBuffer({trackRemovals:!0});return function(l,c,u,h){const f=u.batch,m=f.keys();let p=Z.resolve();return m.forEach(y=>{p=p.next(()=>h.getEntry(c,y)).next(_=>{const C=u.docVersions.get(y);ut(C!==null,48541),_.version.compareTo(C)<0&&(f.applyToRemoteDocument(_,u),_.isValidDocument()&&(_.setReadTime(u.commitVersion),h.addEntry(_)))})}),p.next(()=>l.mutationQueue.removeMutationBatch(c,f))}(n,r,e,i).next(()=>i.apply(r)).next(()=>n.mutationQueue.performConsistencyCheck(r)).next(()=>n.documentOverlayCache.removeOverlaysForBatchId(r,s,e.batch.batchId)).next(()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(r,function(l){let c=Je();for(let u=0;u0&&(c=c.add(l.batch.mutations[u].key));return c}(e))).next(()=>n.localDocuments.getDocuments(r,s))})}function yS(t){const e=Oe(t);return e.persistence.runTransaction("Get last remote snapshot version","readonly",n=>e.li.getLastRemoteSnapshotVersion(n))}function CP(t,e){const n=Oe(t),r=e.snapshotVersion;let s=n.vs;return n.persistence.runTransaction("Apply remote event","readwrite-primary",i=>{const o=n.xs.newChangeBuffer({trackRemovals:!0});s=n.vs;const l=[];e.targetChanges.forEach((h,f)=>{const m=s.get(f);if(!m)return;l.push(n.li.removeMatchingKeys(i,h.removedDocuments,f).next(()=>n.li.addMatchingKeys(i,h.addedDocuments,f)));let p=m.withSequenceNumber(i.currentSequenceNumber);e.targetMismatches.get(f)!==null?p=p.withResumeToken(wn.EMPTY_BYTE_STRING,Me.min()).withLastLimboFreeSnapshotVersion(Me.min()):h.resumeToken.approximateByteSize()>0&&(p=p.withResumeToken(h.resumeToken,r)),s=s.insert(f,p),function(_,C,v){return _.resumeToken.approximateByteSize()===0||C.snapshotVersion.toMicroseconds()-_.snapshotVersion.toMicroseconds()>=TP?!0:v.addedDocuments.size+v.modifiedDocuments.size+v.removedDocuments.size>0}(m,p,h)&&l.push(n.li.updateTargetData(i,p))});let c=js(),u=Je();if(e.documentUpdates.forEach(h=>{e.resolvedLimboDocuments.has(h)&&l.push(n.persistence.referenceDelegate.updateLimboDocument(i,h))}),l.push(AP(i,o,e.documentUpdates).next(h=>{c=h.Bs,u=h.Ls})),!r.isEqual(Me.min())){const h=n.li.getLastRemoteSnapshotVersion(i).next(f=>n.li.setTargetsMetadata(i,i.currentSequenceNumber,r));l.push(h)}return Z.waitFor(l).next(()=>o.apply(i)).next(()=>n.localDocuments.getLocalViewOfDocuments(i,c,u)).next(()=>c)}).then(i=>(n.vs=s,i))}function AP(t,e,n){let r=Je(),s=Je();return n.forEach(i=>r=r.add(i)),e.getEntries(t,r).next(i=>{let o=js();return n.forEach((l,c)=>{const u=i.get(l);c.isFoundDocument()!==u.isFoundDocument()&&(s=s.add(l)),c.isNoDocument()&&c.version.isEqual(Me.min())?(e.removeEntry(l,c.readTime),o=o.insert(l,c)):!u.isValidDocument()||c.version.compareTo(u.version)>0||c.version.compareTo(u.version)===0&&u.hasPendingWrites?(e.addEntry(c),o=o.insert(l,c)):xe(r0,"Ignoring outdated watch update for ",l,". Current version:",u.version," Watch version:",c.version)}),{Bs:o,Ls:s}})}function jP(t,e){const n=Oe(t);return n.persistence.runTransaction("Get next mutation batch","readonly",r=>(e===void 0&&(e=qg),n.mutationQueue.getNextMutationBatchAfterBatchId(r,e)))}function PP(t,e){const n=Oe(t);return n.persistence.runTransaction("Allocate target","readwrite",r=>{let s;return n.li.getTargetData(r,e).next(i=>i?(s=i,Z.resolve(s)):n.li.allocateTargetId(r).next(o=>(s=new ni(e,o,"TargetPurposeListen",r.currentSequenceNumber),n.li.addTargetData(r,s).next(()=>s))))}).then(r=>{const s=n.vs.get(r.targetId);return(s===null||r.snapshotVersion.compareTo(s.snapshotVersion)>0)&&(n.vs=n.vs.insert(r.targetId,r),n.Fs.set(e,r.targetId)),r})}async function ym(t,e,n){const r=Oe(t),s=r.vs.get(e),i=n?"readwrite":"readwrite-primary";try{n||await r.persistence.runTransaction("Release target",i,o=>r.persistence.referenceDelegate.removeTarget(o,s))}catch(o){if(!ka(o))throw o;xe(r0,`Failed to update sequence numbers for target ${e}: ${o}`)}r.vs=r.vs.remove(e),r.Fs.delete(s.target)}function Pv(t,e,n){const r=Oe(t);let s=Me.min(),i=Je();return r.persistence.runTransaction("Execute query","readwrite",o=>function(c,u,h){const f=Oe(c),m=f.Fs.get(h);return m!==void 0?Z.resolve(f.vs.get(m)):f.li.getTargetData(u,h)}(r,o,es(e)).next(l=>{if(l)return s=l.lastLimboFreeSnapshotVersion,r.li.getMatchingKeysForTargetId(o,l.targetId).next(c=>{i=c})}).next(()=>r.Cs.getDocumentsMatchingQuery(o,e,n?s:Me.min(),n?i:Je())).next(l=>(RP(r,xj(e),l),{documents:l,ks:i})))}function RP(t,e,n){let r=t.Ms.get(e)||Me.min();n.forEach((s,i)=>{i.readTime.compareTo(r)>0&&(r=i.readTime)}),t.Ms.set(e,r)}class Rv{constructor(){this.activeTargetIds=Sj()}Qs(e){this.activeTargetIds=this.activeTargetIds.add(e)}Gs(e){this.activeTargetIds=this.activeTargetIds.delete(e)}Ws(){const e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)}}class DP{constructor(){this.vo=new Rv,this.Fo={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,n,r){}addLocalQueryTarget(e,n=!0){return n&&this.vo.Qs(e),this.Fo[e]||"not-current"}updateQueryState(e,n,r){this.Fo[e]=n}removeLocalQueryTarget(e){this.vo.Gs(e)}isLocalQueryTarget(e){return this.vo.activeTargetIds.has(e)}clearQueryState(e){delete this.Fo[e]}getAllActiveQueryTargets(){return this.vo.activeTargetIds}isActiveQueryTarget(e){return this.vo.activeTargetIds.has(e)}start(){return this.vo=new Rv,Promise.resolve()}handleUserChange(e,n,r){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class MP{Mo(e){}shutdown(){}}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Dv="ConnectivityMonitor";class Mv{constructor(){this.xo=()=>this.Oo(),this.No=()=>this.Bo(),this.Lo=[],this.ko()}Mo(e){this.Lo.push(e)}shutdown(){window.removeEventListener("online",this.xo),window.removeEventListener("offline",this.No)}ko(){window.addEventListener("online",this.xo),window.addEventListener("offline",this.No)}Oo(){xe(Dv,"Network connectivity changed: AVAILABLE");for(const e of this.Lo)e(0)}Bo(){xe(Dv,"Network connectivity changed: UNAVAILABLE");for(const e of this.Lo)e(1)}static v(){return typeof window<"u"&&window.addEventListener!==void 0&&window.removeEventListener!==void 0}}/** + * @license + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */let pu=null;function xm(){return pu===null?pu=function(){return 268435456+Math.round(2147483648*Math.random())}():pu++,"0x"+pu.toString(16)}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const If="RestConnection",LP={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery",ExecutePipeline:"executePipeline"};class OP{get qo(){return!1}constructor(e){this.databaseInfo=e,this.databaseId=e.databaseId;const n=e.ssl?"https":"http",r=encodeURIComponent(this.databaseId.projectId),s=encodeURIComponent(this.databaseId.database);this.Ko=n+"://"+e.host,this.Uo=`projects/${r}/databases/${s}`,this.$o=this.databaseId.database===Ed?`project_id=${r}`:`project_id=${r}&database_id=${s}`}Wo(e,n,r,s,i){const o=xm(),l=this.Qo(e,n.toUriEncodedString());xe(If,`Sending RPC '${e}' ${o}:`,l,r);const c={"google-cloud-resource-prefix":this.Uo,"x-goog-request-params":this.$o};this.Go(c,s,i);const{host:u}=new URL(l),h=Sa(u);return this.zo(e,l,c,r,h).then(f=>(xe(If,`Received RPC '${e}' ${o}: `,f),f),f=>{throw oo(If,`RPC '${e}' ${o} failed with error: `,f,"url: ",l,"request:",r),f})}jo(e,n,r,s,i,o){return this.Wo(e,n,r,s,i)}Go(e,n,r){e["X-Goog-Api-Client"]=function(){return"gl-js/ fire/"+Ta}(),e["Content-Type"]="text/plain",this.databaseInfo.appId&&(e["X-Firebase-GMPID"]=this.databaseInfo.appId),n&&n.headers.forEach((s,i)=>e[i]=s),r&&r.headers.forEach((s,i)=>e[i]=s)}Qo(e,n){const r=LP[e];let s=`${this.Ko}/v1/${n}:${r}`;return this.databaseInfo.apiKey&&(s=`${s}?key=${encodeURIComponent(this.databaseInfo.apiKey)}`),s}terminate(){}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class VP{constructor(e){this.Jo=e.Jo,this.Ho=e.Ho}Zo(e){this.Xo=e}Yo(e){this.e_=e}t_(e){this.n_=e}onMessage(e){this.r_=e}close(){this.Ho()}send(e){this.Jo(e)}i_(){this.Xo()}s_(){this.e_()}o_(e){this.n_(e)}__(e){this.r_(e)}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Tn="WebChannelConnection",el=(t,e,n)=>{t.listen(e,r=>{try{n(r)}catch(s){setTimeout(()=>{throw s},0)}})};class Xo extends OP{constructor(e){super(e),this.a_=[],this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}static u_(){if(!Xo.c_){const e=bE();el(e,wE.STAT_EVENT,n=>{n.stat===im.PROXY?xe(Tn,"STAT_EVENT: detected buffering proxy"):n.stat===im.NOPROXY&&xe(Tn,"STAT_EVENT: detected no buffering proxy")}),Xo.c_=!0}}zo(e,n,r,s,i){const o=xm();return new Promise((l,c)=>{const u=new xE;u.setWithCredentials(!0),u.listenOnce(vE.COMPLETE,()=>{try{switch(u.getLastErrorCode()){case Du.NO_ERROR:const f=u.getResponseJson();xe(Tn,`XHR for RPC '${e}' ${o} received:`,JSON.stringify(f)),l(f);break;case Du.TIMEOUT:xe(Tn,`RPC '${e}' ${o} timed out`),c(new fe(Y.DEADLINE_EXCEEDED,"Request time out"));break;case Du.HTTP_ERROR:const m=u.getStatus();if(xe(Tn,`RPC '${e}' ${o} failed with status:`,m,"response text:",u.getResponseText()),m>0){let p=u.getResponseJson();Array.isArray(p)&&(p=p[0]);const y=p==null?void 0:p.error;if(y&&y.status&&y.message){const _=function(v){const w=v.toLowerCase().replace(/_/g,"-");return Object.values(Y).indexOf(w)>=0?w:Y.UNKNOWN}(y.status);c(new fe(_,y.message))}else c(new fe(Y.UNKNOWN,"Server responded with status "+u.getStatus()))}else c(new fe(Y.UNAVAILABLE,"Connection failed."));break;default:Ae(9055,{l_:e,streamId:o,h_:u.getLastErrorCode(),P_:u.getLastError()})}}finally{xe(Tn,`RPC '${e}' ${o} completed.`)}});const h=JSON.stringify(s);xe(Tn,`RPC '${e}' ${o} sending request:`,s),u.send(n,"POST",h,r,15)})}T_(e,n,r){const s=xm(),i=[this.Ko,"/","google.firestore.v1.Firestore","/",e,"/channel"],o=this.createWebChannelTransport(),l={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:`projects/${this.databaseId.projectId}/databases/${this.databaseId.database}`},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling},c=this.longPollingOptions.timeoutSeconds;c!==void 0&&(l.longPollingTimeout=Math.round(1e3*c)),this.useFetchStreams&&(l.useFetchStreams=!0),this.Go(l.initMessageHeaders,n,r),l.encodeInitMessageHeaders=!0;const u=i.join("");xe(Tn,`Creating RPC '${e}' stream ${s}: ${u}`,l);const h=o.createWebChannel(u,l);this.E_(h);let f=!1,m=!1;const p=new VP({Jo:y=>{m?xe(Tn,`Not sending because RPC '${e}' stream ${s} is closed:`,y):(f||(xe(Tn,`Opening RPC '${e}' stream ${s} transport.`),h.open(),f=!0),xe(Tn,`RPC '${e}' stream ${s} sending:`,y),h.send(y))},Ho:()=>h.close()});return el(h,al.EventType.OPEN,()=>{m||(xe(Tn,`RPC '${e}' stream ${s} transport opened.`),p.i_())}),el(h,al.EventType.CLOSE,()=>{m||(m=!0,xe(Tn,`RPC '${e}' stream ${s} transport closed`),p.o_(),this.I_(h))}),el(h,al.EventType.ERROR,y=>{m||(m=!0,oo(Tn,`RPC '${e}' stream ${s} transport errored. Name:`,y.name,"Message:",y.message),p.o_(new fe(Y.UNAVAILABLE,"The operation could not be completed")))}),el(h,al.EventType.MESSAGE,y=>{var _;if(!m){const C=y.data[0];ut(!!C,16349);const v=C,w=(v==null?void 0:v.error)||((_=v[0])==null?void 0:_.error);if(w){xe(Tn,`RPC '${e}' stream ${s} received error:`,w);const E=w.status;let D=function(S){const x=Wt[S];if(x!==void 0)return rS(x)}(E),M=w.message;E==="NOT_FOUND"&&M.includes("database")&&M.includes("does not exist")&&M.includes(this.databaseId.database)&&oo(`Database '${this.databaseId.database}' not found. Please check your project configuration.`),D===void 0&&(D=Y.INTERNAL,M="Unknown error status: "+E+" with message "+w.message),m=!0,p.o_(new fe(D,M)),h.close()}else xe(Tn,`RPC '${e}' stream ${s} received:`,C),p.__(C)}}),Xo.u_(),setTimeout(()=>{p.s_()},0),p}terminate(){this.a_.forEach(e=>e.close()),this.a_=[]}E_(e){this.a_.push(e)}I_(e){this.a_=this.a_.filter(n=>n===e)}Go(e,n,r){super.Go(e,n,r),this.databaseInfo.apiKey&&(e["x-goog-api-key"]=this.databaseInfo.apiKey)}createWebChannelTransport(){return _E()}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function FP(t){return new Xo(t)}function Cf(){return typeof document<"u"?document:null}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Nh(t){return new $j(t,!0)}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */Xo.c_=!1;class xS{constructor(e,n,r=1e3,s=1.5,i=6e4){this.Ci=e,this.timerId=n,this.R_=r,this.A_=s,this.V_=i,this.d_=0,this.m_=null,this.f_=Date.now(),this.reset()}reset(){this.d_=0}g_(){this.d_=this.V_}p_(e){this.cancel();const n=Math.floor(this.d_+this.y_()),r=Math.max(0,Date.now()-this.f_),s=Math.max(0,n-r);s>0&&xe("ExponentialBackoff",`Backing off for ${s} ms (base delay: ${this.d_} ms, delay with jitter: ${n} ms, last attempt: ${r} ms ago)`),this.m_=this.Ci.enqueueAfterDelay(this.timerId,s,()=>(this.f_=Date.now(),e())),this.d_*=this.A_,this.d_this.V_&&(this.d_=this.V_)}w_(){this.m_!==null&&(this.m_.skipDelay(),this.m_=null)}cancel(){this.m_!==null&&(this.m_.cancel(),this.m_=null)}y_(){return(Math.random()-.5)*this.d_}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Lv="PersistentStream";class vS{constructor(e,n,r,s,i,o,l,c){this.Ci=e,this.S_=r,this.b_=s,this.connection=i,this.authCredentialsProvider=o,this.appCheckCredentialsProvider=l,this.listener=c,this.state=0,this.D_=0,this.C_=null,this.v_=null,this.stream=null,this.F_=0,this.M_=new xS(e,n)}x_(){return this.state===1||this.state===5||this.O_()}O_(){return this.state===2||this.state===3}start(){this.F_=0,this.state!==4?this.auth():this.N_()}async stop(){this.x_()&&await this.close(0)}B_(){this.state=0,this.M_.reset()}L_(){this.O_()&&this.C_===null&&(this.C_=this.Ci.enqueueAfterDelay(this.S_,6e4,()=>this.k_()))}q_(e){this.K_(),this.stream.send(e)}async k_(){if(this.O_())return this.close(0)}K_(){this.C_&&(this.C_.cancel(),this.C_=null)}U_(){this.v_&&(this.v_.cancel(),this.v_=null)}async close(e,n){this.K_(),this.U_(),this.M_.cancel(),this.D_++,e!==4?this.M_.reset():n&&n.code===Y.RESOURCE_EXHAUSTED?(As(n.toString()),As("Using maximum backoff delay to prevent overloading the backend."),this.M_.g_()):n&&n.code===Y.UNAUTHENTICATED&&this.state!==3&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),this.stream!==null&&(this.W_(),this.stream.close(),this.stream=null),this.state=e,await this.listener.t_(n)}W_(){}auth(){this.state=1;const e=this.Q_(this.D_),n=this.D_;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then(([r,s])=>{this.D_===n&&this.G_(r,s)},r=>{e(()=>{const s=new fe(Y.UNKNOWN,"Fetching auth token failed: "+r.message);return this.z_(s)})})}G_(e,n){const r=this.Q_(this.D_);this.stream=this.j_(e,n),this.stream.Zo(()=>{r(()=>this.listener.Zo())}),this.stream.Yo(()=>{r(()=>(this.state=2,this.v_=this.Ci.enqueueAfterDelay(this.b_,1e4,()=>(this.O_()&&(this.state=3),Promise.resolve())),this.listener.Yo()))}),this.stream.t_(s=>{r(()=>this.z_(s))}),this.stream.onMessage(s=>{r(()=>++this.F_==1?this.J_(s):this.onNext(s))})}N_(){this.state=5,this.M_.p_(async()=>{this.state=0,this.start()})}z_(e){return xe(Lv,`close with error: ${e}`),this.stream=null,this.close(4,e)}Q_(e){return n=>{this.Ci.enqueueAndForget(()=>this.D_===e?n():(xe(Lv,"stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve()))}}}class zP extends vS{constructor(e,n,r,s,i,o){super(e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",n,r,s,o),this.serializer=i}j_(e,n){return this.connection.T_("Listen",e,n)}J_(e){return this.onNext(e)}onNext(e){this.M_.reset();const n=Gj(this.serializer,e),r=function(i){if(!("targetChange"in i))return Me.min();const o=i.targetChange;return o.targetIds&&o.targetIds.length?Me.min():o.readTime?ts(o.readTime):Me.min()}(e);return this.listener.H_(n,r)}Z_(e){const n={};n.database=gm(this.serializer),n.addTarget=function(i,o){let l;const c=o.target;if(l=um(c)?{documents:Qj(i,c)}:{query:Yj(i,c).ft},l.targetId=o.targetId,o.resumeToken.approximateByteSize()>0){l.resumeToken=oS(i,o.resumeToken);const u=fm(i,o.expectedCount);u!==null&&(l.expectedCount=u)}else if(o.snapshotVersion.compareTo(Me.min())>0){l.readTime=kd(i,o.snapshotVersion.toTimestamp());const u=fm(i,o.expectedCount);u!==null&&(l.expectedCount=u)}return l}(this.serializer,e);const r=Jj(this.serializer,e);r&&(n.labels=r),this.q_(n)}X_(e){const n={};n.database=gm(this.serializer),n.removeTarget=e,this.q_(n)}}class UP extends vS{constructor(e,n,r,s,i,o){super(e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",n,r,s,o),this.serializer=i}get Y_(){return this.F_>0}start(){this.lastStreamToken=void 0,super.start()}W_(){this.Y_&&this.ea([])}j_(e,n){return this.connection.T_("Write",e,n)}J_(e){return ut(!!e.streamToken,31322),this.lastStreamToken=e.streamToken,ut(!e.writeResults||e.writeResults.length===0,55816),this.listener.ta()}onNext(e){ut(!!e.streamToken,12678),this.lastStreamToken=e.streamToken,this.M_.reset();const n=Kj(e.writeResults,e.commitTime),r=ts(e.commitTime);return this.listener.na(r,n)}ra(){const e={};e.database=gm(this.serializer),this.q_(e)}ea(e){const n={streamToken:this.lastStreamToken,writes:e.map(r=>Wj(this.serializer,r))};this.q_(n)}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class BP{}class $P extends BP{constructor(e,n,r,s){super(),this.authCredentials=e,this.appCheckCredentials=n,this.connection=r,this.serializer=s,this.ia=!1}sa(){if(this.ia)throw new fe(Y.FAILED_PRECONDITION,"The client has already been terminated.")}Wo(e,n,r,s){return this.sa(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([i,o])=>this.connection.Wo(e,pm(n,r),s,i,o)).catch(i=>{throw i.name==="FirebaseError"?(i.code===Y.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),i):new fe(Y.UNKNOWN,i.toString())})}jo(e,n,r,s,i){return this.sa(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([o,l])=>this.connection.jo(e,pm(n,r),s,o,l,i)).catch(o=>{throw o.name==="FirebaseError"?(o.code===Y.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),o):new fe(Y.UNKNOWN,o.toString())})}terminate(){this.ia=!0,this.connection.terminate()}}function HP(t,e,n,r){return new $P(t,e,n,r)}class qP{constructor(e,n){this.asyncQueue=e,this.onlineStateHandler=n,this.state="Unknown",this.oa=0,this._a=null,this.aa=!0}ua(){this.oa===0&&(this.ca("Unknown"),this._a=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,()=>(this._a=null,this.la("Backend didn't respond within 10 seconds."),this.ca("Offline"),Promise.resolve())))}ha(e){this.state==="Online"?this.ca("Unknown"):(this.oa++,this.oa>=1&&(this.Pa(),this.la(`Connection failed 1 times. Most recent error: ${e.toString()}`),this.ca("Offline")))}set(e){this.Pa(),this.oa=0,e==="Online"&&(this.aa=!1),this.ca(e)}ca(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}la(e){const n=`Could not reach Cloud Firestore backend. ${e} +This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.`;this.aa?(As(n),this.aa=!1):xe("OnlineStateTracker",n)}Pa(){this._a!==null&&(this._a.cancel(),this._a=null)}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const ao="RemoteStore";class GP{constructor(e,n,r,s,i){this.localStore=e,this.datastore=n,this.asyncQueue=r,this.remoteSyncer={},this.Ta=[],this.Ea=new Map,this.Ia=new Set,this.Ra=[],this.Aa=i,this.Aa.Mo(o=>{r.enqueueAndForget(async()=>{go(this)&&(xe(ao,"Restarting streams for network reachability change."),await async function(c){const u=Oe(c);u.Ia.add(4),await xc(u),u.Va.set("Unknown"),u.Ia.delete(4),await kh(u)}(this))})}),this.Va=new qP(r,s)}}async function kh(t){if(go(t))for(const e of t.Ra)await e(!0)}async function xc(t){for(const e of t.Ra)await e(!1)}function wS(t,e){const n=Oe(t);n.Ea.has(e.targetId)||(n.Ea.set(e.targetId,e),a0(n)?o0(n):Ca(n).O_()&&i0(n,e))}function s0(t,e){const n=Oe(t),r=Ca(n);n.Ea.delete(e),r.O_()&&bS(n,e),n.Ea.size===0&&(r.O_()?r.L_():go(n)&&n.Va.set("Unknown"))}function i0(t,e){if(t.da.$e(e.targetId),e.resumeToken.approximateByteSize()>0||e.snapshotVersion.compareTo(Me.min())>0){const n=t.remoteSyncer.getRemoteKeysForTarget(e.targetId).size;e=e.withExpectedCount(n)}Ca(t).Z_(e)}function bS(t,e){t.da.$e(e),Ca(t).X_(e)}function o0(t){t.da=new Fj({getRemoteKeysForTarget:e=>t.remoteSyncer.getRemoteKeysForTarget(e),At:e=>t.Ea.get(e)||null,ht:()=>t.datastore.serializer.databaseId}),Ca(t).start(),t.Va.ua()}function a0(t){return go(t)&&!Ca(t).x_()&&t.Ea.size>0}function go(t){return Oe(t).Ia.size===0}function _S(t){t.da=void 0}async function WP(t){t.Va.set("Online")}async function KP(t){t.Ea.forEach((e,n)=>{i0(t,e)})}async function QP(t,e){_S(t),a0(t)?(t.Va.ha(e),o0(t)):t.Va.set("Unknown")}async function YP(t,e,n){if(t.Va.set("Online"),e instanceof iS&&e.state===2&&e.cause)try{await async function(s,i){const o=i.cause;for(const l of i.targetIds)s.Ea.has(l)&&(await s.remoteSyncer.rejectListen(l,o),s.Ea.delete(l),s.da.removeTarget(l))}(t,e)}catch(r){xe(ao,"Failed to remove targets %s: %s ",e.targetIds.join(","),r),await Cd(t,r)}else if(e instanceof Vu?t.da.Xe(e):e instanceof sS?t.da.st(e):t.da.tt(e),!n.isEqual(Me.min()))try{const r=await yS(t.localStore);n.compareTo(r)>=0&&await function(i,o){const l=i.da.Tt(o);return l.targetChanges.forEach((c,u)=>{if(c.resumeToken.approximateByteSize()>0){const h=i.Ea.get(u);h&&i.Ea.set(u,h.withResumeToken(c.resumeToken,o))}}),l.targetMismatches.forEach((c,u)=>{const h=i.Ea.get(c);if(!h)return;i.Ea.set(c,h.withResumeToken(wn.EMPTY_BYTE_STRING,h.snapshotVersion)),bS(i,c);const f=new ni(h.target,c,u,h.sequenceNumber);i0(i,f)}),i.remoteSyncer.applyRemoteEvent(l)}(t,n)}catch(r){xe(ao,"Failed to raise snapshot:",r),await Cd(t,r)}}async function Cd(t,e,n){if(!ka(e))throw e;t.Ia.add(1),await xc(t),t.Va.set("Offline"),n||(n=()=>yS(t.localStore)),t.asyncQueue.enqueueRetryable(async()=>{xe(ao,"Retrying IndexedDB access"),await n(),t.Ia.delete(1),await kh(t)})}function ES(t,e){return e().catch(n=>Cd(t,n,e))}async function Ih(t){const e=Oe(t),n=Si(e);let r=e.Ta.length>0?e.Ta[e.Ta.length-1].batchId:qg;for(;XP(e);)try{const s=await jP(e.localStore,r);if(s===null){e.Ta.length===0&&n.L_();break}r=s.batchId,JP(e,s)}catch(s){await Cd(e,s)}SS(e)&&TS(e)}function XP(t){return go(t)&&t.Ta.length<10}function JP(t,e){t.Ta.push(e);const n=Si(t);n.O_()&&n.Y_&&n.ea(e.mutations)}function SS(t){return go(t)&&!Si(t).x_()&&t.Ta.length>0}function TS(t){Si(t).start()}async function ZP(t){Si(t).ra()}async function e4(t){const e=Si(t);for(const n of t.Ta)e.ea(n.mutations)}async function t4(t,e,n){const r=t.Ta.shift(),s=Xg.from(r,e,n);await ES(t,()=>t.remoteSyncer.applySuccessfulWrite(s)),await Ih(t)}async function n4(t,e){e&&Si(t).Y_&&await async function(r,s){if(function(o){return Lj(o)&&o!==Y.ABORTED}(s.code)){const i=r.Ta.shift();Si(r).B_(),await ES(r,()=>r.remoteSyncer.rejectFailedWrite(i.batchId,s)),await Ih(r)}}(t,e),SS(t)&&TS(t)}async function Ov(t,e){const n=Oe(t);n.asyncQueue.verifyOperationInProgress(),xe(ao,"RemoteStore received new credentials");const r=go(n);n.Ia.add(3),await xc(n),r&&n.Va.set("Unknown"),await n.remoteSyncer.handleCredentialChange(e),n.Ia.delete(3),await kh(n)}async function r4(t,e){const n=Oe(t);e?(n.Ia.delete(2),await kh(n)):e||(n.Ia.add(2),await xc(n),n.Va.set("Unknown"))}function Ca(t){return t.ma||(t.ma=function(n,r,s){const i=Oe(n);return i.sa(),new zP(r,i.connection,i.authCredentials,i.appCheckCredentials,i.serializer,s)}(t.datastore,t.asyncQueue,{Zo:WP.bind(null,t),Yo:KP.bind(null,t),t_:QP.bind(null,t),H_:YP.bind(null,t)}),t.Ra.push(async e=>{e?(t.ma.B_(),a0(t)?o0(t):t.Va.set("Unknown")):(await t.ma.stop(),_S(t))})),t.ma}function Si(t){return t.fa||(t.fa=function(n,r,s){const i=Oe(n);return i.sa(),new UP(r,i.connection,i.authCredentials,i.appCheckCredentials,i.serializer,s)}(t.datastore,t.asyncQueue,{Zo:()=>Promise.resolve(),Yo:ZP.bind(null,t),t_:n4.bind(null,t),ta:e4.bind(null,t),na:t4.bind(null,t)}),t.Ra.push(async e=>{e?(t.fa.B_(),await Ih(t)):(await t.fa.stop(),t.Ta.length>0&&(xe(ao,`Stopping write stream with ${t.Ta.length} pending writes`),t.Ta=[]))})),t.fa}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class l0{constructor(e,n,r,s,i){this.asyncQueue=e,this.timerId=n,this.targetTimeMs=r,this.op=s,this.removalCallback=i,this.deferred=new Es,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch(o=>{})}get promise(){return this.deferred.promise}static createAndSchedule(e,n,r,s,i){const o=Date.now()+r,l=new l0(e,n,o,s,i);return l.start(r),l}start(e){this.timerHandle=setTimeout(()=>this.handleDelayElapsed(),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){this.timerHandle!==null&&(this.clearTimeout(),this.deferred.reject(new fe(Y.CANCELLED,"Operation cancelled"+(e?": "+e:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget(()=>this.timerHandle!==null?(this.clearTimeout(),this.op().then(e=>this.deferred.resolve(e))):Promise.resolve())}clearTimeout(){this.timerHandle!==null&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}}function c0(t,e){if(As("AsyncQueue",`${e}: ${t}`),ka(t))return new fe(Y.UNAVAILABLE,`${e}: ${t}`);throw t}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Jo{static emptySet(e){return new Jo(e.comparator)}constructor(e){this.comparator=e?(n,r)=>e(n,r)||Ne.comparator(n.key,r.key):(n,r)=>Ne.comparator(n.key,r.key),this.keyedMap=ll(),this.sortedSet=new Ot(this.comparator)}has(e){return this.keyedMap.get(e)!=null}get(e){return this.keyedMap.get(e)}first(){return this.sortedSet.minKey()}last(){return this.sortedSet.maxKey()}isEmpty(){return this.sortedSet.isEmpty()}indexOf(e){const n=this.keyedMap.get(e);return n?this.sortedSet.indexOf(n):-1}get size(){return this.sortedSet.size}forEach(e){this.sortedSet.inorderTraversal((n,r)=>(e(n),!1))}add(e){const n=this.delete(e.key);return n.copy(n.keyedMap.insert(e.key,e),n.sortedSet.insert(e,null))}delete(e){const n=this.get(e);return n?this.copy(this.keyedMap.remove(e),this.sortedSet.remove(n)):this}isEqual(e){if(!(e instanceof Jo)||this.size!==e.size)return!1;const n=this.sortedSet.getIterator(),r=e.sortedSet.getIterator();for(;n.hasNext();){const s=n.getNext().key,i=r.getNext().key;if(!s.isEqual(i))return!1}return!0}toString(){const e=[];return this.forEach(n=>{e.push(n.toString())}),e.length===0?"DocumentSet ()":`DocumentSet ( + `+e.join(` +`)+` +)`}copy(e,n){const r=new Jo;return r.comparator=this.comparator,r.keyedMap=e,r.sortedSet=n,r}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Vv{constructor(){this.ga=new Ot(Ne.comparator)}track(e){const n=e.doc.key,r=this.ga.get(n);r?e.type!==0&&r.type===3?this.ga=this.ga.insert(n,e):e.type===3&&r.type!==1?this.ga=this.ga.insert(n,{type:r.type,doc:e.doc}):e.type===2&&r.type===2?this.ga=this.ga.insert(n,{type:2,doc:e.doc}):e.type===2&&r.type===0?this.ga=this.ga.insert(n,{type:0,doc:e.doc}):e.type===1&&r.type===0?this.ga=this.ga.remove(n):e.type===1&&r.type===2?this.ga=this.ga.insert(n,{type:1,doc:r.doc}):e.type===0&&r.type===1?this.ga=this.ga.insert(n,{type:2,doc:e.doc}):Ae(63341,{Vt:e,pa:r}):this.ga=this.ga.insert(n,e)}ya(){const e=[];return this.ga.inorderTraversal((n,r)=>{e.push(r)}),e}}class xa{constructor(e,n,r,s,i,o,l,c,u){this.query=e,this.docs=n,this.oldDocs=r,this.docChanges=s,this.mutatedKeys=i,this.fromCache=o,this.syncStateChanged=l,this.excludesMetadataChanges=c,this.hasCachedResults=u}static fromInitialDocuments(e,n,r,s,i){const o=[];return n.forEach(l=>{o.push({type:0,doc:l})}),new xa(e,n,Jo.emptySet(n),o,r,s,!0,!1,i)}get hasPendingWrites(){return!this.mutatedKeys.isEmpty()}isEqual(e){if(!(this.fromCache===e.fromCache&&this.hasCachedResults===e.hasCachedResults&&this.syncStateChanged===e.syncStateChanged&&this.mutatedKeys.isEqual(e.mutatedKeys)&&wh(this.query,e.query)&&this.docs.isEqual(e.docs)&&this.oldDocs.isEqual(e.oldDocs)))return!1;const n=this.docChanges,r=e.docChanges;if(n.length!==r.length)return!1;for(let s=0;se.Da())}}class i4{constructor(){this.queries=Fv(),this.onlineState="Unknown",this.Ca=new Set}terminate(){(function(n,r){const s=Oe(n),i=s.queries;s.queries=Fv(),i.forEach((o,l)=>{for(const c of l.Sa)c.onError(r)})})(this,new fe(Y.ABORTED,"Firestore shutting down"))}}function Fv(){return new mo(t=>HE(t),wh)}async function u0(t,e){const n=Oe(t);let r=3;const s=e.query;let i=n.queries.get(s);i?!i.ba()&&e.Da()&&(r=2):(i=new s4,r=e.Da()?0:1);try{switch(r){case 0:i.wa=await n.onListen(s,!0);break;case 1:i.wa=await n.onListen(s,!1);break;case 2:await n.onFirstRemoteStoreListen(s)}}catch(o){const l=c0(o,`Initialization of query '${ko(e.query)}' failed`);return void e.onError(l)}n.queries.set(s,i),i.Sa.push(e),e.va(n.onlineState),i.wa&&e.Fa(i.wa)&&h0(n)}async function d0(t,e){const n=Oe(t),r=e.query;let s=3;const i=n.queries.get(r);if(i){const o=i.Sa.indexOf(e);o>=0&&(i.Sa.splice(o,1),i.Sa.length===0?s=e.Da()?0:1:!i.ba()&&e.Da()&&(s=2))}switch(s){case 0:return n.queries.delete(r),n.onUnlisten(r,!0);case 1:return n.queries.delete(r),n.onUnlisten(r,!1);case 2:return n.onLastRemoteStoreUnlisten(r);default:return}}function o4(t,e){const n=Oe(t);let r=!1;for(const s of e){const i=s.query,o=n.queries.get(i);if(o){for(const l of o.Sa)l.Fa(s)&&(r=!0);o.wa=s}}r&&h0(n)}function a4(t,e,n){const r=Oe(t),s=r.queries.get(e);if(s)for(const i of s.Sa)i.onError(n);r.queries.delete(e)}function h0(t){t.Ca.forEach(e=>{e.next()})}var vm,zv;(zv=vm||(vm={})).Ma="default",zv.Cache="cache";class f0{constructor(e,n,r){this.query=e,this.xa=n,this.Oa=!1,this.Na=null,this.onlineState="Unknown",this.options=r||{}}Fa(e){if(!this.options.includeMetadataChanges){const r=[];for(const s of e.docChanges)s.type!==3&&r.push(s);e=new xa(e.query,e.docs,e.oldDocs,r,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let n=!1;return this.Oa?this.Ba(e)&&(this.xa.next(e),n=!0):this.La(e,this.onlineState)&&(this.ka(e),n=!0),this.Na=e,n}onError(e){this.xa.error(e)}va(e){this.onlineState=e;let n=!1;return this.Na&&!this.Oa&&this.La(this.Na,e)&&(this.ka(this.Na),n=!0),n}La(e,n){if(!e.fromCache||!this.Da())return!0;const r=n!=="Offline";return(!this.options.qa||!r)&&(!e.docs.isEmpty()||e.hasCachedResults||n==="Offline")}Ba(e){if(e.docChanges.length>0)return!0;const n=this.Na&&this.Na.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!n)&&this.options.includeMetadataChanges===!0}ka(e){e=xa.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.Oa=!0,this.xa.next(e)}Da(){return this.options.source!==vm.Cache}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class NS{constructor(e){this.key=e}}class kS{constructor(e){this.key=e}}class l4{constructor(e,n){this.query=e,this.Za=n,this.Xa=null,this.hasCachedResults=!1,this.current=!1,this.Ya=Je(),this.mutatedKeys=Je(),this.eu=qE(e),this.tu=new Jo(this.eu)}get nu(){return this.Za}ru(e,n){const r=n?n.iu:new Vv,s=n?n.tu:this.tu;let i=n?n.mutatedKeys:this.mutatedKeys,o=s,l=!1;const c=this.query.limitType==="F"&&s.size===this.query.limit?s.last():null,u=this.query.limitType==="L"&&s.size===this.query.limit?s.first():null;if(e.inorderTraversal((h,f)=>{const m=s.get(h),p=bh(this.query,f)?f:null,y=!!m&&this.mutatedKeys.has(m.key),_=!!p&&(p.hasLocalMutations||this.mutatedKeys.has(p.key)&&p.hasCommittedMutations);let C=!1;m&&p?m.data.isEqual(p.data)?y!==_&&(r.track({type:3,doc:p}),C=!0):this.su(m,p)||(r.track({type:2,doc:p}),C=!0,(c&&this.eu(p,c)>0||u&&this.eu(p,u)<0)&&(l=!0)):!m&&p?(r.track({type:0,doc:p}),C=!0):m&&!p&&(r.track({type:1,doc:m}),C=!0,(c||u)&&(l=!0)),C&&(p?(o=o.add(p),i=_?i.add(h):i.delete(h)):(o=o.delete(h),i=i.delete(h)))}),this.query.limit!==null)for(;o.size>this.query.limit;){const h=this.query.limitType==="F"?o.last():o.first();o=o.delete(h.key),i=i.delete(h.key),r.track({type:1,doc:h})}return{tu:o,iu:r,bs:l,mutatedKeys:i}}su(e,n){return e.hasLocalMutations&&n.hasCommittedMutations&&!n.hasLocalMutations}applyChanges(e,n,r,s){const i=this.tu;this.tu=e.tu,this.mutatedKeys=e.mutatedKeys;const o=e.iu.ya();o.sort((h,f)=>function(p,y){const _=C=>{switch(C){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return Ae(20277,{Vt:C})}};return _(p)-_(y)}(h.type,f.type)||this.eu(h.doc,f.doc)),this.ou(r),s=s??!1;const l=n&&!s?this._u():[],c=this.Ya.size===0&&this.current&&!s?1:0,u=c!==this.Xa;return this.Xa=c,o.length!==0||u?{snapshot:new xa(this.query,e.tu,i,o,e.mutatedKeys,c===0,u,!1,!!r&&r.resumeToken.approximateByteSize()>0),au:l}:{au:l}}va(e){return this.current&&e==="Offline"?(this.current=!1,this.applyChanges({tu:this.tu,iu:new Vv,mutatedKeys:this.mutatedKeys,bs:!1},!1)):{au:[]}}uu(e){return!this.Za.has(e)&&!!this.tu.has(e)&&!this.tu.get(e).hasLocalMutations}ou(e){e&&(e.addedDocuments.forEach(n=>this.Za=this.Za.add(n)),e.modifiedDocuments.forEach(n=>{}),e.removedDocuments.forEach(n=>this.Za=this.Za.delete(n)),this.current=e.current)}_u(){if(!this.current)return[];const e=this.Ya;this.Ya=Je(),this.tu.forEach(r=>{this.uu(r.key)&&(this.Ya=this.Ya.add(r.key))});const n=[];return e.forEach(r=>{this.Ya.has(r)||n.push(new kS(r))}),this.Ya.forEach(r=>{e.has(r)||n.push(new NS(r))}),n}cu(e){this.Za=e.ks,this.Ya=Je();const n=this.ru(e.documents);return this.applyChanges(n,!0)}lu(){return xa.fromInitialDocuments(this.query,this.tu,this.mutatedKeys,this.Xa===0,this.hasCachedResults)}}const p0="SyncEngine";class c4{constructor(e,n,r){this.query=e,this.targetId=n,this.view=r}}class u4{constructor(e){this.key=e,this.hu=!1}}class d4{constructor(e,n,r,s,i,o){this.localStore=e,this.remoteStore=n,this.eventManager=r,this.sharedClientState=s,this.currentUser=i,this.maxConcurrentLimboResolutions=o,this.Pu={},this.Tu=new mo(l=>HE(l),wh),this.Eu=new Map,this.Iu=new Set,this.Ru=new Ot(Ne.comparator),this.Au=new Map,this.Vu=new e0,this.du={},this.mu=new Map,this.fu=ya.ar(),this.onlineState="Unknown",this.gu=void 0}get isPrimaryClient(){return this.gu===!0}}async function h4(t,e,n=!0){const r=RS(t);let s;const i=r.Tu.get(e);return i?(r.sharedClientState.addLocalQueryTarget(i.targetId),s=i.view.lu()):s=await IS(r,e,n,!0),s}async function f4(t,e){const n=RS(t);await IS(n,e,!0,!1)}async function IS(t,e,n,r){const s=await PP(t.localStore,es(e)),i=s.targetId,o=t.sharedClientState.addLocalQueryTarget(i,n);let l;return r&&(l=await p4(t,e,i,o==="current",s.resumeToken)),t.isPrimaryClient&&n&&wS(t.remoteStore,s),l}async function p4(t,e,n,r,s){t.pu=(f,m,p)=>async function(_,C,v,w){let E=C.view.ru(v);E.bs&&(E=await Pv(_.localStore,C.query,!1).then(({documents:S})=>C.view.ru(S,E)));const D=w&&w.targetChanges.get(C.targetId),M=w&&w.targetMismatches.get(C.targetId)!=null,T=C.view.applyChanges(E,_.isPrimaryClient,D,M);return Bv(_,C.targetId,T.au),T.snapshot}(t,f,m,p);const i=await Pv(t.localStore,e,!0),o=new l4(e,i.ks),l=o.ru(i.documents),c=yc.createSynthesizedTargetChangeForCurrentChange(n,r&&t.onlineState!=="Offline",s),u=o.applyChanges(l,t.isPrimaryClient,c);Bv(t,n,u.au);const h=new c4(e,n,o);return t.Tu.set(e,h),t.Eu.has(n)?t.Eu.get(n).push(e):t.Eu.set(n,[e]),u.snapshot}async function m4(t,e,n){const r=Oe(t),s=r.Tu.get(e),i=r.Eu.get(s.targetId);if(i.length>1)return r.Eu.set(s.targetId,i.filter(o=>!wh(o,e))),void r.Tu.delete(e);r.isPrimaryClient?(r.sharedClientState.removeLocalQueryTarget(s.targetId),r.sharedClientState.isActiveQueryTarget(s.targetId)||await ym(r.localStore,s.targetId,!1).then(()=>{r.sharedClientState.clearQueryState(s.targetId),n&&s0(r.remoteStore,s.targetId),wm(r,s.targetId)}).catch(Na)):(wm(r,s.targetId),await ym(r.localStore,s.targetId,!0))}async function g4(t,e){const n=Oe(t),r=n.Tu.get(e),s=n.Eu.get(r.targetId);n.isPrimaryClient&&s.length===1&&(n.sharedClientState.removeLocalQueryTarget(r.targetId),s0(n.remoteStore,r.targetId))}async function y4(t,e,n){const r=S4(t);try{const s=await function(o,l){const c=Oe(o),u=Ke.now(),h=l.reduce((p,y)=>p.add(y.key),Je());let f,m;return c.persistence.runTransaction("Locally write mutations","readwrite",p=>{let y=js(),_=Je();return c.xs.getEntries(p,h).next(C=>{y=C,y.forEach((v,w)=>{w.isValidDocument()||(_=_.add(v))})}).next(()=>c.localDocuments.getOverlayedDocuments(p,y)).next(C=>{f=C;const v=[];for(const w of l){const E=jj(w,f.get(w.key).overlayedDocument);E!=null&&v.push(new ji(w.key,E,LE(E.value.mapValue),On.exists(!0)))}return c.mutationQueue.addMutationBatch(p,u,v,l)}).next(C=>{m=C;const v=C.applyToLocalDocumentSet(f,_);return c.documentOverlayCache.saveOverlays(p,C.batchId,v)})}).then(()=>({batchId:m.batchId,changes:WE(f)}))}(r.localStore,e);r.sharedClientState.addPendingMutation(s.batchId),function(o,l,c){let u=o.du[o.currentUser.toKey()];u||(u=new Ot(Xe)),u=u.insert(l,c),o.du[o.currentUser.toKey()]=u}(r,s.batchId,n),await vc(r,s.changes),await Ih(r.remoteStore)}catch(s){const i=c0(s,"Failed to persist write");n.reject(i)}}async function CS(t,e){const n=Oe(t);try{const r=await CP(n.localStore,e);e.targetChanges.forEach((s,i)=>{const o=n.Au.get(i);o&&(ut(s.addedDocuments.size+s.modifiedDocuments.size+s.removedDocuments.size<=1,22616),s.addedDocuments.size>0?o.hu=!0:s.modifiedDocuments.size>0?ut(o.hu,14607):s.removedDocuments.size>0&&(ut(o.hu,42227),o.hu=!1))}),await vc(n,r,e)}catch(r){await Na(r)}}function Uv(t,e,n){const r=Oe(t);if(r.isPrimaryClient&&n===0||!r.isPrimaryClient&&n===1){const s=[];r.Tu.forEach((i,o)=>{const l=o.view.va(e);l.snapshot&&s.push(l.snapshot)}),function(o,l){const c=Oe(o);c.onlineState=l;let u=!1;c.queries.forEach((h,f)=>{for(const m of f.Sa)m.va(l)&&(u=!0)}),u&&h0(c)}(r.eventManager,e),s.length&&r.Pu.H_(s),r.onlineState=e,r.isPrimaryClient&&r.sharedClientState.setOnlineState(e)}}async function x4(t,e,n){const r=Oe(t);r.sharedClientState.updateQueryState(e,"rejected",n);const s=r.Au.get(e),i=s&&s.key;if(i){let o=new Ot(Ne.comparator);o=o.insert(i,In.newNoDocument(i,Me.min()));const l=Je().add(i),c=new Th(Me.min(),new Map,new Ot(Xe),o,l);await CS(r,c),r.Ru=r.Ru.remove(i),r.Au.delete(e),m0(r)}else await ym(r.localStore,e,!1).then(()=>wm(r,e,n)).catch(Na)}async function v4(t,e){const n=Oe(t),r=e.batch.batchId;try{const s=await IP(n.localStore,e);jS(n,r,null),AS(n,r),n.sharedClientState.updateMutationState(r,"acknowledged"),await vc(n,s)}catch(s){await Na(s)}}async function w4(t,e,n){const r=Oe(t);try{const s=await function(o,l){const c=Oe(o);return c.persistence.runTransaction("Reject batch","readwrite-primary",u=>{let h;return c.mutationQueue.lookupMutationBatch(u,l).next(f=>(ut(f!==null,37113),h=f.keys(),c.mutationQueue.removeMutationBatch(u,f))).next(()=>c.mutationQueue.performConsistencyCheck(u)).next(()=>c.documentOverlayCache.removeOverlaysForBatchId(u,h,l)).next(()=>c.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(u,h)).next(()=>c.localDocuments.getDocuments(u,h))})}(r.localStore,e);jS(r,e,n),AS(r,e),r.sharedClientState.updateMutationState(e,"rejected",n),await vc(r,s)}catch(s){await Na(s)}}function AS(t,e){(t.mu.get(e)||[]).forEach(n=>{n.resolve()}),t.mu.delete(e)}function jS(t,e,n){const r=Oe(t);let s=r.du[r.currentUser.toKey()];if(s){const i=s.get(e);i&&(n?i.reject(n):i.resolve(),s=s.remove(e)),r.du[r.currentUser.toKey()]=s}}function wm(t,e,n=null){t.sharedClientState.removeLocalQueryTarget(e);for(const r of t.Eu.get(e))t.Tu.delete(r),n&&t.Pu.yu(r,n);t.Eu.delete(e),t.isPrimaryClient&&t.Vu.Gr(e).forEach(r=>{t.Vu.containsKey(r)||PS(t,r)})}function PS(t,e){t.Iu.delete(e.path.canonicalString());const n=t.Ru.get(e);n!==null&&(s0(t.remoteStore,n),t.Ru=t.Ru.remove(e),t.Au.delete(n),m0(t))}function Bv(t,e,n){for(const r of n)r instanceof NS?(t.Vu.addReference(r.key,e),b4(t,r)):r instanceof kS?(xe(p0,"Document no longer in limbo: "+r.key),t.Vu.removeReference(r.key,e),t.Vu.containsKey(r.key)||PS(t,r.key)):Ae(19791,{wu:r})}function b4(t,e){const n=e.key,r=n.path.canonicalString();t.Ru.get(n)||t.Iu.has(r)||(xe(p0,"New document in limbo: "+n),t.Iu.add(r),m0(t))}function m0(t){for(;t.Iu.size>0&&t.Ru.size{o.push(r.pu(c,e,n).then(u=>{var h;if((u||n)&&r.isPrimaryClient){const f=u?!u.fromCache:(h=n==null?void 0:n.targetChanges.get(c.targetId))==null?void 0:h.current;r.sharedClientState.updateQueryState(c.targetId,f?"current":"not-current")}if(u){s.push(u);const f=n0.Is(c.targetId,u);i.push(f)}}))}),await Promise.all(o),r.Pu.H_(s),await async function(c,u){const h=Oe(c);try{await h.persistence.runTransaction("notifyLocalViewChanges","readwrite",f=>Z.forEach(u,m=>Z.forEach(m.Ts,p=>h.persistence.referenceDelegate.addReference(f,m.targetId,p)).next(()=>Z.forEach(m.Es,p=>h.persistence.referenceDelegate.removeReference(f,m.targetId,p)))))}catch(f){if(!ka(f))throw f;xe(r0,"Failed to update sequence numbers: "+f)}for(const f of u){const m=f.targetId;if(!f.fromCache){const p=h.vs.get(m),y=p.snapshotVersion,_=p.withLastLimboFreeSnapshotVersion(y);h.vs=h.vs.insert(m,_)}}}(r.localStore,i))}async function _4(t,e){const n=Oe(t);if(!n.currentUser.isEqual(e)){xe(p0,"User change. New user:",e.toKey());const r=await gS(n.localStore,e);n.currentUser=e,function(i,o){i.mu.forEach(l=>{l.forEach(c=>{c.reject(new fe(Y.CANCELLED,o))})}),i.mu.clear()}(n,"'waitForPendingWrites' promise is rejected due to a user change."),n.sharedClientState.handleUserChange(e,r.removedBatchIds,r.addedBatchIds),await vc(n,r.Ns)}}function E4(t,e){const n=Oe(t),r=n.Au.get(e);if(r&&r.hu)return Je().add(r.key);{let s=Je();const i=n.Eu.get(e);if(!i)return s;for(const o of i){const l=n.Tu.get(o);s=s.unionWith(l.view.nu)}return s}}function RS(t){const e=Oe(t);return e.remoteStore.remoteSyncer.applyRemoteEvent=CS.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=E4.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=x4.bind(null,e),e.Pu.H_=o4.bind(null,e.eventManager),e.Pu.yu=a4.bind(null,e.eventManager),e}function S4(t){const e=Oe(t);return e.remoteStore.remoteSyncer.applySuccessfulWrite=v4.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=w4.bind(null,e),e}class Ad{constructor(){this.kind="memory",this.synchronizeTabs=!1}async initialize(e){this.serializer=Nh(e.databaseInfo.databaseId),this.sharedClientState=this.Du(e),this.persistence=this.Cu(e),await this.persistence.start(),this.localStore=this.vu(e),this.gcScheduler=this.Fu(e,this.localStore),this.indexBackfillerScheduler=this.Mu(e,this.localStore)}Fu(e,n){return null}Mu(e,n){return null}vu(e){return kP(this.persistence,new SP,e.initialUser,this.serializer)}Cu(e){return new mS(t0.Vi,this.serializer)}Du(e){return new DP}async terminate(){var e,n;(e=this.gcScheduler)==null||e.stop(),(n=this.indexBackfillerScheduler)==null||n.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}}Ad.provider={build:()=>new Ad};class T4 extends Ad{constructor(e){super(),this.cacheSizeBytes=e}Fu(e,n){ut(this.persistence.referenceDelegate instanceof Id,46915);const r=this.persistence.referenceDelegate.garbageCollector;return new cP(r,e.asyncQueue,n)}Cu(e){const n=this.cacheSizeBytes!==void 0?Wn.withCacheSize(this.cacheSizeBytes):Wn.DEFAULT;return new mS(r=>Id.Vi(r,n),this.serializer)}}class bm{async initialize(e,n){this.localStore||(this.localStore=e.localStore,this.sharedClientState=e.sharedClientState,this.datastore=this.createDatastore(n),this.remoteStore=this.createRemoteStore(n),this.eventManager=this.createEventManager(n),this.syncEngine=this.createSyncEngine(n,!e.synchronizeTabs),this.sharedClientState.onlineStateHandler=r=>Uv(this.syncEngine,r,1),this.remoteStore.remoteSyncer.handleCredentialChange=_4.bind(null,this.syncEngine),await r4(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return function(){return new i4}()}createDatastore(e){const n=Nh(e.databaseInfo.databaseId),r=FP(e.databaseInfo);return HP(e.authCredentials,e.appCheckCredentials,r,n)}createRemoteStore(e){return function(r,s,i,o,l){return new GP(r,s,i,o,l)}(this.localStore,this.datastore,e.asyncQueue,n=>Uv(this.syncEngine,n,0),function(){return Mv.v()?new Mv:new MP}())}createSyncEngine(e,n){return function(s,i,o,l,c,u,h){const f=new d4(s,i,o,l,c,u);return h&&(f.gu=!0),f}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,n)}async terminate(){var e,n;await async function(s){const i=Oe(s);xe(ao,"RemoteStore shutting down."),i.Ia.add(5),await xc(i),i.Aa.shutdown(),i.Va.set("Unknown")}(this.remoteStore),(e=this.datastore)==null||e.terminate(),(n=this.eventManager)==null||n.terminate()}}bm.provider={build:()=>new bm};/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *//** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class g0{constructor(e){this.observer=e,this.muted=!1}next(e){this.muted||this.observer.next&&this.Ou(this.observer.next,e)}error(e){this.muted||(this.observer.error?this.Ou(this.observer.error,e):As("Uncaught Error in snapshot listener:",e.toString()))}Nu(){this.muted=!0}Ou(e,n){setTimeout(()=>{this.muted||e(n)},0)}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Ti="FirestoreClient";class N4{constructor(e,n,r,s,i){this.authCredentials=e,this.appCheckCredentials=n,this.asyncQueue=r,this._databaseInfo=s,this.user=Nn.UNAUTHENTICATED,this.clientId=Hg.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=i,this.authCredentials.start(r,async o=>{xe(Ti,"Received user=",o.uid),await this.authCredentialListener(o),this.user=o}),this.appCheckCredentials.start(r,o=>(xe(Ti,"Received new app check token=",o),this.appCheckCredentialListener(o,this.user)))}get configuration(){return{asyncQueue:this.asyncQueue,databaseInfo:this._databaseInfo,clientId:this.clientId,authCredentials:this.authCredentials,appCheckCredentials:this.appCheckCredentials,initialUser:this.user,maxConcurrentLimboResolutions:100}}setCredentialChangeListener(e){this.authCredentialListener=e}setAppCheckTokenChangeListener(e){this.appCheckCredentialListener=e}terminate(){this.asyncQueue.enterRestrictedMode();const e=new Es;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted(async()=>{try{this._onlineComponents&&await this._onlineComponents.terminate(),this._offlineComponents&&await this._offlineComponents.terminate(),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),e.resolve()}catch(n){const r=c0(n,"Failed to shutdown persistence");e.reject(r)}}),e.promise}}async function Af(t,e){t.asyncQueue.verifyOperationInProgress(),xe(Ti,"Initializing OfflineComponentProvider");const n=t.configuration;await e.initialize(n);let r=n.initialUser;t.setCredentialChangeListener(async s=>{r.isEqual(s)||(await gS(e.localStore,s),r=s)}),e.persistence.setDatabaseDeletedListener(()=>t.terminate()),t._offlineComponents=e}async function $v(t,e){t.asyncQueue.verifyOperationInProgress();const n=await k4(t);xe(Ti,"Initializing OnlineComponentProvider"),await e.initialize(n,t.configuration),t.setCredentialChangeListener(r=>Ov(e.remoteStore,r)),t.setAppCheckTokenChangeListener((r,s)=>Ov(e.remoteStore,s)),t._onlineComponents=e}async function k4(t){if(!t._offlineComponents)if(t._uninitializedComponentsProvider){xe(Ti,"Using user provided OfflineComponentProvider");try{await Af(t,t._uninitializedComponentsProvider._offline)}catch(e){const n=e;if(!function(s){return s.name==="FirebaseError"?s.code===Y.FAILED_PRECONDITION||s.code===Y.UNIMPLEMENTED:!(typeof DOMException<"u"&&s instanceof DOMException)||s.code===22||s.code===20||s.code===11}(n))throw n;oo("Error using user provided cache. Falling back to memory cache: "+n),await Af(t,new Ad)}}else xe(Ti,"Using default OfflineComponentProvider"),await Af(t,new T4(void 0));return t._offlineComponents}async function DS(t){return t._onlineComponents||(t._uninitializedComponentsProvider?(xe(Ti,"Using user provided OnlineComponentProvider"),await $v(t,t._uninitializedComponentsProvider._online)):(xe(Ti,"Using default OnlineComponentProvider"),await $v(t,new bm))),t._onlineComponents}function I4(t){return DS(t).then(e=>e.syncEngine)}async function jd(t){const e=await DS(t),n=e.eventManager;return n.onListen=h4.bind(null,e.syncEngine),n.onUnlisten=m4.bind(null,e.syncEngine),n.onFirstRemoteStoreListen=f4.bind(null,e.syncEngine),n.onLastRemoteStoreUnlisten=g4.bind(null,e.syncEngine),n}function C4(t,e,n,r){const s=new g0(r),i=new f0(e,s,n);return t.asyncQueue.enqueueAndForget(async()=>u0(await jd(t),i)),()=>{s.Nu(),t.asyncQueue.enqueueAndForget(async()=>d0(await jd(t),i))}}function A4(t,e,n={}){const r=new Es;return t.asyncQueue.enqueueAndForget(async()=>function(i,o,l,c,u){const h=new g0({next:m=>{h.Nu(),o.enqueueAndForget(()=>d0(i,f));const p=m.docs.has(l);!p&&m.fromCache?u.reject(new fe(Y.UNAVAILABLE,"Failed to get document because the client is offline.")):p&&m.fromCache&&c&&c.source==="server"?u.reject(new fe(Y.UNAVAILABLE,'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')):u.resolve(m)},error:m=>u.reject(m)}),f=new f0(vh(l.path),h,{includeMetadataChanges:!0,qa:!0});return u0(i,f)}(await jd(t),t.asyncQueue,e,n,r)),r.promise}function j4(t,e,n={}){const r=new Es;return t.asyncQueue.enqueueAndForget(async()=>function(i,o,l,c,u){const h=new g0({next:m=>{h.Nu(),o.enqueueAndForget(()=>d0(i,f)),m.fromCache&&c.source==="server"?u.reject(new fe(Y.UNAVAILABLE,'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')):u.resolve(m)},error:m=>u.reject(m)}),f=new f0(l,h,{includeMetadataChanges:!0,qa:!0});return u0(i,f)}(await jd(t),t.asyncQueue,e,n,r)),r.promise}function P4(t,e){const n=new Es;return t.asyncQueue.enqueueAndForget(async()=>y4(await I4(t),e,n)),n.promise}/** + * @license + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function MS(t){const e={};return t.timeoutSeconds!==void 0&&(e.timeoutSeconds=t.timeoutSeconds),e}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const R4="ComponentProvider",Hv=new Map;function D4(t,e,n,r,s){return new ZA(t,e,n,s.host,s.ssl,s.experimentalForceLongPolling,s.experimentalAutoDetectLongPolling,MS(s.experimentalLongPollingOptions),s.useFetchStreams,s.isUsingEmulator,r)}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const LS="firestore.googleapis.com",qv=!0;class Gv{constructor(e){if(e.host===void 0){if(e.ssl!==void 0)throw new fe(Y.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host=LS,this.ssl=qv}else this.host=e.host,this.ssl=e.ssl??qv;if(this.isUsingEmulator=e.emulatorOptions!==void 0,this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,this.localCache=e.localCache,e.cacheSizeBytes===void 0)this.cacheSizeBytes=pS;else{if(e.cacheSizeBytes!==-1&&e.cacheSizeBytes30)throw new fe(Y.INVALID_ARGUMENT,`invalid long polling timeout: ${r.timeoutSeconds} (maximum allowed value is 30)`)}}(this.experimentalLongPollingOptions),this.useFetchStreams=!!e.useFetchStreams}isEqual(e){return this.host===e.host&&this.ssl===e.ssl&&this.credentials===e.credentials&&this.cacheSizeBytes===e.cacheSizeBytes&&this.experimentalForceLongPolling===e.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===e.experimentalAutoDetectLongPolling&&function(r,s){return r.timeoutSeconds===s.timeoutSeconds}(this.experimentalLongPollingOptions,e.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}}class Ch{constructor(e,n,r,s){this._authCredentials=e,this._appCheckCredentials=n,this._databaseId=r,this._app=s,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new Gv({}),this._settingsFrozen=!1,this._emulatorOptions={},this._terminateTask="notTerminated"}get app(){if(!this._app)throw new fe(Y.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}get _initialized(){return this._settingsFrozen}get _terminated(){return this._terminateTask!=="notTerminated"}_setSettings(e){if(this._settingsFrozen)throw new fe(Y.FAILED_PRECONDITION,"Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");this._settings=new Gv(e),this._emulatorOptions=e.emulatorOptions||{},e.credentials!==void 0&&(this._authCredentials=function(r){if(!r)return new PA;switch(r.type){case"firstParty":return new LA(r.sessionIndex||"0",r.iamToken||null,r.authTokenFactory||null);case"provider":return r.client;default:throw new fe(Y.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}}(e.credentials))}_getSettings(){return this._settings}_getEmulatorOptions(){return this._emulatorOptions}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return this._terminateTask==="notTerminated"&&(this._terminateTask=this._terminate()),this._terminateTask}async _restart(){this._terminateTask==="notTerminated"?await this._terminate():this._terminateTask="notTerminated"}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(n){const r=Hv.get(n);r&&(xe(R4,"Removing Datastore"),Hv.delete(n),r.terminate())}(this),Promise.resolve()}}function M4(t,e,n,r={}){var u;t=Ln(t,Ch);const s=Sa(e),i=t._getSettings(),o={...i,emulatorOptions:t._getEmulatorOptions()},l=`${e}:${n}`;s&&Fg(`https://${l}`),i.host!==LS&&i.host!==l&&oo("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used.");const c={...i,host:l,ssl:s,emulatorOptions:r};if(!ro(c,o)&&(t._setSettings(c),r.mockUserToken)){let h,f;if(typeof r.mockUserToken=="string")h=r.mockUserToken,f=Nn.MOCK_USER;else{h=dE(r.mockUserToken,(u=t._app)==null?void 0:u.options.projectId);const m=r.mockUserToken.sub||r.mockUserToken.user_id;if(!m)throw new fe(Y.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");f=new Nn(m)}t._authCredentials=new RA(new SE(h,f))}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Pi{constructor(e,n,r){this.converter=n,this._query=r,this.type="query",this.firestore=e}withConverter(e){return new Pi(this.firestore,e,this._query)}}class Ut{constructor(e,n,r){this.converter=n,this._key=r,this.type="document",this.firestore=e}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new gi(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new Ut(this.firestore,e,this._key)}toJSON(){return{type:Ut._jsonSchemaVersion,referencePath:this._key.toString()}}static fromJSON(e,n,r){if(mc(n,Ut._jsonSchema))return new Ut(e,r||null,new Ne(Et.fromString(n.referencePath)))}}Ut._jsonSchemaVersion="firestore/documentReference/1.0",Ut._jsonSchema={type:Xt("string",Ut._jsonSchemaVersion),referencePath:Xt("string")};class gi extends Pi{constructor(e,n,r){super(e,n,vh(r)),this._path=r,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const e=this._path.popLast();return e.isEmpty()?null:new Ut(this.firestore,null,new Ne(e))}withConverter(e){return new gi(this.firestore,e,this._path)}}function Mt(t,e,...n){if(t=sn(t),TE("collection","path",e),t instanceof Ch){const r=Et.fromString(e,...n);return iv(r),new gi(t,null,r)}{if(!(t instanceof Ut||t instanceof gi))throw new fe(Y.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(Et.fromString(e,...n));return iv(r),new gi(t.firestore,null,r)}}function Nt(t,e,...n){if(t=sn(t),arguments.length===1&&(e=Hg.newId()),TE("doc","path",e),t instanceof Ch){const r=Et.fromString(e,...n);return sv(r),new Ut(t,null,new Ne(r))}{if(!(t instanceof Ut||t instanceof gi))throw new fe(Y.INVALID_ARGUMENT,"Expected first argument to doc() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(Et.fromString(e,...n));return sv(r),new Ut(t.firestore,t instanceof gi?t.converter:null,new Ne(r))}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Wv="AsyncQueue";class Kv{constructor(e=Promise.resolve()){this.Yu=[],this.ec=!1,this.tc=[],this.nc=null,this.rc=!1,this.sc=!1,this.oc=[],this.M_=new xS(this,"async_queue_retry"),this._c=()=>{const r=Cf();r&&xe(Wv,"Visibility state changed to "+r.visibilityState),this.M_.w_()},this.ac=e;const n=Cf();n&&typeof n.addEventListener=="function"&&n.addEventListener("visibilitychange",this._c)}get isShuttingDown(){return this.ec}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.uc(),this.cc(e)}enterRestrictedMode(e){if(!this.ec){this.ec=!0,this.sc=e||!1;const n=Cf();n&&typeof n.removeEventListener=="function"&&n.removeEventListener("visibilitychange",this._c)}}enqueue(e){if(this.uc(),this.ec)return new Promise(()=>{});const n=new Es;return this.cc(()=>this.ec&&this.sc?Promise.resolve():(e().then(n.resolve,n.reject),n.promise)).then(()=>n.promise)}enqueueRetryable(e){this.enqueueAndForget(()=>(this.Yu.push(e),this.lc()))}async lc(){if(this.Yu.length!==0){try{await this.Yu[0](),this.Yu.shift(),this.M_.reset()}catch(e){if(!ka(e))throw e;xe(Wv,"Operation failed with retryable error: "+e)}this.Yu.length>0&&this.M_.p_(()=>this.lc())}}cc(e){const n=this.ac.then(()=>(this.rc=!0,e().catch(r=>{throw this.nc=r,this.rc=!1,As("INTERNAL UNHANDLED ERROR: ",Qv(r)),r}).then(r=>(this.rc=!1,r))));return this.ac=n,n}enqueueAfterDelay(e,n,r){this.uc(),this.oc.indexOf(e)>-1&&(n=0);const s=l0.createAndSchedule(this,e,n,r,i=>this.hc(i));return this.tc.push(s),s}uc(){this.nc&&Ae(47125,{Pc:Qv(this.nc)})}verifyOperationInProgress(){}async Tc(){let e;do e=this.ac,await e;while(e!==this.ac)}Ec(e){for(const n of this.tc)if(n.timerId===e)return!0;return!1}Ic(e){return this.Tc().then(()=>{this.tc.sort((n,r)=>n.targetTimeMs-r.targetTimeMs);for(const n of this.tc)if(n.skipDelay(),e!=="all"&&n.timerId===e)break;return this.Tc()})}Rc(e){this.oc.push(e)}hc(e){const n=this.tc.indexOf(e);this.tc.splice(n,1)}}function Qv(t){let e=t.message||"";return t.stack&&(e=t.stack.includes(t.message)?t.stack:t.message+` +`+t.stack),e}class os extends Ch{constructor(e,n,r,s){super(e,n,r,s),this.type="firestore",this._queue=new Kv,this._persistenceKey=(s==null?void 0:s.name)||"[DEFAULT]"}async _terminate(){if(this._firestoreClient){const e=this._firestoreClient.terminate();this._queue=new Kv(e),this._firestoreClient=void 0,await e}}}function L4(t,e){const n=typeof t=="object"?t:Bg(),r=typeof t=="string"?t:Ed,s=ph(n,"firestore").getImmediate({identifier:r});if(!s._initialized){const i=lE("firestore");i&&M4(s,...i)}return s}function wc(t){if(t._terminated)throw new fe(Y.FAILED_PRECONDITION,"The client has already been terminated.");return t._firestoreClient||O4(t),t._firestoreClient}function O4(t){var r,s,i,o;const e=t._freezeSettings(),n=D4(t._databaseId,((r=t._app)==null?void 0:r.options.appId)||"",t._persistenceKey,(s=t._app)==null?void 0:s.options.apiKey,e);t._componentsProvider||(i=e.localCache)!=null&&i._offlineComponentProvider&&((o=e.localCache)!=null&&o._onlineComponentProvider)&&(t._componentsProvider={_offline:e.localCache._offlineComponentProvider,_online:e.localCache._onlineComponentProvider}),t._firestoreClient=new N4(t._authCredentials,t._appCheckCredentials,t._queue,n,t._componentsProvider&&function(c){const u=c==null?void 0:c._online.build();return{_offline:c==null?void 0:c._offline.build(u),_online:u}}(t._componentsProvider))}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class _r{constructor(e){this._byteString=e}static fromBase64String(e){try{return new _r(wn.fromBase64String(e))}catch(n){throw new fe(Y.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+n)}}static fromUint8Array(e){return new _r(wn.fromUint8Array(e))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return"Bytes(base64: "+this.toBase64()+")"}isEqual(e){return this._byteString.isEqual(e._byteString)}toJSON(){return{type:_r._jsonSchemaVersion,bytes:this.toBase64()}}static fromJSON(e){if(mc(e,_r._jsonSchema))return _r.fromBase64String(e.bytes)}}_r._jsonSchemaVersion="firestore/bytes/1.0",_r._jsonSchema={type:Xt("string",_r._jsonSchemaVersion),bytes:Xt("string")};/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Ah{constructor(...e){for(let n=0;n90)throw new fe(Y.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(n)||n<-180||n>180)throw new fe(Y.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+n);this._lat=e,this._long=n}get latitude(){return this._lat}get longitude(){return this._long}isEqual(e){return this._lat===e._lat&&this._long===e._long}_compareTo(e){return Xe(this._lat,e._lat)||Xe(this._long,e._long)}toJSON(){return{latitude:this._lat,longitude:this._long,type:ns._jsonSchemaVersion}}static fromJSON(e){if(mc(e,ns._jsonSchema))return new ns(e.latitude,e.longitude)}}ns._jsonSchemaVersion="firestore/geoPoint/1.0",ns._jsonSchema={type:Xt("string",ns._jsonSchemaVersion),latitude:Xt("number"),longitude:Xt("number")};/** + * @license + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Vr{constructor(e){this._values=(e||[]).map(n=>n)}toArray(){return this._values.map(e=>e)}isEqual(e){return function(r,s){if(r.length!==s.length)return!1;for(let i=0;itypeof n=="number"))return new Vr(e.vectorValues);throw new fe(Y.INVALID_ARGUMENT,"Expected 'vectorValues' field to be a number array")}}}Vr._jsonSchemaVersion="firestore/vectorValue/1.0",Vr._jsonSchema={type:Xt("string",Vr._jsonSchemaVersion),vectorValues:Xt("object")};/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const V4=/^__.*__$/;class F4{constructor(e,n,r){this.data=e,this.fieldMask=n,this.fieldTransforms=r}toMutation(e,n){return this.fieldMask!==null?new ji(e,this.data,this.fieldMask,n,this.fieldTransforms):new gc(e,this.data,n,this.fieldTransforms)}}class OS{constructor(e,n,r){this.data=e,this.fieldMask=n,this.fieldTransforms=r}toMutation(e,n){return new ji(e,this.data,this.fieldMask,n,this.fieldTransforms)}}function VS(t){switch(t){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw Ae(40011,{dataSource:t})}}class y0{constructor(e,n,r,s,i,o){this.settings=e,this.databaseId=n,this.serializer=r,this.ignoreUndefinedProperties=s,i===void 0&&this.Ac(),this.fieldTransforms=i||[],this.fieldMask=o||[]}get path(){return this.settings.path}get dataSource(){return this.settings.dataSource}i(e){return new y0({...this.settings,...e},this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}dc(e){var s;const n=(s=this.path)==null?void 0:s.child(e),r=this.i({path:n,arrayElement:!1});return r.mc(e),r}fc(e){var s;const n=(s=this.path)==null?void 0:s.child(e),r=this.i({path:n,arrayElement:!1});return r.Ac(),r}gc(e){return this.i({path:void 0,arrayElement:!0})}yc(e){return Pd(e,this.settings.methodName,this.settings.hasConverter||!1,this.path,this.settings.targetDoc)}contains(e){return this.fieldMask.find(n=>e.isPrefixOf(n))!==void 0||this.fieldTransforms.find(n=>e.isPrefixOf(n.field))!==void 0}Ac(){if(this.path)for(let e=0;ec.covers(f.field))}else c=null,u=o.fieldTransforms;return new F4(new Qn(l),c,u)}class _c extends jh{_toFieldTransform(e){if(e.dataSource!==2)throw e.dataSource===1?e.yc(`${this._methodName}() can only appear at the top level of your update data`):e.yc(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);return e.fieldMask.push(e.path),null}isEqual(e){return e instanceof _c}}class v0 extends jh{constructor(e,n){super(e),this.bc=n}_toFieldTransform(e){const n=new ec(e.serializer,YE(e.serializer,this.bc));return new kj(e.path,n)}isEqual(e){return e instanceof v0&&this.bc===e.bc}}function FS(t,e,n,r){const s=t.A(1,e,n);w0("Data must be an object, but it was:",s,r);const i=[],o=Qn.empty();Ai(r,(c,u)=>{const h=$S(e,c,n);u=sn(u);const f=s.fc(h);if(u instanceof _c)i.push(h);else{const m=Ec(u,f);m!=null&&(i.push(h),o.set(h,m))}});const l=new ur(i);return new OS(o,l,s.fieldTransforms)}function zS(t,e,n,r,s,i){const o=t.A(1,e,n),l=[lo(e,r,n)],c=[s];if(i.length%2!=0)throw new fe(Y.INVALID_ARGUMENT,`Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);for(let m=0;m=0;--m)if(!HS(u,l[m])){const p=l[m];let y=c[m];y=sn(y);const _=o.fc(p);if(y instanceof _c)u.push(p);else{const C=Ec(y,_);C!=null&&(u.push(p),h.set(p,C))}}const f=new ur(u);return new OS(h,f,o.fieldTransforms)}function U4(t,e,n,r=!1){return Ec(n,t.A(r?4:3,e))}function Ec(t,e){if(BS(t=sn(t)))return w0("Unsupported field value:",e,t),US(t,e);if(t instanceof jh)return function(r,s){if(!VS(s.dataSource))throw s.yc(`${r._methodName}() can only be used with update() and set()`);if(!s.path)throw s.yc(`${r._methodName}() is not currently supported inside arrays`);const i=r._toFieldTransform(s);i&&s.fieldTransforms.push(i)}(t,e),null;if(t===void 0&&e.ignoreUndefinedProperties)return null;if(e.path&&e.fieldMask.push(e.path),t instanceof Array){if(e.settings.arrayElement&&e.dataSource!==4)throw e.yc("Nested arrays are not supported");return function(r,s){const i=[];let o=0;for(const l of r){let c=Ec(l,s.gc(o));c==null&&(c={nullValue:"NULL_VALUE"}),i.push(c),o++}return{arrayValue:{values:i}}}(t,e)}return function(r,s){if((r=sn(r))===null)return{nullValue:"NULL_VALUE"};if(typeof r=="number")return YE(s.serializer,r);if(typeof r=="boolean")return{booleanValue:r};if(typeof r=="string")return{stringValue:r};if(r instanceof Date){const i=Ke.fromDate(r);return{timestampValue:kd(s.serializer,i)}}if(r instanceof Ke){const i=new Ke(r.seconds,1e3*Math.floor(r.nanoseconds/1e3));return{timestampValue:kd(s.serializer,i)}}if(r instanceof ns)return{geoPointValue:{latitude:r.latitude,longitude:r.longitude}};if(r instanceof _r)return{bytesValue:oS(s.serializer,r._byteString)};if(r instanceof Ut){const i=s.databaseId,o=r.firestore._databaseId;if(!o.isEqual(i))throw s.yc(`Document reference is for database ${o.projectId}/${o.database} but should be for database ${i.projectId}/${i.database}`);return{referenceValue:Zg(r.firestore._databaseId||s.databaseId,r._key.path)}}if(r instanceof Vr)return function(o,l){const c=o instanceof Vr?o.toArray():o;return{mapValue:{fields:{[DE]:{stringValue:ME},[Sd]:{arrayValue:{values:c.map(h=>{if(typeof h!="number")throw l.yc("VectorValues must only contain numeric values.");return Yg(l.serializer,h)})}}}}}}(r,s);if(fS(r))return r._toProto(s.serializer);throw s.yc(`Unsupported field value: ${mh(r)}`)}(t,e)}function US(t,e){const n={};return IE(t)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):Ai(t,(r,s)=>{const i=Ec(s,e.dc(r));i!=null&&(n[r]=i)}),{mapValue:{fields:n}}}function BS(t){return!(typeof t!="object"||t===null||t instanceof Array||t instanceof Date||t instanceof Ke||t instanceof ns||t instanceof _r||t instanceof Ut||t instanceof jh||t instanceof Vr||fS(t))}function w0(t,e,n){if(!BS(n)||!NE(n)){const r=mh(n);throw r==="an object"?e.yc(t+" a custom object"):e.yc(t+" "+r)}}function lo(t,e,n){if((e=sn(e))instanceof Ah)return e._internalPath;if(typeof e=="string")return $S(t,e);throw Pd("Field path arguments must be of type string or ",t,!1,void 0,n)}const B4=new RegExp("[~\\*/\\[\\]]");function $S(t,e,n){if(e.search(B4)>=0)throw Pd(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,t,!1,void 0,n);try{return new Ah(...e.split("."))._internalPath}catch{throw Pd(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,t,!1,void 0,n)}}function Pd(t,e,n,r,s){const i=r&&!r.isEmpty(),o=s!==void 0;let l=`Function ${e}() called with invalid data`;n&&(l+=" (via `toFirestore()`)"),l+=". ";let c="";return(i||o)&&(c+=" (found",i&&(c+=` in field ${r}`),o&&(c+=` in document ${s}`),c+=")"),new fe(Y.INVALID_ARGUMENT,l+t+c)}function HS(t,e){return t.some(n=>n.isEqual(e))}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class $4{convertValue(e,n="none"){switch(Ei(e)){case 0:return null;case 1:return e.booleanValue;case 2:return Ht(e.integerValue||e.doubleValue);case 3:return this.convertTimestamp(e.timestampValue);case 4:return this.convertServerTimestamp(e,n);case 5:return e.stringValue;case 6:return this.convertBytes(_i(e.bytesValue));case 7:return this.convertReference(e.referenceValue);case 8:return this.convertGeoPoint(e.geoPointValue);case 9:return this.convertArray(e.arrayValue,n);case 11:return this.convertObject(e.mapValue,n);case 10:return this.convertVectorValue(e.mapValue);default:throw Ae(62114,{value:e})}}convertObject(e,n){return this.convertObjectMap(e.fields,n)}convertObjectMap(e,n="none"){const r={};return Ai(e,(s,i)=>{r[s]=this.convertValue(i,n)}),r}convertVectorValue(e){var r,s,i;const n=(i=(s=(r=e.fields)==null?void 0:r[Sd].arrayValue)==null?void 0:s.values)==null?void 0:i.map(o=>Ht(o.doubleValue));return new Vr(n)}convertGeoPoint(e){return new ns(Ht(e.latitude),Ht(e.longitude))}convertArray(e,n){return(e.values||[]).map(r=>this.convertValue(r,n))}convertServerTimestamp(e,n){switch(n){case"previous":const r=xh(e);return r==null?null:this.convertValue(r,n);case"estimate":return this.convertTimestamp(Kl(e));default:return null}}convertTimestamp(e){const n=bi(e);return new Ke(n.seconds,n.nanos)}convertDocumentKey(e,n){const r=Et.fromString(e);ut(hS(r),9688,{name:e});const s=new Ql(r.get(1),r.get(3)),i=new Ne(r.popFirst(5));return s.isEqual(n)||As(`Document ${i} contains a document reference within a different database (${s.projectId}/${s.database}) which is not supported. It will be treated as a reference in the current database (${n.projectId}/${n.database}) instead.`),i}}/** + * @license + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class b0 extends $4{constructor(e){super(),this.firestore=e}convertBytes(e){return new _r(e)}convertReference(e){const n=this.convertDocumentKey(e,this.firestore._databaseId);return new Ut(this.firestore,null,n)}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function H4(){return new _c("deleteField")}function q4(t){return new v0("increment",t)}const Yv="@firebase/firestore",Xv="4.13.0";/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Jv(t){return function(n,r){if(typeof n!="object"||n===null)return!1;const s=n;for(const i of r)if(i in s&&typeof s[i]=="function")return!0;return!1}(t,["next","error","complete"])}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class qS{constructor(e,n,r,s,i){this._firestore=e,this._userDataWriter=n,this._key=r,this._document=s,this._converter=i}get id(){return this._key.path.lastSegment()}get ref(){return new Ut(this._firestore,this._converter,this._key)}exists(){return this._document!==null}data(){if(this._document){if(this._converter){const e=new G4(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(e)}return this._userDataWriter.convertValue(this._document.data.value)}}_fieldsProto(){var e;return((e=this._document)==null?void 0:e.data.clone().value.mapValue.fields)??void 0}get(e){if(this._document){const n=this._document.data.field(lo("DocumentSnapshot.get",e));if(n!==null)return this._userDataWriter.convertValue(n)}}}class G4 extends qS{data(){return super.data()}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function GS(t){if(t.limitType==="L"&&t.explicitOrderBy.length===0)throw new fe(Y.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class _0{}class WS extends _0{}function Vn(t,e,...n){let r=[];e instanceof _0&&r.push(e),r=r.concat(n),function(i){const o=i.filter(c=>c instanceof E0).length,l=i.filter(c=>c instanceof Ph).length;if(o>1||o>0&&l>0)throw new fe(Y.INVALID_ARGUMENT,"InvalidQuery. When using composite filters, you cannot use more than one filter at the top level. Consider nesting the multiple filters within an `and(...)` statement. For example: change `query(query, where(...), or(...))` to `query(query, and(where(...), or(...)))`.")}(r);for(const s of r)t=s._apply(t);return t}class Ph extends WS{constructor(e,n,r){super(),this._field=e,this._op=n,this._value=r,this.type="where"}static _create(e,n,r){return new Ph(e,n,r)}_apply(e){const n=this._parse(e);return KS(e._query,n),new Pi(e.firestore,e.converter,dm(e._query,n))}_parse(e){const n=bc(e.firestore);return function(i,o,l,c,u,h,f){let m;if(u.isKeyField()){if(h==="array-contains"||h==="array-contains-any")throw new fe(Y.INVALID_ARGUMENT,`Invalid Query. You can't perform '${h}' queries on documentId().`);if(h==="in"||h==="not-in"){ew(f,h);const y=[];for(const _ of f)y.push(Zv(c,i,_));m={arrayValue:{values:y}}}else m=Zv(c,i,f)}else h!=="in"&&h!=="not-in"&&h!=="array-contains-any"||ew(f,h),m=U4(l,o,f,h==="in"||h==="not-in");return Yt.create(u,h,m)}(e._query,"where",n,e.firestore._databaseId,this._field,this._op,this._value)}}function mr(t,e,n){const r=e,s=lo("where",t);return Ph._create(s,r,n)}class E0 extends _0{constructor(e,n){super(),this.type=e,this._queryConstraints=n}static _create(e,n){return new E0(e,n)}_parse(e){const n=this._queryConstraints.map(r=>r._parse(e)).filter(r=>r.getFilters().length>0);return n.length===1?n[0]:zr.create(n,this._getOperator())}_apply(e){const n=this._parse(e);return n.getFilters().length===0?e:(function(s,i){let o=s;const l=i.getFlattenedFilters();for(const c of l)KS(o,c),o=dm(o,c)}(e._query,n),new Pi(e.firestore,e.converter,dm(e._query,n)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return this.type==="and"?"and":"or"}}class S0 extends WS{constructor(e,n){super(),this._field=e,this._direction=n,this.type="orderBy"}static _create(e,n){return new S0(e,n)}_apply(e){const n=function(s,i,o){if(s.startAt!==null)throw new fe(Y.INVALID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(s.endAt!==null)throw new fe(Y.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");return new Xl(i,o)}(e._query,this._field,this._direction);return new Pi(e.firestore,e.converter,yj(e._query,n))}}function W4(t,e="asc"){const n=e,r=lo("orderBy",t);return S0._create(r,n)}function Zv(t,e,n){if(typeof(n=sn(n))=="string"){if(n==="")throw new fe(Y.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!$E(e)&&n.indexOf("/")!==-1)throw new fe(Y.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);const r=e.path.child(Et.fromString(n));if(!Ne.isDocumentKey(r))throw new fe(Y.INVALID_ARGUMENT,`Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${r}' is not because it has an odd number of segments (${r.length}).`);return fv(t,new Ne(r))}if(n instanceof Ut)return fv(t,n._key);throw new fe(Y.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${mh(n)}.`)}function ew(t,e){if(!Array.isArray(t)||t.length===0)throw new fe(Y.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`)}function KS(t,e){const n=function(s,i){for(const o of s)for(const l of o.getFlattenedFilters())if(i.indexOf(l.op)>=0)return l.op;return null}(t.filters,function(s){switch(s){case"!=":return["!=","not-in"];case"array-contains-any":case"in":return["not-in"];case"not-in":return["array-contains-any","in","not-in","!="];default:return[]}}(e.op));if(n!==null)throw n===e.op?new fe(Y.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}' filter.`):new fe(Y.INVALID_ARGUMENT,`Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`)}function T0(t,e,n){let r;return r=t?n&&(n.merge||n.mergeFields)?t.toFirestore(e,n):t.toFirestore(e):e,r}class ul{constructor(e,n){this.hasPendingWrites=e,this.fromCache=n}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}class Ki extends qS{constructor(e,n,r,s,i,o){super(e,n,r,s,o),this._firestore=e,this._firestoreImpl=e,this.metadata=i}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){const n=new Fu(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(n,e)}return this._userDataWriter.convertValue(this._document.data.value,e.serverTimestamps)}}get(e,n={}){if(this._document){const r=this._document.data.field(lo("DocumentSnapshot.get",e));if(r!==null)return this._userDataWriter.convertValue(r,n.serverTimestamps)}}toJSON(){if(this.metadata.hasPendingWrites)throw new fe(Y.FAILED_PRECONDITION,"DocumentSnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const e=this._document,n={};return n.type=Ki._jsonSchemaVersion,n.bundle="",n.bundleSource="DocumentSnapshot",n.bundleName=this._key.toString(),!e||!e.isValidDocument()||!e.isFoundDocument()?n:(this._userDataWriter.convertObjectMap(e.data.value.mapValue.fields,"previous"),n.bundle=(this._firestore,this.ref.path,"NOT SUPPORTED"),n)}}Ki._jsonSchemaVersion="firestore/documentSnapshot/1.0",Ki._jsonSchema={type:Xt("string",Ki._jsonSchemaVersion),bundleSource:Xt("string","DocumentSnapshot"),bundleName:Xt("string"),bundle:Xt("string")};class Fu extends Ki{data(e={}){return super.data(e)}}class Qi{constructor(e,n,r,s){this._firestore=e,this._userDataWriter=n,this._snapshot=s,this.metadata=new ul(s.hasPendingWrites,s.fromCache),this.query=r}get docs(){const e=[];return this.forEach(n=>e.push(n)),e}get size(){return this._snapshot.docs.size}get empty(){return this.size===0}forEach(e,n){this._snapshot.docs.forEach(r=>{e.call(n,new Fu(this._firestore,this._userDataWriter,r.key,r,new ul(this._snapshot.mutatedKeys.has(r.key),this._snapshot.fromCache),this.query.converter))})}docChanges(e={}){const n=!!e.includeMetadataChanges;if(n&&this._snapshot.excludesMetadataChanges)throw new fe(Y.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===n||(this._cachedChanges=function(s,i){if(s._snapshot.oldDocs.isEmpty()){let o=0;return s._snapshot.docChanges.map(l=>{const c=new Fu(s._firestore,s._userDataWriter,l.doc.key,l.doc,new ul(s._snapshot.mutatedKeys.has(l.doc.key),s._snapshot.fromCache),s.query.converter);return l.doc,{type:"added",doc:c,oldIndex:-1,newIndex:o++}})}{let o=s._snapshot.oldDocs;return s._snapshot.docChanges.filter(l=>i||l.type!==3).map(l=>{const c=new Fu(s._firestore,s._userDataWriter,l.doc.key,l.doc,new ul(s._snapshot.mutatedKeys.has(l.doc.key),s._snapshot.fromCache),s.query.converter);let u=-1,h=-1;return l.type!==0&&(u=o.indexOf(l.doc.key),o=o.delete(l.doc.key)),l.type!==1&&(o=o.add(l.doc),h=o.indexOf(l.doc.key)),{type:K4(l.type),doc:c,oldIndex:u,newIndex:h}})}}(this,n),this._cachedChangesIncludeMetadataChanges=n),this._cachedChanges}toJSON(){if(this.metadata.hasPendingWrites)throw new fe(Y.FAILED_PRECONDITION,"QuerySnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const e={};e.type=Qi._jsonSchemaVersion,e.bundleSource="QuerySnapshot",e.bundleName=Hg.newId(),this._firestore._databaseId.database,this._firestore._databaseId.projectId;const n=[],r=[],s=[];return this.docs.forEach(i=>{i._document!==null&&(n.push(i._document),r.push(this._userDataWriter.convertObjectMap(i._document.data.value.mapValue.fields,"previous")),s.push(i.ref.path))}),e.bundle=(this._firestore,this.query._query,e.bundleName,"NOT SUPPORTED"),e}}function K4(t){switch(t){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return Ae(61501,{type:t})}}/** + * @license + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */Qi._jsonSchemaVersion="firestore/querySnapshot/1.0",Qi._jsonSchema={type:Xt("string",Qi._jsonSchemaVersion),bundleSource:Xt("string","QuerySnapshot"),bundleName:Xt("string"),bundle:Xt("string")};/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Q4{constructor(e,n){this._firestore=e,this._commitHandler=n,this._mutations=[],this._committed=!1,this._dataReader=bc(e)}set(e,n,r){this._verifyNotCommitted();const s=jf(e,this._firestore),i=T0(s.converter,n,r),o=x0(this._dataReader,"WriteBatch.set",s._key,i,s.converter!==null,r);return this._mutations.push(o.toMutation(s._key,On.none())),this}update(e,n,r,...s){this._verifyNotCommitted();const i=jf(e,this._firestore);let o;return o=typeof(n=sn(n))=="string"||n instanceof Ah?zS(this._dataReader,"WriteBatch.update",i._key,n,r,s):FS(this._dataReader,"WriteBatch.update",i._key,n),this._mutations.push(o.toMutation(i._key,On.exists(!0))),this}delete(e){this._verifyNotCommitted();const n=jf(e,this._firestore);return this._mutations=this._mutations.concat(new Sh(n._key,On.none())),this}commit(){return this._verifyNotCommitted(),this._committed=!0,this._mutations.length>0?this._commitHandler(this._mutations):Promise.resolve()}_verifyNotCommitted(){if(this._committed)throw new fe(Y.FAILED_PRECONDITION,"A write batch can no longer be used after commit() has been called.")}}function jf(t,e){if((t=sn(t)).firestore!==e)throw new fe(Y.INVALID_ARGUMENT,"Provided document reference is from a different Firestore instance.");return t}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Ps(t){t=Ln(t,Ut);const e=Ln(t.firestore,os),n=wc(e);return A4(n,t._key).then(r=>YS(e,t,r))}function hn(t){t=Ln(t,Pi);const e=Ln(t.firestore,os),n=wc(e),r=new b0(e);return GS(t._query),j4(n,t._query).then(s=>new Qi(e,r,t,s))}function QS(t,e,n){t=Ln(t,Ut);const r=Ln(t.firestore,os),s=T0(t.converter,e,n),i=bc(r);return Tc(r,[x0(i,"setDoc",t._key,s,t.converter!==null,n).toMutation(t._key,On.none())])}function tr(t,e,n,...r){t=Ln(t,Ut);const s=Ln(t.firestore,os),i=bc(s);let o;return o=typeof(e=sn(e))=="string"||e instanceof Ah?zS(i,"updateDoc",t._key,e,n,r):FS(i,"updateDoc",t._key,e),Tc(s,[o.toMutation(t._key,On.exists(!0))])}function tc(t){return Tc(Ln(t.firestore,os),[new Sh(t._key,On.none())])}function Sc(t,e){const n=Ln(t.firestore,os),r=Nt(t),s=T0(t.converter,e),i=bc(t.firestore);return Tc(n,[x0(i,"addDoc",r._key,s,t.converter!==null,{}).toMutation(r._key,On.exists(!1))]).then(()=>r)}function N0(t,...e){var u,h,f;t=sn(t);let n={includeMetadataChanges:!1,source:"default"},r=0;typeof e[r]!="object"||Jv(e[r])||(n=e[r++]);const s={includeMetadataChanges:n.includeMetadataChanges,source:n.source};if(Jv(e[r])){const m=e[r];e[r]=(u=m.next)==null?void 0:u.bind(m),e[r+1]=(h=m.error)==null?void 0:h.bind(m),e[r+2]=(f=m.complete)==null?void 0:f.bind(m)}let i,o,l;if(t instanceof Ut)o=Ln(t.firestore,os),l=vh(t._key.path),i={next:m=>{e[r]&&e[r](YS(o,t,m))},error:e[r+1],complete:e[r+2]};else{const m=Ln(t,Pi);o=Ln(m.firestore,os),l=m._query;const p=new b0(o);i={next:y=>{e[r]&&e[r](new Qi(o,p,m,y))},error:e[r+1],complete:e[r+2]},GS(t._query)}const c=wc(o);return C4(c,l,s,i)}function Tc(t,e){const n=wc(t);return P4(n,e)}function YS(t,e,n){const r=n.docs.get(e._key),s=new b0(t);return new Ki(t,s,e._key,r,new ul(n.hasPendingWrites,n.fromCache),e.converter)}function Y4(t){return t=Ln(t,os),wc(t),new Q4(t,e=>Tc(t,e))}(function(e,n=!0){jA(po),so(new vi("firestore",(r,{instanceIdentifier:s,options:i})=>{const o=r.getProvider("app").getImmediate(),l=new os(new DA(r.getProvider("auth-internal")),new OA(o,r.getProvider("app-check-internal")),ej(o,s),o);return i={useFetchStreams:n,...i},l._setSettings(i),l},"PUBLIC").setMultipleInstances(!0)),Zr(Yv,Xv,e),Zr(Yv,Xv,"esm2020")})();/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const XS="firebasestorage.googleapis.com",X4="storageBucket",J4=2*60*1e3,Z4=10*60*1e3;/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class us extends cs{constructor(e,n,r=0){super(Pf(e),`Firebase Storage: ${n} (${Pf(e)})`),this.status_=r,this.customData={serverResponse:null},this._baseMessage=this.message,Object.setPrototypeOf(this,us.prototype)}get status(){return this.status_}set status(e){this.status_=e}_codeEquals(e){return Pf(e)===this.code}get serverResponse(){return this.customData.serverResponse}set serverResponse(e){this.customData.serverResponse=e,this.customData.serverResponse?this.message=`${this._baseMessage} +${this.customData.serverResponse}`:this.message=this._baseMessage}}var as;(function(t){t.UNKNOWN="unknown",t.OBJECT_NOT_FOUND="object-not-found",t.BUCKET_NOT_FOUND="bucket-not-found",t.PROJECT_NOT_FOUND="project-not-found",t.QUOTA_EXCEEDED="quota-exceeded",t.UNAUTHENTICATED="unauthenticated",t.UNAUTHORIZED="unauthorized",t.UNAUTHORIZED_APP="unauthorized-app",t.RETRY_LIMIT_EXCEEDED="retry-limit-exceeded",t.INVALID_CHECKSUM="invalid-checksum",t.CANCELED="canceled",t.INVALID_EVENT_NAME="invalid-event-name",t.INVALID_URL="invalid-url",t.INVALID_DEFAULT_BUCKET="invalid-default-bucket",t.NO_DEFAULT_BUCKET="no-default-bucket",t.CANNOT_SLICE_BLOB="cannot-slice-blob",t.SERVER_FILE_WRONG_SIZE="server-file-wrong-size",t.NO_DOWNLOAD_URL="no-download-url",t.INVALID_ARGUMENT="invalid-argument",t.INVALID_ARGUMENT_COUNT="invalid-argument-count",t.APP_DELETED="app-deleted",t.INVALID_ROOT_OPERATION="invalid-root-operation",t.INVALID_FORMAT="invalid-format",t.INTERNAL_ERROR="internal-error",t.UNSUPPORTED_ENVIRONMENT="unsupported-environment"})(as||(as={}));function Pf(t){return"storage/"+t}function eR(){const t="An unknown error occurred, please check the error payload for server response.";return new us(as.UNKNOWN,t)}function tR(){return new us(as.RETRY_LIMIT_EXCEEDED,"Max retry time for operation exceeded, please try again.")}function nR(){return new us(as.CANCELED,"User canceled the upload/download.")}function rR(t){return new us(as.INVALID_URL,"Invalid URL '"+t+"'.")}function sR(t){return new us(as.INVALID_DEFAULT_BUCKET,"Invalid default bucket '"+t+"'.")}function tw(t){return new us(as.INVALID_ARGUMENT,t)}function JS(){return new us(as.APP_DELETED,"The Firebase app was deleted.")}function iR(t){return new us(as.INVALID_ROOT_OPERATION,"The operation '"+t+"' cannot be performed on a root reference, create a non-root reference using child, such as .child('file.png').")}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Dr{constructor(e,n){this.bucket=e,this.path_=n}get path(){return this.path_}get isRoot(){return this.path.length===0}fullServerUrl(){const e=encodeURIComponent;return"/b/"+e(this.bucket)+"/o/"+e(this.path)}bucketOnlyServerUrl(){return"/b/"+encodeURIComponent(this.bucket)+"/o"}static makeFromBucketSpec(e,n){let r;try{r=Dr.makeFromUrl(e,n)}catch{return new Dr(e,"")}if(r.path==="")return r;throw sR(e)}static makeFromUrl(e,n){let r=null;const s="([A-Za-z0-9.\\-_]+)";function i(D){D.path.charAt(D.path.length-1)==="/"&&(D.path_=D.path_.slice(0,-1))}const o="(/(.*))?$",l=new RegExp("^gs://"+s+o,"i"),c={bucket:1,path:3};function u(D){D.path_=decodeURIComponent(D.path)}const h="v[A-Za-z0-9_]+",f=n.replace(/[.]/g,"\\."),m="(/([^?#]*).*)?$",p=new RegExp(`^https?://${f}/${h}/b/${s}/o${m}`,"i"),y={bucket:1,path:3},_=n===XS?"(?:storage.googleapis.com|storage.cloud.google.com)":n,C="([^?#]*)",v=new RegExp(`^https?://${_}/${s}/${C}`,"i"),E=[{regex:l,indices:c,postModify:i},{regex:p,indices:y,postModify:u},{regex:v,indices:{bucket:1,path:2},postModify:u}];for(let D=0;D{s=null,t(p,c())},C)}function m(){i&&clearTimeout(i)}function p(C,...v){if(u){m();return}if(C){m(),h.call(null,C,...v);return}if(c()||o){m(),h.call(null,C,...v);return}r<64&&(r*=2);let E;l===1?(l=2,E=0):E=(r+Math.random())*1e3,f(E)}let y=!1;function _(C){y||(y=!0,m(),!u&&(s!==null?(C||(l=2),clearTimeout(s),f(0)):C||(l=1)))}return f(0),i=setTimeout(()=>{o=!0,_(!0)},n),_}function lR(t){t(!1)}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function cR(t){return t!==void 0}function nw(t,e,n,r){if(rn)throw tw(`Invalid value for '${t}'. Expected ${n} or less.`)}function uR(t){const e=encodeURIComponent;let n="?";for(const r in t)if(t.hasOwnProperty(r)){const s=e(r)+"="+e(t[r]);n=n+s+"&"}return n=n.slice(0,-1),n}var Rd;(function(t){t[t.NO_ERROR=0]="NO_ERROR",t[t.NETWORK_ERROR=1]="NETWORK_ERROR",t[t.ABORT=2]="ABORT"})(Rd||(Rd={}));/** + * @license + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function dR(t,e){const n=t>=500&&t<600,s=[408,429].indexOf(t)!==-1,i=e.indexOf(t)!==-1;return n||s||i}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class hR{constructor(e,n,r,s,i,o,l,c,u,h,f,m=!0,p=!1){this.url_=e,this.method_=n,this.headers_=r,this.body_=s,this.successCodes_=i,this.additionalRetryCodes_=o,this.callback_=l,this.errorCallback_=c,this.timeout_=u,this.progressCallback_=h,this.connectionFactory_=f,this.retry=m,this.isUsingEmulator=p,this.pendingConnection_=null,this.backoffId_=null,this.canceled_=!1,this.appDelete_=!1,this.promise_=new Promise((y,_)=>{this.resolve_=y,this.reject_=_,this.start_()})}start_(){const e=(r,s)=>{if(s){r(!1,new mu(!1,null,!0));return}const i=this.connectionFactory_();this.pendingConnection_=i;const o=l=>{const c=l.loaded,u=l.lengthComputable?l.total:-1;this.progressCallback_!==null&&this.progressCallback_(c,u)};this.progressCallback_!==null&&i.addUploadProgressListener(o),i.send(this.url_,this.method_,this.isUsingEmulator,this.body_,this.headers_).then(()=>{this.progressCallback_!==null&&i.removeUploadProgressListener(o),this.pendingConnection_=null;const l=i.getErrorCode()===Rd.NO_ERROR,c=i.getStatus();if(!l||dR(c,this.additionalRetryCodes_)&&this.retry){const h=i.getErrorCode()===Rd.ABORT;r(!1,new mu(!1,null,h));return}const u=this.successCodes_.indexOf(c)!==-1;r(!0,new mu(u,i))})},n=(r,s)=>{const i=this.resolve_,o=this.reject_,l=s.connection;if(s.wasSuccessCode)try{const c=this.callback_(l,l.getResponse());cR(c)?i(c):i()}catch(c){o(c)}else if(l!==null){const c=eR();c.serverResponse=l.getErrorText(),this.errorCallback_?o(this.errorCallback_(l,c)):o(c)}else if(s.canceled){const c=this.appDelete_?JS():nR();o(c)}else{const c=tR();o(c)}};this.canceled_?n(!1,new mu(!1,null,!0)):this.backoffId_=aR(e,n,this.timeout_)}getPromise(){return this.promise_}cancel(e){this.canceled_=!0,this.appDelete_=e||!1,this.backoffId_!==null&&lR(this.backoffId_),this.pendingConnection_!==null&&this.pendingConnection_.abort()}}class mu{constructor(e,n,r){this.wasSuccessCode=e,this.connection=n,this.canceled=!!r}}function fR(t,e){e!==null&&e.length>0&&(t.Authorization="Firebase "+e)}function pR(t,e){t["X-Firebase-Storage-Version"]="webjs/"+(e??"AppManager")}function mR(t,e){e&&(t["X-Firebase-GMPID"]=e)}function gR(t,e){e!==null&&(t["X-Firebase-AppCheck"]=e)}function yR(t,e,n,r,s,i,o=!0,l=!1){const c=uR(t.urlParams),u=t.url+c,h=Object.assign({},t.headers);return mR(h,e),fR(h,n),pR(h,i),gR(h,r),new hR(u,t.method,h,t.body,t.successCodes,t.additionalRetryCodes,t.handler,t.errorHandler,t.timeout,t.progressCallback,s,o,l)}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function xR(t){if(t.length===0)return null;const e=t.lastIndexOf("/");return e===-1?"":t.slice(0,e)}function vR(t){const e=t.lastIndexOf("/",t.length-2);return e===-1?t:t.slice(e+1)}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Dd{constructor(e,n){this._service=e,n instanceof Dr?this._location=n:this._location=Dr.makeFromUrl(n,e.host)}toString(){return"gs://"+this._location.bucket+"/"+this._location.path}_newRef(e,n){return new Dd(e,n)}get root(){const e=new Dr(this._location.bucket,"");return this._newRef(this._service,e)}get bucket(){return this._location.bucket}get fullPath(){return this._location.path}get name(){return vR(this._location.path)}get storage(){return this._service}get parent(){const e=xR(this._location.path);if(e===null)return null;const n=new Dr(this._location.bucket,e);return new Dd(this._service,n)}_throwIfRoot(e){if(this._location.path==="")throw iR(e)}}function rw(t,e){const n=e==null?void 0:e[X4];return n==null?null:Dr.makeFromBucketSpec(n,t)}function wR(t,e,n,r={}){t.host=`${e}:${n}`;const s=Sa(e);s&&Fg(`https://${t.host}/b`),t._isUsingEmulator=!0,t._protocol=s?"https":"http";const{mockUserToken:i}=r;i&&(t._overrideAuthToken=typeof i=="string"?i:dE(i,t.app.options.projectId))}class bR{constructor(e,n,r,s,i,o=!1){this.app=e,this._authProvider=n,this._appCheckProvider=r,this._url=s,this._firebaseVersion=i,this._isUsingEmulator=o,this._bucket=null,this._host=XS,this._protocol="https",this._appId=null,this._deleted=!1,this._maxOperationRetryTime=J4,this._maxUploadRetryTime=Z4,this._requests=new Set,s!=null?this._bucket=Dr.makeFromBucketSpec(s,this._host):this._bucket=rw(this._host,this.app.options)}get host(){return this._host}set host(e){this._host=e,this._url!=null?this._bucket=Dr.makeFromBucketSpec(this._url,e):this._bucket=rw(e,this.app.options)}get maxUploadRetryTime(){return this._maxUploadRetryTime}set maxUploadRetryTime(e){nw("time",0,Number.POSITIVE_INFINITY,e),this._maxUploadRetryTime=e}get maxOperationRetryTime(){return this._maxOperationRetryTime}set maxOperationRetryTime(e){nw("time",0,Number.POSITIVE_INFINITY,e),this._maxOperationRetryTime=e}async _getAuthToken(){if(this._overrideAuthToken)return this._overrideAuthToken;const e=this._authProvider.getImmediate({optional:!0});if(e){const n=await e.getToken();if(n!==null)return n.accessToken}return null}async _getAppCheckToken(){if(Rr(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const e=this._appCheckProvider.getImmediate({optional:!0});return e?(await e.getToken()).token:null}_delete(){return this._deleted||(this._deleted=!0,this._requests.forEach(e=>e.cancel()),this._requests.clear()),Promise.resolve()}_makeStorageReference(e){return new Dd(this,e)}_makeRequest(e,n,r,s,i=!0){if(this._deleted)return new oR(JS());{const o=yR(e,this._appId,r,s,n,this._firebaseVersion,i,this._isUsingEmulator);return this._requests.add(o),o.getPromise().then(()=>this._requests.delete(o),()=>this._requests.delete(o)),o}}async makeRequestWithTokens(e,n){const[r,s]=await Promise.all([this._getAuthToken(),this._getAppCheckToken()]);return this._makeRequest(e,n,r,s).getPromise()}}const sw="@firebase/storage",iw="0.14.2";/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const ZS="storage";function _R(t=Bg(),e){t=sn(t);const r=ph(t,ZS).getImmediate({identifier:e}),s=lE("storage");return s&&ER(r,...s),r}function ER(t,e,n,r={}){wR(t,e,n,r)}function SR(t,{instanceIdentifier:e}){const n=t.getProvider("app").getImmediate(),r=t.getProvider("auth-internal"),s=t.getProvider("app-check-internal");return new bR(n,r,s,e,po)}function TR(){so(new vi(ZS,SR,"PUBLIC").setMultipleInstances(!0)),Zr(sw,iw,""),Zr(sw,iw,"esm2020")}TR();function e2(){return{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}}const NR=e2,t2=new fc("auth","Firebase",e2());/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Md=new zg("@firebase/auth");function kR(t,...e){Md.logLevel<=Ye.WARN&&Md.warn(`Auth (${po}): ${t}`,...e)}function zu(t,...e){Md.logLevel<=Ye.ERROR&&Md.error(`Auth (${po}): ${t}`,...e)}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Rs(t,...e){throw k0(t,...e)}function rs(t,...e){return k0(t,...e)}function n2(t,e,n){const r={...NR(),[e]:n};return new fc("auth","Firebase",r).create(e,{appName:t.name})}function Yi(t){return n2(t,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function k0(t,...e){if(typeof t!="string"){const n=e[0],r=[...e.slice(1)];return r[0]&&(r[0].appName=t.name),t._errorFactory.create(n,...r)}return t2.create(t,...e)}function Re(t,e,...n){if(!t)throw k0(e,...n)}function vs(t){const e="INTERNAL ASSERTION FAILED: "+t;throw zu(e),new Error(e)}function Ds(t,e){t||vs(e)}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function _m(){var t;return typeof self<"u"&&((t=self.location)==null?void 0:t.href)||""}function IR(){return ow()==="http:"||ow()==="https:"}function ow(){var t;return typeof self<"u"&&((t=self.location)==null?void 0:t.protocol)||null}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function CR(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(IR()||lC()||"connection"in navigator)?navigator.onLine:!0}function AR(){if(typeof navigator>"u")return null;const t=navigator;return t.languages&&t.languages[0]||t.language||null}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Nc{constructor(e,n){this.shortDelay=e,this.longDelay=n,Ds(n>e,"Short delay should be less than long delay!"),this.isMobile=iC()||cC()}get(){return CR()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function I0(t,e){Ds(t.emulator,"Emulator should always be set here");const{url:n}=t.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class r2{static initialize(e,n,r){this.fetchImpl=e,n&&(this.headersImpl=n),r&&(this.responseImpl=r)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;vs("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;vs("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;vs("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const jR={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const PR=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],RR=new Nc(3e4,6e4);function C0(t,e){return t.tenantId&&!e.tenantId?{...e,tenantId:t.tenantId}:e}async function Aa(t,e,n,r,s={}){return s2(t,s,async()=>{let i={},o={};r&&(e==="GET"?o=r:i={body:JSON.stringify(r)});const l=pc({key:t.config.apiKey,...o}).slice(1),c=await t._getAdditionalHeaders();c["Content-Type"]="application/json",t.languageCode&&(c["X-Firebase-Locale"]=t.languageCode);const u={method:e,headers:c,...i};return aC()||(u.referrerPolicy="no-referrer"),t.emulatorConfig&&Sa(t.emulatorConfig.host)&&(u.credentials="include"),r2.fetch()(await i2(t,t.config.apiHost,n,l),u)})}async function s2(t,e,n){t._canInitEmulator=!1;const r={...jR,...e};try{const s=new MR(t),i=await Promise.race([n(),s.promise]);s.clearNetworkTimeout();const o=await i.json();if("needConfirmation"in o)throw gu(t,"account-exists-with-different-credential",o);if(i.ok&&!("errorMessage"in o))return o;{const l=i.ok?o.errorMessage:o.error.message,[c,u]=l.split(" : ");if(c==="FEDERATED_USER_ID_ALREADY_LINKED")throw gu(t,"credential-already-in-use",o);if(c==="EMAIL_EXISTS")throw gu(t,"email-already-in-use",o);if(c==="USER_DISABLED")throw gu(t,"user-disabled",o);const h=r[c]||c.toLowerCase().replace(/[_\s]+/g,"-");if(u)throw n2(t,h,u);Rs(t,h)}}catch(s){if(s instanceof cs)throw s;Rs(t,"network-request-failed",{message:String(s)})}}async function DR(t,e,n,r,s={}){const i=await Aa(t,e,n,r,s);return"mfaPendingCredential"in i&&Rs(t,"multi-factor-auth-required",{_serverResponse:i}),i}async function i2(t,e,n,r){const s=`${e}${n}?${r}`,i=t,o=i.config.emulator?I0(t.config,s):`${t.config.apiScheme}://${s}`;return PR.includes(n)&&(await i._persistenceManagerAvailable,i._getPersistenceType()==="COOKIE")?i._getPersistence()._getFinalTarget(o).toString():o}class MR{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((n,r)=>{this.timer=setTimeout(()=>r(rs(this.auth,"network-request-failed")),RR.get())})}}function gu(t,e,n){const r={appName:t.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const s=rs(t,e,r);return s.customData._tokenResponse=n,s}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function LR(t,e){return Aa(t,"POST","/v1/accounts:delete",e)}async function Ld(t,e){return Aa(t,"POST","/v1/accounts:lookup",e)}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Sl(t){if(t)try{const e=new Date(Number(t));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function OR(t,e=!1){const n=sn(t),r=await n.getIdToken(e),s=A0(r);Re(s&&s.exp&&s.auth_time&&s.iat,n.auth,"internal-error");const i=typeof s.firebase=="object"?s.firebase:void 0,o=i==null?void 0:i.sign_in_provider;return{claims:s,token:r,authTime:Sl(Rf(s.auth_time)),issuedAtTime:Sl(Rf(s.iat)),expirationTime:Sl(Rf(s.exp)),signInProvider:o||null,signInSecondFactor:(i==null?void 0:i.sign_in_second_factor)||null}}function Rf(t){return Number(t)*1e3}function A0(t){const[e,n,r]=t.split(".");if(e===void 0||n===void 0||r===void 0)return zu("JWT malformed, contained fewer than 3 sections"),null;try{const s=oE(n);return s?JSON.parse(s):(zu("Failed to decode base64 JWT payload"),null)}catch(s){return zu("Caught error parsing JWT payload as JSON",s==null?void 0:s.toString()),null}}function aw(t){const e=A0(t);return Re(e,"internal-error"),Re(typeof e.exp<"u","internal-error"),Re(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function nc(t,e,n=!1){if(n)return e;try{return await e}catch(r){throw r instanceof cs&&VR(r)&&t.auth.currentUser===t&&await t.auth.signOut(),r}}function VR({code:t}){return t==="auth/user-disabled"||t==="auth/user-token-expired"}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class FR{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(e){if(e){const n=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),n}else{this.errorBackoff=3e4;const r=(this.user.stsTokenManager.expirationTime??0)-Date.now()-3e5;return Math.max(0,r)}}schedule(e=!1){if(!this.isRunning)return;const n=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},n)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){(e==null?void 0:e.code)==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Em{constructor(e,n){this.createdAt=e,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=Sl(this.lastLoginAt),this.creationTime=Sl(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function Od(t){var f;const e=t.auth,n=await t.getIdToken(),r=await nc(t,Ld(e,{idToken:n}));Re(r==null?void 0:r.users.length,e,"internal-error");const s=r.users[0];t._notifyReloadListener(s);const i=(f=s.providerUserInfo)!=null&&f.length?o2(s.providerUserInfo):[],o=UR(t.providerData,i),l=t.isAnonymous,c=!(t.email&&s.passwordHash)&&!(o!=null&&o.length),u=l?c:!1,h={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:o,metadata:new Em(s.createdAt,s.lastLoginAt),isAnonymous:u};Object.assign(t,h)}async function zR(t){const e=sn(t);await Od(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function UR(t,e){return[...t.filter(r=>!e.some(s=>s.providerId===r.providerId)),...e]}function o2(t){return t.map(({providerId:e,...n})=>({providerId:e,uid:n.rawId||"",displayName:n.displayName||null,email:n.email||null,phoneNumber:n.phoneNumber||null,photoURL:n.photoUrl||null}))}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function BR(t,e){const n=await s2(t,{},async()=>{const r=pc({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:s,apiKey:i}=t.config,o=await i2(t,s,"/v1/token",`key=${i}`),l=await t._getAdditionalHeaders();l["Content-Type"]="application/x-www-form-urlencoded";const c={method:"POST",headers:l,body:r};return t.emulatorConfig&&Sa(t.emulatorConfig.host)&&(c.credentials="include"),r2.fetch()(o,c)});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function $R(t,e){return Aa(t,"POST","/v2/accounts:revokeToken",C0(t,e))}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Zo{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){Re(e.idToken,"internal-error"),Re(typeof e.idToken<"u","internal-error"),Re(typeof e.refreshToken<"u","internal-error");const n="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):aw(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,n)}updateFromIdToken(e){Re(e.length!==0,"internal-error");const n=aw(e);this.updateTokensAndExpiration(e,null,n)}async getToken(e,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(Re(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(e,n){const{accessToken:r,refreshToken:s,expiresIn:i}=await BR(e,n);this.updateTokensAndExpiration(r,s,Number(i))}updateTokensAndExpiration(e,n,r){this.refreshToken=n||null,this.accessToken=e||null,this.expirationTime=Date.now()+r*1e3}static fromJSON(e,n){const{refreshToken:r,accessToken:s,expirationTime:i}=n,o=new Zo;return r&&(Re(typeof r=="string","internal-error",{appName:e}),o.refreshToken=r),s&&(Re(typeof s=="string","internal-error",{appName:e}),o.accessToken=s),i&&(Re(typeof i=="number","internal-error",{appName:e}),o.expirationTime=i),o}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new Zo,this.toJSON())}_performRefresh(){return vs("not implemented")}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Hs(t,e){Re(typeof t=="string"||typeof t>"u","internal-error",{appName:e})}class Mr{constructor({uid:e,auth:n,stsTokenManager:r,...s}){this.providerId="firebase",this.proactiveRefresh=new FR(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=n,this.stsTokenManager=r,this.accessToken=r.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new Em(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(e){const n=await nc(this,this.stsTokenManager.getToken(this.auth,e));return Re(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(e){return OR(this,e)}reload(){return zR(this)}_assign(e){this!==e&&(Re(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(n=>({...n})),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){const n=new Mr({...this,auth:e,stsTokenManager:this.stsTokenManager._clone()});return n.metadata._copy(this.metadata),n}_onReload(e){Re(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,n=!1){let r=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),r=!0),n&&await Od(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(Rr(this.auth.app))return Promise.reject(Yi(this.auth));const e=await this.getIdToken();return await nc(this,LR(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return{uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>({...e})),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId,...this.metadata.toJSON(),apiKey:this.auth.config.apiKey,appName:this.auth.name}}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,n){const r=n.displayName??void 0,s=n.email??void 0,i=n.phoneNumber??void 0,o=n.photoURL??void 0,l=n.tenantId??void 0,c=n._redirectEventId??void 0,u=n.createdAt??void 0,h=n.lastLoginAt??void 0,{uid:f,emailVerified:m,isAnonymous:p,providerData:y,stsTokenManager:_}=n;Re(f&&_,e,"internal-error");const C=Zo.fromJSON(this.name,_);Re(typeof f=="string",e,"internal-error"),Hs(r,e.name),Hs(s,e.name),Re(typeof m=="boolean",e,"internal-error"),Re(typeof p=="boolean",e,"internal-error"),Hs(i,e.name),Hs(o,e.name),Hs(l,e.name),Hs(c,e.name),Hs(u,e.name),Hs(h,e.name);const v=new Mr({uid:f,auth:e,email:s,emailVerified:m,displayName:r,isAnonymous:p,photoURL:o,phoneNumber:i,tenantId:l,stsTokenManager:C,createdAt:u,lastLoginAt:h});return y&&Array.isArray(y)&&(v.providerData=y.map(w=>({...w}))),c&&(v._redirectEventId=c),v}static async _fromIdTokenResponse(e,n,r=!1){const s=new Zo;s.updateFromServerResponse(n);const i=new Mr({uid:n.localId,auth:e,stsTokenManager:s,isAnonymous:r});return await Od(i),i}static async _fromGetAccountInfoResponse(e,n,r){const s=n.users[0];Re(s.localId!==void 0,"internal-error");const i=s.providerUserInfo!==void 0?o2(s.providerUserInfo):[],o=!(s.email&&s.passwordHash)&&!(i!=null&&i.length),l=new Zo;l.updateFromIdToken(r);const c=new Mr({uid:s.localId,auth:e,stsTokenManager:l,isAnonymous:o}),u={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:i,metadata:new Em(s.createdAt,s.lastLoginAt),isAnonymous:!(s.email&&s.passwordHash)&&!(i!=null&&i.length)};return Object.assign(c,u),c}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const lw=new Map;function ws(t){Ds(t instanceof Function,"Expected a class definition");let e=lw.get(t);return e?(Ds(e instanceof t,"Instance stored in cache mismatched with class"),e):(e=new t,lw.set(t,e),e)}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class a2{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,n){this.storage[e]=n}async _get(e){const n=this.storage[e];return n===void 0?null:n}async _remove(e){delete this.storage[e]}_addListener(e,n){}_removeListener(e,n){}}a2.type="NONE";const cw=a2;/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Uu(t,e,n){return`firebase:${t}:${e}:${n}`}class ea{constructor(e,n,r){this.persistence=e,this.auth=n,this.userKey=r;const{config:s,name:i}=this.auth;this.fullUserKey=Uu(this.userKey,s.apiKey,i),this.fullPersistenceKey=Uu("persistence",s.apiKey,i),this.boundEventHandler=n._onStorageEvent.bind(n),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){const e=await this.persistence._get(this.fullUserKey);if(!e)return null;if(typeof e=="string"){const n=await Ld(this.auth,{idToken:e}).catch(()=>{});return n?Mr._fromGetAccountInfoResponse(this.auth,n,e):null}return Mr._fromJSON(this.auth,e)}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;const n=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,n)return this.setCurrentUser(n)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,n,r="authUser"){if(!n.length)return new ea(ws(cw),e,r);const s=(await Promise.all(n.map(async u=>{if(await u._isAvailable())return u}))).filter(u=>u);let i=s[0]||ws(cw);const o=Uu(r,e.config.apiKey,e.name);let l=null;for(const u of n)try{const h=await u._get(o);if(h){let f;if(typeof h=="string"){const m=await Ld(e,{idToken:h}).catch(()=>{});if(!m)break;f=await Mr._fromGetAccountInfoResponse(e,m,h)}else f=Mr._fromJSON(e,h);u!==i&&(l=f),i=u;break}}catch{}const c=s.filter(u=>u._shouldAllowMigration);return!i._shouldAllowMigration||!c.length?new ea(i,e,r):(i=c[0],l&&await i._set(o,l.toJSON()),await Promise.all(n.map(async u=>{if(u!==i)try{await u._remove(o)}catch{}})),new ea(i,e,r))}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function uw(t){const e=t.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(d2(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(l2(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(f2(e))return"Blackberry";if(p2(e))return"Webos";if(c2(e))return"Safari";if((e.includes("chrome/")||u2(e))&&!e.includes("edge/"))return"Chrome";if(h2(e))return"Android";{const n=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,r=t.match(n);if((r==null?void 0:r.length)===2)return r[1]}return"Other"}function l2(t=An()){return/firefox\//i.test(t)}function c2(t=An()){const e=t.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function u2(t=An()){return/crios\//i.test(t)}function d2(t=An()){return/iemobile/i.test(t)}function h2(t=An()){return/android/i.test(t)}function f2(t=An()){return/blackberry/i.test(t)}function p2(t=An()){return/webos/i.test(t)}function j0(t=An()){return/iphone|ipad|ipod/i.test(t)||/macintosh/i.test(t)&&/mobile/i.test(t)}function HR(t=An()){var e;return j0(t)&&!!((e=window.navigator)!=null&&e.standalone)}function qR(){return uC()&&document.documentMode===10}function m2(t=An()){return j0(t)||h2(t)||p2(t)||f2(t)||/windows phone/i.test(t)||d2(t)}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function g2(t,e=[]){let n;switch(t){case"Browser":n=uw(An());break;case"Worker":n=`${uw(An())}-${t}`;break;default:n=t}const r=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${po}/${r}`}/** + * @license + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class GR{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,n){const r=i=>new Promise((o,l)=>{try{const c=e(i);o(c)}catch(c){l(c)}});r.onAbort=n,this.queue.push(r);const s=this.queue.length-1;return()=>{this.queue[s]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;const n=[];try{for(const r of this.queue)await r(e),r.onAbort&&n.push(r.onAbort)}catch(r){n.reverse();for(const s of n)try{s()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:r==null?void 0:r.message})}}}/** + * @license + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function WR(t,e={}){return Aa(t,"GET","/v2/passwordPolicy",C0(t,e))}/** + * @license + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const KR=6;class QR{constructor(e){var r;const n=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=n.minPasswordLength??KR,n.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=n.maxPasswordLength),n.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=n.containsLowercaseCharacter),n.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=n.containsUppercaseCharacter),n.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=n.containsNumericCharacter),n.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=n.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=((r=e.allowedNonAlphanumericCharacters)==null?void 0:r.join(""))??"",this.forceUpgradeOnSignin=e.forceUpgradeOnSignin??!1,this.schemaVersion=e.schemaVersion}validatePassword(e){const n={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,n),this.validatePasswordCharacterOptions(e,n),n.isValid&&(n.isValid=n.meetsMinPasswordLength??!0),n.isValid&&(n.isValid=n.meetsMaxPasswordLength??!0),n.isValid&&(n.isValid=n.containsLowercaseLetter??!0),n.isValid&&(n.isValid=n.containsUppercaseLetter??!0),n.isValid&&(n.isValid=n.containsNumericCharacter??!0),n.isValid&&(n.isValid=n.containsNonAlphanumericCharacter??!0),n}validatePasswordLengthOptions(e,n){const r=this.customStrengthOptions.minPasswordLength,s=this.customStrengthOptions.maxPasswordLength;r&&(n.meetsMinPasswordLength=e.length>=r),s&&(n.meetsMaxPasswordLength=e.length<=s)}validatePasswordCharacterOptions(e,n){this.updatePasswordCharacterOptionsStatuses(n,!1,!1,!1,!1);let r;for(let s=0;s="a"&&r<="z",r>="A"&&r<="Z",r>="0"&&r<="9",this.allowedNonAlphanumericCharacters.includes(r))}updatePasswordCharacterOptionsStatuses(e,n,r,s,i){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=n)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=r)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=s)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=i))}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class YR{constructor(e,n,r,s){this.app=e,this.heartbeatServiceProvider=n,this.appCheckServiceProvider=r,this.config=s,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new dw(this),this.idTokenSubscription=new dw(this),this.beforeStateQueue=new GR(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=t2,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this._resolvePersistenceManagerAvailable=void 0,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=s.sdkClientVersion,this._persistenceManagerAvailable=new Promise(i=>this._resolvePersistenceManagerAvailable=i)}_initializeWithPersistence(e,n){return n&&(this._popupRedirectResolver=ws(n)),this._initializationPromise=this.queue(async()=>{var r,s,i;if(!this._deleted&&(this.persistenceManager=await ea.create(this,e),(r=this._resolvePersistenceManagerAvailable)==null||r.call(this),!this._deleted)){if((s=this._popupRedirectResolver)!=null&&s._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(n),this.lastNotifiedUid=((i=this.currentUser)==null?void 0:i.uid)||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const e=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!e)){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUserFromIdToken(e){try{const n=await Ld(this,{idToken:e}),r=await Mr._fromGetAccountInfoResponse(this,n,e);await this.directlySetCurrentUser(r)}catch(n){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",n),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){var i;if(Rr(this.app)){const o=this.app.settings.authIdToken;return o?new Promise(l=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(o).then(l,l))}):this.directlySetCurrentUser(null)}const n=await this.assertedPersistence.getCurrentUser();let r=n,s=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const o=(i=this.redirectUser)==null?void 0:i._redirectEventId,l=r==null?void 0:r._redirectEventId,c=await this.tryRedirectSignIn(e);(!o||o===l)&&(c!=null&&c.user)&&(r=c.user,s=!0)}if(!r)return this.directlySetCurrentUser(null);if(!r._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(r)}catch(o){r=n,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(o))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return Re(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===r._redirectEventId?this.directlySetCurrentUser(r):this.reloadAndSetCurrentUserOrClear(r)}async tryRedirectSignIn(e){let n=null;try{n=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return n}async reloadAndSetCurrentUserOrClear(e){try{await Od(e)}catch(n){if((n==null?void 0:n.code)!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=AR()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(Rr(this.app))return Promise.reject(Yi(this));const n=e?sn(e):null;return n&&Re(n.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(n&&n._clone(this))}async _updateCurrentUser(e,n=!1){if(!this._deleted)return e&&Re(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),n||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return Rr(this.app)?Promise.reject(Yi(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return Rr(this.app)?Promise.reject(Yi(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(ws(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();const n=this._getPasswordPolicyInternal();return n.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):n.validatePassword(e)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){const e=await WR(this),n=new QR(e);this.tenantId===null?this._projectPasswordPolicy=n:this._tenantPasswordPolicies[this.tenantId]=n}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(e){this._errorFactory=new fc("auth","Firebase",e())}onAuthStateChanged(e,n,r){return this.registerStateListener(this.authStateSubscription,e,n,r)}beforeAuthStateChanged(e,n){return this.beforeStateQueue.pushCallback(e,n)}onIdTokenChanged(e,n,r){return this.registerStateListener(this.idTokenSubscription,e,n,r)}authStateReady(){return new Promise((e,n)=>{if(this.currentUser)e();else{const r=this.onAuthStateChanged(()=>{r(),e()},n)}})}async revokeAccessToken(e){if(this.currentUser){const n=await this.currentUser.getIdToken(),r={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:n};this.tenantId!=null&&(r.tenantId=this.tenantId),await $R(this,r)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:(e=this._currentUser)==null?void 0:e.toJSON()}}async _setRedirectUser(e,n){const r=await this.getOrInitRedirectPersistenceManager(n);return e===null?r.removeCurrentUser():r.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){const n=e&&ws(e)||this._popupRedirectResolver;Re(n,this,"argument-error"),this.redirectPersistenceManager=await ea.create(this,[ws(n._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var n,r;return this._isInitialized&&await this.queue(async()=>{}),((n=this._currentUser)==null?void 0:n._redirectEventId)===e?this._currentUser:((r=this.redirectUser)==null?void 0:r._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var n;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const e=((n=this.currentUser)==null?void 0:n.uid)??null;this.lastNotifiedUid!==e&&(this.lastNotifiedUid=e,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,n,r,s){if(this._deleted)return()=>{};const i=typeof n=="function"?n:n.next.bind(n);let o=!1;const l=this._isInitialized?Promise.resolve():this._initializationPromise;if(Re(l,this,"internal-error"),l.then(()=>{o||i(this.currentUser)}),typeof n=="function"){const c=e.addObserver(n,r,s);return()=>{o=!0,c()}}else{const c=e.addObserver(n);return()=>{o=!0,c()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return Re(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=g2(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var s;const e={"X-Client-Version":this.clientVersion};this.app.options.appId&&(e["X-Firebase-gmpid"]=this.app.options.appId);const n=await((s=this.heartbeatServiceProvider.getImmediate({optional:!0}))==null?void 0:s.getHeartbeatsHeader());n&&(e["X-Firebase-Client"]=n);const r=await this._getAppCheckToken();return r&&(e["X-Firebase-AppCheck"]=r),e}async _getAppCheckToken(){var n;if(Rr(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const e=await((n=this.appCheckServiceProvider.getImmediate({optional:!0}))==null?void 0:n.getToken());return e!=null&&e.error&&kR(`Error while retrieving App Check token: ${e.error}`),e==null?void 0:e.token}}function P0(t){return sn(t)}class dw{constructor(e){this.auth=e,this.observer=null,this.addObserver=xC(n=>this.observer=n)}get next(){return Re(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */let R0={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function XR(t){R0=t}function JR(t){return R0.loadJS(t)}function ZR(){return R0.gapiScript}function e5(t){return`__${t}${Math.floor(Math.random()*1e6)}`}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function t5(t,e){const n=ph(t,"auth");if(n.isInitialized()){const s=n.getImmediate(),i=n.getOptions();if(ro(i,e??{}))return s;Rs(s,"already-initialized")}return n.initialize({options:e})}function n5(t,e){const n=(e==null?void 0:e.persistence)||[],r=(Array.isArray(n)?n:[n]).map(ws);e!=null&&e.errorMap&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(r,e==null?void 0:e.popupRedirectResolver)}function r5(t,e,n){const r=P0(t);Re(/^https?:\/\//.test(e),r,"invalid-emulator-scheme");const s=!1,i=y2(e),{host:o,port:l}=s5(e),c=l===null?"":`:${l}`,u={url:`${i}//${o}${c}/`},h=Object.freeze({host:o,port:l,protocol:i.replace(":",""),options:Object.freeze({disableWarnings:s})});if(!r._canInitEmulator){Re(r.config.emulator&&r.emulatorConfig,r,"emulator-config-failed"),Re(ro(u,r.config.emulator)&&ro(h,r.emulatorConfig),r,"emulator-config-failed");return}r.config.emulator=u,r.emulatorConfig=h,r.settings.appVerificationDisabledForTesting=!0,Sa(o)?Fg(`${i}//${o}${c}`):i5()}function y2(t){const e=t.indexOf(":");return e<0?"":t.substr(0,e+1)}function s5(t){const e=y2(t),n=/(\/\/)?([^?#/]+)/.exec(t.substr(e.length));if(!n)return{host:"",port:null};const r=n[2].split("@").pop()||"",s=/^(\[[^\]]+\])(:|$)/.exec(r);if(s){const i=s[1];return{host:i,port:hw(r.substr(i.length+1))}}else{const[i,o]=r.split(":");return{host:i,port:hw(o)}}}function hw(t){if(!t)return null;const e=Number(t);return isNaN(e)?null:e}function i5(){function t(){const e=document.createElement("p"),n=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",n.position="fixed",n.width="100%",n.backgroundColor="#ffffff",n.border=".1em solid #000000",n.color="#b50000",n.bottom="0px",n.left="0px",n.margin="0px",n.zIndex="10000",n.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",t):t())}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class x2{constructor(e,n){this.providerId=e,this.signInMethod=n}toJSON(){return vs("not implemented")}_getIdTokenResponse(e){return vs("not implemented")}_linkToIdToken(e,n){return vs("not implemented")}_getReauthenticationResolver(e){return vs("not implemented")}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function ta(t,e){return DR(t,"POST","/v1/accounts:signInWithIdp",C0(t,e))}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const o5="http://localhost";class co extends x2{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const n=new co(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(n.idToken=e.idToken),e.accessToken&&(n.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(n.nonce=e.nonce),e.pendingToken&&(n.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(n.accessToken=e.oauthToken,n.secret=e.oauthTokenSecret):Rs("argument-error"),n}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){const n=typeof e=="string"?JSON.parse(e):e,{providerId:r,signInMethod:s,...i}=n;if(!r||!s)return null;const o=new co(r,s);return o.idToken=i.idToken||void 0,o.accessToken=i.accessToken||void 0,o.secret=i.secret,o.nonce=i.nonce,o.pendingToken=i.pendingToken||null,o}_getIdTokenResponse(e){const n=this.buildRequest();return ta(e,n)}_linkToIdToken(e,n){const r=this.buildRequest();return r.idToken=n,ta(e,r)}_getReauthenticationResolver(e){const n=this.buildRequest();return n.autoCreate=!1,ta(e,n)}buildRequest(){const e={requestUri:o5,returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{const n={};this.idToken&&(n.id_token=this.idToken),this.accessToken&&(n.access_token=this.accessToken),this.secret&&(n.oauth_token_secret=this.secret),n.providerId=this.providerId,this.nonce&&!this.pendingToken&&(n.nonce=this.nonce),e.postBody=pc(n)}return e}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class v2{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class kc extends v2{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Xs extends kc{constructor(){super("facebook.com")}static credential(e){return co._fromParams({providerId:Xs.PROVIDER_ID,signInMethod:Xs.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return Xs.credentialFromTaggedObject(e)}static credentialFromError(e){return Xs.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return Xs.credential(e.oauthAccessToken)}catch{return null}}}Xs.FACEBOOK_SIGN_IN_METHOD="facebook.com";Xs.PROVIDER_ID="facebook.com";/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class gs extends kc{constructor(){super("google.com"),this.addScope("profile")}static credential(e,n){return co._fromParams({providerId:gs.PROVIDER_ID,signInMethod:gs.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:n})}static credentialFromResult(e){return gs.credentialFromTaggedObject(e)}static credentialFromError(e){return gs.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:n,oauthAccessToken:r}=e;if(!n&&!r)return null;try{return gs.credential(n,r)}catch{return null}}}gs.GOOGLE_SIGN_IN_METHOD="google.com";gs.PROVIDER_ID="google.com";/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Js extends kc{constructor(){super("github.com")}static credential(e){return co._fromParams({providerId:Js.PROVIDER_ID,signInMethod:Js.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return Js.credentialFromTaggedObject(e)}static credentialFromError(e){return Js.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return Js.credential(e.oauthAccessToken)}catch{return null}}}Js.GITHUB_SIGN_IN_METHOD="github.com";Js.PROVIDER_ID="github.com";/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Zs extends kc{constructor(){super("twitter.com")}static credential(e,n){return co._fromParams({providerId:Zs.PROVIDER_ID,signInMethod:Zs.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:n})}static credentialFromResult(e){return Zs.credentialFromTaggedObject(e)}static credentialFromError(e){return Zs.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthAccessToken:n,oauthTokenSecret:r}=e;if(!n||!r)return null;try{return Zs.credential(n,r)}catch{return null}}}Zs.TWITTER_SIGN_IN_METHOD="twitter.com";Zs.PROVIDER_ID="twitter.com";/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class va{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,n,r,s=!1){const i=await Mr._fromIdTokenResponse(e,r,s),o=fw(r);return new va({user:i,providerId:o,_tokenResponse:r,operationType:n})}static async _forOperation(e,n,r){await e._updateTokensIfNecessary(r,!0);const s=fw(r);return new va({user:e,providerId:s,_tokenResponse:r,operationType:n})}}function fw(t){return t.providerId?t.providerId:"phoneNumber"in t?"phone":null}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Vd extends cs{constructor(e,n,r,s){super(n.code,n.message),this.operationType=r,this.user=s,Object.setPrototypeOf(this,Vd.prototype),this.customData={appName:e.name,tenantId:e.tenantId??void 0,_serverResponse:n.customData._serverResponse,operationType:r}}static _fromErrorAndOperation(e,n,r,s){return new Vd(e,n,r,s)}}function w2(t,e,n,r){return(e==="reauthenticate"?n._getReauthenticationResolver(t):n._getIdTokenResponse(t)).catch(i=>{throw i.code==="auth/multi-factor-auth-required"?Vd._fromErrorAndOperation(t,i,e,r):i})}async function a5(t,e,n=!1){const r=await nc(t,e._linkToIdToken(t.auth,await t.getIdToken()),n);return va._forOperation(t,"link",r)}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function l5(t,e,n=!1){const{auth:r}=t;if(Rr(r.app))return Promise.reject(Yi(r));const s="reauthenticate";try{const i=await nc(t,w2(r,s,e,t),n);Re(i.idToken,r,"internal-error");const o=A0(i.idToken);Re(o,r,"internal-error");const{sub:l}=o;return Re(t.uid===l,r,"user-mismatch"),va._forOperation(t,s,i)}catch(i){throw(i==null?void 0:i.code)==="auth/user-not-found"&&Rs(r,"user-mismatch"),i}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function c5(t,e,n=!1){if(Rr(t.app))return Promise.reject(Yi(t));const r="signIn",s=await w2(t,r,e),i=await va._fromIdTokenResponse(t,r,s);return n||await t._updateCurrentUser(i.user),i}function u5(t,e,n,r){return sn(t).onIdTokenChanged(e,n,r)}function d5(t,e,n){return sn(t).beforeAuthStateChanged(e,n)}const Fd="__sak";/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class b2{constructor(e,n){this.storageRetriever=e,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(Fd,"1"),this.storage.removeItem(Fd),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,n){return this.storage.setItem(e,JSON.stringify(n)),Promise.resolve()}_get(e){const n=this.storage.getItem(e);return Promise.resolve(n?JSON.parse(n):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const h5=1e3,f5=10;class _2 extends b2{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,n)=>this.onStorageEvent(e,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=m2(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(const n of Object.keys(this.listeners)){const r=this.storage.getItem(n),s=this.localCache[n];r!==s&&e(n,s,r)}}onStorageEvent(e,n=!1){if(!e.key){this.forAllChangedKeys((o,l,c)=>{this.notifyListeners(o,c)});return}const r=e.key;n?this.detachListener():this.stopPolling();const s=()=>{const o=this.storage.getItem(r);!n&&this.localCache[r]===o||this.notifyListeners(r,o)},i=this.storage.getItem(r);qR()&&i!==e.newValue&&e.newValue!==e.oldValue?setTimeout(s,f5):s()}notifyListeners(e,n){this.localCache[e]=n;const r=this.listeners[e];if(r)for(const s of Array.from(r))s(n&&JSON.parse(n))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,n,r)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:n,newValue:r}),!0)})},h5)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,n){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(e,n){await super._set(e,n),this.localCache[e]=JSON.stringify(n)}async _get(e){const n=await super._get(e);return this.localCache[e]=JSON.stringify(n),n}async _remove(e){await super._remove(e),delete this.localCache[e]}}_2.type="LOCAL";const p5=_2;/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class E2 extends b2{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,n){}_removeListener(e,n){}}E2.type="SESSION";const S2=E2;/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function m5(t){return Promise.all(t.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(n){return{fulfilled:!1,reason:n}}}))}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Rh{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){const n=this.receivers.find(s=>s.isListeningto(e));if(n)return n;const r=new Rh(e);return this.receivers.push(r),r}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const n=e,{eventId:r,eventType:s,data:i}=n.data,o=this.handlersMap[s];if(!(o!=null&&o.size))return;n.ports[0].postMessage({status:"ack",eventId:r,eventType:s});const l=Array.from(o).map(async u=>u(n.origin,i)),c=await m5(l);n.ports[0].postMessage({status:"done",eventId:r,eventType:s,response:c})}_subscribe(e,n){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(n)}_unsubscribe(e,n){this.handlersMap[e]&&n&&this.handlersMap[e].delete(n),(!n||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}Rh.receivers=[];/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function D0(t="",e=10){let n="";for(let r=0;r{const u=D0("",20);s.port1.start();const h=setTimeout(()=>{c(new Error("unsupported_event"))},r);o={messageChannel:s,onMessage(f){const m=f;if(m.data.eventId===u)switch(m.data.status){case"ack":clearTimeout(h),i=setTimeout(()=>{c(new Error("timeout"))},3e3);break;case"done":clearTimeout(i),l(m.data.response);break;default:clearTimeout(h),clearTimeout(i),c(new Error("invalid_response"));break}}},this.handlers.add(o),s.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:u,data:n},[s.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function ss(){return window}function y5(t){ss().location.href=t}/** + * @license + * Copyright 2020 Google LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function T2(){return typeof ss().WorkerGlobalScope<"u"&&typeof ss().importScripts=="function"}async function x5(){if(!(navigator!=null&&navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function v5(){var t;return((t=navigator==null?void 0:navigator.serviceWorker)==null?void 0:t.controller)||null}function w5(){return T2()?self:null}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const N2="firebaseLocalStorageDb",b5=1,zd="firebaseLocalStorage",k2="fbase_key";class Ic{constructor(e){this.request=e}toPromise(){return new Promise((e,n)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{n(this.request.error)})})}}function Dh(t,e){return t.transaction([zd],e?"readwrite":"readonly").objectStore(zd)}function _5(){const t=indexedDB.deleteDatabase(N2);return new Ic(t).toPromise()}function Sm(){const t=indexedDB.open(N2,b5);return new Promise((e,n)=>{t.addEventListener("error",()=>{n(t.error)}),t.addEventListener("upgradeneeded",()=>{const r=t.result;try{r.createObjectStore(zd,{keyPath:k2})}catch(s){n(s)}}),t.addEventListener("success",async()=>{const r=t.result;r.objectStoreNames.contains(zd)?e(r):(r.close(),await _5(),e(await Sm()))})})}async function pw(t,e,n){const r=Dh(t,!0).put({[k2]:e,value:n});return new Ic(r).toPromise()}async function E5(t,e){const n=Dh(t,!1).get(e),r=await new Ic(n).toPromise();return r===void 0?null:r.value}function mw(t,e){const n=Dh(t,!0).delete(e);return new Ic(n).toPromise()}const S5=800,T5=3;class I2{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.db?this.db:(this.db=await Sm(),this.db)}async _withRetries(e){let n=0;for(;;)try{const r=await this._openDb();return await e(r)}catch(r){if(n++>T5)throw r;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return T2()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Rh._getInstance(w5()),this.receiver._subscribe("keyChanged",async(e,n)=>({keyProcessed:(await this._poll()).includes(n.key)})),this.receiver._subscribe("ping",async(e,n)=>["keyChanged"])}async initializeSender(){var n,r;if(this.activeServiceWorker=await x5(),!this.activeServiceWorker)return;this.sender=new g5(this.activeServiceWorker);const e=await this.sender._send("ping",{},800);e&&(n=e[0])!=null&&n.fulfilled&&(r=e[0])!=null&&r.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||v5()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;const e=await Sm();return await pw(e,Fd,"1"),await mw(e,Fd),!0}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,n){return this._withPendingWrite(async()=>(await this._withRetries(r=>pw(r,e,n)),this.localCache[e]=n,this.notifyServiceWorker(e)))}async _get(e){const n=await this._withRetries(r=>E5(r,e));return this.localCache[e]=n,n}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(n=>mw(n,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){const e=await this._withRetries(s=>{const i=Dh(s,!1).getAll();return new Ic(i).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];const n=[],r=new Set;if(e.length!==0)for(const{fbase_key:s,value:i}of e)r.add(s),JSON.stringify(this.localCache[s])!==JSON.stringify(i)&&(this.notifyListeners(s,i),n.push(s));for(const s of Object.keys(this.localCache))this.localCache[s]&&!r.has(s)&&(this.notifyListeners(s,null),n.push(s));return n}notifyListeners(e,n){this.localCache[e]=n;const r=this.listeners[e];if(r)for(const s of Array.from(r))s(n)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),S5)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,n){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&this.stopPolling()}}I2.type="LOCAL";const N5=I2;new Nc(3e4,6e4);/** + * @license + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function k5(t,e){return e?ws(e):(Re(t._popupRedirectResolver,t,"argument-error"),t._popupRedirectResolver)}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class M0 extends x2{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return ta(e,this._buildIdpRequest())}_linkToIdToken(e,n){return ta(e,this._buildIdpRequest(n))}_getReauthenticationResolver(e){return ta(e,this._buildIdpRequest())}_buildIdpRequest(e){const n={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(n.idToken=e),n}}function I5(t){return c5(t.auth,new M0(t),t.bypassAuthState)}function C5(t){const{auth:e,user:n}=t;return Re(n,e,"internal-error"),l5(n,new M0(t),t.bypassAuthState)}async function A5(t){const{auth:e,user:n}=t;return Re(n,e,"internal-error"),a5(n,new M0(t),t.bypassAuthState)}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class C2{constructor(e,n,r,s,i=!1){this.auth=e,this.resolver=r,this.user=s,this.bypassAuthState=i,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(n)?n:[n]}execute(){return new Promise(async(e,n)=>{this.pendingPromise={resolve:e,reject:n};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(r){this.reject(r)}})}async onAuthEvent(e){const{urlResponse:n,sessionId:r,postBody:s,tenantId:i,error:o,type:l}=e;if(o){this.reject(o);return}const c={auth:this.auth,requestUri:n,sessionId:r,tenantId:i||void 0,postBody:s||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(l)(c))}catch(u){this.reject(u)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return I5;case"linkViaPopup":case"linkViaRedirect":return A5;case"reauthViaPopup":case"reauthViaRedirect":return C5;default:Rs(this.auth,"internal-error")}}resolve(e){Ds(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){Ds(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const j5=new Nc(2e3,1e4);class Bo extends C2{constructor(e,n,r,s,i){super(e,n,s,i),this.provider=r,this.authWindow=null,this.pollId=null,Bo.currentPopupAction&&Bo.currentPopupAction.cancel(),Bo.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return Re(e,this.auth,"internal-error"),e}async onExecution(){Ds(this.filter.length===1,"Popup operations only handle one event");const e=D0();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(n=>{this.reject(n)}),this.resolver._isIframeWebStorageSupported(this.auth,n=>{n||this.reject(rs(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return((e=this.authWindow)==null?void 0:e.associatedEvent)||null}cancel(){this.reject(rs(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,Bo.currentPopupAction=null}pollUserCancellation(){const e=()=>{var n,r;if((r=(n=this.authWindow)==null?void 0:n.window)!=null&&r.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(rs(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,j5.get())};e()}}Bo.currentPopupAction=null;/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const P5="pendingRedirect",Bu=new Map;class R5 extends C2{constructor(e,n,r=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,r),this.eventId=null}async execute(){let e=Bu.get(this.auth._key());if(!e){try{const r=await D5(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(r)}catch(n){e=()=>Promise.reject(n)}Bu.set(this.auth._key(),e)}return this.bypassAuthState||Bu.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if(e.type==="signInViaRedirect")return super.onAuthEvent(e);if(e.type==="unknown"){this.resolve(null);return}if(e.eventId){const n=await this.auth._redirectUserForId(e.eventId);if(n)return this.user=n,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}}async function D5(t,e){const n=O5(e),r=L5(t);if(!await r._isAvailable())return!1;const s=await r._get(n)==="true";return await r._remove(n),s}function M5(t,e){Bu.set(t._key(),e)}function L5(t){return ws(t._redirectPersistence)}function O5(t){return Uu(P5,t.config.apiKey,t.name)}async function V5(t,e,n=!1){if(Rr(t.app))return Promise.reject(Yi(t));const r=P0(t),s=k5(r,e),o=await new R5(r,s,n).execute();return o&&!n&&(delete o.user._redirectEventId,await r._persistUserIfCurrent(o.user),await r._setRedirectUser(null,e)),o}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const F5=10*60*1e3;class z5{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let n=!1;return this.consumers.forEach(r=>{this.isEventForConsumer(e,r)&&(n=!0,this.sendToConsumer(e,r),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!U5(e)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=e,n=!0)),n}sendToConsumer(e,n){var r;if(e.error&&!A2(e)){const s=((r=e.error.code)==null?void 0:r.split("auth/")[1])||"internal-error";n.onError(rs(this.auth,s))}else n.onAuthEvent(e)}isEventForConsumer(e,n){const r=n.eventId===null||!!e.eventId&&e.eventId===n.eventId;return n.filter.includes(e.type)&&r}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=F5&&this.cachedEventUids.clear(),this.cachedEventUids.has(gw(e))}saveEventToCache(e){this.cachedEventUids.add(gw(e)),this.lastProcessedEventTime=Date.now()}}function gw(t){return[t.type,t.eventId,t.sessionId,t.tenantId].filter(e=>e).join("-")}function A2({type:t,error:e}){return t==="unknown"&&(e==null?void 0:e.code)==="auth/no-auth-event"}function U5(t){switch(t.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return A2(t);default:return!1}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function B5(t,e={}){return Aa(t,"GET","/v1/projects",e)}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const $5=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,H5=/^https?/;async function q5(t){if(t.config.emulator)return;const{authorizedDomains:e}=await B5(t);for(const n of e)try{if(G5(n))return}catch{}Rs(t,"unauthorized-domain")}function G5(t){const e=_m(),{protocol:n,hostname:r}=new URL(e);if(t.startsWith("chrome-extension://")){const o=new URL(t);return o.hostname===""&&r===""?n==="chrome-extension:"&&t.replace("chrome-extension://","")===e.replace("chrome-extension://",""):n==="chrome-extension:"&&o.hostname===r}if(!H5.test(n))return!1;if($5.test(t))return r===t;const s=t.replace(/\./g,"\\.");return new RegExp("^(.+\\."+s+"|"+s+")$","i").test(r)}/** + * @license + * Copyright 2020 Google LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const W5=new Nc(3e4,6e4);function yw(){const t=ss().___jsl;if(t!=null&&t.H){for(const e of Object.keys(t.H))if(t.H[e].r=t.H[e].r||[],t.H[e].L=t.H[e].L||[],t.H[e].r=[...t.H[e].L],t.CP)for(let n=0;n{var s,i,o;function r(){yw(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{yw(),n(rs(t,"network-request-failed"))},timeout:W5.get()})}if((i=(s=ss().gapi)==null?void 0:s.iframes)!=null&&i.Iframe)e(gapi.iframes.getContext());else if((o=ss().gapi)!=null&&o.load)r();else{const l=e5("iframefcb");return ss()[l]=()=>{gapi.load?r():n(rs(t,"network-request-failed"))},JR(`${ZR()}?onload=${l}`).catch(c=>n(c))}}).catch(e=>{throw $u=null,e})}let $u=null;function Q5(t){return $u=$u||K5(t),$u}/** + * @license + * Copyright 2020 Google LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Y5=new Nc(5e3,15e3),X5="__/auth/iframe",J5="emulator/auth/iframe",Z5={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},eD=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function tD(t){const e=t.config;Re(e.authDomain,t,"auth-domain-config-required");const n=e.emulator?I0(e,J5):`https://${t.config.authDomain}/${X5}`,r={apiKey:e.apiKey,appName:t.name,v:po},s=eD.get(t.config.apiHost);s&&(r.eid=s);const i=t._getFrameworks();return i.length&&(r.fw=i.join(",")),`${n}?${pc(r).slice(1)}`}async function nD(t){const e=await Q5(t),n=ss().gapi;return Re(n,t,"internal-error"),e.open({where:document.body,url:tD(t),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:Z5,dontclear:!0},r=>new Promise(async(s,i)=>{await r.restyle({setHideOnLeave:!1});const o=rs(t,"network-request-failed"),l=ss().setTimeout(()=>{i(o)},Y5.get());function c(){ss().clearTimeout(l),s(r)}r.ping(c).then(c,()=>{i(o)})}))}/** + * @license + * Copyright 2020 Google LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const rD={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},sD=500,iD=600,oD="_blank",aD="http://localhost";class xw{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function lD(t,e,n,r=sD,s=iD){const i=Math.max((window.screen.availHeight-s)/2,0).toString(),o=Math.max((window.screen.availWidth-r)/2,0).toString();let l="";const c={...rD,width:r.toString(),height:s.toString(),top:i,left:o},u=An().toLowerCase();n&&(l=u2(u)?oD:n),l2(u)&&(e=e||aD,c.scrollbars="yes");const h=Object.entries(c).reduce((m,[p,y])=>`${m}${p}=${y},`,"");if(HR(u)&&l!=="_self")return cD(e||"",l),new xw(null);const f=window.open(e||"",l,h);Re(f,t,"popup-blocked");try{f.focus()}catch{}return new xw(f)}function cD(t,e){const n=document.createElement("a");n.href=t,n.target=e;const r=document.createEvent("MouseEvent");r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(r)}/** + * @license + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const uD="__/auth/handler",dD="emulator/auth/handler",hD=encodeURIComponent("fac");async function vw(t,e,n,r,s,i){Re(t.config.authDomain,t,"auth-domain-config-required"),Re(t.config.apiKey,t,"invalid-api-key");const o={apiKey:t.config.apiKey,appName:t.name,authType:n,redirectUrl:r,v:po,eventId:s};if(e instanceof v2){e.setDefaultLanguage(t.languageCode),o.providerId=e.providerId||"",yC(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(const[h,f]of Object.entries({}))o[h]=f}if(e instanceof kc){const h=e.getScopes().filter(f=>f!=="");h.length>0&&(o.scopes=h.join(","))}t.tenantId&&(o.tid=t.tenantId);const l=o;for(const h of Object.keys(l))l[h]===void 0&&delete l[h];const c=await t._getAppCheckToken(),u=c?`#${hD}=${encodeURIComponent(c)}`:"";return`${fD(t)}?${pc(l).slice(1)}${u}`}function fD({config:t}){return t.emulator?I0(t,dD):`https://${t.authDomain}/${uD}`}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Df="webStorageSupport";class pD{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=S2,this._completeRedirectFn=V5,this._overrideRedirectResult=M5}async _openPopup(e,n,r,s){var o;Ds((o=this.eventManagers[e._key()])==null?void 0:o.manager,"_initialize() not called before _openPopup()");const i=await vw(e,n,r,_m(),s);return lD(e,i,D0())}async _openRedirect(e,n,r,s){await this._originValidation(e);const i=await vw(e,n,r,_m(),s);return y5(i),new Promise(()=>{})}_initialize(e){const n=e._key();if(this.eventManagers[n]){const{manager:s,promise:i}=this.eventManagers[n];return s?Promise.resolve(s):(Ds(i,"If manager is not set, promise should be"),i)}const r=this.initAndGetManager(e);return this.eventManagers[n]={promise:r},r.catch(()=>{delete this.eventManagers[n]}),r}async initAndGetManager(e){const n=await nD(e),r=new z5(e);return n.register("authEvent",s=>(Re(s==null?void 0:s.authEvent,e,"invalid-auth-event"),{status:r.onEvent(s.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:r},this.iframes[e._key()]=n,r}_isIframeWebStorageSupported(e,n){this.iframes[e._key()].send(Df,{type:Df},s=>{var o;const i=(o=s==null?void 0:s[0])==null?void 0:o[Df];i!==void 0&&n(!!i),Rs(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const n=e._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=q5(e)),this.originValidationPromises[n]}get _shouldInitProactively(){return m2()||c2()||j0()}}const mD=pD;var ww="@firebase/auth",bw="1.12.2";/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class gD{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),((e=this.auth.currentUser)==null?void 0:e.uid)||null}async getToken(e){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;const n=this.auth.onIdTokenChanged(r=>{e((r==null?void 0:r.stsTokenManager.accessToken)||null)});this.internalListeners.set(e,n),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();const n=this.internalListeners.get(e);n&&(this.internalListeners.delete(e),n(),this.updateProactiveRefresh())}assertAuthConfigured(){Re(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function yD(t){switch(t){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function xD(t){so(new vi("auth",(e,{options:n})=>{const r=e.getProvider("app").getImmediate(),s=e.getProvider("heartbeat"),i=e.getProvider("app-check-internal"),{apiKey:o,authDomain:l}=r.options;Re(o&&!o.includes(":"),"invalid-api-key",{appName:r.name});const c={apiKey:o,authDomain:l,clientPlatform:t,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:g2(t)},u=new YR(r,s,i,c);return n5(u,n),u},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,n,r)=>{e.getProvider("auth-internal").initialize()})),so(new vi("auth-internal",e=>{const n=P0(e.getProvider("auth").getImmediate());return(r=>new gD(r))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),Zr(ww,bw,yD(t)),Zr(ww,bw,"esm2020")}/** + * @license + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const vD=5*60,wD=uE("authIdTokenMaxAge")||vD;let _w=null;const bD=t=>async e=>{const n=e&&await e.getIdTokenResult(),r=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(r&&r>wD)return;const s=n==null?void 0:n.token;_w!==s&&(_w=s,await fetch(t,{method:s?"POST":"DELETE",headers:s?{Authorization:`Bearer ${s}`}:{}}))};function _D(t=Bg()){const e=ph(t,"auth");if(e.isInitialized())return e.getImmediate();const n=t5(t,{popupRedirectResolver:mD,persistence:[N5,p5,S2]}),r=uE("authTokenSyncURL");if(r&&typeof isSecureContext=="boolean"&&isSecureContext){const i=new URL(r,location.origin);if(location.origin===i.origin){const o=bD(i.toString());d5(n,o,()=>o(n.currentUser)),u5(n,l=>o(l))}}const s=aE("auth");return s&&r5(n,`http://${s}`),n}function ED(){var t;return((t=document.getElementsByTagName("head"))==null?void 0:t[0])??document}XR({loadJS(t){return new Promise((e,n)=>{const r=document.createElement("script");r.setAttribute("src",t),r.onload=e,r.onerror=s=>{const i=rs("internal-error");i.customData=s,n(i)},r.type="text/javascript",r.charset="UTF-8",ED().appendChild(r)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="});xD("Browser");const SD={apiKey:"AIzaSyAH3jvbe0_QLzIuuv5kTMK8246HNvohvfE",authDomain:"twistedbrody-9d163.firebaseapp.com",projectId:"twistedbrody-9d163",storageBucket:"twistedbrody-9d163.firebasestorage.app",messagingSenderId:"733213514129",appId:"1:733213514129:web:e9694684f5c3994ed06230",measurementId:"G-N8TQ7MY42W"},L0=pE(SD),je=L4(L0);_R(L0);_D(L0);new gs;function rc(t){if(t!=null){if(Array.isArray(t)){const e=t.map(n=>rc(n)).filter(n=>n!=null&&n!=="");return e.length>0?e:void 0}if(typeof t=="object"&&!(t instanceof Ke)){const e={};for(const n in t)if(t.hasOwnProperty(n)){const r=rc(t[n]);r!=null&&(e[n]=r)}return Object.keys(e).length>0?e:void 0}return t}}const Gt={ALL_MANGAS:"mangalib_all_v2",MANGA_PREFIX:"mangalib_detail_v2_"};function Ri(t,e){try{localStorage.setItem(t,JSON.stringify(e))}catch(n){console.warn(`Error saving ${t} to localStorage`,n)}}async function O0(t){const e=Ke.now(),n=t.map(async r=>{const s=Nt(je,"mangas",r.id);await tr(s,{title:r.title,updated_at:e});const i=bn.get(r.id);i&&(i.title=r.title,i.updated_at=e.toDate().toISOString(),bn.set(r.id,i),Ri(`${Gt.MANGA_PREFIX}${r.id}`,i))});await Promise.all(n)}function fr(t){try{localStorage.removeItem(t)}catch(e){console.warn(`Error removing ${t} from localStorage`,e)}}async function Mh(){const t=Vn(Mt(je,"mangas"),W4("created_at","desc")),e=await hn(t),r=(await hn(Mt(je,"categories"))).docs.reduce((o,l)=>(o[l.id]={id:l.id,...l.data()},o),{}),s=await Promise.all(e.docs.map(async o=>{var l,c;try{const u=o.data();let h=new Date().toISOString();(l=u.created_at)!=null&&l.toDate?h=u.created_at.toDate().toISOString():u.created_at&&(h=new Date(u.created_at).toISOString());let f=h;(c=u.updated_at)!=null&&c.toDate&&(f=u.updated_at.toDate().toISOString());const m=Vn(Mt(je,"chapters"),mr("manga_id","==",o.id)),y=(await hn(m)).docs.map(v=>{var M,T;const w=v.data(),E=(M=w.created_at)!=null&&M.toDate?w.created_at.toDate().toISOString():new Date().toISOString(),D=(T=w.updated_at)!=null&&T.toDate?w.updated_at.toDate().toISOString():new Date().toISOString();return{id:v.id,manga_id:w.manga_id,number:w.number,title:w.title,pages:w.pages||[],page_formats:w.page_formats||[],original_pages:w.original_pages||[],created_at:E,updated_at:D}}).sort((v,w)=>v.number-w.number),C=(u.categories||[]).map(v=>r[v]).filter(v=>v!==void 0);return{id:o.id,...u,created_at:h,updated_at:f,categories:C,chapters:y}}catch(u){return console.error(`[DATA ERROR] Skipping corrupt manga ${o.id}:`,u),null}})),i=s.filter(o=>o!==null);return console.log(`[DATA] Loaded ${i.length} mangas (Skipped ${s.length-i.length} corrupt)`),i}const bn=new Map;async function Ni(t){var h,f;const e=Nt(je,"mangas",t),n=await Ps(e);if(!n.exists())return null;const r=n.data(),s=Vn(Mt(je,"chapters"),mr("manga_id","==",t)),o=(await hn(s)).docs.map(m=>{const p=m.data();return{id:m.id,manga_id:p.manga_id,number:p.number,title:p.title,pages:p.pages||[],page_formats:p.page_formats||[],original_pages:p.original_pages||[],created_at:p.created_at.toDate().toISOString(),updated_at:p.updated_at.toDate().toISOString()}}).sort((m,p)=>m.number-p.number),l=r.categories||[],c=[];for(const m of l){const p=Nt(je,"categories",m),y=await Ps(p);y.exists()&&c.push({id:y.id,...y.data(),created_at:((f=(h=y.data().created_at)==null?void 0:h.toDate)==null?void 0:f.call(h).toISOString())||new Date().toISOString()})}const u={id:n.id,...r,created_at:r.created_at.toDate().toISOString(),categories:c,chapters:o,updated_at:r.updated_at?r.updated_at.toDate().toISOString():r.created_at.toDate().toISOString()};return bn.set(t,u),Ri(`${Gt.MANGA_PREFIX}${t}`,u),u}function TD(t,e){const n=Nt(je,"mangas",t);return N0(n,async r=>{if(!r.exists()){e(null);return}const s=r.data();let i=bn.get(t),o=(i==null?void 0:i.chapters)||[],l=(i==null?void 0:i.categories)||[];if(!i){const u=Vn(Mt(je,"chapters"),mr("manga_id","==",t));o=(await hn(u)).docs.map(m=>({id:m.id,...m.data(),created_at:m.data().created_at.toDate().toISOString(),updated_at:m.data().updated_at.toDate().toISOString()})).sort((m,p)=>m.number-p.number);const f=s.categories||[];l=[];for(const m of f){const p=await Ps(Nt(je,"categories",m));p.exists()&&l.push({id:p.id,...p.data()})}}const c={id:r.id,...s,chapters:o,categories:l,created_at:s.created_at.toDate().toISOString(),updated_at:s.updated_at?s.updated_at.toDate().toISOString():s.created_at.toDate().toISOString()};bn.set(t,c),Ri(`${Gt.MANGA_PREFIX}${t}`,c),e(c)})}async function Ew(t){const e=Ke.now(),n={title:t.title,author:t.author,description:t.description||"",status:t.status||"En curso",categories:t.categoryIds||[],views:0,rating:0,created_at:e,updated_at:e,...t.is_decensored!==void 0&&{is_decensored:t.is_decensored},...t.is_bn!==void 0&&{is_bn:t.is_bn},...t.is_color!==void 0&&{is_color:t.is_color},section:t.section||"flow"};t.thumbnail_url&&(n.thumbnail_url=t.thumbnail_url),t.cover_url&&(n.cover_url=t.cover_url);const r=await Sc(Mt(je,"mangas"),n),s=new Date().toISOString(),i={id:r.id,title:t.title,author:t.author,description:t.description||"",status:t.status||"En curso",categories:t.categoryIds||[],chapters:[],views:0,rating:0,created_at:s,updated_at:s,is_decensored:!!t.is_decensored,is_bn:!!t.is_bn,is_color:!!t.is_color,section:t.section||"flow"};return t.thumbnail_url&&(i.thumbnail_url=t.thumbnail_url),t.cover_url&&(i.cover_url=t.cover_url),bn.set(i.id,i),Ri(`${Gt.MANGA_PREFIX}${i.id}`,i),fr(Gt.ALL_MANGAS),i}async function j2(){return(await hn(Mt(je,"categories"))).docs.map(e=>({id:e.id,...e.data()}))}async function P2(t,e="genre"){const n=await Sc(Mt(je,"categories"),{name:t,type:e}),r=await Ps(n);return{id:r.id,...r.data()}}async function R2(t){const e=Nt(je,"categories",t);await tc(e);const n=Vn(Mt(je,"mangas"),mr("categories","array-contains",t)),s=(await hn(n)).docs.map(i=>{const c=(i.data().categories||[]).filter(u=>u!==t);return tr(Nt(je,"mangas",i.id),{categories:c})});await Promise.all(s)}async function na(t){const e=Ke.now(),n=await Sc(Mt(je,"chapters"),{manga_id:t.manga_id,number:t.number,title:t.title,pages:t.pages,page_formats:t.page_formats||[],original_pages:t.original_pages||[],created_at:e,updated_at:e}),r=await Ps(n),s=r.data();return{id:r.id,manga_id:s.manga_id,number:s.number,title:s.title,pages:s.pages||[],page_formats:s.page_formats||[],original_pages:s.original_pages||[],created_at:s.created_at.toDate().toISOString(),updated_at:s.updated_at.toDate().toISOString()}}async function ND(){const e=(await Mh()).map(n=>{const r=Nt(je,"mangas",n.id);return tr(r,{views:0})});await Promise.all(e)}async function kD(t){const e=Nt(je,"mangas",t);await tr(e,{views:q4(1)})}async function Lh(t,e){var y,_;const n=Nt(je,"mangas",t),r=Ke.now(),s={title:e.title,author:e.author,categories:e.categoryIds||[],updated_at:r,is_decensored:!!e.is_decensored,is_bn:!!e.is_bn,is_color:!!e.is_color};e.section&&(s.section=e.section),e.status&&(s.status=e.status),e.description!==void 0&&e.description!==null&&(s.description=e.description),e.thumbnail_url&&(s.thumbnail_url=e.thumbnail_url),e.cover_url&&(s.cover_url=e.cover_url);const i=rc(s);await tr(n,i);const o=await Ps(n);if(!o.exists())throw new Error("Manga no encontrado");const l=o.data(),c=Vn(Mt(je,"chapters"),mr("manga_id","==",t)),h=(await hn(c)).docs.map(C=>{const v=C.data();return{id:C.id,manga_id:v.manga_id,number:v.number,title:v.title,pages:v.pages||[],page_formats:v.page_formats||[],original_pages:v.original_pages||[],created_at:v.created_at.toDate().toISOString(),updated_at:v.updated_at.toDate().toISOString()}}).sort((C,v)=>C.number-v.number),f=l.categories||[],m=[];for(const C of f){const v=Nt(je,"categories",C),w=await Ps(v);w.exists()&&m.push({id:w.id,...w.data(),created_at:((_=(y=w.data().created_at)==null?void 0:y.toDate)==null?void 0:_.call(y).toISOString())||new Date().toISOString()})}const p={id:o.id,...l,created_at:l.created_at.toDate().toISOString(),categories:m,chapters:h,updated_at:l.updated_at.toDate().toISOString()};return bn.set(p.id,p),Ri(`${Gt.MANGA_PREFIX}${p.id}`,p),fr(Gt.ALL_MANGAS),p}async function V0(t,e,n){const r=Nt(je,"mangas",t);await tr(r,{is_deleted:e,updated_at:Ke.now()});const s=bn.get(t);s&&(s.is_deleted=e,s.updated_at=n,bn.set(t,s),Ri(`${Gt.MANGA_PREFIX}${t}`,s));const i=Vn(Mt(je,"mangas"),mr("folder_id","==",t)),o=await hn(i);for(const l of o.docs)await V0(l.id,e,n)}async function Ud(t){const e=new Date().toISOString();await V0(t,!0,e),fr(Gt.ALL_MANGAS)}async function ID(t){const e=new Date().toISOString();await V0(t,!1,e),fr(Gt.ALL_MANGAS)}async function D2(t){const e=Nt(je,"mangas",t),n=Vn(Mt(je,"mangas"),mr("folder_id","==",t)),r=await hn(n);for(const o of r.docs)await D2(o.id);const s=Vn(Mt(je,"chapters"),mr("manga_id","==",t)),i=await hn(s);for(const o of i.docs)await tc(o.ref);await tc(e),bn.delete(t),fr(`${Gt.MANGA_PREFIX}${t}`)}async function CD(t){await D2(t),fr(Gt.ALL_MANGAS)}async function AD(t,e){const n=Nt(je,"mangas",t),r=await Ps(n);if(!r.exists())throw new Error("Manga no encontrado");const i={external_links:[...r.data().external_links||[],e]},o=rc(i);await tr(n,o)}async function jD(t,e){const n=Nt(je,"mangas",t),r=await Ps(n);if(!r.exists())throw new Error("Manga no encontrado");const i={external_links:(r.data().external_links||[]).filter((l,c)=>c!==e)},o=rc(i);await tr(n,o)}function Sw(t){const e=t.match(/^(.*?)(?:\s*(?:-|_|#|vol\.?|volume|part|cap\.?|capitulo)?\s*(\d+(?:\.\d+)?))$/i);return e?{baseTitle:e[1].trim().toLowerCase(),number:parseFloat(e[2])}:{baseTitle:t.trim().toLowerCase(),number:null}}async function PD(t,e,n,r){const s=await Mh(),i=s.find(p=>p.id===t),o=(i==null?void 0:i.section)||"flow",l=Sw(n),c=[],u=[];s.forEach(p=>{if(p.id===t||p.is_folder||(p.section||"flow")!==o)return;const y=Sw(p.title);y.baseTitle===l.baseTitle&&y.baseTitle.length>0&&y.number!==null?c.push({manga:p,num:y.number}):u.push(p)}),c.sort((p,y)=>p.num-y.num);let h=[];if(l.number!==null){const p=c.filter(_=>_.num>l.number).map(_=>_.manga),y=c.filter(_=>_.num_.manga);h=[...p,...y]}else h=c.map(p=>p.manga);const f=u.map(p=>{var T,S;let y=0;const _=((T=p.categories)==null?void 0:T.map(x=>x.id))||[],C=e.filter(x=>_.includes(x));y+=C.length*10;const v=n.toLowerCase().split(/\s+/).filter(x=>x.length>2),w=p.title.toLowerCase().split(/\s+/).filter(x=>x.length>2),E=v.filter(x=>w.includes(x));y+=E.length*5;const D=((S=p.author)==null?void 0:S.toLowerCase().split(/\s+/).filter(x=>x.length>2))||[],M=v.filter(x=>D.includes(x));return y+=M.length*3,{manga:p,score:y}}).filter(p=>p.score>0).sort((p,y)=>{if(y.score!==p.score)return y.score-p.score;const _=p.manga.title.toLowerCase(),C=y.manga.title.toLowerCase();return _.localeCompare(C)}).map(p=>p.manga),m=[...h,...f];return r?m.slice(0,r):m}async function RD(t){const e=Vn(Mt(je,"mangas"),mr("author","==",t)),r=(await hn(e)).docs.map(s=>tr(Nt(je,"mangas",s.id),{author:""}));await Promise.all(r)}async function DD(){const t=Vn(Mt(je,"mangas")),e=await hn(t),n=new Set;return e.forEach(r=>{const s=r.data();s&&s.author&&typeof s.author=="string"&&s.author.trim()!==""&&n.add(s.author.trim())}),Array.from(n).sort()}async function MD(t,e,n,r="flow"){const s=Ke.now(),i={title:t,author:"Carpeta",description:"",status:"Carpeta",categories:[],views:0,rating:0,created_at:s,updated_at:s,is_folder:!0,section:r};n&&(i.folder_id=n);const l=(await Sc(Mt(je,"mangas"),i)).id;e.length>0&&await M2(e,l);const c=new Date().toISOString(),u={id:l,...i,created_at:c,updated_at:c,chapters:[],categories:[]};return bn.set(l,u),fr(Gt.ALL_MANGAS),u}async function M2(t,e){const n=Ke.now(),r=t.map(async s=>{const i=Nt(je,"mangas",s);await tr(i,{folder_id:e,updated_at:n});const o=bn.get(s);o&&(e?o.folder_id=e:delete o.folder_id,o.updated_at=n.toDate().toISOString(),bn.set(s,o),Ri(`${Gt.MANGA_PREFIX}${s}`,o))});await Promise.all(r),fr(Gt.ALL_MANGAS)}async function LD(t,e){const n=Ke.now(),r=[];for(let i=0;i{const f=u.data().folder_id,m=f&&s.has(f),p={section:e,updated_at:n};m||(p.folder_id=H4()),o.update(u.ref,p);const y=bn.get(u.id);y&&(y.section=e,m||delete y.folder_id,y.updated_at=n.toDate().toISOString(),bn.set(u.id,y),Ri(`${Gt.MANGA_PREFIX}${u.id}`,y))}),await o.commit()}fr(Gt.ALL_MANGAS)}async function Tw(t){if(t.length<2)return;const e=[];for(const p of t){const y=await Ni(p);y&&e.push(y)}if(e.length<2)return;const n=e.map(p=>p.title).join(" - "),r=e[0].section||"flow",s=e[0].folder_id,i=new Set;e.forEach(p=>{var y;(y=p.categories)==null||y.forEach(_=>i.add(_.id))});const o=Ke.now(),l={title:n,author:e[0].author,description:e.map(p=>p.description).filter(Boolean).join(` + +`),status:"En curso",categories:Array.from(i),views:0,rating:0,created_at:o,updated_at:o,section:r,is_decensored:e.some(p=>p.is_decensored),is_bn:e.some(p=>p.is_bn),is_color:e.some(p=>p.is_color)};e[0].thumbnail_url&&(l.thumbnail_url=e[0].thumbnail_url),e[0].cover_url&&(l.cover_url=e[0].cover_url),s&&(l.folder_id=s);const u=(await Sc(Mt(je,"mangas"),l)).id;let h=[],f=[],m=[];e.forEach(p=>{var y;(y=p.chapters)==null||y.forEach(_=>{_.pages&&(h=h.concat(_.pages)),_.original_pages&&(f=f.concat(_.original_pages)),_.page_formats&&(m=m.concat(_.page_formats))})}),m.length>0&&m.length!==h.length&&(m=h.map((p,y)=>m[y]||"webp")),h.length>0&&await na({manga_id:u,number:1,title:"Capítulo 1",pages:h,page_formats:m,original_pages:f});for(const p of t)await Ud(p);fr(Gt.ALL_MANGAS)}async function OD(t,e,n,r){const s=Vn(Mt(je,"chapters"),mr("manga_id","==",t)),i=await hn(s);for(const u of i.docs)await tc(u.ref);n.length>0&&await na({manga_id:t,number:1,title:"Capítulo 1",pages:n});const o=Vn(Mt(je,"chapters"),mr("manga_id","==",e)),l=await hn(o);for(const u of l.docs)await tc(u.ref);r.length>0&&await na({manga_id:e,number:1,title:"Capítulo 1",pages:r});const c=Ke.now();await tr(Nt(je,"mangas",t),{updated_at:c}),await tr(Nt(je,"mangas",e),{updated_at:c}),fr(`${Gt.MANGA_PREFIX}${t}`),fr(`${Gt.MANGA_PREFIX}${e}`),fr(Gt.ALL_MANGAS),bn.delete(t),bn.delete(e)}function VD(t){if(typeof document>"u")return;let e=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",e.appendChild(n),n.styleSheet?n.styleSheet.cssText=t:n.appendChild(document.createTextNode(t))}const FD=t=>{switch(t){case"success":return BD;case"info":return HD;case"warning":return $D;case"error":return qD;default:return null}},zD=Array(12).fill(0),UD=({visible:t,className:e})=>se.createElement("div",{className:["sonner-loading-wrapper",e].filter(Boolean).join(" "),"data-visible":t},se.createElement("div",{className:"sonner-spinner"},zD.map((n,r)=>se.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),BD=se.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},se.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),$D=se.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},se.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),HD=se.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},se.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),qD=se.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},se.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),GD=se.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},se.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),se.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),WD=()=>{const[t,e]=se.useState(document.hidden);return se.useEffect(()=>{const n=()=>{e(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),t};let Tm=1,KD=class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{const n=this.subscribers.indexOf(e);this.subscribers.splice(n,1)}),this.publish=e=>{this.subscribers.forEach(n=>n(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var n;const{message:r,...s}=e,i=typeof(e==null?void 0:e.id)=="number"||((n=e.id)==null?void 0:n.length)>0?e.id:Tm++,o=this.toasts.find(c=>c.id===i),l=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(i)&&this.dismissedToasts.delete(i),o?this.toasts=this.toasts.map(c=>c.id===i?(this.publish({...c,...e,id:i,title:r}),{...c,...e,id:i,dismissible:l,title:r}):c):this.addToast({title:r,...s,dismissible:l,id:i}),i},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(n=>n({id:e,dismiss:!0})))):this.toasts.forEach(n=>{this.subscribers.forEach(r=>r({id:n.id,dismiss:!0}))}),e),this.message=(e,n)=>this.create({...n,message:e}),this.error=(e,n)=>this.create({...n,message:e,type:"error"}),this.success=(e,n)=>this.create({...n,type:"success",message:e}),this.info=(e,n)=>this.create({...n,type:"info",message:e}),this.warning=(e,n)=>this.create({...n,type:"warning",message:e}),this.loading=(e,n)=>this.create({...n,type:"loading",message:e}),this.promise=(e,n)=>{if(!n)return;let r;n.loading!==void 0&&(r=this.create({...n,promise:e,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));const s=Promise.resolve(e instanceof Function?e():e);let i=r!==void 0,o;const l=s.then(async u=>{if(o=["resolve",u],se.isValidElement(u))i=!1,this.create({id:r,type:"default",message:u});else if(YD(u)&&!u.ok){i=!1;const f=typeof n.error=="function"?await n.error(`HTTP error! status: ${u.status}`):n.error,m=typeof n.description=="function"?await n.description(`HTTP error! status: ${u.status}`):n.description,y=typeof f=="object"&&!se.isValidElement(f)?f:{message:f};this.create({id:r,type:"error",description:m,...y})}else if(u instanceof Error){i=!1;const f=typeof n.error=="function"?await n.error(u):n.error,m=typeof n.description=="function"?await n.description(u):n.description,y=typeof f=="object"&&!se.isValidElement(f)?f:{message:f};this.create({id:r,type:"error",description:m,...y})}else if(n.success!==void 0){i=!1;const f=typeof n.success=="function"?await n.success(u):n.success,m=typeof n.description=="function"?await n.description(u):n.description,y=typeof f=="object"&&!se.isValidElement(f)?f:{message:f};this.create({id:r,type:"success",description:m,...y})}}).catch(async u=>{if(o=["reject",u],n.error!==void 0){i=!1;const h=typeof n.error=="function"?await n.error(u):n.error,f=typeof n.description=="function"?await n.description(u):n.description,p=typeof h=="object"&&!se.isValidElement(h)?h:{message:h};this.create({id:r,type:"error",description:f,...p})}}).finally(()=>{i&&(this.dismiss(r),r=void 0),n.finally==null||n.finally.call(n)}),c=()=>new Promise((u,h)=>l.then(()=>o[0]==="reject"?h(o[1]):u(o[1])).catch(h));return typeof r!="string"&&typeof r!="number"?{unwrap:c}:Object.assign(r,{unwrap:c})},this.custom=(e,n)=>{const r=(n==null?void 0:n.id)||Tm++;return this.create({jsx:e(r),id:r,...n}),r},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}};const Gn=new KD,QD=(t,e)=>{const n=(e==null?void 0:e.id)||Tm++;return Gn.addToast({title:t,...e,id:n}),n},YD=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",XD=QD,JD=()=>Gn.toasts,ZD=()=>Gn.getActiveToasts(),we=Object.assign(XD,{success:Gn.success,info:Gn.info,warning:Gn.warning,error:Gn.error,custom:Gn.custom,message:Gn.message,promise:Gn.promise,dismiss:Gn.dismiss,loading:Gn.loading},{getHistory:JD,getToasts:ZD});VD("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function yu(t){return t.label!==void 0}const eM=3,tM="24px",nM="16px",Nw=4e3,rM=356,sM=14,iM=45,oM=200;function Hr(...t){return t.filter(Boolean).join(" ")}function aM(t){const[e,n]=t.split("-"),r=[];return e&&r.push(e),n&&r.push(n),r}const lM=t=>{var e,n,r,s,i,o,l,c,u;const{invert:h,toast:f,unstyled:m,interacting:p,setHeights:y,visibleToasts:_,heights:C,index:v,toasts:w,expanded:E,removeToast:D,defaultRichColors:M,closeButton:T,style:S,cancelButtonStyle:x,actionButtonStyle:N,className:A="",descriptionClassName:I="",duration:P,position:k,gap:B,expandByDefault:z,classNames:W,icons:ee,closeButtonAriaLabel:F="Close toast"}=t,[K,R]=se.useState(null),[ne,pe]=se.useState(null),[O,Q]=se.useState(!1),[oe,ce]=se.useState(!1),[Ie,te]=se.useState(!1),[it,pt]=se.useState(!1),[Vt,st]=se.useState(!1),[yt,jt]=se.useState(0),[_n,xt]=se.useState(0),tt=se.useRef(f.duration||P||Nw),Bn=se.useRef(null),Ue=se.useRef(null),vt=v===0,Pn=v+1<=_,Pt=f.type,on=f.dismissible!==!1,fn=f.className||"",wt=f.descriptionClassName||"",G=se.useMemo(()=>C.findIndex(be=>be.toastId===f.id)||0,[C,f.id]),ie=se.useMemo(()=>{var be;return(be=f.closeButton)!=null?be:T},[f.closeButton,T]),_e=se.useMemo(()=>f.duration||P||Nw,[f.duration,P]),Se=se.useRef(0),$=se.useRef(0),X=se.useRef(0),re=se.useRef(null),[de,Le]=k.split("-"),H=se.useMemo(()=>C.reduce((be,Ze,ot)=>ot>=G?be:be+Ze.height,0),[C,G]),J=WD(),me=f.invert||h,ye=Pt==="loading";$.current=se.useMemo(()=>G*B+H,[G,H]),se.useEffect(()=>{tt.current=_e},[_e]),se.useEffect(()=>{Q(!0)},[]),se.useEffect(()=>{const be=Ue.current;if(be){const Ze=be.getBoundingClientRect().height;return xt(Ze),y(ot=>[{toastId:f.id,height:Ze,position:f.position},...ot]),()=>y(ot=>ot.filter($e=>$e.toastId!==f.id))}},[y,f.id]),se.useLayoutEffect(()=>{if(!O)return;const be=Ue.current,Ze=be.style.height;be.style.height="auto";const ot=be.getBoundingClientRect().height;be.style.height=Ze,xt(ot),y($e=>$e.find(ft=>ft.toastId===f.id)?$e.map(ft=>ft.toastId===f.id?{...ft,height:ot}:ft):[{toastId:f.id,height:ot,position:f.position},...$e])},[O,f.title,f.description,y,f.id,f.jsx,f.action,f.cancel]);const Ee=se.useCallback(()=>{ce(!0),jt($.current),y(be=>be.filter(Ze=>Ze.toastId!==f.id)),setTimeout(()=>{D(f)},oM)},[f,D,y,$]);se.useEffect(()=>{if(f.promise&&Pt==="loading"||f.duration===1/0||f.type==="loading")return;let be;return E||p||J?(()=>{if(X.current{tt.current!==1/0&&(Se.current=new Date().getTime(),be=setTimeout(()=>{f.onAutoClose==null||f.onAutoClose.call(f,f),Ee()},tt.current))})(),()=>clearTimeout(be)},[E,p,f,Pt,J,Ee]),se.useEffect(()=>{f.delete&&(Ee(),f.onDismiss==null||f.onDismiss.call(f,f))},[Ee,f.delete]);function Ve(){var be;if(ee!=null&&ee.loading){var Ze;return se.createElement("div",{className:Hr(W==null?void 0:W.loader,f==null||(Ze=f.classNames)==null?void 0:Ze.loader,"sonner-loader"),"data-visible":Pt==="loading"},ee.loading)}return se.createElement(UD,{className:Hr(W==null?void 0:W.loader,f==null||(be=f.classNames)==null?void 0:be.loader),visible:Pt==="loading"})}const Be=f.icon||(ee==null?void 0:ee[Pt])||FD(Pt);var De,$n;return se.createElement("li",{tabIndex:0,ref:Ue,className:Hr(A,fn,W==null?void 0:W.toast,f==null||(e=f.classNames)==null?void 0:e.toast,W==null?void 0:W.default,W==null?void 0:W[Pt],f==null||(n=f.classNames)==null?void 0:n[Pt]),"data-sonner-toast":"","data-rich-colors":(De=f.richColors)!=null?De:M,"data-styled":!(f.jsx||f.unstyled||m),"data-mounted":O,"data-promise":!!f.promise,"data-swiped":Vt,"data-removed":oe,"data-visible":Pn,"data-y-position":de,"data-x-position":Le,"data-index":v,"data-front":vt,"data-swiping":Ie,"data-dismissible":on,"data-type":Pt,"data-invert":me,"data-swipe-out":it,"data-swipe-direction":ne,"data-expanded":!!(E||z&&O),"data-testid":f.testId,style:{"--index":v,"--toasts-before":v,"--z-index":w.length-v,"--offset":`${oe?yt:$.current}px`,"--initial-height":z?"auto":`${_n}px`,...S,...f.style},onDragEnd:()=>{te(!1),R(null),re.current=null},onPointerDown:be=>{be.button!==2&&(ye||!on||(Bn.current=new Date,jt($.current),be.target.setPointerCapture(be.pointerId),be.target.tagName!=="BUTTON"&&(te(!0),re.current={x:be.clientX,y:be.clientY})))},onPointerUp:()=>{var be,Ze,ot;if(it||!on)return;re.current=null;const $e=Number(((be=Ue.current)==null?void 0:be.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),He=Number(((Ze=Ue.current)==null?void 0:Ze.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),ft=new Date().getTime()-((ot=Bn.current)==null?void 0:ot.getTime()),bt=K==="x"?$e:He,ct=Math.abs(bt)/ft;if(Math.abs(bt)>=iM||ct>.11){jt($.current),f.onDismiss==null||f.onDismiss.call(f,f),pe(K==="x"?$e>0?"right":"left":He>0?"down":"up"),Ee(),pt(!0);return}else{var Ge,Bt;(Ge=Ue.current)==null||Ge.style.setProperty("--swipe-amount-x","0px"),(Bt=Ue.current)==null||Bt.style.setProperty("--swipe-amount-y","0px")}st(!1),te(!1),R(null)},onPointerMove:be=>{var Ze,ot,$e;if(!re.current||!on||((Ze=window.getSelection())==null?void 0:Ze.toString().length)>0)return;const ft=be.clientY-re.current.y,bt=be.clientX-re.current.x;var ct;const Ge=(ct=t.swipeDirections)!=null?ct:aM(k);!K&&(Math.abs(bt)>1||Math.abs(ft)>1)&&R(Math.abs(bt)>Math.abs(ft)?"x":"y");let Bt={x:0,y:0};const pn=Rn=>1/(1.5+Math.abs(Rn)/20);if(K==="y"){if(Ge.includes("top")||Ge.includes("bottom"))if(Ge.includes("top")&&ft<0||Ge.includes("bottom")&&ft>0)Bt.y=ft;else{const Rn=ft*pn(ft);Bt.y=Math.abs(Rn)0)Bt.x=bt;else{const Rn=bt*pn(bt);Bt.x=Math.abs(Rn)0||Math.abs(Bt.y)>0)&&st(!0),(ot=Ue.current)==null||ot.style.setProperty("--swipe-amount-x",`${Bt.x}px`),($e=Ue.current)==null||$e.style.setProperty("--swipe-amount-y",`${Bt.y}px`)}},ie&&!f.jsx&&Pt!=="loading"?se.createElement("button",{"aria-label":F,"data-disabled":ye,"data-close-button":!0,onClick:ye||!on?()=>{}:()=>{Ee(),f.onDismiss==null||f.onDismiss.call(f,f)},className:Hr(W==null?void 0:W.closeButton,f==null||(r=f.classNames)==null?void 0:r.closeButton)},($n=ee==null?void 0:ee.close)!=null?$n:GD):null,(Pt||f.icon||f.promise)&&f.icon!==null&&((ee==null?void 0:ee[Pt])!==null||f.icon)?se.createElement("div",{"data-icon":"",className:Hr(W==null?void 0:W.icon,f==null||(s=f.classNames)==null?void 0:s.icon)},f.promise||f.type==="loading"&&!f.icon?f.icon||Ve():null,f.type!=="loading"?Be:null):null,se.createElement("div",{"data-content":"",className:Hr(W==null?void 0:W.content,f==null||(i=f.classNames)==null?void 0:i.content)},se.createElement("div",{"data-title":"",className:Hr(W==null?void 0:W.title,f==null||(o=f.classNames)==null?void 0:o.title)},f.jsx?f.jsx:typeof f.title=="function"?f.title():f.title),f.description?se.createElement("div",{"data-description":"",className:Hr(I,wt,W==null?void 0:W.description,f==null||(l=f.classNames)==null?void 0:l.description)},typeof f.description=="function"?f.description():f.description):null),se.isValidElement(f.cancel)?f.cancel:f.cancel&&yu(f.cancel)?se.createElement("button",{"data-button":!0,"data-cancel":!0,style:f.cancelButtonStyle||x,onClick:be=>{yu(f.cancel)&&on&&(f.cancel.onClick==null||f.cancel.onClick.call(f.cancel,be),Ee())},className:Hr(W==null?void 0:W.cancelButton,f==null||(c=f.classNames)==null?void 0:c.cancelButton)},f.cancel.label):null,se.isValidElement(f.action)?f.action:f.action&&yu(f.action)?se.createElement("button",{"data-button":!0,"data-action":!0,style:f.actionButtonStyle||N,onClick:be=>{yu(f.action)&&(f.action.onClick==null||f.action.onClick.call(f.action,be),!be.defaultPrevented&&Ee())},className:Hr(W==null?void 0:W.actionButton,f==null||(u=f.classNames)==null?void 0:u.actionButton)},f.action.label):null)};function kw(){if(typeof window>"u"||typeof document>"u")return"ltr";const t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}function cM(t,e){const n={};return[t,e].forEach((r,s)=>{const i=s===1,o=i?"--mobile-offset":"--offset",l=i?nM:tM;function c(u){["top","right","bottom","left"].forEach(h=>{n[`${o}-${h}`]=typeof u=="number"?`${u}px`:u})}typeof r=="number"||typeof r=="string"?c(r):typeof r=="object"?["top","right","bottom","left"].forEach(u=>{r[u]===void 0?n[`${o}-${u}`]=l:n[`${o}-${u}`]=typeof r[u]=="number"?`${r[u]}px`:r[u]}):c(l)}),n}const uM=se.forwardRef(function(e,n){const{id:r,invert:s,position:i="bottom-right",hotkey:o=["altKey","KeyT"],expand:l,closeButton:c,className:u,offset:h,mobileOffset:f,theme:m="light",richColors:p,duration:y,style:_,visibleToasts:C=eM,toastOptions:v,dir:w=kw(),gap:E=sM,icons:D,containerAriaLabel:M="Notifications"}=e,[T,S]=se.useState([]),x=se.useMemo(()=>r?T.filter(O=>O.toasterId===r):T.filter(O=>!O.toasterId),[T,r]),N=se.useMemo(()=>Array.from(new Set([i].concat(x.filter(O=>O.position).map(O=>O.position)))),[x,i]),[A,I]=se.useState([]),[P,k]=se.useState(!1),[B,z]=se.useState(!1),[W,ee]=se.useState(m!=="system"?m:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),F=se.useRef(null),K=o.join("+").replace(/Key/g,"").replace(/Digit/g,""),R=se.useRef(null),ne=se.useRef(!1),pe=se.useCallback(O=>{S(Q=>{var oe;return(oe=Q.find(ce=>ce.id===O.id))!=null&&oe.delete||Gn.dismiss(O.id),Q.filter(({id:ce})=>ce!==O.id)})},[]);return se.useEffect(()=>Gn.subscribe(O=>{if(O.dismiss){requestAnimationFrame(()=>{S(Q=>Q.map(oe=>oe.id===O.id?{...oe,delete:!0}:oe))});return}setTimeout(()=>{kI.flushSync(()=>{S(Q=>{const oe=Q.findIndex(ce=>ce.id===O.id);return oe!==-1?[...Q.slice(0,oe),{...Q[oe],...O},...Q.slice(oe+1)]:[O,...Q]})})})}),[T]),se.useEffect(()=>{if(m!=="system"){ee(m);return}if(m==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?ee("dark"):ee("light")),typeof window>"u")return;const O=window.matchMedia("(prefers-color-scheme: dark)");try{O.addEventListener("change",({matches:Q})=>{ee(Q?"dark":"light")})}catch{O.addListener(({matches:oe})=>{try{ee(oe?"dark":"light")}catch(ce){console.error(ce)}})}},[m]),se.useEffect(()=>{T.length<=1&&k(!1)},[T]),se.useEffect(()=>{const O=Q=>{var oe;if(o.every(te=>Q[te]||Q.code===te)){var Ie;k(!0),(Ie=F.current)==null||Ie.focus()}Q.code==="Escape"&&(document.activeElement===F.current||(oe=F.current)!=null&&oe.contains(document.activeElement))&&k(!1)};return document.addEventListener("keydown",O),()=>document.removeEventListener("keydown",O)},[o]),se.useEffect(()=>{if(F.current)return()=>{R.current&&(R.current.focus({preventScroll:!0}),R.current=null,ne.current=!1)}},[F.current]),se.createElement("section",{ref:n,"aria-label":`${M} ${K}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},N.map((O,Q)=>{var oe;const[ce,Ie]=O.split("-");return x.length?se.createElement("ol",{key:O,dir:w==="auto"?kw():w,tabIndex:-1,ref:F,className:u,"data-sonner-toaster":!0,"data-sonner-theme":W,"data-y-position":ce,"data-x-position":Ie,style:{"--front-toast-height":`${((oe=A[0])==null?void 0:oe.height)||0}px`,"--width":`${rM}px`,"--gap":`${E}px`,..._,...cM(h,f)},onBlur:te=>{ne.current&&!te.currentTarget.contains(te.relatedTarget)&&(ne.current=!1,R.current&&(R.current.focus({preventScroll:!0}),R.current=null))},onFocus:te=>{te.target instanceof HTMLElement&&te.target.dataset.dismissible==="false"||ne.current||(ne.current=!0,R.current=te.relatedTarget)},onMouseEnter:()=>k(!0),onMouseMove:()=>k(!0),onMouseLeave:()=>{B||k(!1)},onDragEnd:()=>k(!1),onPointerDown:te=>{te.target instanceof HTMLElement&&te.target.dataset.dismissible==="false"||z(!0)},onPointerUp:()=>z(!1)},x.filter(te=>!te.position&&Q===0||te.position===O).map((te,it)=>{var pt,Vt;return se.createElement(lM,{key:te.id,icons:D,index:it,toast:te,defaultRichColors:p,duration:(pt=v==null?void 0:v.duration)!=null?pt:y,className:v==null?void 0:v.className,descriptionClassName:v==null?void 0:v.descriptionClassName,invert:s,visibleToasts:C,closeButton:(Vt=v==null?void 0:v.closeButton)!=null?Vt:c,interacting:B,position:O,style:v==null?void 0:v.style,unstyled:v==null?void 0:v.unstyled,classNames:v==null?void 0:v.classNames,cancelButtonStyle:v==null?void 0:v.cancelButtonStyle,actionButtonStyle:v==null?void 0:v.actionButtonStyle,closeButtonAriaLabel:v==null?void 0:v.closeButtonAriaLabel,removeToast:pe,toasts:x.filter(st=>st.position==te.position),heights:A.filter(st=>st.position==te.position),setHeights:I,expandByDefault:l,gap:E,expanded:P,swipeDirections:e.swipeDirections})})):null}))});function ri({label:t,type:e,categories:n,selectedIds:r,onSelect:s,onRemove:i,onCreate:o,onDeleteCategory:l,colorClass:c,placeholder:u="Añadir..."}){const[h,f]=L.useState(""),[m,p]=L.useState(!1),y=L.useRef(null),_=L.useMemo(()=>n.filter(T=>T.type===e||!T.type&&e==="genre"),[n,e]),C=L.useMemo(()=>h.trim()?_.filter(T=>T.name.toLowerCase().includes(h.toLowerCase())):_,[_,h]);L.useEffect(()=>{const T=S=>{y.current&&!y.current.contains(S.target)&&p(!1)};return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[]);const v=T=>{T.key==="Enter"&&(T.preventDefault(),w())},w=()=>{if(!h.trim())return;const T=_.find(S=>S.name.toLowerCase()===h.trim().toLowerCase());T?r.includes(T.id)||s(T.id):o(h.trim()),f(""),p(!1)},E=(T,S)=>{T.stopPropagation(),we("¿Eliminar esta categoría permanentemente?",{description:"Esta acción no se puede deshacer.",action:{label:"Eliminar",onClick:()=>l(S)},cancel:{label:"Cancelar",onClick:()=>{}},duration:5e3})},M=c.includes("blue")?{bg:"bg-blue-500/20",text:"text-blue-300",border:"border-blue-500/30"}:c.includes("green")?{bg:"bg-green-500/20",text:"text-green-300",border:"border-green-500/30"}:c.includes("purple")?{bg:"bg-purple-500/20",text:"text-purple-300",border:"border-purple-500/30"}:c.includes("pink")?{bg:"bg-pink-500/20",text:"text-pink-300",border:"border-pink-500/30"}:{bg:"bg-gray-500/20",text:"text-gray-300",border:"border-gray-500/30"};return a.jsxs("div",{className:"space-y-3 mb-6",ref:y,children:[a.jsx("label",{className:`text-xs uppercase font-bold tracking-wider ${c}`,children:t}),a.jsxs("div",{className:"relative",children:[a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("div",{className:"relative flex-1",children:[a.jsx("input",{type:"text",value:h,onChange:T=>{f(T.target.value),p(!0)},onFocus:()=>p(!0),onKeyDown:v,placeholder:u,className:"w-full bg-[#1a1a1a] border border-gray-600/50 rounded-lg px-4 py-2 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-[#bb86fc] transition-all"}),h&&a.jsx("button",{onClick:()=>f(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-500 hover:text-white",children:a.jsx(gt,{className:"w-3 h-3"})})]}),a.jsx("button",{onClick:w,disabled:!h.trim(),className:"bg-[#bb86fc]/20 hover:bg-[#bb86fc]/30 text-[#bb86fc] px-3 rounded-lg transition-all",children:a.jsx(Kr,{className:"w-5 h-5"})})]}),m&&(C.length>0||h)&&a.jsx("div",{className:"absolute top-full left-0 right-0 mt-1 bg-[#1a1a1a] border border-gray-700/50 rounded-lg shadow-xl z-50 max-h-60 overflow-y-auto w-full custom-scrollbar",children:C.length>0?C.map(T=>{const S=r.includes(T.id);return a.jsxs("div",{className:"flex items-center justify-between px-4 py-2 hover:bg-white/5 cursor-pointer group",onClick:()=>{S||(s(T.id),f(""),p(!1))},children:[a.jsx("span",{className:`text-sm ${S?"text-[#bb86fc]":"text-gray-300"}`,children:T.name}),a.jsxs("div",{className:"flex items-center gap-2",children:[S&&a.jsx(dc,{className:"w-4 h-4 text-[#bb86fc]"}),a.jsx("button",{onClick:x=>E(x,T.id),className:"opacity-0 group-hover:opacity-100 p-1 hover:bg-red-500/20 text-gray-500 hover:text-red-400 rounded transition-all",title:"Eliminar permanentemente",children:a.jsx(tn,{className:"w-3.5 h-3.5"})})]})]},T.id)}):a.jsxs("div",{className:"px-4 py-3 text-center",children:[a.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"No encontrado."}),a.jsxs("button",{onClick:w,className:"text-xs text-[#bb86fc] hover:underline font-semibold",children:['Crear "',h,'"']})]})})]}),a.jsx("div",{className:"flex gap-2 flex-wrap",children:r.map(T=>{const S=n.find(x=>x.id===T);return!S||S.type!==e&&!(e==="genre"&&!S.type)?null:a.jsxs("span",{className:`px-3 py-1 ${M.bg} ${M.text} text-xs rounded-full border ${M.border} flex items-center gap-2`,children:[S.name,a.jsx("button",{onClick:()=>i(T),className:"hover:text-white",children:a.jsx(gt,{className:"w-3 h-3"})})]},T)})})]})}function Sr({size:t=40,borderWidth:e=2,className:n=""}){return a.jsx("div",{className:`flex items-center justify-center ${n}`,children:a.jsx("div",{className:"relative",style:{width:`${t}px`,height:`${t}px`},children:a.jsx("div",{className:"rounded-full animate-spin",style:{width:`${t}px`,height:`${t}px`,borderWidth:`${e}px`,borderStyle:"solid",borderColor:"rgba(187, 134, 252, 0.3)",borderTopColor:"#bb86fc",animation:"spin 1.2s linear infinite",boxShadow:"0 0 20px rgba(139, 92, 246, 0.2)"}})})})}function Iw(t){const e=new Map,n=t.split(` +`);let r="",s="Hugging Face";for(const l of n){const c=l.trim();if(c.includes("---- WEB P LINKS ----")){r="WEB P LINKS";continue}if(c.includes("---- ORIGINAL LINKS ----")){r="ORIGINAL LINKS";continue}if(c.includes("---- VIDEO LINKS ----")){r="VIDEO LINKS";continue}if(c.includes("Para Hugging Face (Público):")){s="Hugging Face";continue}if(c.includes("Para tu PC Local (Pruebas):")){s="Local";continue}if(s==="Hugging Face"&&c.match(/^\(\d+\)\s+.*?\s+=\s+http/)){const u=c.match(/^\(\d+\)\s+(.*?)\s+=\s+(http.*)$/);if(u){const h=u[1],f=u[2].trim(),p=(r==="VIDEO LINKS"||h.toLowerCase().endsWith(".mp4"))&&!f.includes("format=mp4")?f+(f.includes("?")?"&format=mp4":"?format=mp4"):f,y=c.match(/^\((\d+)\)/);let _=y?parseInt(y[1],10):0;if(!_){const v=h.match(/^(\d+)/);_=v?parseInt(v[1],10):0}e.has(_)||e.set(_,{originalFormat:"webp",originalBase64:""});const C=e.get(_);r==="WEB P LINKS"?(C.thumbnail=p,C.webpDisplay=p,C.webpCover=p):r==="ORIGINAL LINKS"?(C.original=p,C.originalUnmodified=p):(C.thumbnail=p,C.webpDisplay=p,C.webpCover=p,C.original=p,C.originalUnmodified=p)}}}const i=[],o=Array.from(e.keys()).sort((l,c)=>l-c);for(const l of o){const c=e.get(l);c&&(!c.original&&c.thumbnail?(c.original=c.thumbnail,c.originalUnmodified=c.thumbnail):!c.thumbnail&&c.original&&(c.thumbnail=c.original,c.webpDisplay=c.original,c.webpCover=c.original),c.thumbnail&&c.original&&i.push(c))}return i}function Nm({isOpen:t,onClose:e,onConfirm:n,title:r,message:s,confirmText:i="Confirmar",cancelText:o="Cancelar",variant:l="warning"}){if(!t)return null;const c={danger:"from-red-500 to-red-600 shadow-red-500/20",warning:"from-[#bb86fc] to-[#9966dd] shadow-[#bb86fc]/30",info:"from-blue-500 to-blue-600 shadow-blue-500/20"},u={danger:"bg-red-500/10 text-red-500",warning:"bg-[#bb86fc]/10 text-[#bb86fc]",info:"bg-blue-500/10 text-blue-500"};return a.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-[100] p-4 backdrop-blur-sm animate-[fadeIn_0.2s_ease-out]",children:a.jsxs("div",{className:"bg-gradient-to-b from-[#1f1f1f] to-[#121212] rounded-2xl border border-gray-700/40 w-full max-w-md shadow-2xl overflow-hidden scale-in-center",children:[a.jsxs("div",{className:"bg-gradient-to-b from-[#2a2a2a] to-[#1f1f1f] border-b border-gray-700/30 px-6 py-4 flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`p-2 rounded-lg ${u[l]}`,children:a.jsx(jI,{className:"w-5 h-5"})}),a.jsx("h2",{className:"text-xl font-bold text-white tracking-tight",children:r})]}),a.jsx("button",{onClick:e,className:"text-gray-500 hover:text-white hover:bg-white/10 transition-all p-1.5 rounded-lg",children:a.jsx(gt,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"p-8",children:[a.jsx("p",{className:"text-gray-300 leading-relaxed",children:s}),a.jsxs("div",{className:"flex gap-3 mt-8",children:[a.jsx("button",{onClick:e,className:"flex-1 bg-[#1a1a1a] border border-gray-600/40 hover:border-gray-500 hover:bg-[#242424] text-white px-5 py-3 rounded-xl font-semibold text-sm transition-all shadow-md active:scale-95",children:o}),a.jsx("button",{onClick:()=>{n(),e()},className:`flex-1 bg-gradient-to-r ${c[l]} text-white px-5 py-3 rounded-xl font-bold text-sm transition-all shadow-lg hover:brightness-110 active:scale-95`,children:i})]})]})]})})}function dM({currentSection:t,isOpen:e,onClose:n,onMangaCreated:r,editingManga:s,onDelete:i}){const[o,l]=L.useState({title:"",name:"",description:"",selectedCategories:[],is_decensored:!1,is_bn:!1,is_color:!1}),[c,u]=L.useState(null),[h,f]=L.useState(!1),[m,p]=L.useState(null),[y,_]=L.useState([]),[C,v]=L.useState(!1),[w,E]=L.useState([]),[D,M]=L.useState(!1),[T,S]=L.useState(null),[x,N]=L.useState(0),[A,I]=L.useState(!1),[P,k]=L.useState(0),[B,z]=L.useState(0),[W,ee]=L.useState(null),[F,K]=L.useState(!1),[R,ne]=L.useState(null),[pe,O]=L.useState(null),[Q,oe]=L.useState(!1),[ce,Ie]=L.useState(rE()),[te,it]=L.useState(null),[pt,Vt]=L.useState(!1),st=!!s,yt=st&&(s==null?void 0:s.is_folder);L.useEffect(()=>{var $,X;if(e&&(jt(),s)){l({title:s.title,name:s.author,description:s.description||"",selectedCategories:(($=s.categories)==null?void 0:$.map(de=>typeof de=="string"?de:de.id))||[],is_decensored:!!s.is_decensored,is_bn:!!s.is_bn,is_color:!!s.is_color}),s.thumbnail_url&&p(s.thumbnail_url);const re=(X=s.chapters)==null?void 0:X[0];if(re!=null&&re.pages&&re.pages.length>0){const de=re.pages,Le=re.original_pages||[],H=de.map((J,me)=>{var ye;return{thumbnail:J,original:Le[me]||J,webpDisplay:J,webpCover:J,originalFormat:((ye=re.page_formats)==null?void 0:ye[me])||"jpg",originalBase64:"",originalUnmodified:""}});E(H)}}},[e,s]),L.useEffect(()=>{w.length>0&&R===null&&!c&&!pe&&!m&&_e(0)},[w]);async function jt(){try{const $=await j2();_($)}catch($){console.error("Error loading categories:",$)}}const _n=async $=>{const{name:X,value:re}=$.target;l(de=>({...de,[X]:re}))},xt=$=>{l(X=>({...X,selectedCategories:X.selectedCategories.filter(re=>re!==$)}))},tt=async($,X)=>{if($.trim()){if(X==="tag"){const re=$.split(" ").map(de=>de.trim()).filter(de=>de.length>0);for(const de of re)await Bn(de,X);return}await Bn($,X)}},Bn=async($,X)=>{try{const re=y.find(de=>de.name.toLowerCase()===$.trim().toLowerCase()&&de.type===X);if(re)l(de=>de.selectedCategories.includes(re.id)?de:{...de,selectedCategories:[...de.selectedCategories,re.id]});else{const de=await P2($.trim(),X);_(Le=>Le.find(H=>H.id===de.id)?Le:[...Le,de]),l(Le=>Le.selectedCategories.includes(de.id)?Le:{...Le,selectedCategories:[...Le.selectedCategories,de.id]})}}catch(re){console.error("Error creating category:",re)}},Ue=async $=>{try{await R2($),_(X=>X.filter(re=>re.id!==$)),l(X=>({...X,selectedCategories:X.selectedCategories.filter(re=>re!==$)}))}catch(X){console.error("Error deleting category:",X),alert("Error al eliminar la categoría")}},vt=async $=>{var re;const X=(re=$.target.files)==null?void 0:re[0];if(X){f(!0);try{const de=await HI(X);u(de),p(de.originalUnmodified)}catch(de){console.error("Error processing image:",de),alert("Error al procesar la imagen. Intenta con otro archivo.")}finally{f(!1)}}},Pn=async $=>{let X="";if($.target instanceof HTMLInputElement&&$.target.files&&$.target.files.length>0){const re=Array.from($.target.files);if(re.length>1){it(re);return}const de=re[0];if(!st||!o.title.trim()){const H=de.name.split(".").slice(0,-1).join(".").replace(/[_-]/g," ").trim();l(J=>({...J,title:H}))}try{X=await de.text()}catch(Le){console.error("Error reading text file:",Le),alert("Error al leer el archivo de texto.");return}}else $.target instanceof HTMLTextAreaElement&&(X=$.target.value);if(X.trim()){M(!0);try{const re=Iw(X);if(re.length===0){alert("No se encontraron enlaces válidos en el texto provisto. Asegúrate de copiar el formato correcto.");return}E(de=>[...de,...re])}catch(re){console.error("Error parsing pages from text:",re),alert("Error al procesar los enlaces.")}finally{M(!1),$.target instanceof HTMLInputElement&&($.target.value="")}}},Pt=async $=>{var X,re;if(st){alert("La subida masiva solo está disponible al crear nuevos mangas.");return}ee({uploading:!0,current:0,total:$.length,currentName:"",errors:[]});try{for(let de=0;de<$.length;de++){const Le=$[de],J=Le.name.split(".").slice(0,-1).join(".").replace(/[_-]/g," ").trim();ee(me=>me?{...me,current:de+1,currentName:J}:null);try{const me=await Le.text(),ye=Iw(me);if(ye.length===0)throw new Error("No se encontraron enlaces válidos.");const Ee={title:J,author:((X=o.name)==null?void 0:X.trim())||"Anónimo",categoryIds:o.selectedCategories,is_decensored:o.is_decensored,is_bn:o.is_bn,is_color:o.is_color,section:t};(re=o.description)!=null&&re.trim()&&(Ee.description=o.description.trim()),ye.length>0&&(Ee.thumbnail_url=ye[0].webpDisplay,Ee.cover_url=ye[0].originalUnmodified);const Ve=await Ew(Ee);await na({manga_id:Ve.id,number:1,title:"Páginas",pages:ye.map(Be=>Be.webpDisplay),page_formats:ye.map(Be=>Be.originalFormat),original_pages:ye.map(Be=>Be.original)})}catch(me){console.error(`Error processing ${Le.name}:`,me),ee(ye=>ye?{...ye,errors:[...ye.errors,`${Le.name}: ${me.message||"Error desconocido"}`]}:null)}}ee(de=>de?{...de,currentName:"¡Completado!"}:null),setTimeout(()=>{ee(null),Se(),r()},2e3)}catch(de){console.error("Error general en subida masiva:",de),alert("Ocurrió un error inesperado durante la subida masiva."),ee(null)}},on=$=>{E(X=>X.filter((re,de)=>de!==$))},fn=$=>{S($)},wt=($,X)=>{if($.preventDefault(),T===null||T===X)return;const re=[...w],de=re[T];re.splice(T,1),re.splice(X,0,de),E(re),S(X)},G=()=>{S(null)},ie=async()=>{var $,X,re,de,Le;if(!o.title||!o.title.trim()){alert("El título es requerido");return}v(!0);try{let H=[...o.selectedCategories],J=(s==null?void 0:s.thumbnail_url)||void 0,me=(s==null?void 0:s.cover_url)||void 0;if(pe)J=pe.thumbnail,me=pe.original;else if(c)if(c.originalBase64==="")J=c.thumbnail,me=c.originalUnmodified;else try{I(!0),z(2),k(1),N(0);const ye=await Zp(c.thumbnail,`${o.title}_thumb`);N(50),k(2);const Ee=await Zp(c.originalUnmodified,`${o.title}_cover`);N(100),J=ye.data.url,me=Ee.data.url}catch(ye){console.error("Error uploading cover images:",ye),alert("Error al subir la portada. Continuar sin portada.")}finally{I(!1),N(0)}else w.length>0&&(J=w[0].webpDisplay,me=w[0].originalUnmodified);if(st&&s){const ye={title:o.title.trim(),author:(($=o.name)==null?void 0:$.trim())||"",description:((X=o.description)==null?void 0:X.trim())||"",categoryIds:H,is_decensored:o.is_decensored,is_bn:o.is_bn,is_color:o.is_color};if(J&&(ye.thumbnail_url=J),me&&(ye.cover_url=me),await Lh(s.id,ye),w.length>0&&w.length>0)try{I(!0);const Ee=w.filter($e=>$e.originalBase64!==""&&!$e.original.includes("/stream/")&&!$e.original.includes("hash="));let Ve=[],Be=[];if(Ee.length>0){z(Ee.length*2),k(0),N(0);const $e=Ee.map(ct=>ct.webpDisplay),He=Ee.map(ct=>ct.originalUnmodified),ft=await cu($e,`${o.title}_updated_webp`,(ct,Ge)=>{k(ct),N(Math.round(ct/(Ee.length*2)*100))}),bt=await cu(He,`${o.title}_updated_original`,(ct,Ge)=>{k(Ee.length+ct),N(Math.round((Ee.length+ct)/(Ee.length*2)*100))});Ve=ft.map(ct=>ct.data.url),Be=bt.map(ct=>ct.data.url)}let De=0;const $n=w.map($e=>$e.originalBase64!==""&&!$e.original.includes("/stream/")&&!$e.original.includes("hash=")?Ve[De++]:$e.webpDisplay);De=0;const be=w.map($e=>$e.originalBase64!==""&&!$e.original.includes("/stream/")&&!$e.original.includes("hash=")?Be[De++]:$e.original),Ze=w.map($e=>$e.originalFormat);I(!1),N(0);const ot=(re=s.chapters)==null?void 0:re[0];ot?await tr(Nt(je,"chapters",ot.id),{pages:$n,page_formats:Ze,original_pages:be,updated_at:Ke.now()}):await na({manga_id:s.id,number:1,title:"Páginas",pages:$n,page_formats:Ze,original_pages:be})}catch(Ee){console.error("Error updating chapter:",Ee),alert("Error al actualizar las páginas.")}r(s.id)}else{const ye={title:o.title.trim(),author:((de=o.name)==null?void 0:de.trim())||"",categoryIds:H,is_decensored:o.is_decensored,is_bn:o.is_bn,is_color:o.is_color,section:t};(Le=o.description)!=null&&Le.trim()&&(ye.description=o.description.trim()),J&&(ye.thumbnail_url=J),me&&(ye.cover_url=me);const Ee=await Ew(ye);if(!Ee.id)throw new Error("No se pudo obtener el ID del manga creado");const Ve=Ee.id;if(w.length>0)try{I(!0);const Be=w.filter(He=>He.originalBase64!==""&&!He.original.includes("/stream/")&&!He.original.includes("hash="));let De=[],$n=[];if(Be.length>0){z(Be.length*2),k(0),N(0);const He=Be.map(Ge=>Ge.webpDisplay),ft=Be.map(Ge=>Ge.originalUnmodified),bt=await cu(He,`${o.title}_ch1_webp`,(Ge,Bt)=>{k(Ge),N(Math.round(Ge/(Be.length*2)*100))}),ct=await cu(ft,`${o.title}_ch1_original`,(Ge,Bt)=>{k(Be.length+Ge),N(Math.round((Be.length+Ge)/(Be.length*2)*100))});De=bt.map(Ge=>Ge.data.url),$n=ct.map(Ge=>Ge.data.url)}let be=0;const Ze=w.map(He=>He.originalBase64!==""&&!He.original.includes("/stream/")&&!He.original.includes("hash=")?De[be++]:He.webpDisplay);be=0;const ot=w.map(He=>He.originalBase64!==""&&!He.original.includes("/stream/")&&!He.original.includes("hash=")?$n[be++]:He.original),$e=w.map(He=>He.originalFormat);I(!1),N(0),await na({manga_id:Ve,number:1,title:"Páginas",pages:Ze,page_formats:$e,original_pages:ot})}catch(Be){console.error("Error creating chapter:",Be),alert("Error al crear el capítulo. Por favor intenta de nuevo.")}r(Ve)}Se()}catch(H){console.error("Error creating/updating manga:",H);let J="Error al guardar el manga. ";if(H.message)J+=H.message;else if(H.code)switch(H.code){case"permission-denied":J+="No tienes permisos para realizar esta operación.";break;case"unavailable":J+="El servicio no está disponible. Verifica tu conexión.";break;case"invalid-argument":J+="Algunos datos no son válidos. Revisa el formulario.";break;default:J+=`Código de error: ${H.code}`}else J+="Por favor intenta de nuevo.";alert(J)}finally{v(!1),I(!1),N(0)}},_e=$=>{const X=w[$];if(!X.originalBase64)O({thumbnail:X.thumbnail,original:X.original}),u(null);else{const de={thumbnail:X.thumbnail,original:X.originalUnmodified,webpDisplay:X.originalUnmodified,webpCover:X.originalUnmodified,originalFormat:X.originalFormat,originalBase64:X.originalBase64,originalUnmodified:X.originalUnmodified};u(de),O(null)}p(X.thumbnail),ne($),K(!1)},Se=()=>{l({title:"",name:"",description:"",selectedCategories:[],is_decensored:!1,is_bn:!1,is_color:!1}),u(null),O(null),p(null),E([]),N(0),I(!1),k(0),z(0),K(!1),ne(null),n()};return e?a.jsxs("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:[a.jsxs("div",{className:"bg-gradient-to-b from-[#1f1f1f] to-[#121212] rounded-2xl border border-gray-700/40 w-full max-w-2xl max-h-[90vh] overflow-y-auto shadow-2xl",children:[a.jsxs("div",{className:"sticky top-0 bg-gradient-to-b from-[#2a2a2a] to-[#1f1f1f] border-b border-gray-700/30 px-8 py-6 flex items-center justify-between z-10",children:[a.jsxs("div",{children:[a.jsxs("h2",{className:"text-2xl font-bold flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-gradient-to-br from-[#bb86fc] to-[#9966dd] rounded-lg shadow-lg shadow-[#bb86fc]/30",children:a.jsx(fa,{className:"w-5 h-5 text-white"})}),yt?"Editar Carpeta":st?t==="patreon"||t==="onlyfans"||t==="grok"?"Editar Galería":"Editar Manga":t==="patreon"?"Subir Imágenes":t==="onlyfans"?"Subir Only":t==="grok"?"Subir Grok":"Crear Manga"]}),a.jsx("p",{className:"text-sm text-gray-400 mt-1.5",children:yt?"Actualiza el nombre de la carpeta":st?t==="patreon"||t==="onlyfans"||t==="grok"?"Actualiza los detalles de la galería":"Actualiza los detalles de tu obra":t==="patreon"||t==="onlyfans"||t==="grok"?"Sube nuevas imágenes exclusivas":"Comparte tu historia con el mundo"})]}),a.jsx("button",{onClick:Se,className:"text-gray-500 hover:text-white hover:bg-white/10 transition-all p-2 rounded-lg",children:a.jsx(gt,{className:"w-6 h-6"})})]}),a.jsxs("div",{className:"p-8 space-y-5",children:[a.jsxs("div",{className:"bg-gradient-to-br from-[#242424] to-[#1a1a1a] rounded-xl p-6 border border-gray-700/40 shadow-lg hover:border-gray-700/60 transition-all",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-5",children:[a.jsx("div",{className:"w-1 h-5 bg-gradient-to-b from-[#bb86fc] to-[#7744cc] rounded-full"}),a.jsx("h3",{className:"text-sm font-semibold text-white tracking-wide uppercase",children:"Información Principal"})]}),a.jsxs("div",{className:"space-y-3.5",children:[a.jsxs("div",{children:[a.jsxs("label",{className:"block text-xs font-semibold text-gray-200 mb-2",children:[yt?"Nombre de la Carpeta":t==="patreon"||t==="onlyfans"||t==="grok"?"Título de la Galería":"Título del Manga"," ",a.jsx("span",{className:"text-red-400 font-bold",children:"*"})]}),a.jsx("input",{type:"text",name:"title",placeholder:t==="patreon"||t==="onlyfans"||t==="grok"?"Nombre de la sesión o imágenes":"El nombre de tu obra maestra",value:o.title,onChange:_n,onKeyPress:$=>$.key==="Enter"&&st&&!C&&ie(),className:"w-full bg-[#1a1a1a] border border-gray-600/50 rounded-lg px-4 py-3 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-[#bb86fc] focus:ring-2 focus:ring-[#bb86fc]/30 transition-all shadow-md hover:border-gray-600/70"})]}),!yt&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{children:[a.jsxs("label",{className:"block text-xs font-semibold text-gray-200 mb-2",children:["Autor ",a.jsx("span",{className:"text-gray-500 font-normal",children:"(opcional)"})]}),a.jsx("input",{type:"text",name:"name",placeholder:"Tu nombre o seudónimo",value:o.name,onChange:_n,onKeyPress:$=>$.key==="Enter"&&st&&!C&&ie(),className:"w-full bg-[#1a1a1a] border border-gray-600/50 rounded-lg px-4 py-3 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-[#bb86fc] focus:ring-2 focus:ring-[#bb86fc]/30 transition-all shadow-md hover:border-gray-600/70"})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"block text-xs font-semibold text-gray-200 mb-2",children:["Sinopsis ",a.jsx("span",{className:"text-gray-500 font-normal",children:"(opcional)"})]}),a.jsx("textarea",{name:"description",placeholder:t==="patreon"||t==="onlyfans"||t==="grok"?"Cuéntanos detalles de estas imágenes...":"Cuéntanos de qué trata tu manga, qué lo hace especial...",value:o.description,onChange:_n,onKeyDown:$=>$.key==="Enter"&&$.ctrlKey&&st&&!C&&ie(),rows:3,className:"w-full bg-[#1a1a1a] border border-gray-600/50 rounded-lg px-4 py-3 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-[#bb86fc] focus:ring-2 focus:ring-[#bb86fc]/30 transition-all shadow-md hover:border-gray-600/70 resize-none"})]})]})]})]}),!yt&&a.jsxs("div",{className:"bg-gradient-to-br from-[#242424] to-[#1a1a1a] rounded-xl p-6 border border-gray-700/40 shadow-lg hover:border-gray-700/60 transition-all",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-5",children:[a.jsx("div",{className:"w-1 h-5 bg-gradient-to-b from-[#bb86fc] to-[#7744cc] rounded-full"}),a.jsx("h3",{className:"text-sm font-semibold text-white tracking-wide uppercase",children:"Clasificación"})]}),a.jsx(ri,{label:"Personajes",type:"character",categories:y,selectedIds:o.selectedCategories,onSelect:$=>{o.selectedCategories.includes($)||l(X=>({...X,selectedCategories:[...X.selectedCategories,$]}))},onRemove:xt,onCreate:$=>tt($,"character"),onDeleteCategory:Ue,colorClass:"text-blue-400",placeholder:"Añadir personaje..."}),a.jsx(ri,{label:"Series",type:"series",categories:y,selectedIds:o.selectedCategories,onSelect:$=>{o.selectedCategories.includes($)||l(X=>({...X,selectedCategories:[...X.selectedCategories,$]}))},onRemove:xt,onCreate:$=>tt($,"series"),onDeleteCategory:Ue,colorClass:"text-green-400",placeholder:"Añadir serie..."}),a.jsx(ri,{label:"Géneros",type:"genre",categories:y,selectedIds:o.selectedCategories,onSelect:$=>{o.selectedCategories.includes($)||l(X=>({...X,selectedCategories:[...X.selectedCategories,$]}))},onRemove:xt,onCreate:$=>tt($,"genre"),onDeleteCategory:Ue,colorClass:"text-purple-400",placeholder:"Añadir género..."}),a.jsx(ri,{label:"Etiquetas",type:"tag",categories:y,selectedIds:o.selectedCategories,onSelect:$=>{o.selectedCategories.includes($)||l(X=>({...X,selectedCategories:[...X.selectedCategories,$]}))},onRemove:xt,onCreate:$=>tt($,"tag"),onDeleteCategory:Ue,colorClass:"text-pink-400",placeholder:"Añadir etiqueta..."}),a.jsxs("div",{className:"mt-6 pt-5 border-t border-gray-700/50 space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-semibold text-white",children:"Sin censura"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Marcar como contenido sin censura"})]}),a.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[a.jsx("input",{type:"checkbox",className:"sr-only peer",checked:!!o.is_decensored,onChange:$=>l(X=>({...X,is_decensored:$.target.checked}))}),a.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-[#bb86fc]"})]})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-semibold text-white",children:"B/N"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Marcar como contenido Blanco y Negro"})]}),a.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[a.jsx("input",{type:"checkbox",className:"sr-only peer",checked:!!o.is_bn,onChange:$=>{const X=$.target.checked;l(re=>({...re,is_bn:X,...X?{is_color:!1}:{}}))}}),a.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-[#bb86fc]"})]})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-semibold text-white",children:"a color"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Marcar como contenido a color"})]}),a.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[a.jsx("input",{type:"checkbox",className:"sr-only peer",checked:!!o.is_color,onChange:$=>{const X=$.target.checked;l(re=>({...re,is_color:X,...X?{is_bn:!1}:{}}))}}),a.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-[#bb86fc]"})]})]})]})]}),!yt&&a.jsxs("div",{className:"bg-gradient-to-br from-[#242424] to-[#1a1a1a] rounded-xl p-6 border border-gray-700/40 shadow-lg hover:border-gray-700/60 transition-all",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-5",children:[a.jsx("div",{className:"w-1 h-5 bg-gradient-to-b from-[#bb86fc] to-[#7744cc] rounded-full"}),a.jsx("h3",{className:"text-sm font-semibold text-white tracking-wide uppercase",children:"Portada"}),a.jsx("span",{className:"text-xs text-gray-500 ml-auto",children:"Opcional"})]}),h&&a.jsxs("div",{className:"mb-4",children:[a.jsx("div",{className:"flex items-center justify-between mb-2",children:a.jsx("span",{className:"text-xs font-semibold text-[#bb86fc]",children:"Procesando portada..."})}),a.jsx("div",{className:"w-full bg-gray-700/40 rounded-full h-2 overflow-hidden border border-[#bb86fc]/30",children:a.jsx("div",{className:"bg-gradient-to-r from-[#bb86fc] to-[#9966dd] h-full transition-all duration-300 ease-out animate-pulse",style:{width:"100%"}})})]}),m&&!h&&a.jsxs("div",{className:"mb-4 relative group max-w-xs mx-auto",children:[a.jsx(un,{src:m,alt:"Preview",aspectRatio:"3/4",objectFit:"cover",loading:"eager",className:"rounded-xl border border-gray-600 shadow-2xl shadow-[#bb86fc]/20"}),a.jsx("div",{className:"absolute inset-0 rounded-xl bg-black/40 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center gap-2",children:a.jsx("button",{onClick:()=>{u(null),p(null),ne(null)},className:"bg-red-600/80 hover:bg-red-600 text-white p-2 rounded-lg transition-all shadow-lg",children:a.jsx(tn,{className:"w-4 h-4"})})}),R!==null&&a.jsxs("div",{className:"absolute bottom-2 left-2 bg-green-600/90 text-white text-xs px-2.5 py-1 rounded-lg font-semibold",children:["Página ",R+1]})]}),a.jsxs("div",{className:"flex gap-3 mb-4",children:[a.jsxs("label",{className:"flex-1 border-2 border-dashed border-gray-600/50 rounded-xl p-6 cursor-pointer hover:border-[#bb86fc]/50 hover:bg-[#bb86fc]/5 transition-all block group",children:[a.jsxs("div",{className:"flex flex-col items-center gap-2",children:[a.jsx("div",{className:"w-12 h-12 bg-gradient-to-br from-[#bb86fc] to-[#9966dd] rounded-xl flex items-center justify-center shadow-lg shadow-[#bb86fc]/40 group-hover:scale-110 group-hover:shadow-[#bb86fc]/60 transition-all",children:h?a.jsx(Sr,{size:24,borderWidth:2}):a.jsx(Kr,{className:"w-6 h-6 text-white"})}),a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"text-xs font-semibold text-white mb-0.5",children:h?"Procesando...":"Subir portada"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Archivo"})]})]}),a.jsx("input",{type:"file",accept:"image/*",onChange:vt,disabled:h,className:"hidden"})]}),w.length>0&&a.jsxs("button",{onClick:()=>K(!F),className:"flex-1 border-2 border-dashed border-gray-600/50 rounded-xl p-6 hover:border-[#bb86fc]/50 hover:bg-[#bb86fc]/5 transition-all group flex flex-col items-center justify-center gap-2 bg-gradient-to-br from-[#1a1a1a] to-[#0f0f0f]",children:[a.jsx("div",{className:"w-12 h-12 bg-gradient-to-br from-[#9966dd] to-[#bb86fc] rounded-xl flex items-center justify-center shadow-lg shadow-[#bb86fc]/40 group-hover:scale-110 group-hover:shadow-[#bb86fc]/60 transition-all",children:a.jsx(Yp,{className:"w-6 h-6 text-white"})}),a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"text-xs font-semibold text-white mb-0.5",children:"Elegir página"}),a.jsxs("p",{className:"text-xs text-gray-400",children:[w.length," disponibles"]})]})]})]})]}),!yt&&a.jsxs("div",{className:"bg-gradient-to-br from-[#242424] to-[#1a1a1a] rounded-xl p-6 border border-gray-700/40 shadow-lg hover:border-gray-700/60 transition-all",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-5",children:[a.jsx("div",{className:"w-1 h-5 bg-gradient-to-b from-[#bb86fc] to-[#7744cc] rounded-full"}),a.jsx("h3",{className:"text-sm font-semibold text-white tracking-wide uppercase",children:"Páginas del Capítulo"}),a.jsx("span",{className:"text-xs text-gray-500 ml-auto",children:"Opcional"}),a.jsxs("button",{onClick:()=>oe(!0),className:"bg-[#1a1a1a] hover:bg-[#242424] border border-gray-600/50 hover:border-[#bb86fc]/50 text-gray-300 hover:text-[#bb86fc] p-2 rounded-lg transition-all flex items-center gap-1.5 text-xs font-medium",title:"Configurar tamaño de lote de subida",children:[a.jsx($x,{className:"w-3.5 h-3.5"}),a.jsxs("span",{className:"hidden sm:inline",children:["Subida: ",ce===0?"Sin límite":`${ce} por lote`]})]})]}),D&&a.jsxs("div",{className:"mb-5",children:[a.jsx("div",{className:"flex items-center justify-between mb-2",children:a.jsx("span",{className:"text-xs font-semibold text-[#bb86fc]",children:"Procesando enlaces..."})}),a.jsx("div",{className:"w-full bg-gray-700/40 rounded-full h-2 overflow-hidden border border-[#bb86fc]/30",children:a.jsx("div",{className:"bg-gradient-to-r from-[#bb86fc] to-[#9966dd] h-full transition-all duration-300 ease-out animate-pulse",style:{width:"100%"}})})]}),w.length>0&&!D&&a.jsxs("div",{className:"mb-5",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[a.jsx(Ux,{className:"w-3.5 h-3.5 text-gray-500"}),a.jsxs("p",{className:"text-xs text-gray-400",children:[w.length," página",w.length!==1?"s":""," • Arrastra para reordenar"]})]}),a.jsx("div",{className:"grid grid-cols-4 gap-2",children:w.map(($,X)=>a.jsxs("div",{draggable:!0,onDragStart:()=>fn(X),onDragOver:re=>wt(re,X),onDragEnd:G,style:{animationDelay:`${X*40}ms`},className:`relative group cursor-move opacity-0 animate-[fadeIn_0.7s_ease-out_forwards] ${T===X?"opacity-50 scale-95":"hover:scale-105"} transition-all duration-200`,children:[a.jsxs("div",{className:"relative overflow-hidden w-full aspect-[3/4] rounded-lg border border-gray-600/50 shadow-md bg-black",children:[a.jsx("div",{className:"absolute inset-0 flex items-center justify-center z-10 transition-opacity duration-300",children:a.jsx("div",{className:"rounded-full animate-spin",style:{width:"24px",height:"24px",borderWidth:"2px",borderStyle:"solid",borderColor:"rgba(187, 134, 252, 0.2)",borderTopColor:"#bb86fc",animation:"spin 0.6s linear infinite"}})}),a.jsx("img",{src:$.thumbnail,alt:`Página ${X+1}`,className:"w-full h-full object-cover transition-all duration-700 ease-out transform-gpu group-hover:scale-[1.08] group-hover:shadow-[#bb86fc]/30 opacity-0 scale-95",onLoad:re=>{var Le;re.currentTarget.classList.remove("opacity-0","scale-95"),re.currentTarget.classList.add("opacity-100","scale-100");const de=(Le=re.currentTarget.parentElement)==null?void 0:Le.querySelector("div:nth-child(1)");de&&de.classList.add("opacity-0","pointer-events-none")}})]}),a.jsxs("div",{className:"absolute inset-0 bg-black/60 opacity-0 group-hover:opacity-100 transition-opacity rounded-lg flex items-center justify-center gap-2",children:[a.jsx(Ux,{className:"w-4 h-4 text-white/70"}),a.jsx("button",{onClick:()=>on(X),className:"bg-red-600/80 hover:bg-red-600 text-white p-1.5 rounded-lg transition-all shadow-lg",children:a.jsx(tn,{className:"w-3.5 h-3.5"})})]}),a.jsx("div",{className:"absolute top-1.5 left-1.5 bg-black/80 text-white text-xs px-2 py-0.5 rounded-md font-semibold",children:X+1})]},X))})]}),w.length===0&&a.jsxs("label",{className:"border-2 border-dashed border-gray-600/50 rounded-xl p-8 text-center hover:border-[#bb86fc]/50 hover:bg-[#bb86fc]/5 transition-all block group",children:[a.jsx("div",{className:"w-14 h-14 bg-gradient-to-br from-[#bb86fc] to-[#9966dd] rounded-xl flex items-center justify-center mx-auto mb-4 shadow-lg shadow-[#bb86fc]/40 group-hover:scale-110 group-hover:shadow-[#bb86fc]/60 transition-all",children:D?a.jsx(Sr,{size:24,borderWidth:2}):a.jsx(Yp,{className:"w-7 h-7 text-white"})}),a.jsx("p",{className:"text-sm font-semibold text-white mb-2",children:D?"Procesando...":"Sube tu archivo TXT"}),a.jsx("div",{className:"flex flex-col gap-4 max-w-lg mx-auto mt-4",children:a.jsxs("div",{className:"relative",children:[a.jsx("span",{className:"bg-[#1a1a1a] hover:bg-[#242424] border border-gray-600/50 text-white px-4 py-2 rounded-lg text-sm font-medium transition-all block w-max mx-auto cursor-pointer relative z-10",children:"Seleccionar Archivo .txt"}),a.jsx("input",{type:"file",accept:".txt",multiple:!0,onChange:Pn,disabled:D||((W==null?void 0:W.uploading)??!1),className:"absolute inset-0 w-full h-full opacity-0 cursor-pointer z-20"})]})})]})]}),(W==null?void 0:W.uploading)&&a.jsxs("div",{className:"mb-6 bg-gradient-to-br from-[#242424] to-[#1a1a1a] rounded-xl p-5 border border-[#bb86fc]/30 shadow-xl",children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Sr,{size:16,borderWidth:2}),a.jsxs("span",{className:"text-sm font-semibold text-white",children:["Subida Masiva: ",W.current," de ",W.total]})]}),a.jsxs("span",{className:"text-sm font-bold text-[#bb86fc]",children:[Math.round(W.current/W.total*100),"%"]})]}),a.jsx("div",{className:"w-full bg-gray-700/40 rounded-full h-3 overflow-hidden border border-[#bb86fc]/40 shadow-inner",children:a.jsx("div",{className:"bg-gradient-to-r from-[#bb86fc] via-[#9966dd] to-[#bb86fc] h-full transition-all duration-500 ease-out relative overflow-hidden",style:{width:`${W.current/W.total*100}%`},children:a.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent animate-pulse"})})}),a.jsx("p",{className:"text-xs text-[#bb86fc] mt-2 font-medium",children:W.currentName}),W.errors.length>0&&a.jsxs("div",{className:"mt-3 text-[10px] text-red-400 max-h-20 overflow-y-auto bg-black/20 p-2 rounded border border-red-500/20",children:[a.jsxs("p",{className:"font-bold mb-1",children:["Errores (",W.errors.length,"):"]}),W.errors.map(($,X)=>a.jsxs("div",{children:["• ",$]},X))]}),a.jsx("p",{className:"text-xs text-gray-400 mt-2 text-center",children:"Procesando archivos... Por favor espera."})]}),A&&a.jsxs("div",{className:"mb-6 bg-gradient-to-br from-[#242424] to-[#1a1a1a] rounded-xl p-5 border border-[#bb86fc]/30 shadow-xl",children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Sr,{size:16,borderWidth:2}),a.jsxs("span",{className:"text-sm font-semibold text-white",children:["Subiendo imagen ",P," de ",B]})]}),a.jsxs("span",{className:"text-sm font-bold text-[#bb86fc]",children:[x,"%"]})]}),a.jsx("div",{className:"w-full bg-gray-700/40 rounded-full h-3 overflow-hidden border border-[#bb86fc]/40 shadow-inner",children:a.jsx("div",{className:"bg-gradient-to-r from-[#bb86fc] via-[#9966dd] to-[#bb86fc] h-full transition-all duration-500 ease-out relative overflow-hidden",style:{width:`${x}%`},children:a.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent animate-pulse"})})}),a.jsx("p",{className:"text-xs text-gray-400 mt-2 text-center",children:"Por favor no cierres esta ventana..."})]}),a.jsxs("div",{className:"flex gap-3 pt-6 border-t border-gray-700/50",children:[st&&i&&a.jsxs("button",{onClick:()=>Vt(!0),className:"bg-red-500/10 border border-red-500/30 hover:bg-red-500/20 text-red-500 px-4 py-3 rounded-lg font-semibold text-sm transition-all flex items-center gap-2 mr-auto",children:[a.jsx(tn,{className:"w-4 h-4"}),"Eliminar"]}),a.jsx("button",{onClick:Se,disabled:C||A,className:"flex-1 bg-[#1a1a1a] border border-gray-600/50 hover:border-gray-500 hover:bg-[#242424] text-white px-5 py-3 rounded-lg font-semibold text-sm transition-all shadow-md disabled:opacity-50 disabled:cursor-not-allowed",children:"Cancelar"}),a.jsx("button",{onClick:ie,disabled:C||A||!o.title.trim(),children:A?"Subiendo imágenes...":C?st?"Actualizando...":"Creando...":st?"Guardar Cambios":"Crear Manga"})]})]})]}),F&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:a.jsxs("div",{className:"bg-gradient-to-b from-[#1f1f1f] to-[#121212] rounded-2xl border border-gray-700/40 w-full max-w-2xl max-h-[80vh] shadow-2xl overflow-hidden flex flex-col",children:[a.jsxs("div",{className:"bg-gradient-to-b from-[#2a2a2a]/80 to-[#1f1f1f]/80 border-b border-gray-700/30 px-6 py-4 flex items-center justify-between flex-shrink-0",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-xl font-bold text-white",children:"Selecciona portada"}),a.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Elige una página para usar como portada del manga"})]}),a.jsx("button",{onClick:()=>K(!1),className:"text-gray-500 hover:text-white transition-colors p-1.5 rounded-lg hover:bg-white/10 flex-shrink-0",children:a.jsx(gt,{className:"w-5 h-5"})})]}),a.jsx("div",{className:"overflow-y-auto flex-1 p-6",children:a.jsx("div",{className:"grid grid-cols-3 md:grid-cols-4 gap-3",children:w.map(($,X)=>a.jsxs("button",{onClick:()=>_e(X),className:`group relative aspect-[3/4] rounded-lg overflow-hidden transition-all duration-300 hover:scale-105 border-2 ${R===X?"border-green-500 shadow-lg shadow-green-500/40":"border-gray-600/50 hover:border-[#bb86fc]/50"}`,children:[a.jsxs("div",{className:"absolute inset-0 overflow-hidden bg-black flex items-center justify-center",children:[a.jsx("div",{className:"absolute inset-0 flex items-center justify-center z-10 transition-opacity duration-300",children:a.jsx("div",{className:"rounded-full animate-spin",style:{width:"20px",height:"20px",borderWidth:"2px",borderStyle:"solid",borderColor:"rgba(187, 134, 252, 0.2)",borderTopColor:"#bb86fc",animation:"spin 0.6s linear infinite"}})}),a.jsx("img",{src:$.thumbnail,alt:`Página ${X+1}`,className:"w-full h-full object-cover transition-all duration-700 ease-out transform-gpu group-hover:scale-[1.10] opacity-0 scale-95",onLoad:re=>{var Le;re.currentTarget.classList.remove("opacity-0","scale-95"),re.currentTarget.classList.add("opacity-100","scale-100");const de=(Le=re.currentTarget.parentElement)==null?void 0:Le.querySelector("div:nth-child(1)");de&&de.classList.add("opacity-0","pointer-events-none")}})]}),a.jsx("div",{className:"absolute inset-0 bg-black/40 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center",children:a.jsx("div",{className:"bg-[#bb86fc]/90 text-white px-3 py-1.5 rounded-lg font-semibold text-sm",children:"Seleccionar"})}),a.jsx("div",{className:"absolute bottom-2 left-2 bg-black/80 text-white text-xs px-2 py-1 rounded-md font-semibold",children:X+1}),R===X&&a.jsxs("div",{className:"absolute top-2 right-2 bg-green-600/90 text-white px-2.5 py-1.5 rounded-lg flex items-center gap-1.5 font-semibold text-xs",children:[a.jsx("div",{className:"w-2 h-2 bg-white rounded-full"}),"Seleccionado"]})]},X))})}),a.jsxs("div",{className:"bg-gradient-to-b from-[#1f1f1f]/80 to-[#1a1a1a]/80 border-t border-gray-700/30 px-6 py-4 flex items-center justify-end gap-3 flex-shrink-0",children:[a.jsx("button",{onClick:()=>K(!1),className:"bg-[#1a1a1a] border border-gray-600/50 hover:border-gray-500 hover:bg-[#242424] text-white px-4 py-2 rounded-lg font-semibold text-sm transition-all",children:"Cancelar"}),a.jsx("button",{onClick:()=>K(!1),className:"bg-gradient-to-r from-[#bb86fc] to-[#9966dd] hover:from-[#9966dd] hover:to-[#7744cc] text-white px-4 py-2 rounded-lg font-semibold text-sm transition-all shadow-lg shadow-[#bb86fc]/40 hover:shadow-[#bb86fc]/60",children:"Confirmar"})]})]})}),Q&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:a.jsxs("div",{className:"bg-gradient-to-b from-[#1f1f1f] to-[#121212] rounded-2xl border border-gray-700/40 w-full max-w-md shadow-2xl",children:[a.jsxs("div",{className:"bg-gradient-to-b from-[#2a2a2a]/80 to-[#1f1f1f]/80 border-b border-gray-700/30 px-6 py-4 flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-gradient-to-br from-[#bb86fc] to-[#9966dd] rounded-lg shadow-lg shadow-[#bb86fc]/30",children:a.jsx($x,{className:"w-5 h-5 text-white"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-xl font-bold text-white",children:"Configurar Subida"}),a.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:"Tamaño de lote de imágenes"})]})]}),a.jsx("button",{onClick:()=>oe(!1),className:"text-gray-500 hover:text-white transition-colors p-1.5 rounded-lg hover:bg-white/10",children:a.jsx(gt,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"p-6 space-y-4",children:[a.jsxs("div",{className:"bg-[#1a1a1a] border border-gray-700/40 rounded-lg p-4 mb-4",children:[a.jsx("h3",{className:"text-xs font-semibold text-gray-300 mb-2",children:"Opciones disponibles:"}),a.jsxs("ul",{className:"text-xs text-gray-400 space-y-1.5",children:[a.jsx("li",{children:"• 1 por lote: Más lento pero más estable"}),a.jsx("li",{children:"• 10 por lote: Balance entre velocidad y estabilidad (predeterminado)"}),a.jsx("li",{children:"• 50 por lote: Más rápido para muchas imágenes"}),a.jsx("li",{children:"• Sin límite: Sube todas las imágenes simultáneamente"})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsx("button",{onClick:()=>{Ie(1),lu(1)},className:`p-4 rounded-lg border-2 transition-all ${ce===1?"border-[#bb86fc] bg-[#bb86fc]/10 shadow-lg shadow-[#bb86fc]/30":"border-gray-600/50 hover:border-gray-600 bg-[#1a1a1a]"}`,children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"text-2xl font-bold text-white mb-1",children:"1"}),a.jsx("div",{className:"text-xs text-gray-400",children:"Por lote"})]})}),a.jsx("button",{onClick:()=>{Ie(10),lu(10)},className:`p-4 rounded-lg border-2 transition-all ${ce===10?"border-[#bb86fc] bg-[#bb86fc]/10 shadow-lg shadow-[#bb86fc]/30":"border-gray-600/50 hover:border-gray-600 bg-[#1a1a1a]"}`,children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"text-2xl font-bold text-white mb-1",children:"10"}),a.jsx("div",{className:"text-xs text-gray-400",children:"Por lote"})]})}),a.jsx("button",{onClick:()=>{Ie(50),lu(50)},className:`p-4 rounded-lg border-2 transition-all ${ce===50?"border-[#bb86fc] bg-[#bb86fc]/10 shadow-lg shadow-[#bb86fc]/30":"border-gray-600/50 hover:border-gray-600 bg-[#1a1a1a]"}`,children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"text-2xl font-bold text-white mb-1",children:"50"}),a.jsx("div",{className:"text-xs text-gray-400",children:"Por lote"})]})}),a.jsx("button",{onClick:()=>{Ie(0),lu(999999)},className:`p-4 rounded-lg border-2 transition-all ${ce===0||ce>=999999?"border-[#bb86fc] bg-[#bb86fc]/10 shadow-lg shadow-[#bb86fc]/30":"border-gray-600/50 hover:border-gray-600 bg-[#1a1a1a]"}`,children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"text-2xl font-bold text-white mb-1",children:"∞"}),a.jsx("div",{className:"text-xs text-gray-400",children:"Sin límite"})]})})]}),a.jsx("div",{className:"bg-green-500/10 border border-green-500/30 rounded-lg p-3",children:a.jsxs("p",{className:"text-green-400 text-xs font-semibold",children:["Configuración guardada: ",ce===0||ce>=999999?"Sin límite":`${ce} imagen${ce!==1?"es":""} por lote`]})}),a.jsx("button",{onClick:()=>oe(!1),className:"w-full bg-gradient-to-r from-[#bb86fc] to-[#9966dd] hover:from-[#9966dd] hover:to-[#7744cc] text-white px-4 py-3 rounded-lg font-semibold text-sm transition-all shadow-lg shadow-[#bb86fc]/40 hover:shadow-[#bb86fc]/60",children:"Cerrar"})]})]})}),a.jsx(Nm,{isOpen:!!te,onClose:()=>it(null),onConfirm:()=>{te&&(Pt(te),it(null))},title:"Subida Masiva",message:`Estás a punto de subir ${te==null?void 0:te.length} archivos TXT. Se creará un manga por cada archivo usando la información de Autor y Categorías actual.`,confirmText:"Empezar Subida"}),a.jsx(Nm,{isOpen:pt,onClose:()=>Vt(!1),onConfirm:()=>{s&&i&&(i(s.id),n())},title:"Eliminar Manga",message:"¿Estás seguro de que deseas eliminar este manga? Esta acción no se puede deshacer y se borrarán todos sus capítulos.",confirmText:"Eliminar permanentemente",variant:"danger"})]}):null}const L2="settings",O2="announcement";async function Cw(t,e){const n=Nt(je,L2,O2),r=new Date;let s=null;e&&(s=new Date(r.getTime()+e).toISOString());const i={text:t,updatedAt:r.toISOString(),expiresAt:s};await QS(n,i)}function hM(t){const e=Nt(je,L2,O2);return N0(e,n=>{n.exists()?t(n.data()):t(null)})}async function fM(t){let e=0,n=0;try{const r=Mt(je,"mangas"),i=(await hn(r)).docs;let o=0;for(const l of i){const c=l.data(),u=l.id;o++,t&&t(c.title||u,o,i.length);try{const h=Vn(Mt(je,"chapters"),mr("manga_id","==",u)),f=await hn(h);for(const m of f.docs){const p=m.data(),y=p.pages||[],_=p.original_pages||[],C=p.page_formats||[];if(y.length===0)continue;const v=[];for(let M=0;MM.pageNum-T.pageNum);const w=v.map(M=>M.url),E=v.map(M=>M.originalUrl),D=v.map(M=>M.format);await tr(Nt(je,"chapters",m.id),{pages:w,original_pages:E,page_formats:D})}e++}catch(h){console.error(`Error processing chapter for manga ${u}`,h),n++}}return{updated:e,errors:n}}catch(r){throw console.error("Error fetching mangas for reorder: ",r),r}}function pM({isOpen:t,onClose:e,isAdmin:n,onAdminChange:r,isCategoryPlusEnabled:s,onCategoryPlusChange:i,isCopyIdsEnabled:o,onCopyIdsChange:l,isDeletePlusEnabled:c,onDeletePlusChange:u,isCategoryMinusEnabled:h,onCategoryMinusChange:f,isEditTitlePlusEnabled:m,onEditTitlePlusChange:p,isEtiquetadoraEnabled:y,onEtiquetadoraChange:_,isFolderPlusEnabled:C,onFolderPlusChange:v,isPortalPlusEnabled:w,onPortalPlusChange:E,isFolderAnimationEnabled:D,onFolderAnimationChange:M,isMergePlusEnabled:T,onMergePlusChange:S,isTransferPlusEnabled:x,onTransferPlusChange:N,onOpenTitleManager:A,onOpenFolderMap:I,onCleanKemonoTitles:P}){const[k,B]=L.useState(""),[z,W]=L.useState(24),[ee,F]=L.useState("hours"),[K,R]=L.useState(!1),[ne,pe]=L.useState(!1),[O,Q]=L.useState({current:0,total:0,title:""});L.useEffect(()=>{},[t]);const oe=async()=>{if(!k.trim()){we.error("El texto del anuncio no puede estar vacío");return}let te=0;ee==="seconds"&&(te=z*1e3),ee==="minutes"&&(te=z*60*1e3),ee==="hours"&&(te=z*60*60*1e3),ee==="days"&&(te=z*24*60*60*1e3);try{await Cw(k,te),we.success("Anuncio publicado exitosamente"),B(""),e()}catch(it){console.error(it),we.error("Error al publicar el anuncio")}},ce=async()=>{try{await Cw("",null),B(""),R(!1),we.success("Anuncio eliminado.")}catch(te){console.error(te),we.error("Error al eliminar")}},Ie=async()=>{if(window.confirm("¿Seguro que quieres reordenar automáticamente TODAS las páginas de todos los mangas? Este proceso puede tardar un par de minutos.")){pe(!0),Q({current:0,total:0,title:"Iniciando..."});try{const te=await fM((it,pt,Vt)=>{Q({current:pt,total:Vt,title:it})});we.success(`Se reordenaron las páginas correctamente en ${te.updated} mangas (Errores: ${te.errors}).`)}catch(te){console.error(te),we.error("Ocurrió un error al reordenar las páginas.")}finally{pe(!1)}}};return t?a.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50 p-4 animate-in fade-in duration-200",children:a.jsxs("div",{className:"bg-[#121212] rounded-2xl border border-gray-800 w-full max-w-lg shadow-2xl overflow-hidden flex flex-col max-h-[90vh]",children:[a.jsxs("div",{className:"bg-[#1a1a1a] border-b border-gray-800 px-6 py-4 flex items-center justify-between sticky top-0 z-10",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-[#bb86fc]/10 rounded-lg text-[#bb86fc]",children:a.jsx(Z_,{className:"w-5 h-5"})}),a.jsx("h2",{className:"text-xl font-bold text-white",children:"Ajustes de Administrador"})]}),a.jsx("button",{onClick:e,className:"text-gray-400 hover:text-white transition-colors p-2 hover:bg-white/5 rounded-lg",children:a.jsx(gt,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"p-6 space-y-8 overflow-y-auto custom-scrollbar",children:[a.jsx("section",{className:"space-y-4",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`p-2 rounded-lg ${s?"bg-purple-500/10 text-purple-400":"bg-gray-800 text-gray-400"}`,children:a.jsx(Pr,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold text-white",children:"Categorías Plus"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Habilitar selección múltiple y edición masiva"})]})]}),a.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[a.jsx("input",{type:"checkbox",className:"sr-only peer",checked:s,onChange:te=>i(te.target.checked)}),a.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-purple-300 dark:peer-focus:ring-purple-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-[#bb86fc]"})]})]})}),a.jsx("section",{className:"space-y-4 pt-4 border-t border-gray-800",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`p-2 rounded-lg ${C?"bg-indigo-500/10 text-indigo-400":"bg-gray-800 text-gray-400"}`,children:a.jsx(Q_,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold text-white",children:"Carpetas Plus"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Habilitar selección para crear carpetas y agrupar mangas"})]})]}),a.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[a.jsx("input",{type:"checkbox",className:"sr-only peer",checked:C,onChange:te=>v(te.target.checked)}),a.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-indigo-300 dark:peer-focus:ring-indigo-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-indigo-500"})]})]})}),a.jsx("section",{className:"space-y-4 pt-4 border-t border-gray-800",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`p-2 rounded-lg ${w?"bg-cyan-500/10 text-cyan-400":"bg-gray-800 text-gray-400"}`,children:a.jsx(Dg,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold text-white",children:"Portal Plus"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Habilitar selección masiva para cambiar de sección (Patreon, OnlyFans, Flow)"})]})]}),a.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[a.jsx("input",{type:"checkbox",className:"sr-only peer",checked:w,onChange:te=>E(te.target.checked)}),a.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-cyan-300 dark:peer-focus:ring-cyan-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-cyan-500"})]})]})}),a.jsx("section",{className:"space-y-4 pt-4 border-t border-gray-800",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`p-2 rounded-lg ${T?"bg-emerald-500/10 text-emerald-400":"bg-gray-800 text-gray-400"}`,children:a.jsx(xd,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold text-white",children:"Unir Plus"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Habilitar selección de múltiples mangas para unirlos en uno"})]})]}),a.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[a.jsx("input",{type:"checkbox",className:"sr-only peer",checked:T,onChange:te=>S(te.target.checked)}),a.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-emerald-300 dark:peer-focus:ring-emerald-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-emerald-500"})]})]})}),a.jsx("section",{className:"space-y-4 pt-4 border-t border-gray-800",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`p-2 rounded-lg ${x?"bg-amber-500/10 text-amber-400":"bg-gray-800 text-gray-400"}`,children:a.jsx(Pr,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold text-white",children:"Transferencia Plus"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Habilitar selección de dos mangas para transferir páginas entre ellos"})]})]}),a.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[a.jsx("input",{type:"checkbox",className:"sr-only peer",checked:x,onChange:te=>N(te.target.checked)}),a.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-amber-300 dark:peer-focus:ring-amber-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-amber-500"})]})]})}),a.jsx("section",{className:"space-y-4 pt-4 border-t border-gray-800",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`p-2 rounded-lg ${h?"bg-orange-500/10 text-orange-400":"bg-gray-800 text-gray-400"}`,children:a.jsx(Pr,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold text-white",children:"Categorías Minus"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Habilitar eliminación masiva de categorías en mangas seleccionados"})]})]}),a.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[a.jsx("input",{type:"checkbox",className:"sr-only peer",checked:h,onChange:te=>f(te.target.checked)}),a.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-orange-300 dark:peer-focus:ring-orange-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-orange-500"})]})]})}),a.jsx("section",{className:"space-y-4 pt-4 border-t border-gray-800",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`p-2 rounded-lg ${m?"bg-pink-500/10 text-pink-400":"bg-gray-800 text-gray-400"}`,children:a.jsx(Yo,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold text-white",children:"Nombres Plus"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Habilitar selección masiva para editar títulos"})]})]}),a.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[a.jsx("input",{type:"checkbox",className:"sr-only peer",checked:m,onChange:te=>p(te.target.checked)}),a.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-pink-300 dark:peer-focus:ring-pink-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-pink-500"})]})]})}),a.jsx("section",{className:"space-y-4 pt-4 border-t border-gray-800",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`p-2 rounded-lg ${y?"bg-[#bb86fc]/10 text-[#bb86fc]":"bg-gray-800 text-gray-400"}`,children:a.jsx(vd,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold text-white",children:"Etiquetadora Plus"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Habilitar selección masiva para etiquetar clasificaciones (Sin censura, B/N, a color)"})]})]}),a.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[a.jsx("input",{type:"checkbox",className:"sr-only peer",checked:y,onChange:te=>_(te.target.checked)}),a.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-[#bb86fc]/30 dark:peer-focus:ring-[#bb86fc]/80 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-[#bb86fc]"})]})]})}),a.jsx("section",{className:"space-y-4 pt-4 border-t border-gray-800",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`p-2 rounded-lg ${o?"bg-blue-500/10 text-blue-400":"bg-gray-800 text-gray-400"}`,children:a.jsx(W_,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold text-white",children:"Copiar IDs Plus"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Habilitar selección masiva para copiar IDs"})]})]}),a.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[a.jsx("input",{type:"checkbox",className:"sr-only peer",checked:o,onChange:te=>l(te.target.checked)}),a.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-blue-300 dark:peer-focus:ring-blue-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-blue-500"})]})]})}),a.jsx("section",{className:"space-y-4 pt-4 border-t border-gray-800",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`p-2 rounded-lg ${c?"bg-red-500/10 text-red-500":"bg-gray-800 text-gray-400"}`,children:a.jsx(tn,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold text-white",children:"Eliminar Plus"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Habilitar selección masiva para eliminar mangas"})]})]}),a.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[a.jsx("input",{type:"checkbox",className:"sr-only peer",checked:c,onChange:te=>u(te.target.checked)}),a.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-red-300 dark:peer-focus:ring-red-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-red-500"})]})]})}),a.jsxs("section",{className:"space-y-4 pt-4 border-t border-gray-800",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[a.jsx("div",{className:"p-2 bg-red-500/10 rounded-lg text-red-500",children:a.jsx(Wp,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"tex-sm font-semibold text-white",children:"Gestión de Vistas"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Restablecer contadores de visualización"})]})]}),a.jsx("button",{onClick:async()=>{if(window.confirm("¿Seguro que quieres reiniciar las vistas de TODOS los mangas a 0? Esta acción no se puede deshacer."))try{await ND(),we.success("Vistas reiniciadas correctamente.")}catch(te){console.error(te),we.error("Error al reiniciar vistas.")}},className:"w-full bg-red-500/10 hover:bg-red-500/20 text-red-500 py-2.5 rounded-lg font-semibold text-sm transition-all border border-red-500/20 hover:border-red-500/40",children:"Reiniciar Vistas a 0"})]}),a.jsxs("section",{className:"space-y-4 pt-4 border-t border-gray-800",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[a.jsx("div",{className:"p-2 bg-blue-500/10 rounded-lg text-blue-400",children:a.jsx(Yo,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"tex-sm font-semibold text-white",children:"Gestor de Nombres"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Edición masiva rápida de títulos alfabéticamente"})]})]}),a.jsxs("button",{onClick:()=>{e(),A()},className:"w-full bg-blue-500/10 hover:bg-blue-500/20 text-blue-500 py-2.5 rounded-lg font-semibold text-sm transition-all border border-blue-500/20 hover:border-blue-500/40 flex items-center justify-center gap-2",children:[a.jsx(Yo,{className:"w-4 h-4"}),"Abrir Gestor de Nombres"]})]}),a.jsxs("section",{className:"space-y-4 pt-4 border-t border-gray-800",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[a.jsx("div",{className:"p-2 bg-indigo-500/10 rounded-lg text-indigo-400",children:a.jsx(Pr,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"tex-sm font-semibold text-white",children:"Mapa Mental de Carpetas"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Observa toda tu estructura de carpetas y cómics en un formato de mapa mental interconectado"})]})]}),a.jsxs("button",{onClick:()=>{e(),I()},className:"w-full bg-indigo-500/10 hover:bg-indigo-500/20 text-indigo-400 py-2.5 rounded-lg font-semibold text-sm transition-all border border-indigo-500/20 hover:border-indigo-500/40 flex items-center justify-center gap-2",children:[a.jsx(Pr,{className:"w-4 h-4"}),"Abrir Mapa Mental"]})]}),a.jsxs("section",{className:"space-y-4 pt-4 border-t border-gray-800",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[a.jsx("div",{className:"p-2 bg-yellow-500/10 rounded-lg text-yellow-500",children:a.jsx(Fx,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"tex-sm font-semibold text-white",children:"Limpiador Kemono"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Elimina el patrón [12345] del final de todos los nombres en la base de datos automáticamente"})]})]}),a.jsxs("button",{onClick:P,className:"w-full bg-yellow-500/10 hover:bg-yellow-500/20 text-yellow-500 py-2.5 rounded-lg font-semibold text-sm transition-all border border-yellow-500/20 hover:border-yellow-500/40 flex items-center justify-center gap-2",children:[a.jsx(Fx,{className:"w-4 h-4"}),"Limpiar IDs [Numeros]"]})]}),a.jsxs("section",{className:"space-y-4 pt-4 border-t border-gray-800",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[a.jsx("div",{className:"p-2 bg-emerald-500/10 rounded-lg text-emerald-500",children:a.jsx(Pr,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"tex-sm font-semibold text-white",children:"Ordenar Páginas Plus"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Reordena las páginas desordenadas analizando los archivos originales."})]})]}),a.jsx("button",{onClick:Ie,disabled:ne,className:`w-full py-2.5 rounded-lg font-semibold text-sm transition-all border flex items-center justify-center gap-2 ${ne?"bg-emerald-500/5 text-emerald-500/50 border-emerald-500/10 cursor-not-allowed":"bg-emerald-500/10 hover:bg-emerald-500/20 text-emerald-500 border-emerald-500/20 hover:border-emerald-500/40"}`,children:ne?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"w-4 h-4 border-2 border-emerald-500/30 border-t-emerald-500 rounded-full animate-spin"}),"Procesando ",O.current," / ",O.total," - ",O.title.substring(0,20),"..."]}):"Reordenar Todas Las Páginas Automáticamente"})]}),a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"h-px bg-gray-800"}),a.jsxs("section",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[a.jsx("div",{className:"p-2 bg-purple-500/10 rounded-lg text-purple-400",children:a.jsx(X_,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"tex-sm font-semibold text-white",children:"Publicar Anuncio"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Visible para todos los usuarios"})]})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("textarea",{value:k,onChange:te=>B(te.target.value),placeholder:"Escribe el mensaje del anuncio...",className:"w-full bg-[#1a1a1a] border border-gray-700 rounded-lg px-4 py-3 text-sm text-white placeholder-gray-600 focus:outline-none focus:border-[#bb86fc] min-h-[100px] resize-none"}),a.jsxs("div",{className:"flex gap-3",children:[a.jsxs("div",{className:"flex-1 bg-[#1a1a1a] border border-gray-700 rounded-lg px-3 py-2 flex items-center gap-2",children:[a.jsx(LI,{className:"w-4 h-4 text-gray-400"}),a.jsx("input",{type:"number",min:"1",value:z,onChange:te=>W(Number(te.target.value)),className:"bg-transparent text-white text-sm w-full focus:outline-none"})]}),a.jsxs("select",{value:ee,onChange:te=>F(te.target.value),className:"bg-[#1a1a1a] border border-gray-700 rounded-lg px-3 py-2 text-sm text-white focus:outline-none focus:border-[#bb86fc]",children:[a.jsx("option",{value:"seconds",children:"Segundos"}),a.jsx("option",{value:"minutes",children:"Minutos"}),a.jsx("option",{value:"hours",children:"Horas"}),a.jsx("option",{value:"days",children:"Días"})]})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:()=>R(!0),className:"px-4 py-2.5 rounded-lg font-semibold text-sm bg-red-500/10 text-red-500 border border-red-500/20 hover:bg-red-500/20 transition-colors",title:"Eliminar anuncio",children:a.jsx(tn,{className:"w-5 h-5"})}),a.jsx("button",{onClick:oe,className:"flex-1 bg-gradient-to-r from-[#bb86fc] to-[#9966dd] hover:from-[#9966dd] hover:to-[#7744cc] text-white py-2.5 rounded-lg font-semibold text-sm transition-all shadow-lg shadow-[#bb86fc]/20",children:"Publicar Anuncio"})]})]})]})]})]}),K&&a.jsx("div",{className:"absolute inset-0 bg-black/80 backdrop-blur-sm flex items-center justify-center z-50 p-6 animate-in fade-in duration-200",children:a.jsx("div",{className:"bg-[#1a1a1a] border border-gray-700 w-full max-w-sm rounded-xl shadow-2xl p-6 transform scale-100 animate-in zoom-in-95 duration-200",children:a.jsxs("div",{className:"flex flex-col items-center text-center gap-4",children:[a.jsx("div",{className:"p-3 bg-red-500/10 rounded-full text-red-500",children:a.jsx(tn,{className:"w-8 h-8"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-bold text-white mb-1",children:"¿Eliminar anuncio?"}),a.jsx("p",{className:"text-sm text-gray-400",children:"Esta acción eliminará el anuncio actual inmediatamente. No se puede deshacer."})]}),a.jsxs("div",{className:"flex gap-3 w-full mt-2",children:[a.jsx("button",{onClick:()=>R(!1),className:"flex-1 px-4 py-2 rounded-lg text-sm font-semibold text-gray-300 hover:bg-gray-800 transition-colors",children:"Cancelar"}),a.jsx("button",{onClick:ce,className:"flex-1 px-4 py-2 rounded-lg text-sm font-semibold bg-red-500 hover:bg-red-600 text-white transition-colors shadow-lg shadow-red-500/20",children:"Eliminar"})]})]})})})]})}):null}function mM({isAdmin:t}){const[e,n]=L.useState(""),[r,s]=L.useState(null),[i,o]=L.useState(""),[l,c]=L.useState(!0);return L.useEffect(()=>{const u=hM(h=>{h?(n(h.text),s(h.expiresAt)):(n(""),s(null)),c(!1)});return()=>u()},[]),L.useEffect(()=>{if(!r){o("");return}const u=setInterval(()=>{const h=new Date().getTime(),m=new Date(r).getTime()-h;if(m<=0)n(""),s(null),clearInterval(u);else{const p=Math.floor(m/864e5),y=Math.floor(m%(1e3*60*60*24)/(1e3*60*60)),_=Math.floor(m%(1e3*60*60)/(1e3*60)),C=Math.floor(m%(1e3*60)/1e3);let v="";p>0&&(v+=`${p}d `),v+=`${y.toString().padStart(2,"0")}h ${_.toString().padStart(2,"0")}m ${C.toString().padStart(2,"0")}s`,o(v)}},1e3);return()=>clearInterval(u)},[r]),!e&&!l||!e?null:a.jsx("div",{className:"w-full max-w-[1800px] mx-auto px-4 sm:px-6 md:px-12 mt-6 mb-8 animate-in fade-in slide-in-from-top-4 duration-500 flex justify-center",children:a.jsxs("div",{className:"bg-gradient-to-r from-[#bb86fc]/20 to-[#121212] border border-[#bb86fc]/30 rounded-xl p-6 flex flex-col items-center gap-4 shadow-lg shadow-[#bb86fc]/10 relative group backdrop-blur-sm max-w-2xl w-full text-center",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2.5 bg-[#bb86fc]/20 rounded-lg animate-pulse",children:a.jsx(X_,{className:"w-6 h-6 text-[#bb86fc]"})}),a.jsxs("h3",{className:"text-sm font-bold text-[#bb86fc] uppercase tracking-wider flex items-center gap-2",children:["Información Importante",a.jsx("span",{className:"w-2 h-2 rounded-full bg-[#bb86fc] animate-ping"})]})]}),a.jsx("div",{className:"text-base text-gray-200 leading-relaxed whitespace-pre-wrap font-medium max-w-lg",children:e}),i&&a.jsxs("div",{className:"flex items-center gap-2 text-xs font-mono text-gray-400 bg-black/30 px-3 py-1.5 rounded-full border border-gray-800",children:[a.jsx(BI,{className:"w-3.5 h-3.5"}),a.jsxs("span",{children:["Expira en: ",i]})]})]})})}const V2=()=>"",Ks=t=>{if(!t)return;if(t.startsWith("blob:")||t.startsWith("data:"))return t;const e=V2(),n=new URLSearchParams({url:t,width:"600",quality:"85",format:"webp"});return`${e}/api/image-proxy?${n.toString()}`},gM=(t,e)=>{if(!t)return"";if(t.startsWith("blob:")||t.startsWith("data:"))return t;const n=V2(),r=new URLSearchParams({url:t});return`${n}/api/image-proxy?${r.toString()}`};function Aw(t){return t!==null&&typeof t=="object"&&"constructor"in t&&t.constructor===Object}function F0(t={},e={}){const n=["__proto__","constructor","prototype"];Object.keys(e).filter(r=>n.indexOf(r)<0).forEach(r=>{typeof t[r]>"u"?t[r]=e[r]:Aw(e[r])&&Aw(t[r])&&Object.keys(e[r]).length>0&&F0(t[r],e[r])})}const F2={body:{},addEventListener(){},removeEventListener(){},activeElement:{blur(){},nodeName:""},querySelector(){return null},querySelectorAll(){return[]},getElementById(){return null},createEvent(){return{initEvent(){}}},createElement(){return{children:[],childNodes:[],style:{},setAttribute(){},getElementsByTagName(){return[]}}},createElementNS(){return{}},importNode(){return null},location:{hash:"",host:"",hostname:"",href:"",origin:"",pathname:"",protocol:"",search:""}};function yo(){const t=typeof document<"u"?document:{};return F0(t,F2),t}const yM={document:F2,navigator:{userAgent:""},location:{hash:"",host:"",hostname:"",href:"",origin:"",pathname:"",protocol:"",search:""},history:{replaceState(){},pushState(){},go(){},back(){}},CustomEvent:function(){return this},addEventListener(){},removeEventListener(){},getComputedStyle(){return{getPropertyValue(){return""}}},Image(){},Date(){},screen:{},setTimeout(){},clearTimeout(){},matchMedia(){return{}},requestAnimationFrame(t){return typeof setTimeout>"u"?(t(),null):setTimeout(t,0)},cancelAnimationFrame(t){typeof setTimeout>"u"||clearTimeout(t)}};function Un(){const t=typeof window<"u"?window:{};return F0(t,yM),t}function xM(t=""){return t.trim().split(" ").filter(e=>!!e.trim())}function vM(t){const e=t;Object.keys(e).forEach(n=>{try{e[n]=null}catch{}try{delete e[n]}catch{}})}function z2(t,e=0){return setTimeout(t,e)}function Bd(){return Date.now()}function wM(t){const e=Un();let n;return e.getComputedStyle&&(n=e.getComputedStyle(t,null)),!n&&t.currentStyle&&(n=t.currentStyle),n||(n=t.style),n}function bM(t,e="x"){const n=Un();let r,s,i;const o=wM(t);return n.WebKitCSSMatrix?(s=o.transform||o.webkitTransform,s.split(",").length>6&&(s=s.split(", ").map(l=>l.replace(",",".")).join(", ")),i=new n.WebKitCSSMatrix(s==="none"?"":s)):(i=o.MozTransform||o.OTransform||o.MsTransform||o.msTransform||o.transform||o.getPropertyValue("transform").replace("translate(","matrix(1, 0, 0, 1,"),r=i.toString().split(",")),e==="x"&&(n.WebKitCSSMatrix?s=i.m41:r.length===16?s=parseFloat(r[12]):s=parseFloat(r[4])),e==="y"&&(n.WebKitCSSMatrix?s=i.m42:r.length===16?s=parseFloat(r[13]):s=parseFloat(r[5])),s||0}function xu(t){return typeof t=="object"&&t!==null&&t.constructor&&Object.prototype.toString.call(t).slice(8,-1)==="Object"}function _M(t){return typeof window<"u"&&typeof window.HTMLElement<"u"?t instanceof HTMLElement:t&&(t.nodeType===1||t.nodeType===11)}function lr(...t){const e=Object(t[0]);for(let n=1;ni!=="__proto__"&&i!=="constructor"&&i!=="prototype");for(let i=0,o=s.length;is?"next":"prev",u=(f,m)=>c==="next"&&f>=m||c==="prev"&&f<=m,h=()=>{o=new Date().getTime(),i===null&&(i=o);const f=Math.max(Math.min((o-i)/l,1),0),m=.5-Math.cos(f*Math.PI)/2;let p=s+m*(e-s);if(u(p,e)&&(p=e),t.wrapperEl.scrollTo({[n]:p}),u(p,e)){t.wrapperEl.style.overflow="hidden",t.wrapperEl.style.scrollSnapType="",setTimeout(()=>{t.wrapperEl.style.overflow="",t.wrapperEl.scrollTo({[n]:p})}),r.cancelAnimationFrame(t.cssModeFrameID);return}t.cssModeFrameID=r.requestAnimationFrame(h)};h()}function z0(t){return t.querySelector(".swiper-slide-transform")||t.shadowRoot&&t.shadowRoot.querySelector(".swiper-slide-transform")||t}function bs(t,e=""){const n=Un(),r=[...t.children];return n.HTMLSlotElement&&t instanceof HTMLSlotElement&&r.push(...t.assignedElements()),e?r.filter(s=>s.matches(e)):r}function EM(t,e){const n=[e];for(;n.length>0;){const r=n.shift();if(t===r)return!0;n.push(...r.children,...r.shadowRoot?r.shadowRoot.children:[],...r.assignedElements?r.assignedElements():[])}}function SM(t,e){const n=Un();let r=e.contains(t);return!r&&n.HTMLSlotElement&&e instanceof HTMLSlotElement&&(r=[...e.assignedElements()].includes(t),r||(r=EM(t,e))),r}function $d(t){try{console.warn(t);return}catch{}}function Hd(t,e=[]){const n=document.createElement(t);return n.classList.add(...Array.isArray(e)?e:xM(e)),n}function TM(t,e){const n=[];for(;t.previousElementSibling;){const r=t.previousElementSibling;e?r.matches(e)&&n.push(r):n.push(r),t=r}return n}function NM(t,e){const n=[];for(;t.nextElementSibling;){const r=t.nextElementSibling;e?r.matches(e)&&n.push(r):n.push(r),t=r}return n}function si(t,e){return Un().getComputedStyle(t,null).getPropertyValue(e)}function jw(t){let e=t,n;if(e){for(n=0;(e=e.previousSibling)!==null;)e.nodeType===1&&(n+=1);return n}}function kM(t,e){const n=[];let r=t.parentElement;for(;r;)n.push(r),r=r.parentElement;return n}function IM(t,e){function n(r){r.target===t&&(e.call(t,r),t.removeEventListener("transitionend",n))}e&&t.addEventListener("transitionend",n)}function Pw(t,e,n){const r=Un();return t[e==="width"?"offsetWidth":"offsetHeight"]+parseFloat(r.getComputedStyle(t,null).getPropertyValue(e==="width"?"margin-right":"margin-top"))+parseFloat(r.getComputedStyle(t,null).getPropertyValue(e==="width"?"margin-left":"margin-bottom"))}function CM(t){return e=>Math.abs(e)>0&&t.browser&&t.browser.need3dFix&&Math.abs(e)%90===0?e+.001:e}function Rw(t,e=""){typeof trustedTypes<"u"?t.innerHTML=trustedTypes.createPolicy("html",{createHTML:n=>n}).createHTML(e):t.innerHTML=e}let Mf;function AM(){const t=Un(),e=yo();return{smoothScroll:e.documentElement&&e.documentElement.style&&"scrollBehavior"in e.documentElement.style,touch:!!("ontouchstart"in t||t.DocumentTouch&&e instanceof t.DocumentTouch)}}function B2(){return Mf||(Mf=AM()),Mf}let Lf;function jM({userAgent:t}={}){const e=B2(),n=Un(),r=n.navigator.platform,s=t||n.navigator.userAgent,i={ios:!1,android:!1},o=n.screen.width,l=n.screen.height,c=s.match(/(Android);?[\s\/]+([\d.]+)?/);let u=s.match(/(iPad)(?!\1).*OS\s([\d_]+)/);const h=s.match(/(iPod)(.*OS\s([\d_]+))?/),f=!u&&s.match(/(iPhone\sOS|iOS)\s([\d_]+)/),m=r==="Win32";let p=r==="MacIntel";const y=["1024x1366","1366x1024","834x1194","1194x834","834x1112","1112x834","768x1024","1024x768","820x1180","1180x820","810x1080","1080x810"];return!u&&p&&e.touch&&y.indexOf(`${o}x${l}`)>=0&&(u=s.match(/(Version)\/([\d.]+)/),u||(u=[0,1,"13_0_0"]),p=!1),c&&!m&&(i.os="android",i.android=!0),(u||f||h)&&(i.os="ios",i.ios=!0),i}function $2(t={}){return Lf||(Lf=jM(t)),Lf}let Of;function PM(){const t=Un(),e=$2();let n=!1;function r(){const l=t.navigator.userAgent.toLowerCase();return l.indexOf("safari")>=0&&l.indexOf("chrome")<0&&l.indexOf("android")<0}if(r()){const l=String(t.navigator.userAgent);if(l.includes("Version/")){const[c,u]=l.split("Version/")[1].split(" ")[0].split(".").map(h=>Number(h));n=c<16||c===16&&u<2}}const s=/(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(t.navigator.userAgent),i=r(),o=i||s&&e.ios;return{isSafari:n||i,needPerspectiveFix:n,need3dFix:o,isWebView:s}}function H2(){return Of||(Of=PM()),Of}function RM({swiper:t,on:e,emit:n}){const r=Un();let s=null,i=null;const o=()=>{!t||t.destroyed||!t.initialized||(n("beforeResize"),n("resize"))},l=()=>{!t||t.destroyed||!t.initialized||(s=new ResizeObserver(h=>{i=r.requestAnimationFrame(()=>{const{width:f,height:m}=t;let p=f,y=m;h.forEach(({contentBoxSize:_,contentRect:C,target:v})=>{v&&v!==t.el||(p=C?C.width:(_[0]||_).inlineSize,y=C?C.height:(_[0]||_).blockSize)}),(p!==f||y!==m)&&o()})}),s.observe(t.el))},c=()=>{i&&r.cancelAnimationFrame(i),s&&s.unobserve&&t.el&&(s.unobserve(t.el),s=null)},u=()=>{!t||t.destroyed||!t.initialized||n("orientationchange")};e("init",()=>{if(t.params.resizeObserver&&typeof r.ResizeObserver<"u"){l();return}r.addEventListener("resize",o),r.addEventListener("orientationchange",u)}),e("destroy",()=>{c(),r.removeEventListener("resize",o),r.removeEventListener("orientationchange",u)})}function DM({swiper:t,extendParams:e,on:n,emit:r}){const s=[],i=Un(),o=(u,h={})=>{const f=i.MutationObserver||i.WebkitMutationObserver,m=new f(p=>{if(t.__preventObserver__)return;if(p.length===1){r("observerUpdate",p[0]);return}const y=function(){r("observerUpdate",p[0])};i.requestAnimationFrame?i.requestAnimationFrame(y):i.setTimeout(y,0)});m.observe(u,{attributes:typeof h.attributes>"u"?!0:h.attributes,childList:t.isElement||(typeof h.childList>"u"?!0:h).childList,characterData:typeof h.characterData>"u"?!0:h.characterData}),s.push(m)},l=()=>{if(t.params.observer){if(t.params.observeParents){const u=kM(t.hostEl);for(let h=0;h{s.forEach(u=>{u.disconnect()}),s.splice(0,s.length)};e({observer:!1,observeParents:!1,observeSlideChildren:!1}),n("init",l),n("destroy",c)}var MM={on(t,e,n){const r=this;if(!r.eventsListeners||r.destroyed||typeof e!="function")return r;const s=n?"unshift":"push";return t.split(" ").forEach(i=>{r.eventsListeners[i]||(r.eventsListeners[i]=[]),r.eventsListeners[i][s](e)}),r},once(t,e,n){const r=this;if(!r.eventsListeners||r.destroyed||typeof e!="function")return r;function s(...i){r.off(t,s),s.__emitterProxy&&delete s.__emitterProxy,e.apply(r,i)}return s.__emitterProxy=e,r.on(t,s,n)},onAny(t,e){const n=this;if(!n.eventsListeners||n.destroyed||typeof t!="function")return n;const r=e?"unshift":"push";return n.eventsAnyListeners.indexOf(t)<0&&n.eventsAnyListeners[r](t),n},offAny(t){const e=this;if(!e.eventsListeners||e.destroyed||!e.eventsAnyListeners)return e;const n=e.eventsAnyListeners.indexOf(t);return n>=0&&e.eventsAnyListeners.splice(n,1),e},off(t,e){const n=this;return!n.eventsListeners||n.destroyed||!n.eventsListeners||t.split(" ").forEach(r=>{typeof e>"u"?n.eventsListeners[r]=[]:n.eventsListeners[r]&&n.eventsListeners[r].forEach((s,i)=>{(s===e||s.__emitterProxy&&s.__emitterProxy===e)&&n.eventsListeners[r].splice(i,1)})}),n},emit(...t){const e=this;if(!e.eventsListeners||e.destroyed||!e.eventsListeners)return e;let n,r,s;return typeof t[0]=="string"||Array.isArray(t[0])?(n=t[0],r=t.slice(1,t.length),s=e):(n=t[0].events,r=t[0].data,s=t[0].context||e),r.unshift(s),(Array.isArray(n)?n:n.split(" ")).forEach(o=>{e.eventsAnyListeners&&e.eventsAnyListeners.length&&e.eventsAnyListeners.forEach(l=>{l.apply(s,[o,...r])}),e.eventsListeners&&e.eventsListeners[o]&&e.eventsListeners[o].forEach(l=>{l.apply(s,r)})}),e}};function LM(){const t=this;let e,n;const r=t.el;typeof t.params.width<"u"&&t.params.width!==null?e=t.params.width:e=r.clientWidth,typeof t.params.height<"u"&&t.params.height!==null?n=t.params.height:n=r.clientHeight,!(e===0&&t.isHorizontal()||n===0&&t.isVertical())&&(e=e-parseInt(si(r,"padding-left")||0,10)-parseInt(si(r,"padding-right")||0,10),n=n-parseInt(si(r,"padding-top")||0,10)-parseInt(si(r,"padding-bottom")||0,10),Number.isNaN(e)&&(e=0),Number.isNaN(n)&&(n=0),Object.assign(t,{width:e,height:n,size:t.isHorizontal()?e:n}))}function OM(){const t=this;function e(A,I){return parseFloat(A.getPropertyValue(t.getDirectionLabel(I))||0)}const n=t.params,{wrapperEl:r,slidesEl:s,rtlTranslate:i,wrongRTL:o}=t,l=t.virtual&&n.virtual.enabled,c=l?t.virtual.slides.length:t.slides.length,u=bs(s,`.${t.params.slideClass}, swiper-slide`),h=l?t.virtual.slides.length:u.length;let f=[];const m=[],p=[];let y=n.slidesOffsetBefore;typeof y=="function"&&(y=n.slidesOffsetBefore.call(t));let _=n.slidesOffsetAfter;typeof _=="function"&&(_=n.slidesOffsetAfter.call(t));const C=t.snapGrid.length,v=t.slidesGrid.length,w=t.size-y-_;let E=n.spaceBetween,D=-y,M=0,T=0;if(typeof w>"u")return;typeof E=="string"&&E.indexOf("%")>=0?E=parseFloat(E.replace("%",""))/100*w:typeof E=="string"&&(E=parseFloat(E)),t.virtualSize=-E-y-_,u.forEach(A=>{i?A.style.marginLeft="":A.style.marginRight="",A.style.marginBottom="",A.style.marginTop=""}),n.centeredSlides&&n.cssMode&&(So(r,"--swiper-centered-offset-before",""),So(r,"--swiper-centered-offset-after","")),n.cssMode&&(So(r,"--swiper-slides-offset-before",`${y}px`),So(r,"--swiper-slides-offset-after",`${_}px`));const S=n.grid&&n.grid.rows>1&&t.grid;S?t.grid.initSlides(u):t.grid&&t.grid.unsetSlides();let x;const N=n.slidesPerView==="auto"&&n.breakpoints&&Object.keys(n.breakpoints).filter(A=>typeof n.breakpoints[A].slidesPerView<"u").length>0;for(let A=0;A=0&&(z+=p[W]+(W1&&(I||f.push(t.virtualSize-w))}if(l&&n.loop){const A=p[0]+E;if(n.slidesPerGroup>1){const I=Math.ceil((t.virtual.slidesBefore+t.virtual.slidesAfter)/n.slidesPerGroup),P=A*n.slidesPerGroup;for(let k=0;k!n.cssMode||n.loop?!0:P!==u.length-1).forEach(I=>{I.style[A]=`${E}px`})}if(n.centeredSlides&&n.centeredSlidesBounds){let A=0;p.forEach(P=>{A+=P+(E||0)}),A-=E;const I=A>w?A-w:0;f=f.map(P=>P<=0?-y:P>I?I+_:P)}if(n.centerInsufficientSlides){let A=0;if(p.forEach(I=>{A+=I+(E||0)}),A-=E,A{f[k]=P-I}),m.forEach((P,k)=>{m[k]=P+I})}}if(Object.assign(t,{slides:u,snapGrid:f,slidesGrid:m,slidesSizesGrid:p}),n.centeredSlides&&n.cssMode&&!n.centeredSlidesBounds){So(r,"--swiper-centered-offset-before",`${-f[0]}px`),So(r,"--swiper-centered-offset-after",`${t.size/2-p[p.length-1]/2}px`);const A=-t.snapGrid[0],I=-t.slidesGrid[0];t.snapGrid=t.snapGrid.map(P=>P+A),t.slidesGrid=t.slidesGrid.map(P=>P+I)}if(h!==c&&t.emit("slidesLengthChange"),f.length!==C&&(t.params.watchOverflow&&t.checkOverflow(),t.emit("snapGridLengthChange")),m.length!==v&&t.emit("slidesGridLengthChange"),n.watchSlidesProgress&&t.updateSlidesOffset(),t.emit("slidesUpdated"),!l&&!n.cssMode&&(n.effect==="slide"||n.effect==="fade")){const A=`${n.containerModifierClass}backface-hidden`,I=t.el.classList.contains(A);h<=n.maxBackfaceHiddenSlides?I||t.el.classList.add(A):I&&t.el.classList.remove(A)}}function VM(t){const e=this,n=[],r=e.virtual&&e.params.virtual.enabled;let s=0,i;typeof t=="number"?e.setTransition(t):t===!0&&e.setTransition(e.params.speed);const o=l=>r?e.slides[e.getSlideIndexByData(l)]:e.slides[l];if(e.params.slidesPerView!=="auto"&&e.params.slidesPerView>1)if(e.params.centeredSlides)(e.visibleSlides||[]).forEach(l=>{n.push(l)});else for(i=0;ie.slides.length&&!r)break;n.push(o(l))}else n.push(o(e.activeIndex));for(i=0;is?l:s}(s||s===0)&&(e.wrapperEl.style.height=`${s}px`)}function FM(){const t=this,e=t.slides,n=t.isElement?t.isHorizontal()?t.wrapperEl.offsetLeft:t.wrapperEl.offsetTop:0;for(let r=0;r{e&&!t.classList.contains(n)?t.classList.add(n):!e&&t.classList.contains(n)&&t.classList.remove(n)};function zM(t=this&&this.translate||0){const e=this,n=e.params,{slides:r,rtlTranslate:s,snapGrid:i}=e;if(r.length===0)return;typeof r[0].swiperSlideOffset>"u"&&e.updateSlidesOffset();let o=-t;s&&(o=t),e.visibleSlidesIndexes=[],e.visibleSlides=[];let l=n.spaceBetween;typeof l=="string"&&l.indexOf("%")>=0?l=parseFloat(l.replace("%",""))/100*e.size:typeof l=="string"&&(l=parseFloat(l));for(let c=0;c=0&&p<=e.size-e.slidesSizesGrid[c],C=p>=0&&p1&&y<=e.size||p<=0&&y>=e.size;C&&(e.visibleSlides.push(u),e.visibleSlidesIndexes.push(c)),Dw(u,C,n.slideVisibleClass),Dw(u,_,n.slideFullyVisibleClass),u.progress=s?-f:f,u.originalProgress=s?-m:m}}function UM(t){const e=this;if(typeof t>"u"){const h=e.rtlTranslate?-1:1;t=e&&e.translate&&e.translate*h||0}const n=e.params,r=e.maxTranslate()-e.minTranslate();let{progress:s,isBeginning:i,isEnd:o,progressLoop:l}=e;const c=i,u=o;if(r===0)s=0,i=!0,o=!0;else{s=(t-e.minTranslate())/r;const h=Math.abs(t-e.minTranslate())<1,f=Math.abs(t-e.maxTranslate())<1;i=h||s<=0,o=f||s>=1,h&&(s=0),f&&(s=1)}if(n.loop){const h=e.getSlideIndexByData(0),f=e.getSlideIndexByData(e.slides.length-1),m=e.slidesGrid[h],p=e.slidesGrid[f],y=e.slidesGrid[e.slidesGrid.length-1],_=Math.abs(t);_>=m?l=(_-m)/y:l=(_+y-p)/y,l>1&&(l-=1)}Object.assign(e,{progress:s,progressLoop:l,isBeginning:i,isEnd:o}),(n.watchSlidesProgress||n.centeredSlides&&n.autoHeight)&&e.updateSlidesProgress(t),i&&!c&&e.emit("reachBeginning toEdge"),o&&!u&&e.emit("reachEnd toEdge"),(c&&!i||u&&!o)&&e.emit("fromEdge"),e.emit("progress",s)}const Vf=(t,e,n)=>{e&&!t.classList.contains(n)?t.classList.add(n):!e&&t.classList.contains(n)&&t.classList.remove(n)};function BM(){const t=this,{slides:e,params:n,slidesEl:r,activeIndex:s}=t,i=t.virtual&&n.virtual.enabled,o=t.grid&&n.grid&&n.grid.rows>1,l=f=>bs(r,`.${n.slideClass}${f}, swiper-slide${f}`)[0];let c,u,h;if(i)if(n.loop){let f=s-t.virtual.slidesBefore;f<0&&(f=t.virtual.slides.length+f),f>=t.virtual.slides.length&&(f-=t.virtual.slides.length),c=l(`[data-swiper-slide-index="${f}"]`)}else c=l(`[data-swiper-slide-index="${s}"]`);else o?(c=e.find(f=>f.column===s),h=e.find(f=>f.column===s+1),u=e.find(f=>f.column===s-1)):c=e[s];c&&(o||(h=NM(c,`.${n.slideClass}, swiper-slide`)[0],n.loop&&!h&&(h=e[0]),u=TM(c,`.${n.slideClass}, swiper-slide`)[0],n.loop&&!u===0&&(u=e[e.length-1]))),e.forEach(f=>{Vf(f,f===c,n.slideActiveClass),Vf(f,f===h,n.slideNextClass),Vf(f,f===u,n.slidePrevClass)}),t.emitSlidesClasses()}const Hu=(t,e)=>{if(!t||t.destroyed||!t.params)return;const n=()=>t.isElement?"swiper-slide":`.${t.params.slideClass}`,r=e.closest(n());if(r){let s=r.querySelector(`.${t.params.lazyPreloaderClass}`);!s&&t.isElement&&(r.shadowRoot?s=r.shadowRoot.querySelector(`.${t.params.lazyPreloaderClass}`):requestAnimationFrame(()=>{r.shadowRoot&&(s=r.shadowRoot.querySelector(`.${t.params.lazyPreloaderClass}`),s&&!s.lazyPreloaderManaged&&s.remove())})),s&&!s.lazyPreloaderManaged&&s.remove()}},Ff=(t,e)=>{if(!t.slides[e])return;const n=t.slides[e].querySelector('[loading="lazy"]');n&&n.removeAttribute("loading")},km=t=>{if(!t||t.destroyed||!t.params)return;let e=t.params.lazyPreloadPrevNext;const n=t.slides.length;if(!n||!e||e<0)return;e=Math.min(e,n);const r=t.params.slidesPerView==="auto"?t.slidesPerViewDynamic():Math.ceil(t.params.slidesPerView),s=t.activeIndex;if(t.params.grid&&t.params.grid.rows>1){const o=s,l=[o-e];l.push(...Array.from({length:e}).map((c,u)=>o+r+u)),t.slides.forEach((c,u)=>{l.includes(c.column)&&Ff(t,u)});return}const i=s+r-1;if(t.params.rewind||t.params.loop)for(let o=s-e;o<=i+e;o+=1){const l=(o%n+n)%n;(li)&&Ff(t,l)}else for(let o=Math.max(s-e,0);o<=Math.min(i+e,n-1);o+=1)o!==s&&(o>i||o=e[i]&&r=e[i]&&r=e[i]&&(s=i);return n.normalizeSlideIndex&&(s<0||typeof s>"u")&&(s=0),s}function HM(t){const e=this,n=e.rtlTranslate?e.translate:-e.translate,{snapGrid:r,params:s,activeIndex:i,realIndex:o,snapIndex:l}=e;let c=t,u;const h=p=>{let y=p-e.virtual.slidesBefore;return y<0&&(y=e.virtual.slides.length+y),y>=e.virtual.slides.length&&(y-=e.virtual.slides.length),y};if(typeof c>"u"&&(c=$M(e)),r.indexOf(n)>=0)u=r.indexOf(n);else{const p=Math.min(s.slidesPerGroupSkip,c);u=p+Math.floor((c-p)/s.slidesPerGroup)}if(u>=r.length&&(u=r.length-1),c===i&&!e.params.loop){u!==l&&(e.snapIndex=u,e.emit("snapIndexChange"));return}if(c===i&&e.params.loop&&e.virtual&&e.params.virtual.enabled){e.realIndex=h(c);return}const f=e.grid&&s.grid&&s.grid.rows>1;let m;if(e.virtual&&s.virtual.enabled)s.loop?m=h(c):m=c;else if(f){const p=e.slides.find(_=>_.column===c);let y=parseInt(p.getAttribute("data-swiper-slide-index"),10);Number.isNaN(y)&&(y=Math.max(e.slides.indexOf(p),0)),m=Math.floor(y/s.grid.rows)}else if(e.slides[c]){const p=e.slides[c].getAttribute("data-swiper-slide-index");p?m=parseInt(p,10):m=c}else m=c;Object.assign(e,{previousSnapIndex:l,snapIndex:u,previousRealIndex:o,realIndex:m,previousIndex:i,activeIndex:c}),e.initialized&&km(e),e.emit("activeIndexChange"),e.emit("snapIndexChange"),(e.initialized||e.params.runCallbacksOnInit)&&(o!==m&&e.emit("realIndexChange"),e.emit("slideChange"))}function qM(t,e){const n=this,r=n.params;let s=t.closest(`.${r.slideClass}, swiper-slide`);!s&&n.isElement&&e&&e.length>1&&e.includes(t)&&[...e.slice(e.indexOf(t)+1,e.length)].forEach(l=>{!s&&l.matches&&l.matches(`.${r.slideClass}, swiper-slide`)&&(s=l)});let i=!1,o;if(s){for(let l=0;lc?h=c:r&&ti?o="next":s"u"&&(e=i.params.speed);const _=Math.min(i.params.slidesPerGroupSkip,o);let C=_+Math.floor((o-_)/i.params.slidesPerGroup);C>=c.length&&(C=c.length-1);const v=-c[C];if(l.normalizeSlideIndex)for(let S=0;S=N&&x=N&&x=N&&(o=S)}if(i.initialized&&o!==f&&(!i.allowSlideNext&&(m?v>i.translate&&v>i.minTranslate():vi.translate&&v>i.maxTranslate()&&(f||0)!==o))return!1;o!==(h||0)&&n&&i.emit("beforeSlideChangeStart"),i.updateProgress(v);let w;o>f?w="next":o0?(i._cssModeVirtualInitialSet=!0,requestAnimationFrame(()=>{p[S?"scrollLeft":"scrollTop"]=x})):p[S?"scrollLeft":"scrollTop"]=x,E&&requestAnimationFrame(()=>{i.wrapperEl.style.scrollSnapType="",i._immediateVirtual=!1});else{if(!i.support.smoothScroll)return U2({swiper:i,targetPosition:x,side:S?"left":"top"}),!0;p.scrollTo({[S?"left":"top"]:x,behavior:"smooth"})}return!0}const T=H2().isSafari;return E&&!s&&T&&i.isElement&&i.virtual.update(!1,!1,o),i.setTransition(e),i.setTranslate(v),i.updateActiveIndex(o),i.updateSlidesClasses(),i.emit("beforeTransitionStart",e,r),i.transitionStart(n,w),e===0?i.transitionEnd(n,w):i.animating||(i.animating=!0,i.onSlideToWrapperTransitionEnd||(i.onSlideToWrapperTransitionEnd=function(x){!i||i.destroyed||x.target===this&&(i.wrapperEl.removeEventListener("transitionend",i.onSlideToWrapperTransitionEnd),i.onSlideToWrapperTransitionEnd=null,delete i.onSlideToWrapperTransitionEnd,i.transitionEnd(n,w))}),i.wrapperEl.addEventListener("transitionend",i.onSlideToWrapperTransitionEnd)),!0}function s3(t=0,e,n=!0,r){typeof t=="string"&&(t=parseInt(t,10));const s=this;if(s.destroyed)return;typeof e>"u"&&(e=s.params.speed);const i=s.grid&&s.params.grid&&s.params.grid.rows>1;let o=t;if(s.params.loop)if(s.virtual&&s.params.virtual.enabled)o=o+s.virtual.slidesBefore;else{let l;if(i){const _=o*s.params.grid.rows;l=s.slides.find(C=>C.getAttribute("data-swiper-slide-index")*1===_).column}else l=s.getSlideIndexByData(o);const c=i?Math.ceil(s.slides.length/s.params.grid.rows):s.slides.length,{centeredSlides:u,slidesOffsetBefore:h,slidesOffsetAfter:f}=s.params,m=u||!!h||!!f;let p=s.params.slidesPerView;p==="auto"?p=s.slidesPerViewDynamic():(p=Math.ceil(parseFloat(s.params.slidesPerView,10)),m&&p%2===0&&(p=p+1));let y=c-lC.getAttribute("data-swiper-slide-index")*1===_).column}else o=s.getSlideIndexByData(o)}return requestAnimationFrame(()=>{s.slideTo(o,e,n,r)}),s}function i3(t,e=!0,n){const r=this,{enabled:s,params:i,animating:o}=r;if(!s||r.destroyed)return r;typeof t>"u"&&(t=r.params.speed);let l=i.slidesPerGroup;i.slidesPerView==="auto"&&i.slidesPerGroup===1&&i.slidesPerGroupAuto&&(l=Math.max(r.slidesPerViewDynamic("current",!0),1));const c=r.activeIndex{r.slideTo(r.activeIndex+c,t,e,n)}),!0}return i.rewind&&r.isEnd?r.slideTo(0,t,e,n):r.slideTo(r.activeIndex+c,t,e,n)}function o3(t,e=!0,n){const r=this,{params:s,snapGrid:i,slidesGrid:o,rtlTranslate:l,enabled:c,animating:u}=r;if(!c||r.destroyed)return r;typeof t>"u"&&(t=r.params.speed);const h=r.virtual&&s.virtual.enabled;if(s.loop){if(u&&!h&&s.loopPreventsSliding)return!1;r.loopFix({direction:"prev"}),r._clientLeft=r.wrapperEl.clientLeft}const f=l?r.translate:-r.translate;function m(w){return w<0?-Math.floor(Math.abs(w)):Math.floor(w)}const p=m(f),y=i.map(w=>m(w)),_=s.freeMode&&s.freeMode.enabled;let C=i[y.indexOf(p)-1];if(typeof C>"u"&&(s.cssMode||_)){let w;i.forEach((E,D)=>{p>=E&&(w=D)}),typeof w<"u"&&(C=_?i[w]:i[w>0?w-1:w])}let v=0;if(typeof C<"u"&&(v=o.indexOf(C),v<0&&(v=r.activeIndex-1),s.slidesPerView==="auto"&&s.slidesPerGroup===1&&s.slidesPerGroupAuto&&(v=v-r.slidesPerViewDynamic("previous",!0)+1,v=Math.max(v,0))),s.rewind&&r.isBeginning){const w=r.params.virtual&&r.params.virtual.enabled&&r.virtual?r.virtual.slides.length-1:r.slides.length-1;return r.slideTo(w,t,e,n)}else if(s.loop&&r.activeIndex===0&&s.cssMode)return requestAnimationFrame(()=>{r.slideTo(v,t,e,n)}),!0;return r.slideTo(v,t,e,n)}function a3(t,e=!0,n){const r=this;if(!r.destroyed)return typeof t>"u"&&(t=r.params.speed),r.slideTo(r.activeIndex,t,e,n)}function l3(t,e=!0,n,r=.5){const s=this;if(s.destroyed)return;typeof t>"u"&&(t=s.params.speed);let i=s.activeIndex;const o=Math.min(s.params.slidesPerGroupSkip,i),l=o+Math.floor((i-o)/s.params.slidesPerGroup),c=s.rtlTranslate?s.translate:-s.translate;if(c>=s.snapGrid[l]){const u=s.snapGrid[l],h=s.snapGrid[l+1];c-u>(h-u)*r&&(i+=s.params.slidesPerGroup)}else{const u=s.snapGrid[l-1],h=s.snapGrid[l];c-u<=(h-u)*r&&(i-=s.params.slidesPerGroup)}return i=Math.max(i,0),i=Math.min(i,s.slidesGrid.length-1),s.slideTo(i,t,e,n)}function c3(){const t=this;if(t.destroyed)return;const{params:e,slidesEl:n}=t,r=e.slidesPerView==="auto"?t.slidesPerViewDynamic():e.slidesPerView;let s=t.getSlideIndexWhenGrid(t.clickedIndex),i;const o=t.isElement?"swiper-slide":`.${e.slideClass}`,l=t.grid&&t.params.grid&&t.params.grid.rows>1;if(e.loop){if(t.animating)return;i=parseInt(t.clickedSlide.getAttribute("data-swiper-slide-index"),10),e.centeredSlides?t.slideToLoop(i):s>(l?(t.slides.length-r)/2-(t.params.grid.rows-1):t.slides.length-r)?(t.loopFix(),s=t.getSlideIndex(bs(n,`${o}[data-swiper-slide-index="${i}"]`)[0]),z2(()=>{t.slideTo(s)})):t.slideTo(s)}else t.slideTo(s)}var u3={slideTo:r3,slideToLoop:s3,slideNext:i3,slidePrev:o3,slideReset:a3,slideToClosest:l3,slideToClickedSlide:c3};function d3(t,e){const n=this,{params:r,slidesEl:s}=n;if(!r.loop||n.virtual&&n.params.virtual.enabled)return;const i=()=>{bs(s,`.${r.slideClass}, swiper-slide`).forEach((y,_)=>{y.setAttribute("data-swiper-slide-index",_)})},o=()=>{const p=bs(s,`.${r.slideBlankClass}`);p.forEach(y=>{y.remove()}),p.length>0&&(n.recalcSlides(),n.updateSlides())},l=n.grid&&r.grid&&r.grid.rows>1;r.loopAddBlankSlides&&(r.slidesPerGroup>1||l)&&o();const c=r.slidesPerGroup*(l?r.grid.rows:1),u=n.slides.length%c!==0,h=l&&n.slides.length%r.grid.rows!==0,f=p=>{for(let y=0;y1;u.length"u"?s=c.getSlideIndex(u.find(F=>F.classList.contains(p.slideActiveClass))):I=s;const P=n==="next"||!n,k=n==="prev"||!n;let B=0,z=0;const ee=(T?u[s].column:s)+(w&&typeof r>"u"?-E/2+.5:0);if(ee=0;ne-=1)u[ne].column===R&&S.push(ne)}else S.push(N-K-1)}}else if(ee+E>N-M){z=Math.max(ee-(N-M*2),D),A&&(z=Math.max(z,E-N+v+1));for(let F=0;F{R.column===K&&x.push(ne)}):x.push(K)}}if(c.__preventObserver__=!0,requestAnimationFrame(()=>{c.__preventObserver__=!1}),c.params.effect==="cards"&&u.length{u[F].swiperLoopMoveDOM=!0,m.prepend(u[F]),u[F].swiperLoopMoveDOM=!1}),P&&x.forEach(F=>{u[F].swiperLoopMoveDOM=!0,m.append(u[F]),u[F].swiperLoopMoveDOM=!1}),c.recalcSlides(),p.slidesPerView==="auto"?c.updateSlides():T&&(S.length>0&&k||x.length>0&&P)&&c.slides.forEach((F,K)=>{c.grid.updateSlide(K,F,c.slides)}),p.watchSlidesProgress&&c.updateSlidesOffset(),e){if(S.length>0&&k){if(typeof t>"u"){const F=c.slidesGrid[I],R=c.slidesGrid[I+B]-F;l?c.setTranslate(c.translate-R):(c.slideTo(I+Math.ceil(B),0,!1,!0),r&&(c.touchEventsData.startTranslate=c.touchEventsData.startTranslate-R,c.touchEventsData.currentTranslate=c.touchEventsData.currentTranslate-R))}else if(r){const F=T?S.length/p.grid.rows:S.length;c.slideTo(c.activeIndex+F,0,!1,!0),c.touchEventsData.currentTranslate=c.translate}}else if(x.length>0&&P)if(typeof t>"u"){const F=c.slidesGrid[I],R=c.slidesGrid[I-z]-F;l?c.setTranslate(c.translate-R):(c.slideTo(I-z,0,!1,!0),r&&(c.touchEventsData.startTranslate=c.touchEventsData.startTranslate-R,c.touchEventsData.currentTranslate=c.touchEventsData.currentTranslate-R))}else{const F=T?x.length/p.grid.rows:x.length;c.slideTo(c.activeIndex-F,0,!1,!0)}}if(c.allowSlidePrev=h,c.allowSlideNext=f,c.controller&&c.controller.control&&!o){const F={slideRealIndex:t,direction:n,setTranslate:r,activeSlideIndex:s,byController:!0};Array.isArray(c.controller.control)?c.controller.control.forEach(K=>{!K.destroyed&&K.params.loop&&K.loopFix({...F,slideTo:K.params.slidesPerView===p.slidesPerView?e:!1})}):c.controller.control instanceof c.constructor&&c.controller.control.params.loop&&c.controller.control.loopFix({...F,slideTo:c.controller.control.params.slidesPerView===p.slidesPerView?e:!1})}c.emit("loopFix")}function f3(){const t=this,{params:e,slidesEl:n}=t;if(!e.loop||!n||t.virtual&&t.params.virtual.enabled)return;t.recalcSlides();const r=[];t.slides.forEach(s=>{const i=typeof s.swiperSlideIndex>"u"?s.getAttribute("data-swiper-slide-index")*1:s.swiperSlideIndex;r[i]=s}),t.slides.forEach(s=>{s.removeAttribute("data-swiper-slide-index")}),r.forEach(s=>{n.append(s)}),t.recalcSlides(),t.slideTo(t.realIndex,0)}var p3={loopCreate:d3,loopFix:h3,loopDestroy:f3};function m3(t){const e=this;if(!e.params.simulateTouch||e.params.watchOverflow&&e.isLocked||e.params.cssMode)return;const n=e.params.touchEventsTarget==="container"?e.el:e.wrapperEl;e.isElement&&(e.__preventObserver__=!0),n.style.cursor="move",n.style.cursor=t?"grabbing":"grab",e.isElement&&requestAnimationFrame(()=>{e.__preventObserver__=!1})}function g3(){const t=this;t.params.watchOverflow&&t.isLocked||t.params.cssMode||(t.isElement&&(t.__preventObserver__=!0),t[t.params.touchEventsTarget==="container"?"el":"wrapperEl"].style.cursor="",t.isElement&&requestAnimationFrame(()=>{t.__preventObserver__=!1}))}var y3={setGrabCursor:m3,unsetGrabCursor:g3};function x3(t,e=this){function n(r){if(!r||r===yo()||r===Un())return null;r.assignedSlot&&(r=r.assignedSlot);const s=r.closest(t);return!s&&!r.getRootNode?null:s||n(r.getRootNode().host)}return n(e)}function Mw(t,e,n){const r=Un(),{params:s}=t,i=s.edgeSwipeDetection,o=s.edgeSwipeThreshold;return i&&(n<=o||n>=r.innerWidth-o)?i==="prevent"?(e.preventDefault(),!0):!1:!0}function v3(t){const e=this,n=yo();let r=t;r.originalEvent&&(r=r.originalEvent);const s=e.touchEventsData;if(r.type==="pointerdown"){if(s.pointerId!==null&&s.pointerId!==r.pointerId)return;s.pointerId=r.pointerId}else r.type==="touchstart"&&r.targetTouches.length===1&&(s.touchId=r.targetTouches[0].identifier);if(r.type==="touchstart"){Mw(e,r,r.targetTouches[0].pageX);return}const{params:i,touches:o,enabled:l}=e;if(!l||!i.simulateTouch&&r.pointerType==="mouse"||e.animating&&i.preventInteractionOnTransition)return;!e.animating&&i.cssMode&&i.loop&&e.loopFix();let c=r.target;if(i.touchEventsTarget==="wrapper"&&!SM(c,e.wrapperEl)||"which"in r&&r.which===3||"button"in r&&r.button>0||s.isTouched&&s.isMoved)return;const u=!!i.noSwipingClass&&i.noSwipingClass!=="",h=r.composedPath?r.composedPath():r.path;u&&r.target&&r.target.shadowRoot&&h&&(c=h[0]);const f=i.noSwipingSelector?i.noSwipingSelector:`.${i.noSwipingClass}`,m=!!(r.target&&r.target.shadowRoot);if(i.noSwiping&&(m?x3(f,c):c.closest(f))){e.allowClick=!0;return}if(i.swipeHandler&&!c.closest(i.swipeHandler))return;o.currentX=r.pageX,o.currentY=r.pageY;const p=o.currentX,y=o.currentY;if(!Mw(e,r,p))return;Object.assign(s,{isTouched:!0,isMoved:!1,allowTouchCallbacks:!0,isScrolling:void 0,startMoving:void 0}),o.startX=p,o.startY=y,s.touchStartTime=Bd(),e.allowClick=!0,e.updateSize(),e.swipeDirection=void 0,i.threshold>0&&(s.allowThresholdMove=!1);let _=!0;c.matches(s.focusableElements)&&(_=!1,c.nodeName==="SELECT"&&(s.isTouched=!1)),n.activeElement&&n.activeElement.matches(s.focusableElements)&&n.activeElement!==c&&(r.pointerType==="mouse"||r.pointerType!=="mouse"&&!c.matches(s.focusableElements))&&n.activeElement.blur();const C=_&&e.allowTouchMove&&i.touchStartPreventDefault;(i.touchStartForcePreventDefault||C)&&!c.isContentEditable&&r.preventDefault(),i.freeMode&&i.freeMode.enabled&&e.freeMode&&e.animating&&!i.cssMode&&e.freeMode.onTouchStart(),e.emit("touchStart",r)}function w3(t){const e=yo(),n=this,r=n.touchEventsData,{params:s,touches:i,rtlTranslate:o,enabled:l}=n;if(!l||!s.simulateTouch&&t.pointerType==="mouse")return;let c=t;if(c.originalEvent&&(c=c.originalEvent),c.type==="pointermove"&&(r.touchId!==null||c.pointerId!==r.pointerId))return;let u;if(c.type==="touchmove"){if(u=[...c.changedTouches].find(M=>M.identifier===r.touchId),!u||u.identifier!==r.touchId)return}else u=c;if(!r.isTouched){r.startMoving&&r.isScrolling&&n.emit("touchMoveOpposite",c);return}const h=u.pageX,f=u.pageY;if(c.preventedByNestedSwiper){i.startX=h,i.startY=f;return}if(!n.allowTouchMove){c.target.matches(r.focusableElements)||(n.allowClick=!1),r.isTouched&&(Object.assign(i,{startX:h,startY:f,currentX:h,currentY:f}),r.touchStartTime=Bd());return}if(s.touchReleaseOnEdges&&!s.loop)if(n.isVertical()){if(fi.startY&&n.translate>=n.minTranslate()){r.isTouched=!1,r.isMoved=!1;return}}else{if(o&&(h>i.startX&&-n.translate<=n.maxTranslate()||h=n.minTranslate()))return;if(!o&&(hi.startX&&n.translate>=n.minTranslate()))return}if(e.activeElement&&e.activeElement.matches(r.focusableElements)&&e.activeElement!==c.target&&c.pointerType!=="mouse"&&e.activeElement.blur(),e.activeElement&&c.target===e.activeElement&&c.target.matches(r.focusableElements)){r.isMoved=!0,n.allowClick=!1;return}r.allowTouchCallbacks&&n.emit("touchMove",c),i.previousX=i.currentX,i.previousY=i.currentY,i.currentX=h,i.currentY=f;const m=i.currentX-i.startX,p=i.currentY-i.startY;if(n.params.threshold&&Math.sqrt(m**2+p**2)"u"){let M;n.isHorizontal()&&i.currentY===i.startY||n.isVertical()&&i.currentX===i.startX?r.isScrolling=!1:m*m+p*p>=25&&(M=Math.atan2(Math.abs(p),Math.abs(m))*180/Math.PI,r.isScrolling=n.isHorizontal()?M>s.touchAngle:90-M>s.touchAngle)}if(r.isScrolling&&n.emit("touchMoveOpposite",c),typeof r.startMoving>"u"&&(i.currentX!==i.startX||i.currentY!==i.startY)&&(r.startMoving=!0),r.isScrolling||c.type==="touchmove"&&r.preventTouchMoveFromPointerMove){r.isTouched=!1;return}if(!r.startMoving)return;n.allowClick=!1,!s.cssMode&&c.cancelable&&c.preventDefault(),s.touchMoveStopPropagation&&!s.nested&&c.stopPropagation();let y=n.isHorizontal()?m:p,_=n.isHorizontal()?i.currentX-i.previousX:i.currentY-i.previousY;s.oneWayMovement&&(y=Math.abs(y)*(o?1:-1),_=Math.abs(_)*(o?1:-1)),i.diff=y,y*=s.touchRatio,o&&(y=-y,_=-_);const C=n.touchesDirection;n.swipeDirection=y>0?"prev":"next",n.touchesDirection=_>0?"prev":"next";const v=n.params.loop&&!s.cssMode,w=n.touchesDirection==="next"&&n.allowSlideNext||n.touchesDirection==="prev"&&n.allowSlidePrev;if(!r.isMoved){if(v&&w&&n.loopFix({direction:n.swipeDirection}),r.startTranslate=n.getTranslate(),n.setTransition(0),n.animating){const M=new window.CustomEvent("transitionend",{bubbles:!0,cancelable:!0,detail:{bySwiperTouchMove:!0}});n.wrapperEl.dispatchEvent(M)}r.allowMomentumBounce=!1,s.grabCursor&&(n.allowSlideNext===!0||n.allowSlidePrev===!0)&&n.setGrabCursor(!0),n.emit("sliderFirstMove",c)}if(new Date().getTime(),s._loopSwapReset!==!1&&r.isMoved&&r.allowThresholdMove&&C!==n.touchesDirection&&v&&w&&Math.abs(y)>=1){Object.assign(i,{startX:h,startY:f,currentX:h,currentY:f,startTranslate:r.currentTranslate}),r.loopSwapReset=!0,r.startTranslate=r.currentTranslate;return}n.emit("sliderMove",c),r.isMoved=!0,r.currentTranslate=y+r.startTranslate;let E=!0,D=s.resistanceRatio;if(s.touchReleaseOnEdges&&(D=0),y>0?(v&&w&&r.allowThresholdMove&&r.currentTranslate>(s.centeredSlides?n.minTranslate()-n.slidesSizesGrid[n.activeIndex+1]-(s.slidesPerView!=="auto"&&n.slides.length-s.slidesPerView>=2?n.slidesSizesGrid[n.activeIndex+1]+n.params.spaceBetween:0)-n.params.spaceBetween:n.minTranslate())&&n.loopFix({direction:"prev",setTranslate:!0,activeSlideIndex:0}),r.currentTranslate>n.minTranslate()&&(E=!1,s.resistance&&(r.currentTranslate=n.minTranslate()-1+(-n.minTranslate()+r.startTranslate+y)**D))):y<0&&(v&&w&&r.allowThresholdMove&&r.currentTranslate<(s.centeredSlides?n.maxTranslate()+n.slidesSizesGrid[n.slidesSizesGrid.length-1]+n.params.spaceBetween+(s.slidesPerView!=="auto"&&n.slides.length-s.slidesPerView>=2?n.slidesSizesGrid[n.slidesSizesGrid.length-1]+n.params.spaceBetween:0):n.maxTranslate())&&n.loopFix({direction:"next",setTranslate:!0,activeSlideIndex:n.slides.length-(s.slidesPerView==="auto"?n.slidesPerViewDynamic():Math.ceil(parseFloat(s.slidesPerView,10)))}),r.currentTranslater.startTranslate&&(r.currentTranslate=r.startTranslate),!n.allowSlidePrev&&!n.allowSlideNext&&(r.currentTranslate=r.startTranslate),s.threshold>0)if(Math.abs(y)>s.threshold||r.allowThresholdMove){if(!r.allowThresholdMove){r.allowThresholdMove=!0,i.startX=i.currentX,i.startY=i.currentY,r.currentTranslate=r.startTranslate,i.diff=n.isHorizontal()?i.currentX-i.startX:i.currentY-i.startY;return}}else{r.currentTranslate=r.startTranslate;return}!s.followFinger||s.cssMode||((s.freeMode&&s.freeMode.enabled&&n.freeMode||s.watchSlidesProgress)&&(n.updateActiveIndex(),n.updateSlidesClasses()),s.freeMode&&s.freeMode.enabled&&n.freeMode&&n.freeMode.onTouchMove(),n.updateProgress(r.currentTranslate),n.setTranslate(r.currentTranslate))}function b3(t){const e=this,n=e.touchEventsData;let r=t;r.originalEvent&&(r=r.originalEvent);let s;if(r.type==="touchend"||r.type==="touchcancel"){if(s=[...r.changedTouches].find(M=>M.identifier===n.touchId),!s||s.identifier!==n.touchId)return}else{if(n.touchId!==null||r.pointerId!==n.pointerId)return;s=r}if(["pointercancel","pointerout","pointerleave","contextmenu"].includes(r.type)&&!(["pointercancel","contextmenu"].includes(r.type)&&(e.browser.isSafari||e.browser.isWebView)))return;n.pointerId=null,n.touchId=null;const{params:o,touches:l,rtlTranslate:c,slidesGrid:u,enabled:h}=e;if(!h||!o.simulateTouch&&r.pointerType==="mouse")return;if(n.allowTouchCallbacks&&e.emit("touchEnd",r),n.allowTouchCallbacks=!1,!n.isTouched){n.isMoved&&o.grabCursor&&e.setGrabCursor(!1),n.isMoved=!1,n.startMoving=!1;return}o.grabCursor&&n.isMoved&&n.isTouched&&(e.allowSlideNext===!0||e.allowSlidePrev===!0)&&e.setGrabCursor(!1);const f=Bd(),m=f-n.touchStartTime;if(e.allowClick){const M=r.path||r.composedPath&&r.composedPath();e.updateClickedSlide(M&&M[0]||r.target,M),e.emit("tap click",r),m<300&&f-n.lastClickTime<300&&e.emit("doubleTap doubleClick",r)}if(n.lastClickTime=Bd(),z2(()=>{e.destroyed||(e.allowClick=!0)}),!n.isTouched||!n.isMoved||!e.swipeDirection||l.diff===0&&!n.loopSwapReset||n.currentTranslate===n.startTranslate&&!n.loopSwapReset){n.isTouched=!1,n.isMoved=!1,n.startMoving=!1;return}n.isTouched=!1,n.isMoved=!1,n.startMoving=!1;let p;if(o.followFinger?p=c?e.translate:-e.translate:p=-n.currentTranslate,o.cssMode)return;if(o.freeMode&&o.freeMode.enabled){e.freeMode.onTouchEnd({currentPos:p});return}const y=p>=-e.maxTranslate()&&!e.params.loop;let _=0,C=e.slidesSizesGrid[0];for(let M=0;M=u[M]&&p=u[M])&&(_=M,C=u[u.length-1]-u[u.length-2])}let v=null,w=null;o.rewind&&(e.isBeginning?w=o.virtual&&o.virtual.enabled&&e.virtual?e.virtual.slides.length-1:e.slides.length-1:e.isEnd&&(v=0));const E=(p-u[_])/C,D=_o.longSwipesMs){if(!o.longSwipes){e.slideTo(e.activeIndex);return}e.swipeDirection==="next"&&(E>=o.longSwipesRatio?e.slideTo(o.rewind&&e.isEnd?v:_+D):e.slideTo(_)),e.swipeDirection==="prev"&&(E>1-o.longSwipesRatio?e.slideTo(_+D):w!==null&&E<0&&Math.abs(E)>o.longSwipesRatio?e.slideTo(w):e.slideTo(_))}else{if(!o.shortSwipes){e.slideTo(e.activeIndex);return}e.navigation&&(r.target===e.navigation.nextEl||r.target===e.navigation.prevEl)?r.target===e.navigation.nextEl?e.slideTo(_+D):e.slideTo(_):(e.swipeDirection==="next"&&e.slideTo(v!==null?v:_+D),e.swipeDirection==="prev"&&e.slideTo(w!==null?w:_))}}function Lw(){const t=this,{params:e,el:n}=t;if(n&&n.offsetWidth===0)return;e.breakpoints&&t.setBreakpoint();const{allowSlideNext:r,allowSlidePrev:s,snapGrid:i}=t,o=t.virtual&&t.params.virtual.enabled;t.allowSlideNext=!0,t.allowSlidePrev=!0,t.updateSize(),t.updateSlides(),t.updateSlidesClasses();const l=o&&e.loop;if((e.slidesPerView==="auto"||e.slidesPerView>1)&&t.isEnd&&!t.isBeginning&&!t.params.centeredSlides&&!l){const c=o?t.virtual.slides:t.slides;t.slideTo(c.length-1,0,!1,!0)}else t.params.loop&&!o?t.slideToLoop(t.realIndex,0,!1,!0):t.slideTo(t.activeIndex,0,!1,!0);t.autoplay&&t.autoplay.running&&t.autoplay.paused&&(clearTimeout(t.autoplay.resizeTimeout),t.autoplay.resizeTimeout=setTimeout(()=>{t.autoplay&&t.autoplay.running&&t.autoplay.paused&&t.autoplay.resume()},500)),t.allowSlidePrev=s,t.allowSlideNext=r,t.params.watchOverflow&&i!==t.snapGrid&&t.checkOverflow()}function _3(t){const e=this;e.enabled&&(e.allowClick||(e.params.preventClicks&&t.preventDefault(),e.params.preventClicksPropagation&&e.animating&&(t.stopPropagation(),t.stopImmediatePropagation())))}function E3(){const t=this,{wrapperEl:e,rtlTranslate:n,enabled:r}=t;if(!r)return;t.previousTranslate=t.translate,t.isHorizontal()?t.translate=-e.scrollLeft:t.translate=-e.scrollTop,t.translate===0&&(t.translate=0),t.updateActiveIndex(),t.updateSlidesClasses();let s;const i=t.maxTranslate()-t.minTranslate();i===0?s=0:s=(t.translate-t.minTranslate())/i,s!==t.progress&&t.updateProgress(n?-t.translate:t.translate),t.emit("setTranslate",t.translate,!1)}function S3(t){const e=this;Hu(e,t.target),!(e.params.cssMode||e.params.slidesPerView!=="auto"&&!e.params.autoHeight)&&e.update()}function T3(){const t=this;t.documentTouchHandlerProceeded||(t.documentTouchHandlerProceeded=!0,t.params.touchReleaseOnEdges&&(t.el.style.touchAction="auto"))}const G2=(t,e)=>{const n=yo(),{params:r,el:s,wrapperEl:i,device:o}=t,l=!!r.nested,c=e==="on"?"addEventListener":"removeEventListener",u=e;!s||typeof s=="string"||(n[c]("touchstart",t.onDocumentTouchStart,{passive:!1,capture:l}),s[c]("touchstart",t.onTouchStart,{passive:!1}),s[c]("pointerdown",t.onTouchStart,{passive:!1}),n[c]("touchmove",t.onTouchMove,{passive:!1,capture:l}),n[c]("pointermove",t.onTouchMove,{passive:!1,capture:l}),n[c]("touchend",t.onTouchEnd,{passive:!0}),n[c]("pointerup",t.onTouchEnd,{passive:!0}),n[c]("pointercancel",t.onTouchEnd,{passive:!0}),n[c]("touchcancel",t.onTouchEnd,{passive:!0}),n[c]("pointerout",t.onTouchEnd,{passive:!0}),n[c]("pointerleave",t.onTouchEnd,{passive:!0}),n[c]("contextmenu",t.onTouchEnd,{passive:!0}),(r.preventClicks||r.preventClicksPropagation)&&s[c]("click",t.onClick,!0),r.cssMode&&i[c]("scroll",t.onScroll),r.updateOnWindowResize?t[u](o.ios||o.android?"resize orientationchange observerUpdate":"resize observerUpdate",Lw,!0):t[u]("observerUpdate",Lw,!0),s[c]("load",t.onLoad,{capture:!0}))};function N3(){const t=this,{params:e}=t;t.onTouchStart=v3.bind(t),t.onTouchMove=w3.bind(t),t.onTouchEnd=b3.bind(t),t.onDocumentTouchStart=T3.bind(t),e.cssMode&&(t.onScroll=E3.bind(t)),t.onClick=_3.bind(t),t.onLoad=S3.bind(t),G2(t,"on")}function k3(){G2(this,"off")}var I3={attachEvents:N3,detachEvents:k3};const Ow=(t,e)=>t.grid&&e.grid&&e.grid.rows>1;function C3(){const t=this,{realIndex:e,initialized:n,params:r,el:s}=t,i=r.breakpoints;if(!i||i&&Object.keys(i).length===0)return;const o=yo(),l=r.breakpointsBase==="window"||!r.breakpointsBase?r.breakpointsBase:"container",c=["window","container"].includes(r.breakpointsBase)||!r.breakpointsBase?t.el:o.querySelector(r.breakpointsBase),u=t.getBreakpoint(i,l,c);if(!u||t.currentBreakpoint===u)return;const f=(u in i?i[u]:void 0)||t.originalParams,m=Ow(t,r),p=Ow(t,f),y=t.params.grabCursor,_=f.grabCursor,C=r.enabled;m&&!p?(s.classList.remove(`${r.containerModifierClass}grid`,`${r.containerModifierClass}grid-column`),t.emitContainerClasses()):!m&&p&&(s.classList.add(`${r.containerModifierClass}grid`),(f.grid.fill&&f.grid.fill==="column"||!f.grid.fill&&r.grid.fill==="column")&&s.classList.add(`${r.containerModifierClass}grid-column`),t.emitContainerClasses()),y&&!_?t.unsetGrabCursor():!y&&_&&t.setGrabCursor(),["navigation","pagination","scrollbar"].forEach(T=>{if(typeof f[T]>"u")return;const S=r[T]&&r[T].enabled,x=f[T]&&f[T].enabled;S&&!x&&t[T].disable(),!S&&x&&t[T].enable()});const v=f.direction&&f.direction!==r.direction,w=r.loop&&(f.slidesPerView!==r.slidesPerView||v),E=r.loop;v&&n&&t.changeDirection(),lr(t.params,f);const D=t.params.enabled,M=t.params.loop;Object.assign(t,{allowTouchMove:t.params.allowTouchMove,allowSlideNext:t.params.allowSlideNext,allowSlidePrev:t.params.allowSlidePrev}),C&&!D?t.disable():!C&&D&&t.enable(),t.currentBreakpoint=u,t.emit("_beforeBreakpoint",f),n&&(w?(t.loopDestroy(),t.loopCreate(e),t.updateSlides()):!E&&M?(t.loopCreate(e),t.updateSlides()):E&&!M&&t.loopDestroy()),t.emit("breakpoint",f)}function A3(t,e="window",n){if(!t||e==="container"&&!n)return;let r=!1;const s=Un(),i=e==="window"?s.innerHeight:n.clientHeight,o=Object.keys(t).map(l=>{if(typeof l=="string"&&l.indexOf("@")===0){const c=parseFloat(l.substr(1));return{value:i*c,point:l}}return{value:l,point:l}});o.sort((l,c)=>parseInt(l.value,10)-parseInt(c.value,10));for(let l=0;l{typeof r=="object"?Object.keys(r).forEach(s=>{r[s]&&n.push(e+s)}):typeof r=="string"&&n.push(e+r)}),n}function R3(){const t=this,{classNames:e,params:n,rtl:r,el:s,device:i}=t,o=P3(["initialized",n.direction,{"free-mode":t.params.freeMode&&n.freeMode.enabled},{autoheight:n.autoHeight},{rtl:r},{grid:n.grid&&n.grid.rows>1},{"grid-column":n.grid&&n.grid.rows>1&&n.grid.fill==="column"},{android:i.android},{ios:i.ios},{"css-mode":n.cssMode},{centered:n.cssMode&&n.centeredSlides},{"watch-progress":n.watchSlidesProgress}],n.containerModifierClass);e.push(...o),s.classList.add(...e),t.emitContainerClasses()}function D3(){const t=this,{el:e,classNames:n}=t;!e||typeof e=="string"||(e.classList.remove(...n),t.emitContainerClasses())}var M3={addClasses:R3,removeClasses:D3};function L3(){const t=this,{isLocked:e,params:n}=t,{slidesOffsetBefore:r}=n;if(r){const s=t.slides.length-1,i=t.slidesGrid[s]+t.slidesSizesGrid[s]+r*2;t.isLocked=t.size>i}else t.isLocked=t.snapGrid.length===1;n.allowSlideNext===!0&&(t.allowSlideNext=!t.isLocked),n.allowSlidePrev===!0&&(t.allowSlidePrev=!t.isLocked),e&&e!==t.isLocked&&(t.isEnd=!1),e!==t.isLocked&&t.emit(t.isLocked?"lock":"unlock")}var O3={checkOverflow:L3},Im={init:!0,direction:"horizontal",oneWayMovement:!1,swiperElementNodeName:"SWIPER-CONTAINER",touchEventsTarget:"wrapper",initialSlide:0,speed:300,cssMode:!1,updateOnWindowResize:!0,resizeObserver:!0,nested:!1,createElements:!1,eventsPrefix:"swiper",enabled:!0,focusableElements:"input, select, option, textarea, button, video, label",width:null,height:null,preventInteractionOnTransition:!1,userAgent:null,url:null,edgeSwipeDetection:!1,edgeSwipeThreshold:20,autoHeight:!1,setWrapperSize:!1,virtualTranslate:!1,effect:"slide",breakpoints:void 0,breakpointsBase:"window",spaceBetween:0,slidesPerView:1,slidesPerGroup:1,slidesPerGroupSkip:0,slidesPerGroupAuto:!1,centeredSlides:!1,centeredSlidesBounds:!1,slidesOffsetBefore:0,slidesOffsetAfter:0,normalizeSlideIndex:!0,centerInsufficientSlides:!1,snapToSlideEdge:!1,watchOverflow:!0,roundLengths:!1,touchRatio:1,touchAngle:45,simulateTouch:!0,shortSwipes:!0,longSwipes:!0,longSwipesRatio:.5,longSwipesMs:300,followFinger:!0,allowTouchMove:!0,threshold:5,touchMoveStopPropagation:!1,touchStartPreventDefault:!0,touchStartForcePreventDefault:!1,touchReleaseOnEdges:!1,uniqueNavElements:!0,resistance:!0,resistanceRatio:.85,watchSlidesProgress:!1,grabCursor:!1,preventClicks:!0,preventClicksPropagation:!0,slideToClickedSlide:!1,loop:!1,loopAddBlankSlides:!0,loopAdditionalSlides:0,loopPreventsSliding:!0,rewind:!1,allowSlidePrev:!0,allowSlideNext:!0,swipeHandler:null,noSwiping:!0,noSwipingClass:"swiper-no-swiping",noSwipingSelector:null,passiveListeners:!0,maxBackfaceHiddenSlides:10,containerModifierClass:"swiper-",slideClass:"swiper-slide",slideBlankClass:"swiper-slide-blank",slideActiveClass:"swiper-slide-active",slideVisibleClass:"swiper-slide-visible",slideFullyVisibleClass:"swiper-slide-fully-visible",slideNextClass:"swiper-slide-next",slidePrevClass:"swiper-slide-prev",wrapperClass:"swiper-wrapper",lazyPreloaderClass:"swiper-lazy-preloader",lazyPreloadPrevNext:0,runCallbacksOnInit:!0,_emitClasses:!1};function V3(t,e){return function(r={}){const s=Object.keys(r)[0],i=r[s];if(typeof i!="object"||i===null){lr(e,r);return}if(t[s]===!0&&(t[s]={enabled:!0}),s==="navigation"&&t[s]&&t[s].enabled&&!t[s].prevEl&&!t[s].nextEl&&(t[s].auto=!0),["pagination","scrollbar"].indexOf(s)>=0&&t[s]&&t[s].enabled&&!t[s].el&&(t[s].auto=!0),!(s in t&&"enabled"in i)){lr(e,r);return}typeof t[s]=="object"&&!("enabled"in t[s])&&(t[s].enabled=!0),t[s]||(t[s]={enabled:!1}),lr(e,r)}}const zf={eventsEmitter:MM,update:GM,translate:JM,transition:n3,slide:u3,loop:p3,grabCursor:y3,events:I3,breakpoints:j3,checkOverflow:O3,classes:M3},Uf={};let U0=class fs{constructor(...e){let n,r;e.length===1&&e[0].constructor&&Object.prototype.toString.call(e[0]).slice(8,-1)==="Object"?r=e[0]:[n,r]=e,r||(r={}),r=lr({},r),n&&!r.el&&(r.el=n);const s=yo();if(r.el&&typeof r.el=="string"&&s.querySelectorAll(r.el).length>1){const c=[];return s.querySelectorAll(r.el).forEach(u=>{const h=lr({},r,{el:u});c.push(new fs(h))}),c}const i=this;i.__swiper__=!0,i.support=B2(),i.device=$2({userAgent:r.userAgent}),i.browser=H2(),i.eventsListeners={},i.eventsAnyListeners=[],i.modules=[...i.__modules__],r.modules&&Array.isArray(r.modules)&&r.modules.forEach(c=>{typeof c=="function"&&i.modules.indexOf(c)<0&&i.modules.push(c)});const o={};i.modules.forEach(c=>{c({params:r,swiper:i,extendParams:V3(r,o),on:i.on.bind(i),once:i.once.bind(i),off:i.off.bind(i),emit:i.emit.bind(i)})});const l=lr({},Im,o);return i.params=lr({},l,Uf,r),i.originalParams=lr({},i.params),i.passedParams=lr({},r),i.params&&i.params.on&&Object.keys(i.params.on).forEach(c=>{i.on(c,i.params.on[c])}),i.params&&i.params.onAny&&i.onAny(i.params.onAny),Object.assign(i,{enabled:i.params.enabled,el:n,classNames:[],slides:[],slidesGrid:[],snapGrid:[],slidesSizesGrid:[],isHorizontal(){return i.params.direction==="horizontal"},isVertical(){return i.params.direction==="vertical"},activeIndex:0,realIndex:0,isBeginning:!0,isEnd:!1,translate:0,previousTranslate:0,progress:0,velocity:0,animating:!1,cssOverflowAdjustment(){return Math.trunc(this.translate/2**23)*2**23},allowSlideNext:i.params.allowSlideNext,allowSlidePrev:i.params.allowSlidePrev,touchEventsData:{isTouched:void 0,isMoved:void 0,allowTouchCallbacks:void 0,touchStartTime:void 0,isScrolling:void 0,currentTranslate:void 0,startTranslate:void 0,allowThresholdMove:void 0,focusableElements:i.params.focusableElements,lastClickTime:0,clickTimeout:void 0,velocities:[],allowMomentumBounce:void 0,startMoving:void 0,pointerId:null,touchId:null},allowClick:!0,allowTouchMove:i.params.allowTouchMove,touches:{startX:0,startY:0,currentX:0,currentY:0,diff:0},imagesToLoad:[],imagesLoaded:0}),i.emit("_swiper"),i.params.init&&i.init(),i}getDirectionLabel(e){return this.isHorizontal()?e:{width:"height","margin-top":"margin-left","margin-bottom ":"margin-right","margin-left":"margin-top","margin-right":"margin-bottom","padding-left":"padding-top","padding-right":"padding-bottom",marginRight:"marginBottom"}[e]}getSlideIndex(e){const{slidesEl:n,params:r}=this,s=bs(n,`.${r.slideClass}, swiper-slide`),i=jw(s[0]);return jw(e)-i}getSlideIndexByData(e){return this.getSlideIndex(this.slides.find(n=>n.getAttribute("data-swiper-slide-index")*1===e))}getSlideIndexWhenGrid(e){return this.grid&&this.params.grid&&this.params.grid.rows>1&&(this.params.grid.fill==="column"?e=Math.floor(e/this.params.grid.rows):this.params.grid.fill==="row"&&(e=e%Math.ceil(this.slides.length/this.params.grid.rows))),e}recalcSlides(){const e=this,{slidesEl:n,params:r}=e;e.slides=bs(n,`.${r.slideClass}, swiper-slide`)}enable(){const e=this;e.enabled||(e.enabled=!0,e.params.grabCursor&&e.setGrabCursor(),e.emit("enable"))}disable(){const e=this;e.enabled&&(e.enabled=!1,e.params.grabCursor&&e.unsetGrabCursor(),e.emit("disable"))}setProgress(e,n){const r=this;e=Math.min(Math.max(e,0),1);const s=r.minTranslate(),o=(r.maxTranslate()-s)*e+s;r.translateTo(o,typeof n>"u"?0:n),r.updateActiveIndex(),r.updateSlidesClasses()}emitContainerClasses(){const e=this;if(!e.params._emitClasses||!e.el)return;const n=e.el.className.split(" ").filter(r=>r.indexOf("swiper")===0||r.indexOf(e.params.containerModifierClass)===0);e.emit("_containerClasses",n.join(" "))}getSlideClasses(e){const n=this;return n.destroyed?"":e.className.split(" ").filter(r=>r.indexOf("swiper-slide")===0||r.indexOf(n.params.slideClass)===0).join(" ")}emitSlidesClasses(){const e=this;if(!e.params._emitClasses||!e.el)return;const n=[];e.slides.forEach(r=>{const s=e.getSlideClasses(r);n.push({slideEl:r,classNames:s}),e.emit("_slideClass",r,s)}),e.emit("_slideClasses",n)}slidesPerViewDynamic(e="current",n=!1){const r=this,{params:s,slides:i,slidesGrid:o,slidesSizesGrid:l,size:c,activeIndex:u}=r;let h=1;if(typeof s.slidesPerView=="number")return s.slidesPerView;if(s.centeredSlides){let f=i[u]?Math.ceil(i[u].swiperSlideSize):0,m;for(let p=u+1;pc&&(m=!0));for(let p=u-1;p>=0;p-=1)i[p]&&!m&&(f+=i[p].swiperSlideSize,h+=1,f>c&&(m=!0))}else if(e==="current")for(let f=u+1;f=0;f-=1)o[u]-o[f]{o.complete&&Hu(e,o)}),e.updateSize(),e.updateSlides(),e.updateProgress(),e.updateSlidesClasses();function s(){const o=e.rtlTranslate?e.translate*-1:e.translate,l=Math.min(Math.max(o,e.maxTranslate()),e.minTranslate());e.setTranslate(l),e.updateActiveIndex(),e.updateSlidesClasses()}let i;if(r.freeMode&&r.freeMode.enabled&&!r.cssMode)s(),r.autoHeight&&e.updateAutoHeight();else{if((r.slidesPerView==="auto"||r.slidesPerView>1)&&e.isEnd&&!r.centeredSlides){const o=e.virtual&&r.virtual.enabled?e.virtual.slides:e.slides;i=e.slideTo(o.length-1,0,!1,!0)}else i=e.slideTo(e.activeIndex,0,!1,!0);i||s()}r.watchOverflow&&n!==e.snapGrid&&e.checkOverflow(),e.emit("update")}changeDirection(e,n=!0){const r=this,s=r.params.direction;return e||(e=s==="horizontal"?"vertical":"horizontal"),e===s||e!=="horizontal"&&e!=="vertical"||(r.el.classList.remove(`${r.params.containerModifierClass}${s}`),r.el.classList.add(`${r.params.containerModifierClass}${e}`),r.emitContainerClasses(),r.params.direction=e,r.slides.forEach(i=>{e==="vertical"?i.style.width="":i.style.height=""}),r.emit("changeDirection"),n&&r.update()),r}changeLanguageDirection(e){const n=this;n.rtl&&e==="rtl"||!n.rtl&&e==="ltr"||(n.rtl=e==="rtl",n.rtlTranslate=n.params.direction==="horizontal"&&n.rtl,n.rtl?(n.el.classList.add(`${n.params.containerModifierClass}rtl`),n.el.dir="rtl"):(n.el.classList.remove(`${n.params.containerModifierClass}rtl`),n.el.dir="ltr"),n.update())}mount(e){const n=this;if(n.mounted)return!0;let r=e||n.params.el;if(typeof r=="string"&&(r=document.querySelector(r)),!r)return!1;r.swiper=n,r.parentNode&&r.parentNode.host&&r.parentNode.host.nodeName===n.params.swiperElementNodeName.toUpperCase()&&(n.isElement=!0);const s=()=>`.${(n.params.wrapperClass||"").trim().split(" ").join(".")}`;let o=r&&r.shadowRoot&&r.shadowRoot.querySelector?r.shadowRoot.querySelector(s()):bs(r,s())[0];return!o&&n.params.createElements&&(o=Hd("div",n.params.wrapperClass),r.append(o),bs(r,`.${n.params.slideClass}`).forEach(l=>{o.append(l)})),Object.assign(n,{el:r,wrapperEl:o,slidesEl:n.isElement&&!r.parentNode.host.slideSlots?r.parentNode.host:o,hostEl:n.isElement?r.parentNode.host:r,mounted:!0,rtl:r.dir.toLowerCase()==="rtl"||si(r,"direction")==="rtl",rtlTranslate:n.params.direction==="horizontal"&&(r.dir.toLowerCase()==="rtl"||si(r,"direction")==="rtl"),wrongRTL:si(o,"display")==="-webkit-box"}),!0}init(e){const n=this;if(n.initialized||n.mount(e)===!1)return n;n.emit("beforeInit"),n.params.breakpoints&&n.setBreakpoint(),n.addClasses(),n.updateSize(),n.updateSlides(),n.params.watchOverflow&&n.checkOverflow(),n.params.grabCursor&&n.enabled&&n.setGrabCursor(),n.params.loop&&n.virtual&&n.params.virtual.enabled?n.slideTo(n.params.initialSlide+n.virtual.slidesBefore,0,n.params.runCallbacksOnInit,!1,!0):n.slideTo(n.params.initialSlide,0,n.params.runCallbacksOnInit,!1,!0),n.params.loop&&n.loopCreate(void 0,!0),n.attachEvents();const s=[...n.el.querySelectorAll('[loading="lazy"]')];return n.isElement&&s.push(...n.hostEl.querySelectorAll('[loading="lazy"]')),s.forEach(i=>{i.complete?Hu(n,i):i.addEventListener("load",o=>{Hu(n,o.target)})}),km(n),n.initialized=!0,km(n),n.emit("init"),n.emit("afterInit"),n}destroy(e=!0,n=!0){const r=this,{params:s,el:i,wrapperEl:o,slides:l}=r;return typeof r.params>"u"||r.destroyed||(r.emit("beforeDestroy"),r.initialized=!1,r.detachEvents(),s.loop&&r.loopDestroy(),n&&(r.removeClasses(),i&&typeof i!="string"&&i.removeAttribute("style"),o&&o.removeAttribute("style"),l&&l.length&&l.forEach(c=>{c.classList.remove(s.slideVisibleClass,s.slideFullyVisibleClass,s.slideActiveClass,s.slideNextClass,s.slidePrevClass),c.removeAttribute("style"),c.removeAttribute("data-swiper-slide-index")})),r.emit("destroy"),Object.keys(r.eventsListeners).forEach(c=>{r.off(c)}),e!==!1&&(r.el&&typeof r.el!="string"&&(r.el.swiper=null),vM(r)),r.destroyed=!0),null}static extendDefaults(e){lr(Uf,e)}static get extendedDefaults(){return Uf}static get defaults(){return Im}static installModule(e){fs.prototype.__modules__||(fs.prototype.__modules__=[]);const n=fs.prototype.__modules__;typeof e=="function"&&n.indexOf(e)<0&&n.push(e)}static use(e){return Array.isArray(e)?(e.forEach(n=>fs.installModule(n)),fs):(fs.installModule(e),fs)}};Object.keys(zf).forEach(t=>{Object.keys(zf[t]).forEach(e=>{U0.prototype[e]=zf[t][e]})});U0.use([RM,DM]);const W2=["eventsPrefix","injectStyles","injectStylesUrls","modules","init","_direction","oneWayMovement","swiperElementNodeName","touchEventsTarget","initialSlide","_speed","cssMode","updateOnWindowResize","resizeObserver","nested","focusableElements","_enabled","_width","_height","preventInteractionOnTransition","userAgent","url","_edgeSwipeDetection","_edgeSwipeThreshold","_freeMode","_autoHeight","setWrapperSize","virtualTranslate","_effect","breakpoints","breakpointsBase","_spaceBetween","_slidesPerView","maxBackfaceHiddenSlides","_grid","_slidesPerGroup","_slidesPerGroupSkip","_slidesPerGroupAuto","_centeredSlides","_centeredSlidesBounds","_slidesOffsetBefore","_slidesOffsetAfter","normalizeSlideIndex","_centerInsufficientSlides","_snapToSlideEdge","_watchOverflow","roundLengths","touchRatio","touchAngle","simulateTouch","_shortSwipes","_longSwipes","longSwipesRatio","longSwipesMs","_followFinger","allowTouchMove","_threshold","touchMoveStopPropagation","touchStartPreventDefault","touchStartForcePreventDefault","touchReleaseOnEdges","uniqueNavElements","_resistance","_resistanceRatio","_watchSlidesProgress","_grabCursor","preventClicks","preventClicksPropagation","_slideToClickedSlide","_loop","loopAdditionalSlides","loopAddBlankSlides","loopPreventsSliding","_rewind","_allowSlidePrev","_allowSlideNext","_swipeHandler","_noSwiping","noSwipingClass","noSwipingSelector","passiveListeners","containerModifierClass","slideClass","slideActiveClass","slideVisibleClass","slideFullyVisibleClass","slideNextClass","slidePrevClass","slideBlankClass","wrapperClass","lazyPreloaderClass","lazyPreloadPrevNext","runCallbacksOnInit","observer","observeParents","observeSlideChildren","a11y","_autoplay","_controller","coverflowEffect","cubeEffect","fadeEffect","flipEffect","creativeEffect","cardsEffect","hashNavigation","history","keyboard","mousewheel","_navigation","_pagination","parallax","_scrollbar","_thumbs","virtual","zoom","control"];function uo(t){return typeof t=="object"&&t!==null&&t.constructor&&Object.prototype.toString.call(t).slice(8,-1)==="Object"&&!t.__swiper__}function ra(t,e){const n=["__proto__","constructor","prototype"];Object.keys(e).filter(r=>n.indexOf(r)<0).forEach(r=>{typeof t[r]>"u"?t[r]=e[r]:uo(e[r])&&uo(t[r])&&Object.keys(e[r]).length>0?e[r].__swiper__?t[r]=e[r]:ra(t[r],e[r]):t[r]=e[r]})}function K2(t={}){return t.navigation&&typeof t.navigation.nextEl>"u"&&typeof t.navigation.prevEl>"u"}function Q2(t={}){return t.pagination&&typeof t.pagination.el>"u"}function Y2(t={}){return t.scrollbar&&typeof t.scrollbar.el>"u"}function X2(t=""){const e=t.split(" ").map(r=>r.trim()).filter(r=>!!r),n=[];return e.forEach(r=>{n.indexOf(r)<0&&n.push(r)}),n.join(" ")}function F3(t=""){return t?t.includes("swiper-wrapper")?t:`swiper-wrapper ${t}`:"swiper-wrapper"}function z3({swiper:t,slides:e,passedParams:n,changedParams:r,nextEl:s,prevEl:i,scrollbarEl:o,paginationEl:l}){const c=r.filter(x=>x!=="children"&&x!=="direction"&&x!=="wrapperClass"),{params:u,pagination:h,navigation:f,scrollbar:m,virtual:p,thumbs:y}=t;let _,C,v,w,E,D,M,T;r.includes("thumbs")&&n.thumbs&&n.thumbs.swiper&&!n.thumbs.swiper.destroyed&&u.thumbs&&(!u.thumbs.swiper||u.thumbs.swiper.destroyed)&&(_=!0),r.includes("controller")&&n.controller&&n.controller.control&&u.controller&&!u.controller.control&&(C=!0),r.includes("pagination")&&n.pagination&&(n.pagination.el||l)&&(u.pagination||u.pagination===!1)&&h&&!h.el&&(v=!0),r.includes("scrollbar")&&n.scrollbar&&(n.scrollbar.el||o)&&(u.scrollbar||u.scrollbar===!1)&&m&&!m.el&&(w=!0),r.includes("navigation")&&n.navigation&&(n.navigation.prevEl||i)&&(n.navigation.nextEl||s)&&(u.navigation||u.navigation===!1)&&f&&!f.prevEl&&!f.nextEl&&(E=!0);const S=x=>{t[x]&&(t[x].destroy(),x==="navigation"?(t.isElement&&(t[x].prevEl.remove(),t[x].nextEl.remove()),u[x].prevEl=void 0,u[x].nextEl=void 0,t[x].prevEl=void 0,t[x].nextEl=void 0):(t.isElement&&t[x].el.remove(),u[x].el=void 0,t[x].el=void 0))};r.includes("loop")&&t.isElement&&(u.loop&&!n.loop?D=!0:!u.loop&&n.loop?M=!0:T=!0),c.forEach(x=>{if(uo(u[x])&&uo(n[x]))Object.assign(u[x],n[x]),(x==="navigation"||x==="pagination"||x==="scrollbar")&&"enabled"in n[x]&&!n[x].enabled&&S(x);else{const N=n[x];(N===!0||N===!1)&&(x==="navigation"||x==="pagination"||x==="scrollbar")?N===!1&&S(x):u[x]=n[x]}}),c.includes("controller")&&!C&&t.controller&&t.controller.control&&u.controller&&u.controller.control&&(t.controller.control=u.controller.control),r.includes("children")&&e&&p&&u.virtual.enabled?(p.slides=e,p.update(!0)):r.includes("virtual")&&p&&u.virtual.enabled&&(e&&(p.slides=e),p.update(!0)),r.includes("children")&&e&&u.loop&&(T=!0),_&&y.init()&&y.update(!0),C&&(t.controller.control=u.controller.control),v&&(t.isElement&&(!l||typeof l=="string")&&(l=document.createElement("div"),l.classList.add("swiper-pagination"),l.part.add("pagination"),t.el.appendChild(l)),l&&(u.pagination.el=l),h.init(),h.render(),h.update()),w&&(t.isElement&&(!o||typeof o=="string")&&(o=document.createElement("div"),o.classList.add("swiper-scrollbar"),o.part.add("scrollbar"),t.el.appendChild(o)),o&&(u.scrollbar.el=o),m.init(),m.updateSize(),m.setTranslate()),E&&(t.isElement&&((!s||typeof s=="string")&&(s=document.createElement("div"),s.classList.add("swiper-button-next"),Rw(s,t.navigation.arrowSvg),s.part.add("button-next"),t.el.appendChild(s)),(!i||typeof i=="string")&&(i=document.createElement("div"),i.classList.add("swiper-button-prev"),Rw(i,t.navigation.arrowSvg),i.part.add("button-prev"),t.el.appendChild(i))),s&&(u.navigation.nextEl=s),i&&(u.navigation.prevEl=i),f.init(),f.update()),r.includes("allowSlideNext")&&(t.allowSlideNext=n.allowSlideNext),r.includes("allowSlidePrev")&&(t.allowSlidePrev=n.allowSlidePrev),r.includes("direction")&&t.changeDirection(n.direction,!1),(D||T)&&t.loopDestroy(),(M||T)&&t.loopCreate(),t.update()}function U3(t={},e=!0){const n={on:{}},r={},s={};ra(n,Im),n._emitClasses=!0,n.init=!1;const i={},o=W2.map(c=>c.replace(/_/,"")),l=Object.assign({},t);return Object.keys(l).forEach(c=>{typeof t[c]>"u"||(o.indexOf(c)>=0?uo(t[c])?(n[c]={},s[c]={},ra(n[c],t[c]),ra(s[c],t[c])):(n[c]=t[c],s[c]=t[c]):c.search(/on[A-Z]/)===0&&typeof t[c]=="function"?e?r[`${c[2].toLowerCase()}${c.substr(3)}`]=t[c]:n.on[`${c[2].toLowerCase()}${c.substr(3)}`]=t[c]:i[c]=t[c])}),["navigation","pagination","scrollbar"].forEach(c=>{n[c]===!0&&(n[c]={}),n[c]===!1&&delete n[c]}),{params:n,passedParams:s,rest:i,events:r}}function B3({el:t,nextEl:e,prevEl:n,paginationEl:r,scrollbarEl:s,swiper:i},o){K2(o)&&e&&n&&(i.params.navigation.nextEl=e,i.originalParams.navigation.nextEl=e,i.params.navigation.prevEl=n,i.originalParams.navigation.prevEl=n),Q2(o)&&r&&(i.params.pagination.el=r,i.originalParams.pagination.el=r),Y2(o)&&s&&(i.params.scrollbar.el=s,i.originalParams.scrollbar.el=s),i.init(t)}function $3(t,e,n,r,s){const i=[];if(!e)return i;const o=c=>{i.indexOf(c)<0&&i.push(c)};if(n&&r){const c=r.map(s),u=n.map(s);c.join("")!==u.join("")&&o("children"),r.length!==n.length&&o("children")}return W2.filter(c=>c[0]==="_").map(c=>c.replace(/_/,"")).forEach(c=>{if(c in t&&c in e)if(uo(t[c])&&uo(e[c])){const u=Object.keys(t[c]),h=Object.keys(e[c]);u.length!==h.length?o(c):(u.forEach(f=>{t[c][f]!==e[c][f]&&o(c)}),h.forEach(f=>{t[c][f]!==e[c][f]&&o(c)}))}else t[c]!==e[c]&&o(c)}),i}const H3=t=>{!t||t.destroyed||!t.params.virtual||t.params.virtual&&!t.params.virtual.enabled||(t.updateSlides(),t.updateProgress(),t.updateSlidesClasses(),t.emit("_virtualUpdated"),t.parallax&&t.params.parallax&&t.params.parallax.enabled&&t.parallax.setTranslate())};function qd(){return qd=Object.assign?Object.assign.bind():function(t){for(var e=1;e{J2(n)?e.push(n):n.props&&n.props.children&&Z2(n.props.children).forEach(r=>e.push(r))}),e}function q3(t){const e=[],n={"container-start":[],"container-end":[],"wrapper-start":[],"wrapper-end":[]};return se.Children.toArray(t).forEach(r=>{if(J2(r))e.push(r);else if(r.props&&r.props.slot&&n[r.props.slot])n[r.props.slot].push(r);else if(r.props&&r.props.children){const s=Z2(r.props.children);s.length>0?s.forEach(i=>e.push(i)):n["container-end"].push(r)}else n["container-end"].push(r)}),{slides:e,slots:n}}function G3(t,e,n){if(!n)return null;const r=h=>{let f=h;return h<0?f=e.length+h:f>=e.length&&(f=f-e.length),f},s=t.isHorizontal()?{[t.rtlTranslate?"right":"left"]:`${n.offset}px`}:{top:`${n.offset}px`},{from:i,to:o}=n,l=t.params.loop?-e.length:0,c=t.params.loop?e.length*2:e.length,u=[];for(let h=l;h=i&&h<=o&&u.push(e[r(h)]);return u.map((h,f)=>se.cloneElement(h,{swiper:t,style:s,key:h.props.virtualIndex||h.key||`slide-${f}`}))}function Tl(t,e){return typeof window>"u"?L.useEffect(t,e):L.useLayoutEffect(t,e)}const Vw=L.createContext(null),W3=L.createContext(null),eT=L.forwardRef(({className:t,tag:e="div",wrapperTag:n="div",children:r,onSwiper:s,...i}={},o)=>{let l=!1;const[c,u]=L.useState("swiper"),[h,f]=L.useState(null),[m,p]=L.useState(!1),y=L.useRef(!1),_=L.useRef(null),C=L.useRef(null),v=L.useRef(null),w=L.useRef(null),E=L.useRef(null),D=L.useRef(null),M=L.useRef(null),T=L.useRef(null),{params:S,passedParams:x,rest:N,events:A}=U3(i),{slides:I,slots:P}=q3(r),k=()=>{p(!m)};Object.assign(S.on,{_containerClasses(F,K){u(K)}});const B=()=>{Object.assign(S.on,A),l=!0;const F={...S};if(delete F.wrapperClass,C.current=new U0(F),C.current.virtual&&C.current.params.virtual.enabled){C.current.virtual.slides=I;const K={cache:!1,slides:I,renderExternal:f,renderExternalUpdate:!1};ra(C.current.params.virtual,K),ra(C.current.originalParams.virtual,K)}};_.current||B(),C.current&&C.current.on("_beforeBreakpoint",k);const z=()=>{l||!A||!C.current||Object.keys(A).forEach(F=>{C.current.on(F,A[F])})},W=()=>{!A||!C.current||Object.keys(A).forEach(F=>{C.current.off(F,A[F])})};L.useEffect(()=>()=>{C.current&&C.current.off("_beforeBreakpoint",k)}),L.useEffect(()=>{!y.current&&C.current&&(C.current.emitSlidesClasses(),y.current=!0)}),Tl(()=>{if(o&&(o.current=_.current),!!_.current)return C.current.destroyed&&B(),B3({el:_.current,nextEl:E.current,prevEl:D.current,paginationEl:M.current,scrollbarEl:T.current,swiper:C.current},S),s&&!C.current.destroyed&&s(C.current),()=>{C.current&&!C.current.destroyed&&C.current.destroy(!0,!1)}},[]),Tl(()=>{z();const F=$3(x,v.current,I,w.current,K=>K.key);return v.current=x,w.current=I,F.length&&C.current&&!C.current.destroyed&&z3({swiper:C.current,slides:I,passedParams:x,changedParams:F,nextEl:E.current,prevEl:D.current,scrollbarEl:T.current,paginationEl:M.current}),()=>{W()}}),Tl(()=>{H3(C.current)},[h]);function ee(){return S.virtual?G3(C.current,I,h):I.map((F,K)=>se.cloneElement(F,{swiper:C.current,swiperSlideIndex:K}))}return se.createElement(e,qd({ref:_,className:X2(`${c}${t?` ${t}`:""}`)},N),se.createElement(W3.Provider,{value:C.current},P["container-start"],se.createElement(n,{className:F3(S.wrapperClass)},P["wrapper-start"],ee(),P["wrapper-end"]),K2(S)&&se.createElement(se.Fragment,null,se.createElement("div",{ref:D,className:"swiper-button-prev"}),se.createElement("div",{ref:E,className:"swiper-button-next"})),Y2(S)&&se.createElement("div",{ref:T,className:"swiper-scrollbar"}),Q2(S)&&se.createElement("div",{ref:M,className:"swiper-pagination"}),P["container-end"]))});eT.displayName="Swiper";const tT=L.forwardRef(({tag:t="div",children:e,className:n="",swiper:r,zoom:s,lazy:i,virtualIndex:o,swiperSlideIndex:l,...c}={},u)=>{const h=L.useRef(null),[f,m]=L.useState("swiper-slide"),[p,y]=L.useState(!1);function _(E,D,M){D===h.current&&m(M)}Tl(()=>{if(typeof l<"u"&&(h.current.swiperSlideIndex=l),u&&(u.current=h.current),!(!h.current||!r)){if(r.destroyed){f!=="swiper-slide"&&m("swiper-slide");return}return r.on("_slideClass",_),()=>{r&&r.off("_slideClass",_)}}}),Tl(()=>{r&&h.current&&!r.destroyed&&m(r.getSlideClasses(h.current))},[r]);const C={isActive:f.indexOf("swiper-slide-active")>=0,isVisible:f.indexOf("swiper-slide-visible")>=0,isPrev:f.indexOf("swiper-slide-prev")>=0,isNext:f.indexOf("swiper-slide-next")>=0},v=()=>typeof e=="function"?e(C):e,w=()=>{y(!0)};return se.createElement(t,qd({ref:h,className:X2(`${f}${n?` ${n}`:""}`),"data-swiper-slide-index":o,onLoad:w},c),s&&se.createElement(Vw.Provider,{value:C},se.createElement("div",{className:"swiper-zoom-container","data-swiper-zoom":typeof s=="number"?s:void 0},v(),i&&!p&&se.createElement("div",{className:"swiper-lazy-preloader",ref:E=>{E&&(E.lazyPreloaderManaged=!0)}}))),!s&&se.createElement(Vw.Provider,{value:C},v(),i&&!p&&se.createElement("div",{className:"swiper-lazy-preloader",ref:E=>{E&&(E.lazyPreloaderManaged=!0)}})))});tT.displayName="SwiperSlide";const sc=({className:t})=>a.jsxs("svg",{viewBox:"0 0 569 546",fill:"currentColor",className:t,xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("circle",{cx:"362.59",cy:"204.59",r:"204.59"}),a.jsx("rect",{height:"545.8",width:"100",x:"0",y:"0"})]});function K3(t){const{effect:e,swiper:n,on:r,setTranslate:s,setTransition:i,overwriteParams:o,perspective:l,recreateShadows:c,getEffectParams:u}=t;r("beforeInit",()=>{if(n.params.effect!==e)return;n.classNames.push(`${n.params.containerModifierClass}${e}`),l&&l()&&n.classNames.push(`${n.params.containerModifierClass}3d`);const f=o?o():{};Object.assign(n.params,f),Object.assign(n.originalParams,f)}),r("setTranslate _virtualUpdated",()=>{n.params.effect===e&&s()}),r("setTransition",(f,m)=>{n.params.effect===e&&i(m)}),r("transitionEnd",()=>{if(n.params.effect===e&&c){if(!u||!u().slideShadows)return;n.slides.forEach(f=>{f.querySelectorAll(".swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left").forEach(m=>m.remove())}),c()}});let h;r("virtualUpdate",()=>{n.params.effect===e&&(n.slides.length||(h=!0),requestAnimationFrame(()=>{h&&n.slides&&n.slides.length&&(s(),h=!1)}))})}function Q3(t,e){const n=z0(e);return n!==e&&(n.style.backfaceVisibility="hidden",n.style["-webkit-backface-visibility"]="hidden"),n}function Y3({swiper:t,duration:e,transformElements:n,allSlides:r}){const{activeIndex:s}=t;if(t.params.virtualTranslate&&e!==0){let i=!1,o;o=n,o.forEach(l=>{IM(l,()=>{if(i||!t||t.destroyed)return;i=!0,t.animating=!1;const c=new window.CustomEvent("transitionend",{bubbles:!0,cancelable:!0});t.wrapperEl.dispatchEvent(c)})})}}function X3(t,e,n){const r=`swiper-slide-shadow${` swiper-slide-shadow-${t}`}`,s=z0(e);let i=s.querySelector(`.${r.split(" ").join(".")}`);return i||(i=Hd("div",r.split(" ")),s.append(i)),i}function J3({swiper:t,extendParams:e,on:n}){e({creativeEffect:{limitProgress:1,shadowPerProgress:!1,progressMultiplier:1,perspective:!0,prev:{translate:[0,0,0],rotate:[0,0,0],opacity:1,scale:1},next:{translate:[0,0,0],rotate:[0,0,0],opacity:1,scale:1}}});const r=o=>typeof o=="string"?o:`${o}px`;K3({effect:"creative",swiper:t,on:n,setTranslate:()=>{const{slides:o,wrapperEl:l,slidesSizesGrid:c}=t,u=t.params.creativeEffect,{progressMultiplier:h}=u,f=t.params.centeredSlides,m=CM(t);if(f){const p=c[0]/2-t.params.slidesOffsetBefore||0;l.style.transform=`translateX(calc(50% - ${p}px))`}for(let p=0;p0&&(T=u.prev,M=!0),E.forEach((k,B)=>{E[B]=`calc(${k}px + (${r(T.translate[B])} * ${Math.abs(C*h)}))`}),D.forEach((k,B)=>{let z=T.rotate[B]*Math.abs(C*h);D[B]=z}),y.style.zIndex=-Math.abs(Math.round(_))+o.length;const S=E.join(", "),x=`rotateX(${m(D[0])}deg) rotateY(${m(D[1])}deg) rotateZ(${m(D[2])}deg)`,N=v<0?`scale(${1+(1-T.scale)*v*h})`:`scale(${1-(1-T.scale)*v*h})`,A=v<0?1+(1-T.opacity)*v*h:1-(1-T.opacity)*v*h,I=`translate3d(${S}) ${x} ${N}`;if(M&&T.shadow||!M){let k=y.querySelector(".swiper-slide-shadow");if(!k&&T.shadow&&(k=X3("creative",y)),k){const B=u.shadowPerProgress?C*(1/u.limitProgress):C;k.style.opacity=Math.min(Math.max(Math.abs(B),0),1)}}const P=Q3(u,y);P.style.transform=I,P.style.opacity=A,T.origin&&(P.style.transformOrigin=T.origin)}},setTransition:o=>{const l=t.slides.map(c=>z0(c));l.forEach(c=>{c.style.transitionDuration=`${o}ms`,c.querySelectorAll(".swiper-slide-shadow").forEach(u=>{u.style.transitionDuration=`${o}ms`})}),Y3({swiper:t,duration:o,transformElements:l,allSlides:!0})},perspective:()=>t.params.creativeEffect.perspective,overwriteParams:()=>({watchSlidesProgress:!0,virtualTranslate:!t.params.cssMode})})}function nT({id:t,title:e,author:n,pageCount:r,thumbnail:s,manga:i,onSelect:o,onEdit:l,onDelete:c,isCategoryPlusEnabled:u,isSelected:h,onMouseDown:f,onMouseEnter:m,folderItemCount:p,folderThumbnails:y,hasSubfolders:_,isFolderAnimationEnabled:C=!0,currentSection:v,dragStateParams:w,hasAnySelection:E,onToggleSelect:D}){const[M,T]=L.useState(!1),[S,x]=L.useState(0),N=s?Ks(s):void 0,[A,I]=L.useState(null),[P,k]=L.useState(!0),[B,z]=L.useState(!1),ee=!!(i!=null&&i.is_folder&&e.toLowerCase().includes("patreon"))&&!(i!=null&&i.folder_id)&&!!(y&&y.length>=2);L.useEffect(()=>{let ne;if(!B||!C){i!=null&&i.is_folder&&y&&y.length>2&&k(!0);return}if(i!=null&&i.is_folder&&y&&y.length===2){const pe=()=>{x(O=>(O+1)%y.length)};pe(),ne=setInterval(pe,4e3)}if(A&&(i!=null&&i.is_folder)&&y&&y.length>2){const pe=()=>{k(!1),setTimeout(()=>{A==null||A.slideNext(600),setTimeout(()=>{k(!0)},700)},400)};pe(),ne=setInterval(pe,4500)}return()=>clearInterval(ne)},[i==null?void 0:i.is_folder,y,A,B]);const F=ne=>{ne.stopPropagation(),T(!0)},K=ne=>{ne.stopPropagation(),c==null||c(t),T(!1)},R=ne=>{ne.stopPropagation(),i&&(l==null||l(i))};return a.jsxs("div",{className:"group cursor-pointer flex flex-col w-full max-w-xs",children:[a.jsxs("div",{onMouseDown:f,onMouseEnter:ne=>{z(!0),m==null||m(ne)},onMouseLeave:()=>z(!1),onDragStart:ne=>{ne.preventDefault()},onClick:ne=>{w!=null&&w.hasDragged?ne.preventDefault():u||E?(ne.preventDefault(),D==null||D()):(kD(t),o==null||o(t))},className:`relative bg-black rounded-lg shadow-lg overflow-hidden transition-transform duration-300 hover:scale-[1.02] aspect-[2/3] ${h?"ring-4 ring-[#bb86fc]":""}`,children:[i!=null&&i.is_folder?a.jsx("div",{className:"w-full aspect-[2/3] relative flex items-center justify-center bg-gradient-to-br from-[#1a1a1a] to-[#2a2a2a] rounded-lg border-2 border-gray-800 transition-colors duration-300 overflow-hidden group-hover:border-purple-500/50",children:y&&y.length>0?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"absolute inset-0 w-full h-full bg-black flex items-center justify-center overflow-hidden pointer-events-none",children:v!=="flow"&&y.length>=2?a.jsx("div",{className:"w-full h-full bg-[#111] p-[3px] grid gap-[3px]",style:{gridTemplateColumns:"1fr 1fr",gridTemplateRows:y.length>=3?"1fr 1fr":"1fr"},children:y.slice(0,4).map((ne,pe)=>a.jsx("div",{className:`relative overflow-hidden bg-gray-900 rounded-[3px] ${y.length===3&&pe===0?"col-span-2":""}`,children:a.jsx(un,{src:Ks(ne)||"",alt:"Patreon Collage",aspectRatio:"auto",objectFit:"cover",className:"absolute inset-0 w-full h-full",imgClassName:"w-full h-full object-cover transition-transform duration-700 group-hover:scale-110"})},ne+pe))}):y.length>2?B&&C?a.jsx(eT,{onSwiper:I,effect:"creative",grabCursor:!1,centeredSlides:!0,slidesPerView:1,loop:y.length>2,allowTouchMove:!1,speed:600,creativeEffect:{limitProgress:2,prev:{shadow:!0,translate:["-65%",0,-300],rotate:[0,45,0]},next:{shadow:!0,translate:["65%",0,-300],rotate:[0,-45,0]}},modules:[J3],className:"w-full h-full flex items-center justify-center overflow-visible",children:y.map((ne,pe)=>a.jsx(tT,{style:{width:"100%",height:"100%"},className:"flex items-center justify-center overflow-visible",children:({isActive:O})=>a.jsx("div",{className:`w-full h-full transition-transform duration-[400ms] ease-in-out origin-center rounded-lg overflow-hidden shadow-2xl border-2 border-white/5 ${O&&P?"scale-100":"scale-[0.80]"}`,children:a.jsx(un,{src:Ks(ne)||"",alt:"Folder Cover",aspectRatio:"2/3",objectFit:"cover",className:"w-full h-full"})})},ne+pe))}):a.jsx(un,{src:Ks(y[0])||"",alt:"Folder Cover",aspectRatio:"2/3",objectFit:"cover",className:"w-full h-full",imgClassName:"transition-transform duration-700"}):y.length===2?y.map((ne,pe)=>a.jsx("div",{className:`absolute inset-0 w-full h-full transition-all duration-[600ms] ease-out ${pe===S?"opacity-100 scale-100 blur-0 z-10":"opacity-0 scale-110 blur-md z-0"} pointer-events-none`,children:a.jsx(un,{src:Ks(ne)||"",alt:"Folder Cover",aspectRatio:"2/3",objectFit:"cover",className:"w-full h-full",imgClassName:""})},ne+pe)):a.jsx(un,{src:Ks(y[0])||"",alt:"Folder Cover",aspectRatio:"2/3",objectFit:"cover",className:"w-full h-full",imgClassName:"transition-transform duration-700 group-hover:scale-110"})}),a.jsx("div",{className:"absolute inset-x-0 bottom-0 h-1/3 bg-gradient-to-t from-black/60 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300 pointer-events-none z-10"}),ee&&a.jsx("div",{className:"absolute inset-0 z-30 flex items-center justify-center pointer-events-none",children:a.jsxs("div",{className:"bg-gray-800/50 backdrop-blur-[8px] rounded-2xl w-[55%] aspect-square border border-white/10 shadow-[0_8px_32px_0_rgba(0,0,0,0.5)] flex flex-col items-center justify-center gap-2 sm:gap-3 transition-transform duration-500 group-hover:scale-105",children:[a.jsx(sc,{className:"w-[40%] h-[40%] text-white drop-shadow-[0_2px_4px_rgba(0,0,0,0.6)]"}),a.jsx("span",{className:"text-white font-bold text-[9px] sm:text-[11px] tracking-widest uppercase drop-shadow-[0_2px_4px_rgba(0,0,0,0.6)]",children:"Patreon"})]})}),!ee&&a.jsx("div",{className:"absolute bottom-2 right-2 z-20 flex items-center justify-center bg-gray-800/70 backdrop-blur-md rounded-lg p-1.5 border border-gray-500/50 shadow-xl transition-all duration-300 group-hover:bg-gray-700/80 group-hover:scale-110",children:_?a.jsxs("div",{className:"relative w-[20px] h-[20px]",children:[a.jsx(xr,{className:"absolute top-0 right-0 w-3.5 h-3.5 text-white/50"}),a.jsx(xr,{className:"absolute bottom-0 left-0 w-4 h-4 text-white drop-shadow-[0_0_5px_rgba(255,255,255,0.5)] fill-black/20"})]}):a.jsx(xr,{className:"w-4 h-4 text-white drop-shadow-[0_0_5px_rgba(255,255,255,0.5)]"})})]}):a.jsxs(a.Fragment,{children:[ee&&a.jsx("div",{className:"absolute inset-0 z-30 flex items-center justify-center pointer-events-none",children:a.jsxs("div",{className:"bg-gray-800/50 backdrop-blur-[8px] rounded-2xl w-[55%] aspect-square border border-white/10 shadow-[0_8px_32px_0_rgba(0,0,0,0.5)] flex flex-col items-center justify-center gap-2 sm:gap-3 transition-transform duration-500 group-hover:scale-105",children:[a.jsx(sc,{className:"w-[40%] h-[40%] text-white drop-shadow-[0_2px_4px_rgba(0,0,0,0.6)]"}),a.jsx("span",{className:"text-white font-bold text-[9px] sm:text-[11px] tracking-widest uppercase drop-shadow-[0_2px_4px_rgba(0,0,0,0.6)]",children:"Patreon"})]})}),!ee&&a.jsx("div",{className:"absolute bottom-2 right-2 z-20 flex items-center justify-center bg-gray-800/70 backdrop-blur-md rounded-lg p-1.5 border border-gray-500/50 shadow-xl transition-all duration-300 group-hover:bg-gray-700/80 group-hover:scale-110",children:_?a.jsxs("div",{className:"relative w-[20px] h-[20px]",children:[a.jsx(xr,{className:"absolute top-0 right-0 w-3.5 h-3.5 text-white/50"}),a.jsx(xr,{className:"absolute bottom-0 left-0 w-4 h-4 text-white drop-shadow-[0_0_5px_rgba(255,255,255,0.5)] fill-black/20"})]}):a.jsx(xr,{className:"w-4 h-4 text-white drop-shadow-[0_0_5px_rgba(255,255,255,0.5)]"})}),a.jsx("div",{className:"relative z-10 flex flex-col items-center justify-center opacity-30",children:!ee&&a.jsx(xr,{className:"w-16 h-16 text-gray-400 mb-2"})})]})}):N?a.jsxs(a.Fragment,{children:[a.jsx(un,{src:N,alt:e,aspectRatio:"2/3",objectFit:"cover",loading:"lazy",imgClassName:"group-hover:scale-110"}),a.jsx("div",{className:"absolute inset-x-0 bottom-0 h-1/3 bg-gradient-to-t from-black/60 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300 pointer-events-none"})]}):a.jsx("div",{className:"w-full aspect-[2/3] flex items-center justify-center text-white/40 bg-gradient-to-br from-gray-800 to-gray-900 rounded-lg group-hover:text-white/60",children:a.jsx(fa,{className:"w-12 h-12"})}),(i==null?void 0:i.is_folder)&&p!==void 0&&a.jsx("div",{className:"absolute bottom-2 left-2 flex gap-1 flex-wrap pointer-events-none items-end z-10",children:a.jsxs("div",{className:"bg-black/70 text-white text-xs px-2 py-1 rounded-md font-semibold opacity-0 group-hover:opacity-100 transition-opacity duration-300 shadow-md",children:[p," elementos"]})}),!(i!=null&&i.is_folder)&&a.jsxs("div",{className:"absolute bottom-2 left-2 flex gap-1 flex-wrap pointer-events-none items-end",children:[a.jsxs("div",{className:"bg-black/70 text-white text-xs px-2 py-1 rounded-md font-semibold opacity-0 group-hover:opacity-100 transition-opacity duration-300 shadow-md",children:[r," paginas"]}),(i==null?void 0:i.is_decensored)&&a.jsx("div",{className:"bg-black/70 text-white text-xs px-2 py-1 rounded-md font-semibold opacity-0 group-hover:opacity-100 transition-opacity duration-300 shadow-md",children:"Sin censura"}),(i==null?void 0:i.is_bn)&&a.jsx("div",{className:"bg-black/70 text-white text-xs px-2 py-1 rounded-md font-semibold opacity-0 group-hover:opacity-100 transition-opacity duration-300 shadow-md",children:"B/N"}),(i==null?void 0:i.is_color)&&a.jsx("div",{className:"bg-black/70 text-white text-xs px-2 py-1 rounded-md font-semibold opacity-0 group-hover:opacity-100 transition-opacity duration-300 shadow-md",children:"a color"})]}),(u||E)&&a.jsx("div",{className:`absolute top-2 left-2 w-6 h-6 rounded-md border-2 flex items-center justify-center transition-all ${h?"bg-[#bb86fc] border-[#bb86fc]":"bg-black/50 border-white/50 hover:border-white"}`,children:h&&a.jsx(dc,{className:"w-4 h-4 text-white"})}),!u&&!E&&a.jsxs("div",{className:"absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity duration-300 flex gap-1",children:[i&&l&&a.jsx("button",{onClick:R,className:"bg-black/60 hover:bg-purple-600 text-white p-1.5 rounded-full transition-colors backdrop-blur-sm",title:"Editar manga",children:a.jsx(J_,{className:"w-3 h-3"})}),c&&a.jsx("button",{onClick:F,className:"bg-black/60 hover:bg-red-600 text-white p-1.5 rounded-full transition-colors backdrop-blur-sm",title:"Eliminar manga",children:a.jsx(tn,{className:"w-3 h-3"})})]}),M&&a.jsxs("div",{className:"absolute inset-0 bg-black/80 backdrop-blur-sm flex flex-col items-center justify-center gap-3 rounded-lg z-20 animate-in fade-in duration-200",children:[a.jsx("p",{className:"text-white text-sm font-semibold text-center px-3",children:"Eliminar manga?"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:ne=>{ne.stopPropagation(),T(!1)},className:"bg-gray-600 hover:bg-gray-700 text-white px-3 py-1.5 rounded-md text-xs font-semibold transition-all duration-200 transform hover:scale-105 active:scale-95",children:"Cancelar"}),a.jsx("button",{onClick:K,className:"bg-red-600 hover:bg-red-700 text-white px-3 py-1.5 rounded-md text-xs font-semibold transition-all duration-200 transform hover:scale-105 active:scale-95",children:"Eliminar"})]})]})]}),a.jsxs("div",{className:"mt-1 sm:mt-2 flex flex-col gap-0.5 text-center mb-2",children:[a.jsx("h3",{onClick:()=>o==null?void 0:o(t),className:"font-semibold text-xs sm:text-sm text-white line-clamp-2 cursor-pointer text-center group-hover:text-purple-400 transition-colors duration-300 ease-out",children:e}),n&&n.trim()!==""&&n.toLowerCase()!=="anónimo"&&n.toLowerCase()!=="anonimo"&&a.jsx("p",{className:"text-xs text-gray-400 text-center group-hover:text-gray-300 transition-colors duration-300 ease-out",children:n})]})]})}function Z3({id:t,onBack:e,onNavigateToManga:n,onMangaLoaded:r,onSelectCategory:s,onSelectAuthor:i,isAdmin:o=!1}){var $,X,re,de,Le;const[l,c]=L.useState(null),[u,h]=L.useState(!0),[f,m]=L.useState(!1),[p,y]=L.useState(0),[_,C]=L.useState(!1),[v,w]=L.useState(!1),[E,D]=L.useState(!1),[M,T]=L.useState(0),[S,x]=L.useState(!1),[N,A]=L.useState({name:"",url:""}),[I,P]=L.useState([]),[k,B]=L.useState("portrait"),[z,W]=L.useState("vertical"),[ee,F]=L.useState(!1),[K,R]=L.useState(0),[ne,pe]=L.useState([]),[O,Q]=L.useState(!1),[oe,ce]=L.useState(""),[Ie,te]=L.useState([]),[it,pt]=L.useState(!1),[Vt,st]=L.useState(!1),[yt,jt]=L.useState(1),[_n,xt]=L.useState(1),tt=6,Bn=()=>xt(H=>Math.min(H+.25,3)),Ue=()=>xt(H=>Math.max(H-.25,.5)),vt=()=>xt(1);L.useEffect(()=>{wt();const H=TD(t,me=>{me&&(c(()=>me),h(!1))});Pn(),ce("");const J=localStorage.getItem("manga-view-mode");return(J==="vertical"||J==="gallery"||J==="grid")&&W(J),()=>H()},[t]);async function Pn(){try{pt(!0);const H=await Mh();te(H)}catch(H){console.error("Error loading all mangas:",H)}finally{pt(!1)}}L.useEffect(()=>{function H(J){const me=J.target;_&&!me.closest(".download-menu-container")&&C(!1),v&&!me.closest(".pdf-menu-container")&&w(!1)}return document.addEventListener("mousedown",H),()=>document.removeEventListener("mousedown",H)},[_,v]);const Pt=async()=>{if(N.name.trim()&&N.url.trim()&&l)try{await AD(l.id,N),P([...I,N]),A({name:"",url:""}),x(!1)}catch(H){console.error("Error al guardar el enlace:",H),alert("Error al guardar el enlace")}},on=async H=>{if(l)try{await jD(l.id,H),P(I.filter((J,me)=>me!==H))}catch(J){console.error("Error al eliminar el enlace:",J),alert("Error al eliminar el enlace")}},fn=H=>{W(H),localStorage.setItem("manga-view-mode",H)};async function wt(){try{h(!0);const H=await Ni(t);if(H){if(c(H),P(H.external_links||[]),H.cover_url)try{const J=await WI(H.cover_url);B(J)}catch(J){console.warn("Failed to detect image orientation:",J),B("portrait")}G(H)}}catch(H){console.error("Error loading manga:",H)}finally{}}async function G(H){var J;try{Q(!0);const me=((J=H.categories)==null?void 0:J.map(Ee=>Ee.id))||[],ye=await PD(H.id,me,H.title);pe(ye),jt(1)}catch(me){console.error("Error loading recommendations:",me)}finally{Q(!1)}}async function ie(H){const J=(l==null?void 0:l.id)||t;if(!J){alert("Error: ID no encontrado.");return}const me=J;console.log(`🚀 [CLIENTE] Suscribiendo a progreso: ${me}`);const ye=new EventSource(`/api/download/progress/${me}`);ye.onmessage=Ee=>{const Ve=JSON.parse(Ee.data);y(Ve.progress),Ve.progress>=100&&ye.close()};try{console.log("🚀 [CLIENTE] Iniciando descarga para ID:",J),m(!0),C(!1),y(0);const Ee=await fetch("/api/download/zip",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mangaId:J,mangaTitle:(l==null?void 0:l.title)||"Descarga",format:H,jobId:me})});if(!Ee.ok)throw new Error("Error en el servidor");const Ve=await Ee.blob(),Be=window.URL.createObjectURL(Ve),De=document.createElement("a");De.href=Be,De.download=`${(l==null?void 0:l.title)||"manga"}.zip`,document.body.appendChild(De),De.click(),De.remove(),window.URL.revokeObjectURL(Be),console.log("✅ [CLIENTE] Descarga disparada con éxito")}catch(Ee){console.error("❌ Error en la descarga:",Ee),alert("Hubo un fallo en la matriz de descarga.")}finally{m(!1),ye.close()}}async function _e(H){const J=(l==null?void 0:l.id)||t;if(!J){alert("Error: ID no encontrado.");return}const me=J;console.log(`🚀 [CLIENTE] Suscribiendo a progreso PDF: ${me}`);const ye=new EventSource(`/api/download/progress/${me}`);ye.onmessage=Ee=>{const Ve=JSON.parse(Ee.data);Ve.progress&&T(Ve.progress),Ve.progress>=100&&ye.close()};try{console.log("🚀 [CLIENTE] Iniciando PDF para ID:",J),D(!0),T(0),w(!1);const Ee=await fetch("/api/download/pdf",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mangaId:J,mangaTitle:(l==null?void 0:l.title)||"Descarga",format:H,jobId:me})});if(!Ee.ok)throw new Error("Error en el servidor al generar PDF");const Ve=await Ee.blob(),Be=window.URL.createObjectURL(Ve),De=document.createElement("a");De.href=Be,De.download=`${(l==null?void 0:l.title)||"manga"}.pdf`,document.body.appendChild(De),De.click(),De.remove(),window.URL.revokeObjectURL(Be),console.log("✅ [CLIENTE] PDF descargado con éxito")}catch(Ee){console.error("Error initiating PDF generation:",Ee),alert("Error al generar PDF (puede que el archivo sea muy grande o Python falló).")}finally{D(!1),ye.close()}}if(u)return a.jsxs("div",{className:"h-screen bg-[#121212] flex flex-col items-center justify-center gap-4",children:[a.jsx(Sr,{size:40,borderWidth:2}),a.jsx("div",{className:"text-gray-400 text-sm",children:"Cargando..."})]});if(!l)return a.jsx("div",{className:"h-screen bg-[#121212] flex items-center justify-center",children:a.jsx("div",{className:"text-gray-400 text-lg",children:"Manga no encontrado"})});const Se=oe.trim()?Ie.filter(H=>{var Ve;if(!H.id||!H.title||H.id===l.id)return!1;const J=oe.toLowerCase(),me=H.title.toLowerCase().includes(J),ye=H.author?H.author.toLowerCase().includes(J):!1,Ee=((Ve=H.categories)==null?void 0:Ve.some(Be=>{var De;return(De=Be==null?void 0:Be.name)==null?void 0:De.toLowerCase().includes(J)}))||!1;return me||ye||Ee}):[];return a.jsxs("div",{className:"h-screen flex flex-col bg-[#121212] overflow-hidden",children:[a.jsx("header",{className:"border-b border-gray-800 z-40 bg-[#121212] flex-shrink-0",children:a.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 py-3 sm:py-4 flex items-center gap-3 sm:gap-4",children:[a.jsx("button",{onClick:e,className:"p-2 hover:bg-[#333] rounded-lg transition-colors text-gray-300 hover:text-white flex-shrink-0",children:a.jsx(Is,{className:"w-5 h-5"})}),a.jsx("h1",{className:"text-base sm:text-lg font-bold text-white truncate flex-shrink-0",children:l.title}),a.jsx("div",{className:"flex-1 max-w-md ml-auto",children:a.jsxs("div",{className:"relative",children:[a.jsx(no,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400"}),a.jsx("input",{type:"text",placeholder:"Buscar comics…",value:oe,onChange:H=>ce(H.target.value),className:"w-full bg-[#1a1a1a] text-white rounded-lg pl-10 pr-3 py-2 text-sm placeholder-gray-400 focus:ring-2 focus:ring-[#bb86fc] focus:outline-none transition-all border border-gray-700/50 focus:border-[#bb86fc]"})]})})]})}),a.jsxs("main",{className:"flex-1 overflow-y-auto bg-[#121212]",children:[a.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 py-4 sm:py-8",children:[!oe.trim()&&a.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 sm:gap-6",children:[a.jsx("div",{className:"flex-shrink-0 mx-auto sm:mx-0",children:a.jsx("div",{className:"group w-56 sm:w-64",children:a.jsx("div",{className:"relative bg-black rounded-lg shadow-lg overflow-hidden transition-transform duration-300 hover:scale-[1.02]",children:l.cover_url?a.jsxs(a.Fragment,{children:[a.jsx(un,{src:l.cover_url,alt:l.title,aspectRatio:"2/3",objectFit:"cover",loading:"eager",imgClassName:"group-hover:scale-110"}),a.jsx("div",{className:"absolute inset-x-0 bottom-0 h-1/3 bg-gradient-to-t from-black/60 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300 ease-in-out pointer-events-none"})]}):a.jsx("div",{className:"w-full aspect-[2/3] flex items-center justify-center text-white/40 bg-black",children:a.jsx(Vx,{className:"w-16 h-16"})})})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("h2",{className:"text-2xl sm:text-4xl font-bold text-white mb-3 sm:mb-4",children:l.title}),a.jsx("div",{className:"mb-4",children:a.jsxs("div",{className:"flex items-center gap-2 text-gray-300",children:[l.author&&l.author.toLowerCase()!=="anónimo"&&l.author.toLowerCase()!=="anonimo"&&a.jsxs(a.Fragment,{children:[a.jsx(Lg,{className:"w-4 h-4 text-[#bb86fc]"}),a.jsx("button",{onClick:()=>i==null?void 0:i(l.author),className:"text-sm hover:text-[#bb86fc] hover:underline transition-colors",children:l.author}),a.jsx("div",{className:"w-1 h-1 bg-gray-600 rounded-full mx-2"})]}),a.jsx(Wp,{className:"w-4 h-4 text-[#bb86fc]"}),a.jsxs("span",{className:"text-sm",children:[(($=l.views)==null?void 0:$.toLocaleString())||0," vistas"]})]})}),a.jsxs("div",{className:"mb-6",children:[a.jsx("h3",{className:"text-sm font-semibold text-gray-300 mb-3",children:"Categorías"}),a.jsx("div",{className:"flex gap-2 flex-wrap",children:(X=l.categories)==null?void 0:X.sort((H,J)=>{const me={series:1,character:2,genre:3,tag:4,other:5},ye=H.type||"genre",Ee=J.type||"genre";return(me[ye]||5)-(me[Ee]||5)}).map(H=>{let J="bg-[#bb86fc]/20 text-[#bb86fc] border-[#bb86fc]/40";return H.type==="character"?J="bg-blue-500/20 text-blue-300 border-blue-500/30":H.type==="series"?J="bg-green-500/20 text-green-300 border-green-500/30":H.type==="tag"&&(J="bg-pink-500/20 text-pink-300 border-pink-500/30"),a.jsx("button",{onClick:()=>s==null?void 0:s(H.name),className:`px-3 py-1.5 text-xs rounded-full border ${J} hover:opacity-80 transition-opacity cursor-pointer`,children:H.name},H.id)})})]}),l.description&&l.description.trim()!==""&&a.jsxs("div",{className:"mb-6",children:[a.jsx("h3",{className:"text-sm font-semibold text-gray-300 mb-2",children:"Sinopsis"}),a.jsx("p",{className:"text-sm text-gray-400 leading-relaxed whitespace-pre-wrap",children:l.description})]}),a.jsx("div",{className:"flex flex-col gap-3 sm:gap-4",children:l.chapters&&l.chapters.length>0&&l.chapters[0].pages&&l.chapters[0].pages.length>0&&a.jsxs(a.Fragment,{children:[f&&a.jsxs("div",{className:"w-full",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("span",{className:"text-xs sm:text-sm font-semibold text-[#bb86fc]",children:"Descargando ZIP"}),a.jsxs("span",{className:"text-xs sm:text-sm font-bold text-[#bb86fc]",children:[p,"%"]})]}),a.jsx("div",{className:"w-full bg-gray-700/40 rounded-full h-2 overflow-hidden border border-[#bb86fc]/30",children:a.jsx("div",{className:"bg-gradient-to-r from-[#bb86fc] to-[#9966dd] h-full transition-all duration-300 ease-out",style:{width:`${p}%`}})})]}),E&&a.jsxs("div",{className:"w-full",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("span",{className:"text-xs sm:text-sm font-semibold text-[#bb86fc]",children:"Generando PDF"}),a.jsxs("span",{className:"text-xs sm:text-sm font-bold text-[#bb86fc]",children:[M,"%"]})]}),a.jsx("div",{className:"w-full bg-gray-700/40 rounded-full h-2 overflow-hidden border border-[#bb86fc]/30",children:a.jsx("div",{className:"bg-gradient-to-r from-[#bb86fc] to-[#9966dd] h-full transition-all duration-300 ease-out",style:{width:`${M}%`}})})]}),a.jsxs("div",{className:"flex flex-wrap gap-2 items-center",children:[a.jsxs("div",{className:"relative download-menu-container",children:[a.jsxs("button",{onClick:()=>C(!_),disabled:f,className:"bg-[#121212] hover:bg-[#1f1f1f] border border-[#bb86fc]/50 hover:border-[#bb86fc] text-[#bb86fc] px-2 sm:px-3 py-1.5 sm:py-2 rounded-lg flex items-center gap-1 font-semibold text-xs sm:text-sm transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed",children:[a.jsx(Ja,{className:"w-3 h-3 sm:w-4 sm:h-4 flex-shrink-0"}),a.jsx("span",{className:"hidden sm:inline",children:f?`Descargando (${p}%)`:"ZIP"}),a.jsx("span",{className:"sm:hidden",children:"ZIP"})]}),_&&!f&&a.jsxs("div",{className:"absolute top-full mt-2 left-0 bg-[#1f1f1f] border border-gray-700/60 rounded-lg shadow-2xl shadow-black/50 overflow-hidden z-50 min-w-[200px]",children:[a.jsxs("button",{onClick:()=>ie("original"),className:"w-full px-3 py-2 text-left text-xs sm:text-sm text-white hover:bg-[#bb86fc]/20 transition-colors flex items-center gap-2 border-b border-gray-700/40",children:[a.jsx(Ja,{className:"w-3 h-3 text-[#bb86fc]"}),a.jsxs("div",{children:[a.jsx("div",{className:"font-semibold",children:"Original"}),a.jsx("div",{className:"text-xs text-gray-400",children:"Sin cambios"})]})]}),a.jsxs("button",{onClick:()=>ie("webp"),className:"w-full px-3 py-2 text-left text-xs sm:text-sm text-white hover:bg-[#bb86fc]/20 transition-colors flex items-center gap-2 border-b border-gray-700/40",children:[a.jsx(Ja,{className:"w-3 h-3 text-[#bb86fc]"}),a.jsxs("div",{children:[a.jsx("div",{className:"font-semibold",children:"WebP"}),a.jsx("div",{className:"text-xs text-gray-400",children:"Optimizado"})]})]}),a.jsxs("button",{onClick:()=>ie("png"),className:"w-full px-3 py-2 text-left text-xs sm:text-sm text-white hover:bg-[#bb86fc]/20 transition-colors flex items-center gap-2 border-b border-gray-700/40",children:[a.jsx(Ja,{className:"w-3 h-3 text-[#bb86fc]"}),a.jsxs("div",{children:[a.jsx("div",{className:"font-semibold",children:"PNG"}),a.jsx("div",{className:"text-xs text-gray-400",children:"Sin pérdida"})]})]}),a.jsxs("button",{onClick:()=>ie("jpg"),className:"w-full px-3 py-2 text-left text-xs sm:text-sm text-white hover:bg-[#bb86fc]/20 transition-colors flex items-center gap-2",children:[a.jsx(Ja,{className:"w-3 h-3 text-[#bb86fc]"}),a.jsxs("div",{children:[a.jsx("div",{className:"font-semibold",children:"JPG"}),a.jsx("div",{className:"text-xs text-gray-400",children:"Comprimido"})]})]})]})]}),a.jsxs("div",{className:"relative pdf-menu-container",children:[a.jsxs("button",{onClick:()=>w(!v),disabled:E,className:"bg-[#121212] hover:bg-[#1f1f1f] border border-[#bb86fc]/50 hover:border-[#bb86fc] text-[#bb86fc] px-2 sm:px-3 py-1.5 sm:py-2 rounded-lg flex items-center gap-1 font-semibold text-xs sm:text-sm transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed",children:[a.jsx(Za,{className:"w-3 h-3 sm:w-4 sm:h-4 flex-shrink-0"}),a.jsx("span",{className:"hidden sm:inline",children:E?`Generando (${M}%)`:"PDF"}),a.jsx("span",{className:"sm:hidden",children:"PDF"})]}),v&&!E&&a.jsxs("div",{className:"absolute top-full mt-2 left-0 bg-[#1f1f1f] border border-gray-700/60 rounded-lg shadow-2xl shadow-black/50 overflow-hidden z-50 min-w-[200px]",children:[a.jsxs("button",{onClick:()=>_e("original"),className:"w-full px-3 py-2 text-left text-xs sm:text-sm text-white hover:bg-[#bb86fc]/20 transition-colors flex items-center gap-2 border-b border-gray-700/40",children:[a.jsx(Za,{className:"w-3 h-3 text-[#bb86fc]"}),a.jsxs("div",{children:[a.jsx("div",{className:"font-semibold",children:"Original"}),a.jsx("div",{className:"text-xs text-gray-400",children:"Sin cambios"})]})]}),a.jsxs("button",{onClick:()=>_e("webp"),className:"w-full px-3 py-2 text-left text-xs sm:text-sm text-white hover:bg-[#bb86fc]/20 transition-colors flex items-center gap-2 border-b border-gray-700/40",children:[a.jsx(Za,{className:"w-3 h-3 text-[#bb86fc]"}),a.jsxs("div",{children:[a.jsx("div",{className:"font-semibold",children:"WebP"}),a.jsx("div",{className:"text-xs text-gray-400",children:"Optimizado"})]})]}),a.jsxs("button",{onClick:()=>_e("png"),className:"w-full px-3 py-2 text-left text-xs sm:text-sm text-white hover:bg-[#bb86fc]/20 transition-colors flex items-center gap-2 border-b border-gray-700/40",children:[a.jsx(Za,{className:"w-3 h-3 text-[#bb86fc]"}),a.jsxs("div",{children:[a.jsx("div",{className:"font-semibold",children:"PNG"}),a.jsx("div",{className:"text-xs text-gray-400",children:"Sin pérdida"})]})]}),a.jsxs("button",{onClick:()=>_e("jpg"),className:"w-full px-3 py-2 text-left text-xs sm:text-sm text-white hover:bg-[#bb86fc]/20 transition-colors flex items-center gap-2",children:[a.jsx(Za,{className:"w-3 h-3 text-[#bb86fc]"}),a.jsxs("div",{children:[a.jsx("div",{className:"font-semibold",children:"JPG"}),a.jsx("div",{className:"text-xs text-gray-400",children:"Comprimido"})]})]})]})]}),a.jsxs("button",{onClick:()=>{l!=null&&l.id&&(window.location.hash=`manga/${l.id}/hd`)},className:"bg-[#121212] hover:bg-[#1f1f1f] border border-[#bb86fc]/50 hover:border-[#bb86fc] text-[#bb86fc] px-2 sm:px-3 py-1.5 sm:py-2 rounded-lg flex items-center gap-1 font-semibold text-xs sm:text-sm transition-all duration-200",children:[a.jsx(Wp,{className:"w-3 h-3 sm:w-4 sm:h-4 flex-shrink-0"}),a.jsx("span",{className:"hidden sm:inline",children:"Ver HD"}),a.jsx("span",{className:"sm:hidden",children:"HD"})]}),a.jsxs("button",{onClick:async()=>{try{await navigator.clipboard.writeText(l.id),st(!0),setTimeout(()=>st(!1),2e3),window.open("https://t.me/twistedbrodymangaflowbot","_blank")}catch(H){console.error("Failed to copy:",H)}},className:"bg-[#121212] hover:bg-[#1f1f1f] border border-[#bb86fc]/50 hover:border-[#bb86fc] text-[#bb86fc] px-2 sm:px-3 py-1.5 sm:py-2 rounded-lg flex items-center gap-1 font-semibold text-xs sm:text-sm transition-all duration-200",children:[Vt?a.jsx(dc,{className:"w-3 h-3 sm:w-4 sm:h-4 flex-shrink-0"}):a.jsx(UI,{className:"w-3 h-3 sm:w-4 sm:h-4 flex-shrink-0"}),a.jsx("span",{className:"hidden sm:inline",children:Vt?"ID Copiado":"Bot Telegram"}),a.jsx("span",{className:"sm:hidden",children:Vt?"Copiado":"Bot"})]}),I.map((H,J)=>a.jsxs("a",{href:H.url,target:"_blank",rel:"noopener noreferrer",className:"bg-[#121212] hover:bg-[#1f1f1f] border border-[#bb86fc]/50 hover:border-[#bb86fc] text-[#bb86fc] px-2 sm:px-3 py-1.5 sm:py-2 rounded-lg flex items-center gap-1.5 font-semibold text-xs sm:text-sm transition-all duration-200 group",children:[a.jsx(xd,{className:"w-3 h-3 sm:w-4 sm:h-4 flex-shrink-0"}),a.jsx("span",{className:"truncate max-w-[150px]",children:H.name}),o&&a.jsx("button",{onClick:me=>{me.preventDefault(),me.stopPropagation(),on(J)},className:"opacity-0 group-hover:opacity-100 hover:text-red-400 transition-all flex-shrink-0",children:a.jsx(gt,{className:"w-3 h-3 sm:w-4 sm:h-4"})})]},J)),o&&a.jsx("button",{onClick:()=>x(!0),className:"bg-[#121212] hover:bg-[#1f1f1f] border border-[#bb86fc]/50 hover:border-[#bb86fc] text-[#bb86fc] p-1.5 sm:p-2 rounded-lg transition-all duration-200 flex items-center justify-center",title:"Añadir enlace externo",children:a.jsx(Kr,{className:"w-4 h-4 sm:w-5 sm:h-5"})})]})]})})]})]}),oe.trim()?a.jsxs("div",{className:"mt-2",children:[a.jsxs("h3",{className:"text-lg font-semibold text-white mb-4",children:["Resultados de búsqueda",Se.length>0&&a.jsxs("span",{className:"text-sm text-gray-400 ml-2",children:["(",Se.length," ",Se.length===1?"resultado":"resultados",")"]})]}),it?a.jsx("div",{className:"flex justify-center py-12",children:a.jsx(Sr,{size:40,borderWidth:2})}):Se.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[a.jsx(no,{className:"w-12 h-12 text-gray-600 mb-3"}),a.jsxs("p",{className:"text-gray-400 text-sm",children:['No se encontraron comics que coincidan con "',oe,'"']})]}):a.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 gap-1.5 sm:gap-2 md:gap-3",children:Se.map(H=>{var me,ye;if(!H.id||!H.title)return null;(me=H.chapters)!=null&&me.length;const J=((ye=H.chapters)==null?void 0:ye.reduce((Ee,Ve)=>{var Be;return Ee+(((Be=Ve.pages)==null?void 0:Be.length)||0)},0))||0;return a.jsx(nT,{id:H.id,title:H.title,author:H.author||"Desconocido",pageCount:J,thumbnail:H.cover_url||H.thumbnail_url||void 0,manga:H,onSelect:Ee=>{n&&(window.scrollTo({top:0,behavior:"smooth"}),n(Ee))}},H.id)})})]}):l.chapters&&l.chapters.length>0&&l.chapters[0].pages&&l.chapters[0].pages.length>0&&a.jsxs("div",{className:"mt-6 sm:mt-8 border-t border-gray-800 pt-6 sm:pt-8",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4 sm:mb-6",children:[a.jsx("h3",{className:"text-lg font-semibold text-white",children:"Páginas"}),a.jsxs("div",{className:"flex items-center gap-1 bg-[#0a0a0a] border border-gray-800 rounded-lg p-1",children:[a.jsxs("button",{onClick:()=>fn("vertical"),className:`px-3 py-2 rounded-md flex items-center gap-2 text-xs sm:text-sm font-medium transition-all duration-200 ${z==="vertical"?"bg-gradient-to-r from-[#bb86fc] to-[#9966dd] text-white shadow-lg shadow-[#bb86fc]/30":"text-gray-400 hover:text-white hover:bg-[#242424]"}`,title:"Vista vertical",children:[a.jsx(Xp,{className:"w-4 h-4"}),a.jsx("span",{className:"hidden sm:inline",children:"Vertical"})]}),a.jsxs("button",{onClick:()=>fn("gallery"),className:`px-3 py-2 rounded-md flex items-center gap-2 text-xs sm:text-sm font-medium transition-all duration-200 ${z==="gallery"?"bg-gradient-to-r from-[#bb86fc] to-[#9966dd] text-white shadow-lg shadow-[#bb86fc]/30":"text-gray-400 hover:text-white hover:bg-[#242424]"}`,title:"Vista galería",children:[a.jsx(Kp,{className:"w-4 h-4"}),a.jsx("span",{className:"hidden sm:inline",children:"Galería"})]}),a.jsxs("button",{onClick:()=>fn("grid"),className:`px-3 py-2 rounded-md flex items-center gap-2 text-xs sm:text-sm font-medium transition-all duration-200 ${z==="grid"?"bg-gradient-to-r from-[#bb86fc] to-[#9966dd] text-white shadow-lg shadow-[#bb86fc]/30":"text-gray-400 hover:text-white hover:bg-[#242424]"}`,title:"Vista cuadrícula",children:[a.jsx(Qp,{className:"w-4 h-4"}),a.jsx("span",{className:"hidden sm:inline",children:"Cuadrícula"})]}),z==="vertical"&&a.jsxs("div",{className:"flex items-center gap-1 ml-2 border-l border-gray-700 pl-2",children:[a.jsx("button",{onClick:Ue,className:"p-2 text-gray-400 hover:text-white hover:bg-[#242424] rounded-md transition-colors",title:"Reducir",children:a.jsx(Vg,{className:"w-4 h-4"})}),a.jsxs("span",{className:"text-xs text-gray-300 w-8 text-center hidden sm:inline-block",children:[Math.round(_n*100),"%"]}),a.jsx("button",{onClick:Bn,className:"p-2 text-gray-400 hover:text-white hover:bg-[#242424] rounded-md transition-colors",title:"Aumentar",children:a.jsx(Og,{className:"w-4 h-4"})}),a.jsx("button",{onClick:vt,className:"p-2 text-gray-400 hover:text-white hover:bg-[#242424] rounded-md transition-colors",title:"Restablecer",children:a.jsx(Mg,{className:"w-3 h-3"})})]})]})]}),a.jsx("div",{className:`bg-[#121212] rounded-lg p-0 sm:p-4 transition-all duration-150 ease-out ${z==="vertical"?"flex flex-col items-center gap-0 sm:gap-4":z==="gallery"?"masonry-container":"grid grid-cols-3 md:grid-cols-5 gap-2"}`,children:z==="gallery"?l.chapters[0].pages.map((H,J)=>({pageUrl:H,index:J})).map(({pageUrl:H,index:J})=>a.jsx("div",{className:"masonry-item group cursor-pointer relative bg-black rounded-lg shadow-lg overflow-hidden transition-transform duration-300 hover:scale-[1.02]",onClick:()=>{R(J),F(!0)},children:a.jsx(un,{src:H,alt:`Página ${J+1}`,aspectRatio:"auto",objectFit:"contain",loading:J>2?"lazy":"eager",className:"rounded-lg",imgClassName:"group-hover:scale-110"})},J)):l.chapters[0].pages.map((H,J)=>({pageUrl:H,index:J})).map(({pageUrl:H,index:J})=>a.jsx("div",{className:z==="vertical"?"relative transition-all duration-200 mx-auto":"group cursor-pointer relative bg-black rounded-lg shadow-lg overflow-hidden transition-transform duration-300 hover:scale-[1.02]",style:z==="vertical"?{width:`${Math.min(100*_n,100)}%`,maxWidth:_n>1?"none":void 0}:void 0,onClick:()=>{z==="grid"&&(R(J),F(!0))},children:z==="vertical"?a.jsx(tE,{minHeight:"50vh",children:()=>a.jsx(un,{src:H,alt:`Página ${J+1}`,aspectRatio:"auto",objectFit:"contain",loading:"eager",className:"rounded-none sm:rounded-lg shadow-none sm:shadow-2xl w-full block",imgClassName:"w-full block"})}):a.jsx(un,{src:H,alt:`Página ${J+1}`,aspectRatio:"1/1",objectFit:"cover",loading:J>2?"lazy":"eager",className:"rounded-lg",imgClassName:"group-hover:scale-110"})},J))})]}),!oe.trim()&&ne.length>0&&a.jsxs("div",{className:"mt-8 sm:mt-12 border-t border-gray-800 pt-8 sm:pt-12",children:[a.jsx("h3",{className:"text-xl sm:text-2xl font-bold text-white mb-6",children:"Recomendaciones"}),O?a.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 gap-1.5 sm:gap-2 md:gap-3",children:Array.from({length:6}).map((H,J)=>a.jsxs("div",{className:"animate-pulse",children:[a.jsx("div",{className:"bg-gray-800 rounded-lg aspect-[2/3] w-full mb-2"}),a.jsx("div",{className:"h-3 bg-gray-800 rounded w-3/4 mx-auto mb-1"}),a.jsx("div",{className:"h-2 bg-gray-800 rounded w-1/2 mx-auto"})]},J))}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 gap-1.5 sm:gap-2 md:gap-3 mb-6 animate-slide-in-right",children:ne.slice((yt-1)*tt,yt*tt).map((H,J)=>{var me;return a.jsx("div",{children:a.jsxs("div",{onClick:()=>{window.scrollTo({top:0,behavior:"smooth"}),n&&n(H.id)},className:"group cursor-pointer flex flex-col",children:[a.jsxs("div",{className:"relative bg-black rounded-lg shadow-lg overflow-hidden transition-transform duration-300 hover:scale-[1.02]",children:[H.cover_url||H.thumbnail_url?a.jsxs(a.Fragment,{children:[a.jsx(un,{src:H.cover_url||H.thumbnail_url||"",alt:H.title,aspectRatio:"2/3",objectFit:"cover",loading:"lazy",imgClassName:"group-hover:scale-110"}),a.jsx("div",{className:"absolute inset-x-0 bottom-0 h-1/3 bg-gradient-to-t from-black/60 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300 ease-in-out pointer-events-none"})]}):a.jsx("div",{className:"w-full aspect-[2/3] flex items-center justify-center text-white/40 bg-black",children:a.jsx(Vx,{className:"w-8 h-8"})}),a.jsxs("div",{className:"absolute bottom-2 left-2 flex gap-1 flex-wrap pointer-events-none items-end",children:[a.jsxs("div",{className:"bg-black/70 text-white text-[10px] sm:text-xs px-1.5 sm:px-2 py-0.5 sm:py-1 rounded font-semibold opacity-0 group-hover:opacity-100 transition-opacity duration-300 shadow-md",children:[((me=H.chapters)==null?void 0:me.reduce((ye,Ee)=>{var Ve;return ye+(((Ve=Ee.pages)==null?void 0:Ve.length)||0)},0))||0," paginas"]}),H.is_decensored&&a.jsx("div",{className:"bg-black/70 text-white text-[10px] sm:text-xs px-1.5 sm:px-2 py-0.5 sm:py-1 rounded font-semibold opacity-0 group-hover:opacity-100 transition-opacity duration-300 shadow-md",children:"Sin censura"}),H.is_bn&&a.jsx("div",{className:"bg-black/70 text-white text-[10px] sm:text-xs px-1.5 sm:px-2 py-0.5 sm:py-1 rounded font-semibold opacity-0 group-hover:opacity-100 transition-opacity duration-300 shadow-md",children:"B/N"}),H.is_color&&a.jsx("div",{className:"bg-black/70 text-white text-[10px] sm:text-xs px-1.5 sm:px-2 py-0.5 sm:py-1 rounded font-semibold opacity-0 group-hover:opacity-100 transition-opacity duration-300 shadow-md",children:"a color"})]})]}),a.jsxs("div",{className:"mt-2 flex flex-col gap-0.5",children:[a.jsx("h4",{className:"font-semibold text-xs text-white line-clamp-2 text-center group-hover:text-[#bb86fc] transition-colors duration-300",children:H.title}),H.categories&&H.categories.length>0&&a.jsx("p",{className:"text-xs text-gray-500 text-center truncate",children:(H.categories.find(ye=>ye.type==="series")||H.categories[0]).name})]})]})},H.id)})},yt),ne.length>tt&&a.jsxs("div",{className:"flex items-center justify-center gap-2 mt-4 flex-wrap",children:[a.jsx("button",{onClick:()=>jt(1),disabled:yt===1,className:"p-2 rounded-lg bg-[#1a1a1a] text-white hover:bg-[#bb86fc] disabled:opacity-50 disabled:hover:bg-[#1a1a1a] transition-colors",children:a.jsx(q_,{className:"w-4 h-4"})}),a.jsx("button",{onClick:()=>jt(H=>Math.max(1,H-1)),disabled:yt===1,className:"p-2 rounded-lg bg-[#1a1a1a] text-white hover:bg-[#bb86fc] disabled:opacity-50 disabled:hover:bg-[#1a1a1a] transition-colors",children:a.jsx(dh,{className:"w-4 h-4"})}),a.jsxs("span",{className:"text-sm text-gray-400 px-2",children:["Página ",yt," de ",Math.ceil(ne.length/tt)]}),a.jsx("button",{onClick:()=>jt(H=>Math.min(Math.ceil(ne.length/tt),H+1)),disabled:yt===Math.ceil(ne.length/tt),className:"p-2 rounded-lg bg-[#1a1a1a] text-white hover:bg-[#bb86fc] disabled:opacity-50 disabled:hover:bg-[#1a1a1a] transition-colors",children:a.jsx(hc,{className:"w-4 h-4"})}),a.jsx("button",{onClick:()=>jt(Math.ceil(ne.length/tt)),disabled:yt===Math.ceil(ne.length/tt),className:"p-2 rounded-lg bg-[#1a1a1a] text-white hover:bg-[#bb86fc] disabled:opacity-50 disabled:hover:bg-[#1a1a1a] transition-colors",children:a.jsx(G_,{className:"w-4 h-4"})})]})]})]})]}),a.jsx(hh,{})]}),ee&&((de=(re=l.chapters)==null?void 0:re[0])==null?void 0:de.pages)&&a.jsx(eE,{images:((Le=l.chapters)==null?void 0:Le[0].pages)||[],initialIndex:K,onClose:()=>F(!1)}),S&&a.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:a.jsxs("div",{className:"bg-gradient-to-b from-[#1f1f1f] to-[#121212] rounded-2xl border border-gray-700/40 w-full max-w-md shadow-2xl",children:[a.jsxs("div",{className:"bg-gradient-to-b from-[#2a2a2a]/80 to-[#1f1f1f]/80 border-b border-gray-700/30 px-6 py-4 flex items-center justify-between",children:[a.jsx("h2",{className:"text-xl font-bold text-white",children:"Añadir Enlace Externo"}),a.jsx("button",{onClick:()=>x(!1),className:"text-gray-500 hover:text-white transition-colors p-1.5 rounded-lg hover:bg-white/10",children:a.jsx(gt,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"p-6 space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-semibold text-gray-200 mb-2",children:"Nombre del Enlace"}),a.jsx("input",{type:"text",placeholder:"Ej: Servidor Alternativo",value:N.name,onChange:H=>A({...N,name:H.target.value}),className:"w-full bg-[#1a1a1a] border border-gray-600/50 rounded-lg px-4 py-3 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-[#bb86fc] focus:ring-2 focus:ring-[#bb86fc]/30 transition-all"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-semibold text-gray-200 mb-2",children:"URL del Enlace"}),a.jsx("input",{type:"url",placeholder:"https://ejemplo.com/descarga",value:N.url,onChange:H=>A({...N,url:H.target.value}),className:"w-full bg-[#1a1a1a] border border-gray-600/50 rounded-lg px-4 py-3 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-[#bb86fc] focus:ring-2 focus:ring-[#bb86fc]/30 transition-all"})]}),a.jsxs("div",{className:"flex gap-3 pt-2",children:[a.jsx("button",{onClick:()=>x(!1),className:"flex-1 bg-[#1a1a1a] border border-gray-600/50 hover:border-gray-500 hover:bg-[#242424] text-white px-4 py-3 rounded-lg font-semibold text-sm transition-all",children:"Cancelar"}),a.jsx("button",{onClick:Pt,disabled:!N.name.trim()||!N.url.trim(),className:"flex-1 bg-gradient-to-r from-[#bb86fc] to-[#9966dd] hover:from-[#9966dd] hover:to-[#7744cc] disabled:opacity-50 disabled:cursor-not-allowed text-white px-4 py-3 rounded-lg font-semibold text-sm transition-all shadow-lg shadow-[#bb86fc]/40 hover:shadow-[#bb86fc]/60",children:"Añadir Enlace"})]})]})]})})]})}function e6({manga:t,chapter:e,onBack:n}){const[r,s]=L.useState(0);if(!e.pages||e.pages.length===0)return a.jsxs("div",{className:"h-screen bg-[#121212] flex flex-col items-center justify-center",children:[a.jsx("button",{onClick:n,className:"absolute top-6 left-6 p-2 hover:bg-[#333] rounded-lg transition-colors text-gray-300 hover:text-white",children:a.jsx(Is,{className:"w-5 h-5"})}),a.jsx("div",{className:"text-gray-400 text-lg",children:"No hay páginas disponibles"})]});const i=()=>{r>0&&s(r-1)},o=()=>{r{const u=c<2,h=gM(l);return a.jsx("div",{className:"w-full flex justify-center",children:a.jsx(un,{src:h,alt:`Página ${c+1}`,aspectRatio:"auto",objectFit:"contain",loading:u?"eager":"lazy",className:"max-w-full shadow-2xl",showPlaceholder:c>0})},c)}),a.jsx("div",{className:"w-full mt-8",children:a.jsx(hh,{})})]})}),a.jsx("div",{className:"border-t border-gray-700/60 bg-gradient-to-r from-[#2a2a2a] to-[#252525] px-6 py-6 flex-shrink-0",children:a.jsxs("div",{className:"max-w-7xl mx-auto flex items-center justify-between",children:[a.jsxs("button",{onClick:i,disabled:r===0,className:"flex items-center gap-2 px-4 py-2 rounded-lg bg-gray-800 hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed text-white transition-all",children:[a.jsx(dh,{className:"w-5 h-5"}),"Anterior"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{type:"range",min:"0",max:e.pages.length-1,value:r,onChange:l=>s(parseInt(l.target.value)),className:"w-64 h-2 bg-gray-700 rounded-lg appearance-none cursor-pointer accent-[#bb86fc]"}),a.jsxs("span",{className:"text-sm text-gray-400 w-12 text-right",children:[r+1,"/",e.pages.length]})]}),a.jsxs("button",{onClick:o,disabled:r===e.pages.length-1,className:"flex items-center gap-2 px-4 py-2 rounded-lg bg-gray-800 hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed text-white transition-all",children:["Siguiente",a.jsx(hc,{className:"w-5 h-5"})]})]})})]})}const rT="settings",sT="info",t6=`# Bienvenid@ a Twisted Brody MangaFlow +¡Tu plataforma definitiva para la gestión y lectura de mangas! + +Este proyecto nació con la misión de ofrecer una experiencia de lectura fluida, moderna y sin interrupciones, diseñada por fans para fans. + +## 🌟 Características Principales + +* **⚡ Lectura sin límites:** Disfruta de una interfaz optimizada, rápida y responsiva. +* **📥 Descargas Flexibles:** Baja tus capítulos favoritos en formato **ZIP** o **PDF** para leer offline. +* **🔄 Conversión Inteligente:** Nuestro servidor procesa las imágenes para darte la mejor calidad y compatibilidad. + +## 🤝 Comunidad y Apoyo + +Este es un proyecto **sin fines de lucro**, desarrollado por pura pasión. + +Sin embargo, si valoras mi trabajo y quieres apoyarme para mantener el proyecto vivo, puedes suscribirte a mi **Patreon**. ¡Tu apoyo significa mucho! + +* [**💜 Apóyame en Patreon**](https://www.patreon.com/cw/Twistedbrody) + +### 💡 ¿Tienes nuevas ideas? +¡Quiero escucharlas! Si tienes sugerencias, feedback o ideas locas, háblame directamente: + +* **Telegram:** [@twistedbrodyoficial](https://t.me/twistedbrodyoficial) + +También puedes unirte a nuestros canales: +* [Canal Principal](https://t.me/twistedbrody) +* [Canal Hub](https://t.me/+CmmZFHM9hpViYzMx) +* [X (Twitter)](https://x.com/TwistedBrody) + +--- +> **Disclaimer:** Todo el contenido es propiedad de sus respectivos autores. Apoya el material original siempre que sea posible. + + +`;async function n6(t){const e=Nt(je,rT,sT),n={content:t,updatedAt:new Date().toISOString()};await QS(e,n)}function r6(t){const e=Nt(je,rT,sT);return N0(e,n=>{n.exists()?t(n.data()):t({content:t6,updatedAt:new Date().toISOString()})})}function s6(t,e){const n={};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const i6=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,o6=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,a6={};function Fw(t,e){return(a6.jsx?o6:i6).test(t)}const l6=/[ \t\n\f\r]/g;function c6(t){return typeof t=="object"?t.type==="text"?zw(t.value):!1:zw(t)}function zw(t){return t.replace(l6,"")===""}class Cc{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}Cc.prototype.normal={};Cc.prototype.property={};Cc.prototype.space=void 0;function iT(t,e){const n={},r={};for(const s of t)Object.assign(n,s.property),Object.assign(r,s.normal);return new Cc(n,r,e)}function Cm(t){return t.toLowerCase()}class nr{constructor(e,n){this.attribute=n,this.property=e}}nr.prototype.attribute="";nr.prototype.booleanish=!1;nr.prototype.boolean=!1;nr.prototype.commaOrSpaceSeparated=!1;nr.prototype.commaSeparated=!1;nr.prototype.defined=!1;nr.prototype.mustUseProperty=!1;nr.prototype.number=!1;nr.prototype.overloadedBoolean=!1;nr.prototype.property="";nr.prototype.spaceSeparated=!1;nr.prototype.space=void 0;let u6=0;const Fe=xo(),Kt=xo(),Am=xo(),ue=xo(),_t=xo(),sa=xo(),or=xo();function xo(){return 2**++u6}const jm=Object.freeze(Object.defineProperty({__proto__:null,boolean:Fe,booleanish:Kt,commaOrSpaceSeparated:or,commaSeparated:sa,number:ue,overloadedBoolean:Am,spaceSeparated:_t},Symbol.toStringTag,{value:"Module"})),Bf=Object.keys(jm);class B0 extends nr{constructor(e,n,r,s){let i=-1;if(super(e,n),Uw(this,"space",s),typeof r=="number")for(;++i4&&n.slice(0,4)==="data"&&m6.test(e)){if(e.charAt(4)==="-"){const i=e.slice(5).replace(Bw,x6);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=e.slice(4);if(!Bw.test(i)){let o=i.replace(p6,y6);o.charAt(0)!=="-"&&(o="-"+o),e="data"+o}}s=B0}return new s(r,e)}function y6(t){return"-"+t.toLowerCase()}function x6(t){return t.charAt(1).toUpperCase()}const v6=iT([oT,d6,cT,uT,dT],"html"),$0=iT([oT,h6,cT,uT,dT],"svg");function w6(t){return t.join(" ").trim()}var H0={},$w=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,b6=/\n/g,_6=/^\s*/,E6=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,S6=/^:\s*/,T6=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,N6=/^[;\s]*/,k6=/^\s+|\s+$/g,I6=` +`,Hw="/",qw="*",Ui="",C6="comment",A6="declaration";function j6(t,e){if(typeof t!="string")throw new TypeError("First argument must be a string");if(!t)return[];e=e||{};var n=1,r=1;function s(y){var _=y.match(b6);_&&(n+=_.length);var C=y.lastIndexOf(I6);r=~C?y.length-C:r+y.length}function i(){var y={line:n,column:r};return function(_){return _.position=new o(y),u(),_}}function o(y){this.start=y,this.end={line:n,column:r},this.source=e.source}o.prototype.content=t;function l(y){var _=new Error(e.source+":"+n+":"+r+": "+y);if(_.reason=y,_.filename=e.source,_.line=n,_.column=r,_.source=t,!e.silent)throw _}function c(y){var _=y.exec(t);if(_){var C=_[0];return s(C),t=t.slice(C.length),_}}function u(){c(_6)}function h(y){var _;for(y=y||[];_=f();)_!==!1&&y.push(_);return y}function f(){var y=i();if(!(Hw!=t.charAt(0)||qw!=t.charAt(1))){for(var _=2;Ui!=t.charAt(_)&&(qw!=t.charAt(_)||Hw!=t.charAt(_+1));)++_;if(_+=2,Ui===t.charAt(_-1))return l("End of comment missing");var C=t.slice(2,_-2);return r+=2,s(C),t=t.slice(_),r+=2,y({type:C6,comment:C})}}function m(){var y=i(),_=c(E6);if(_){if(f(),!c(S6))return l("property missing ':'");var C=c(T6),v=y({type:A6,property:Gw(_[0].replace($w,Ui)),value:C?Gw(C[0].replace($w,Ui)):Ui});return c(N6),v}}function p(){var y=[];h(y);for(var _;_=m();)_!==!1&&(y.push(_),h(y));return y}return u(),p()}function Gw(t){return t?t.replace(k6,Ui):Ui}var P6=j6,R6=Wu&&Wu.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(H0,"__esModule",{value:!0});H0.default=M6;const D6=R6(P6);function M6(t,e){let n=null;if(!t||typeof t!="string")return n;const r=(0,D6.default)(t),s=typeof e=="function";return r.forEach(i=>{if(i.type!=="declaration")return;const{property:o,value:l}=i;s?e(o,l,i):l&&(n=n||{},n[o]=l)}),n}var Oh={};Object.defineProperty(Oh,"__esModule",{value:!0});Oh.camelCase=void 0;var L6=/^--[a-zA-Z0-9_-]+$/,O6=/-([a-z])/g,V6=/^[^-]+$/,F6=/^-(webkit|moz|ms|o|khtml)-/,z6=/^-(ms)-/,U6=function(t){return!t||V6.test(t)||L6.test(t)},B6=function(t,e){return e.toUpperCase()},Ww=function(t,e){return"".concat(e,"-")},$6=function(t,e){return e===void 0&&(e={}),U6(t)?t:(t=t.toLowerCase(),e.reactCompat?t=t.replace(z6,Ww):t=t.replace(F6,Ww),t.replace(O6,B6))};Oh.camelCase=$6;var H6=Wu&&Wu.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},q6=H6(H0),G6=Oh;function Pm(t,e){var n={};return!t||typeof t!="string"||(0,q6.default)(t,function(r,s){r&&s&&(n[(0,G6.camelCase)(r,e)]=s)}),n}Pm.default=Pm;var W6=Pm;const K6=Kd(W6),hT=fT("end"),q0=fT("start");function fT(t){return e;function e(n){const r=n&&n.position&&n.position[t]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function Q6(t){const e=q0(t),n=hT(t);if(e&&n)return{start:e,end:n}}function Nl(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?Kw(t.position):"start"in t||"end"in t?Kw(t):"line"in t||"column"in t?Rm(t):""}function Rm(t){return Qw(t&&t.line)+":"+Qw(t&&t.column)}function Kw(t){return Rm(t&&t.start)+"-"+Rm(t&&t.end)}function Qw(t){return t&&typeof t=="number"?t:1}class jn extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",i={},o=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof e=="string"?s=e:!i.cause&&e&&(o=!0,s=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?i.ruleId=r:(i.source=r.slice(0,c),i.ruleId=r.slice(c+1))}if(!i.place&&i.ancestors&&i.ancestors){const c=i.ancestors[i.ancestors.length-1];c&&(i.place=c.position)}const l=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=l?l.line:void 0,this.name=Nl(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=o&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}jn.prototype.file="";jn.prototype.name="";jn.prototype.reason="";jn.prototype.message="";jn.prototype.stack="";jn.prototype.column=void 0;jn.prototype.line=void 0;jn.prototype.ancestors=void 0;jn.prototype.cause=void 0;jn.prototype.fatal=void 0;jn.prototype.place=void 0;jn.prototype.ruleId=void 0;jn.prototype.source=void 0;const G0={}.hasOwnProperty,Y6=new Map,X6=/[A-Z]/g,J6=new Set(["table","tbody","thead","tfoot","tr"]),Z6=new Set(["td","th"]),pT="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function eL(t,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=e.filePath||void 0;let r;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=lL(n,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=aL(n,e.jsx,e.jsxs)}const s={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:r,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?$0:v6,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},i=mT(s,t,void 0);return i&&typeof i!="string"?i:s.create(t,s.Fragment,{children:i||void 0},void 0)}function mT(t,e,n){if(e.type==="element")return tL(t,e,n);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return nL(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return sL(t,e,n);if(e.type==="mdxjsEsm")return rL(t,e);if(e.type==="root")return iL(t,e,n);if(e.type==="text")return oL(t,e)}function tL(t,e,n){const r=t.schema;let s=r;e.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=$0,t.schema=s),t.ancestors.push(e);const i=yT(t,e.tagName,!1),o=cL(t,e);let l=K0(t,e);return J6.has(e.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!c6(c):!0})),gT(t,o,i,e),W0(o,l),t.ancestors.pop(),t.schema=r,t.create(e,i,o,n)}function nL(t,e){if(e.data&&e.data.estree&&t.evaluater){const r=e.data.estree.body[0];return r.type,t.evaluater.evaluateExpression(r.expression)}ic(t,e.position)}function rL(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);ic(t,e.position)}function sL(t,e,n){const r=t.schema;let s=r;e.name==="svg"&&r.space==="html"&&(s=$0,t.schema=s),t.ancestors.push(e);const i=e.name===null?t.Fragment:yT(t,e.name,!0),o=uL(t,e),l=K0(t,e);return gT(t,o,i,e),W0(o,l),t.ancestors.pop(),t.schema=r,t.create(e,i,o,n)}function iL(t,e,n){const r={};return W0(r,K0(t,e)),t.create(e,t.Fragment,r,n)}function oL(t,e){return e.value}function gT(t,e,n,r){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=r)}function W0(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function aL(t,e,n){return r;function r(s,i,o,l){const u=Array.isArray(o.children)?n:e;return l?u(i,o,l):u(i,o)}}function lL(t,e){return n;function n(r,s,i,o){const l=Array.isArray(i.children),c=q0(r);return e(s,i,o,l,{columnNumber:c?c.column-1:void 0,fileName:t,lineNumber:c?c.line:void 0},void 0)}}function cL(t,e){const n={};let r,s;for(s in e.properties)if(s!=="children"&&G0.call(e.properties,s)){const i=dL(t,s,e.properties[s]);if(i){const[o,l]=i;t.tableCellAlignToStyle&&o==="align"&&typeof l=="string"&&Z6.has(e.tagName)?r=l:n[o]=l}}if(r){const i=n.style||(n.style={});i[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function uL(t,e){const n={};for(const r of e.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&t.evaluater){const i=r.data.estree.body[0];i.type;const o=i.expression;o.type;const l=o.properties[0];l.type,Object.assign(n,t.evaluater.evaluateExpression(l.argument))}else ic(t,e.position);else{const s=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&t.evaluater){const l=r.value.data.estree.body[0];l.type,i=t.evaluater.evaluateExpression(l.expression)}else ic(t,e.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function K0(t,e){const n=[];let r=-1;const s=t.passKeys?new Map:Y6;for(;++rs?0:s+e:e=e>s?s:e,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(e,n),t.splice(...o);else for(n&&t.splice(e,n);i0?(ls(t,t.length,0,e),t):e}const Jw={}.hasOwnProperty;function vL(t){const e={};let n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function ia(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Yr=Di(/[A-Za-z]/),dr=Di(/[\dA-Za-z]/),_L=Di(/[#-'*+\--9=?A-Z^-~]/);function Dm(t){return t!==null&&(t<32||t===127)}const Mm=Di(/\d/),EL=Di(/[\dA-Fa-f]/),SL=Di(/[!-/:-@[-`{-~]/);function Pe(t){return t!==null&&t<-2}function er(t){return t!==null&&(t<0||t===32)}function lt(t){return t===-2||t===-1||t===32}const TL=Di(new RegExp("\\p{P}|\\p{S}","u")),NL=Di(/\s/);function Di(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function Pa(t){const e=[];let n=-1,r=0,s=0;for(;++n55295&&i<57344){const l=t.charCodeAt(n+1);i<56320&&l>56319&&l<57344?(o=String.fromCharCode(i,l),s=1):o="�"}else o=String.fromCharCode(i);o&&(e.push(t.slice(r,n),encodeURIComponent(o)),r=n+s+1,o=""),s&&(n+=s,s=0)}return e.join("")+t.slice(r)}function Tt(t,e,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return o;function o(c){return lt(c)?(t.enter(n),l(c)):e(c)}function l(c){return lt(c)&&i++o))return;const S=e.events.length;let x=S,N,A;for(;x--;)if(e.events[x][0]==="exit"&&e.events[x][1].type==="chunkFlow"){if(N){A=e.events[x][1].end;break}N=!0}for(v(r),T=S;TE;){const M=n[D];e.containerState=M[1],M[0].exit.call(e,t)}n.length=E}function w(){s.write([null]),i=void 0,s=void 0,e.containerState._closeFlow=void 0}}function jL(t,e,n){return Tt(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function eb(t){if(t===null||er(t)||NL(t))return 1;if(TL(t))return 2}function Y0(t,e,n){const r=[];let s=-1;for(;++s1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const f={...t[r][1].end},m={...t[n][1].start};tb(f,-c),tb(m,c),o={type:c>1?"strongSequence":"emphasisSequence",start:f,end:{...t[r][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:m},i={type:c>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},s={type:c>1?"strong":"emphasis",start:{...o.start},end:{...l.end}},t[r][1].end={...o.start},t[n][1].start={...l.end},u=[],t[r][1].end.offset-t[r][1].start.offset&&(u=br(u,[["enter",t[r][1],e],["exit",t[r][1],e]])),u=br(u,[["enter",s,e],["enter",o,e],["exit",o,e],["enter",i,e]]),u=br(u,Y0(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),u=br(u,[["exit",i,e],["enter",l,e],["exit",l,e],["exit",s,e]]),t[n][1].end.offset-t[n][1].start.offset?(h=2,u=br(u,[["enter",t[n][1],e],["exit",t[n][1],e]])):h=0,ls(t,r-1,n-r+3,u),n=r+u.length-h-2;break}}for(n=-1;++n0&<(T)?Tt(t,w,"linePrefix",i+1)(T):w(T)}function w(T){return T===null||Pe(T)?t.check(nb,_,D)(T):(t.enter("codeFlowValue"),E(T))}function E(T){return T===null||Pe(T)?(t.exit("codeFlowValue"),w(T)):(t.consume(T),E)}function D(T){return t.exit("codeFenced"),e(T)}function M(T,S,x){let N=0;return A;function A(z){return T.enter("lineEnding"),T.consume(z),T.exit("lineEnding"),I}function I(z){return T.enter("codeFencedFence"),lt(z)?Tt(T,P,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(z):P(z)}function P(z){return z===l?(T.enter("codeFencedFenceSequence"),k(z)):x(z)}function k(z){return z===l?(N++,T.consume(z),k):N>=o?(T.exit("codeFencedFenceSequence"),lt(z)?Tt(T,B,"whitespace")(z):B(z)):x(z)}function B(z){return z===null||Pe(z)?(T.exit("codeFencedFence"),S(z)):x(z)}}}function $L(t,e,n){const r=this;return s;function s(o){return o===null?n(o):(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),i)}function i(o){return r.parser.lazy[r.now().line]?n(o):e(o)}}const Hf={name:"codeIndented",tokenize:qL},HL={partial:!0,tokenize:GL};function qL(t,e,n){const r=this;return s;function s(u){return t.enter("codeIndented"),Tt(t,i,"linePrefix",5)(u)}function i(u){const h=r.events[r.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?o(u):n(u)}function o(u){return u===null?c(u):Pe(u)?t.attempt(HL,o,c)(u):(t.enter("codeFlowValue"),l(u))}function l(u){return u===null||Pe(u)?(t.exit("codeFlowValue"),o(u)):(t.consume(u),l)}function c(u){return t.exit("codeIndented"),e(u)}}function GL(t,e,n){const r=this;return s;function s(o){return r.parser.lazy[r.now().line]?n(o):Pe(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s):Tt(t,i,"linePrefix",5)(o)}function i(o){const l=r.events[r.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?e(o):Pe(o)?s(o):n(o)}}const WL={name:"codeText",previous:QL,resolve:KL,tokenize:YL};function KL(t){let e=t.length-4,n=3,r,s;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(r=n;++r=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return ethis.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(e,n,r){const s=n||0;this.setCursor(Math.trunc(e));const i=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&tl(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),tl(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),tl(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e=4?e(o):t.interrupt(r.parser.constructs.flow,n,e)(o)}}function ST(t,e,n,r,s,i,o,l,c){const u=c||Number.POSITIVE_INFINITY;let h=0;return f;function f(v){return v===60?(t.enter(r),t.enter(s),t.enter(i),t.consume(v),t.exit(i),m):v===null||v===32||v===41||Dm(v)?n(v):(t.enter(r),t.enter(o),t.enter(l),t.enter("chunkString",{contentType:"string"}),_(v))}function m(v){return v===62?(t.enter(i),t.consume(v),t.exit(i),t.exit(s),t.exit(r),e):(t.enter(l),t.enter("chunkString",{contentType:"string"}),p(v))}function p(v){return v===62?(t.exit("chunkString"),t.exit(l),m(v)):v===null||v===60||Pe(v)?n(v):(t.consume(v),v===92?y:p)}function y(v){return v===60||v===62||v===92?(t.consume(v),p):p(v)}function _(v){return!h&&(v===null||v===41||er(v))?(t.exit("chunkString"),t.exit(l),t.exit(o),t.exit(r),e(v)):h999||p===null||p===91||p===93&&!c||p===94&&!l&&"_hiddenFootnoteSupport"in o.parser.constructs?n(p):p===93?(t.exit(i),t.enter(s),t.consume(p),t.exit(s),t.exit(r),e):Pe(p)?(t.enter("lineEnding"),t.consume(p),t.exit("lineEnding"),h):(t.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===null||p===91||p===93||Pe(p)||l++>999?(t.exit("chunkString"),h(p)):(t.consume(p),c||(c=!lt(p)),p===92?m:f)}function m(p){return p===91||p===92||p===93?(t.consume(p),l++,f):f(p)}}function NT(t,e,n,r,s,i){let o;return l;function l(m){return m===34||m===39||m===40?(t.enter(r),t.enter(s),t.consume(m),t.exit(s),o=m===40?41:m,c):n(m)}function c(m){return m===o?(t.enter(s),t.consume(m),t.exit(s),t.exit(r),e):(t.enter(i),u(m))}function u(m){return m===o?(t.exit(i),c(o)):m===null?n(m):Pe(m)?(t.enter("lineEnding"),t.consume(m),t.exit("lineEnding"),Tt(t,u,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),h(m))}function h(m){return m===o||m===null||Pe(m)?(t.exit("chunkString"),u(m)):(t.consume(m),m===92?f:h)}function f(m){return m===o||m===92?(t.consume(m),h):h(m)}}function kl(t,e){let n;return r;function r(s){return Pe(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),n=!0,r):lt(s)?Tt(t,r,n?"linePrefix":"lineSuffix")(s):e(s)}}const sO={name:"definition",tokenize:oO},iO={partial:!0,tokenize:aO};function oO(t,e,n){const r=this;let s;return i;function i(p){return t.enter("definition"),o(p)}function o(p){return TT.call(r,t,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function l(p){return s=ia(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(t.enter("definitionMarker"),t.consume(p),t.exit("definitionMarker"),c):n(p)}function c(p){return er(p)?kl(t,u)(p):u(p)}function u(p){return ST(t,h,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function h(p){return t.attempt(iO,f,f)(p)}function f(p){return lt(p)?Tt(t,m,"whitespace")(p):m(p)}function m(p){return p===null||Pe(p)?(t.exit("definition"),r.parser.defined.push(s),e(p)):n(p)}}function aO(t,e,n){return r;function r(l){return er(l)?kl(t,s)(l):n(l)}function s(l){return NT(t,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function i(l){return lt(l)?Tt(t,o,"whitespace")(l):o(l)}function o(l){return l===null||Pe(l)?e(l):n(l)}}const lO={name:"hardBreakEscape",tokenize:cO};function cO(t,e,n){return r;function r(i){return t.enter("hardBreakEscape"),t.consume(i),s}function s(i){return Pe(i)?(t.exit("hardBreakEscape"),e(i)):n(i)}}const uO={name:"headingAtx",resolve:dO,tokenize:hO};function dO(t,e){let n=t.length-2,r=3,s,i;return t[r][1].type==="whitespace"&&(r+=2),n-2>r&&t[n][1].type==="whitespace"&&(n-=2),t[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&t[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(s={type:"atxHeadingText",start:t[r][1].start,end:t[n][1].end},i={type:"chunkText",start:t[r][1].start,end:t[n][1].end,contentType:"text"},ls(t,r,n-r+1,[["enter",s,e],["enter",i,e],["exit",i,e],["exit",s,e]])),t}function hO(t,e,n){let r=0;return s;function s(h){return t.enter("atxHeading"),i(h)}function i(h){return t.enter("atxHeadingSequence"),o(h)}function o(h){return h===35&&r++<6?(t.consume(h),o):h===null||er(h)?(t.exit("atxHeadingSequence"),l(h)):n(h)}function l(h){return h===35?(t.enter("atxHeadingSequence"),c(h)):h===null||Pe(h)?(t.exit("atxHeading"),e(h)):lt(h)?Tt(t,l,"whitespace")(h):(t.enter("atxHeadingText"),u(h))}function c(h){return h===35?(t.consume(h),c):(t.exit("atxHeadingSequence"),l(h))}function u(h){return h===null||h===35||er(h)?(t.exit("atxHeadingText"),l(h)):(t.consume(h),u)}}const fO=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],sb=["pre","script","style","textarea"],pO={concrete:!0,name:"htmlFlow",resolveTo:yO,tokenize:xO},mO={partial:!0,tokenize:wO},gO={partial:!0,tokenize:vO};function yO(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function xO(t,e,n){const r=this;let s,i,o,l,c;return u;function u(O){return h(O)}function h(O){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(O),f}function f(O){return O===33?(t.consume(O),m):O===47?(t.consume(O),i=!0,_):O===63?(t.consume(O),s=3,r.interrupt?e:R):Yr(O)?(t.consume(O),o=String.fromCharCode(O),C):n(O)}function m(O){return O===45?(t.consume(O),s=2,p):O===91?(t.consume(O),s=5,l=0,y):Yr(O)?(t.consume(O),s=4,r.interrupt?e:R):n(O)}function p(O){return O===45?(t.consume(O),r.interrupt?e:R):n(O)}function y(O){const Q="CDATA[";return O===Q.charCodeAt(l++)?(t.consume(O),l===Q.length?r.interrupt?e:P:y):n(O)}function _(O){return Yr(O)?(t.consume(O),o=String.fromCharCode(O),C):n(O)}function C(O){if(O===null||O===47||O===62||er(O)){const Q=O===47,oe=o.toLowerCase();return!Q&&!i&&sb.includes(oe)?(s=1,r.interrupt?e(O):P(O)):fO.includes(o.toLowerCase())?(s=6,Q?(t.consume(O),v):r.interrupt?e(O):P(O)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(O):i?w(O):E(O))}return O===45||dr(O)?(t.consume(O),o+=String.fromCharCode(O),C):n(O)}function v(O){return O===62?(t.consume(O),r.interrupt?e:P):n(O)}function w(O){return lt(O)?(t.consume(O),w):A(O)}function E(O){return O===47?(t.consume(O),A):O===58||O===95||Yr(O)?(t.consume(O),D):lt(O)?(t.consume(O),E):A(O)}function D(O){return O===45||O===46||O===58||O===95||dr(O)?(t.consume(O),D):M(O)}function M(O){return O===61?(t.consume(O),T):lt(O)?(t.consume(O),M):E(O)}function T(O){return O===null||O===60||O===61||O===62||O===96?n(O):O===34||O===39?(t.consume(O),c=O,S):lt(O)?(t.consume(O),T):x(O)}function S(O){return O===c?(t.consume(O),c=null,N):O===null||Pe(O)?n(O):(t.consume(O),S)}function x(O){return O===null||O===34||O===39||O===47||O===60||O===61||O===62||O===96||er(O)?M(O):(t.consume(O),x)}function N(O){return O===47||O===62||lt(O)?E(O):n(O)}function A(O){return O===62?(t.consume(O),I):n(O)}function I(O){return O===null||Pe(O)?P(O):lt(O)?(t.consume(O),I):n(O)}function P(O){return O===45&&s===2?(t.consume(O),W):O===60&&s===1?(t.consume(O),ee):O===62&&s===4?(t.consume(O),ne):O===63&&s===3?(t.consume(O),R):O===93&&s===5?(t.consume(O),K):Pe(O)&&(s===6||s===7)?(t.exit("htmlFlowData"),t.check(mO,pe,k)(O)):O===null||Pe(O)?(t.exit("htmlFlowData"),k(O)):(t.consume(O),P)}function k(O){return t.check(gO,B,pe)(O)}function B(O){return t.enter("lineEnding"),t.consume(O),t.exit("lineEnding"),z}function z(O){return O===null||Pe(O)?k(O):(t.enter("htmlFlowData"),P(O))}function W(O){return O===45?(t.consume(O),R):P(O)}function ee(O){return O===47?(t.consume(O),o="",F):P(O)}function F(O){if(O===62){const Q=o.toLowerCase();return sb.includes(Q)?(t.consume(O),ne):P(O)}return Yr(O)&&o.length<8?(t.consume(O),o+=String.fromCharCode(O),F):P(O)}function K(O){return O===93?(t.consume(O),R):P(O)}function R(O){return O===62?(t.consume(O),ne):O===45&&s===2?(t.consume(O),R):P(O)}function ne(O){return O===null||Pe(O)?(t.exit("htmlFlowData"),pe(O)):(t.consume(O),ne)}function pe(O){return t.exit("htmlFlow"),e(O)}}function vO(t,e,n){const r=this;return s;function s(o){return Pe(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),i):n(o)}function i(o){return r.parser.lazy[r.now().line]?n(o):e(o)}}function wO(t,e,n){return r;function r(s){return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),t.attempt(Vh,e,n)}}const bO={name:"htmlText",tokenize:_O};function _O(t,e,n){const r=this;let s,i,o;return l;function l(R){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(R),c}function c(R){return R===33?(t.consume(R),u):R===47?(t.consume(R),M):R===63?(t.consume(R),E):Yr(R)?(t.consume(R),x):n(R)}function u(R){return R===45?(t.consume(R),h):R===91?(t.consume(R),i=0,y):Yr(R)?(t.consume(R),w):n(R)}function h(R){return R===45?(t.consume(R),p):n(R)}function f(R){return R===null?n(R):R===45?(t.consume(R),m):Pe(R)?(o=f,ee(R)):(t.consume(R),f)}function m(R){return R===45?(t.consume(R),p):f(R)}function p(R){return R===62?W(R):R===45?m(R):f(R)}function y(R){const ne="CDATA[";return R===ne.charCodeAt(i++)?(t.consume(R),i===ne.length?_:y):n(R)}function _(R){return R===null?n(R):R===93?(t.consume(R),C):Pe(R)?(o=_,ee(R)):(t.consume(R),_)}function C(R){return R===93?(t.consume(R),v):_(R)}function v(R){return R===62?W(R):R===93?(t.consume(R),v):_(R)}function w(R){return R===null||R===62?W(R):Pe(R)?(o=w,ee(R)):(t.consume(R),w)}function E(R){return R===null?n(R):R===63?(t.consume(R),D):Pe(R)?(o=E,ee(R)):(t.consume(R),E)}function D(R){return R===62?W(R):E(R)}function M(R){return Yr(R)?(t.consume(R),T):n(R)}function T(R){return R===45||dr(R)?(t.consume(R),T):S(R)}function S(R){return Pe(R)?(o=S,ee(R)):lt(R)?(t.consume(R),S):W(R)}function x(R){return R===45||dr(R)?(t.consume(R),x):R===47||R===62||er(R)?N(R):n(R)}function N(R){return R===47?(t.consume(R),W):R===58||R===95||Yr(R)?(t.consume(R),A):Pe(R)?(o=N,ee(R)):lt(R)?(t.consume(R),N):W(R)}function A(R){return R===45||R===46||R===58||R===95||dr(R)?(t.consume(R),A):I(R)}function I(R){return R===61?(t.consume(R),P):Pe(R)?(o=I,ee(R)):lt(R)?(t.consume(R),I):N(R)}function P(R){return R===null||R===60||R===61||R===62||R===96?n(R):R===34||R===39?(t.consume(R),s=R,k):Pe(R)?(o=P,ee(R)):lt(R)?(t.consume(R),P):(t.consume(R),B)}function k(R){return R===s?(t.consume(R),s=void 0,z):R===null?n(R):Pe(R)?(o=k,ee(R)):(t.consume(R),k)}function B(R){return R===null||R===34||R===39||R===60||R===61||R===96?n(R):R===47||R===62||er(R)?N(R):(t.consume(R),B)}function z(R){return R===47||R===62||er(R)?N(R):n(R)}function W(R){return R===62?(t.consume(R),t.exit("htmlTextData"),t.exit("htmlText"),e):n(R)}function ee(R){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(R),t.exit("lineEnding"),F}function F(R){return lt(R)?Tt(t,K,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):K(R)}function K(R){return t.enter("htmlTextData"),o(R)}}const X0={name:"labelEnd",resolveAll:NO,resolveTo:kO,tokenize:IO},EO={tokenize:CO},SO={tokenize:AO},TO={tokenize:jO};function NO(t){let e=-1;const n=[];for(;++e=3&&(u===null||Pe(u))?(t.exit("thematicBreak"),e(u)):n(u)}function c(u){return u===s?(t.consume(u),r++,c):(t.exit("thematicBreakSequence"),lt(u)?Tt(t,l,"whitespace")(u):l(u))}}const qn={continuation:{tokenize:UO},exit:$O,name:"list",tokenize:zO},VO={partial:!0,tokenize:HO},FO={partial:!0,tokenize:BO};function zO(t,e,n){const r=this,s=r.events[r.events.length-1];let i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,o=0;return l;function l(p){const y=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(y==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:Mm(p)){if(r.containerState.type||(r.containerState.type=y,t.enter(y,{_container:!0})),y==="listUnordered")return t.enter("listItemPrefix"),p===42||p===45?t.check(qu,n,u)(p):u(p);if(!r.interrupt||p===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),c(p)}return n(p)}function c(p){return Mm(p)&&++o<10?(t.consume(p),c):(!r.interrupt||o<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(t.exit("listItemValue"),u(p)):n(p)}function u(p){return t.enter("listItemMarker"),t.consume(p),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,t.check(Vh,r.interrupt?n:h,t.attempt(VO,m,f))}function h(p){return r.containerState.initialBlankLine=!0,i++,m(p)}function f(p){return lt(p)?(t.enter("listItemPrefixWhitespace"),t.consume(p),t.exit("listItemPrefixWhitespace"),m):n(p)}function m(p){return r.containerState.size=i+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(p)}}function UO(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(Vh,s,i);function s(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Tt(t,e,"listItemIndent",r.containerState.size+1)(l)}function i(l){return r.containerState.furtherBlankLines||!lt(l)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(l)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(FO,e,o)(l))}function o(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,Tt(t,t.attempt(qn,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function BO(t,e,n){const r=this;return Tt(t,s,"listItemIndent",r.containerState.size+1);function s(i){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?e(i):n(i)}}function $O(t){t.exit(this.containerState.type)}function HO(t,e,n){const r=this;return Tt(t,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(i){const o=r.events[r.events.length-1];return!lt(i)&&o&&o[1].type==="listItemPrefixWhitespace"?e(i):n(i)}}const ib={name:"setextUnderline",resolveTo:qO,tokenize:GO};function qO(t,e){let n=t.length,r,s,i;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){r=n;break}t[n][1].type==="paragraph"&&(s=n)}else t[n][1].type==="content"&&t.splice(n,1),!i&&t[n][1].type==="definition"&&(i=n);const o={type:"setextHeading",start:{...t[r][1].start},end:{...t[t.length-1][1].end}};return t[s][1].type="setextHeadingText",i?(t.splice(s,0,["enter",o,e]),t.splice(i+1,0,["exit",t[r][1],e]),t[r][1].end={...t[i][1].end}):t[r][1]=o,t.push(["exit",o,e]),t}function GO(t,e,n){const r=this;let s;return i;function i(u){let h=r.events.length,f;for(;h--;)if(r.events[h][1].type!=="lineEnding"&&r.events[h][1].type!=="linePrefix"&&r.events[h][1].type!=="content"){f=r.events[h][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(t.enter("setextHeadingLine"),s=u,o(u)):n(u)}function o(u){return t.enter("setextHeadingLineSequence"),l(u)}function l(u){return u===s?(t.consume(u),l):(t.exit("setextHeadingLineSequence"),lt(u)?Tt(t,c,"lineSuffix")(u):c(u))}function c(u){return u===null||Pe(u)?(t.exit("setextHeadingLine"),e(u)):n(u)}}const WO={tokenize:KO};function KO(t){const e=this,n=t.attempt(Vh,r,t.attempt(this.parser.constructs.flowInitial,s,Tt(t,t.attempt(this.parser.constructs.flow,s,t.attempt(ZL,s)),"linePrefix")));return n;function r(i){if(i===null){t.consume(i);return}return t.enter("lineEndingBlank"),t.consume(i),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n}function s(i){if(i===null){t.consume(i);return}return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),e.currentConstruct=void 0,n}}const QO={resolveAll:IT()},YO=kT("string"),XO=kT("text");function kT(t){return{resolveAll:IT(t==="text"?JO:void 0),tokenize:e};function e(n){const r=this,s=this.parser.constructs[t],i=n.attempt(s,o,l);return o;function o(h){return u(h)?i(h):l(h)}function l(h){if(h===null){n.consume(h);return}return n.enter("data"),n.consume(h),c}function c(h){return u(h)?(n.exit("data"),i(h)):(n.consume(h),c)}function u(h){if(h===null)return!0;const f=s[h];let m=-1;if(f)for(;++m-1){const l=o[0];typeof l=="string"?o[0]=l.slice(r):o.shift()}i>0&&o.push(t[s].slice(0,i))}return o}function dV(t,e){let n=-1;const r=[];let s;for(;++n0){const X=_e.tokenStack[_e.tokenStack.length-1];(X[1]||ab).call(_e,void 0,X[0])}for(ie.position={start:qs(G.length>0?G[0][1].start:{line:1,column:1,offset:0}),end:qs(G.length>0?G[G.length-2][1].end:{line:1,column:1,offset:0})},$=-1;++$0&&(r.className=["language-"+s[0]]);let i={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return e.meta&&(i.data={meta:e.meta}),t.patch(e,i),i=t.applyData(e,i),i={type:"element",tagName:"pre",properties:{},children:[i]},t.patch(e,i),i}function TV(t,e){const n={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function NV(t,e){const n={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function kV(t,e){const n=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=String(e.identifier).toUpperCase(),s=Pa(r.toLowerCase()),i=t.footnoteOrder.indexOf(r);let o,l=t.footnoteCounts.get(r);l===void 0?(l=0,t.footnoteOrder.push(r),o=t.footnoteOrder.length):o=i+1,l+=1,t.footnoteCounts.set(r,l);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};t.patch(e,c);const u={type:"element",tagName:"sup",properties:{},children:[c]};return t.patch(e,u),t.applyData(e,u)}function IV(t,e){const n={type:"element",tagName:"h"+e.depth,properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function CV(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}}function jT(t,e){const n=e.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+r}];const s=t.all(e),i=s[0];i&&i.type==="text"?i.value="["+i.value:s.unshift({type:"text",value:"["});const o=s[s.length-1];return o&&o.type==="text"?o.value+=r:s.push({type:"text",value:r}),s}function AV(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return jT(t,e);const s={src:Pa(r.url||""),alt:e.alt};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"img",properties:s,children:[]};return t.patch(e,i),t.applyData(e,i)}function jV(t,e){const n={src:Pa(e.url)};e.alt!==null&&e.alt!==void 0&&(n.alt=e.alt),e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"img",properties:n,children:[]};return t.patch(e,r),t.applyData(e,r)}function PV(t,e){const n={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};t.patch(e,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return t.patch(e,r),t.applyData(e,r)}function RV(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return jT(t,e);const s={href:Pa(r.url||"")};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"a",properties:s,children:t.all(e)};return t.patch(e,i),t.applyData(e,i)}function DV(t,e){const n={href:Pa(e.url)};e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"a",properties:n,children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function MV(t,e,n){const r=t.all(e),s=n?LV(n):PT(e),i={},o=[];if(typeof e.checked=="boolean"){const h=r[0];let f;h&&h.type==="element"&&h.tagName==="p"?f=h:(f={type:"element",tagName:"p",properties:{},children:[]},r.unshift(f)),f.children.length>0&&f.children.unshift({type:"text",value:" "}),f.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let l=-1;for(;++l1}function OV(t,e){const n={},r=t.all(e);let s=-1;for(typeof e.start=="number"&&e.start!==1&&(n.start=e.start);++s0){const o={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},l=q0(e.children[1]),c=hT(e.children[e.children.length-1]);l&&c&&(o.position={start:l,end:c}),s.push(o)}const i={type:"element",tagName:"table",properties:{},children:t.wrap(s,!0)};return t.patch(e,i),t.applyData(e,i)}function BV(t,e,n){const r=n?n.children:void 0,i=(r?r.indexOf(e):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,l=o?o.length:e.children.length;let c=-1;const u=[];for(;++c0,!0),r[0]),s=r.index+r[0].length,r=n.exec(e);return i.push(ub(e.slice(s),s>0,!1)),i.join("")}function ub(t,e,n){let r=0,s=t.length;if(e){let i=t.codePointAt(r);for(;i===lb||i===cb;)r++,i=t.codePointAt(r)}if(n){let i=t.codePointAt(s-1);for(;i===lb||i===cb;)s--,i=t.codePointAt(s-1)}return s>r?t.slice(r,s):""}function qV(t,e){const n={type:"text",value:HV(String(e.value))};return t.patch(e,n),t.applyData(e,n)}function GV(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)}const WV={blockquote:_V,break:EV,code:SV,delete:TV,emphasis:NV,footnoteReference:kV,heading:IV,html:CV,imageReference:AV,image:jV,inlineCode:PV,linkReference:RV,link:DV,listItem:MV,list:OV,paragraph:VV,root:FV,strong:zV,table:UV,tableCell:$V,tableRow:BV,text:qV,thematicBreak:GV,toml:vu,yaml:vu,definition:vu,footnoteDefinition:vu};function vu(){}const RT=-1,Fh=0,Il=1,Gd=2,J0=3,Z0=4,ey=5,ty=6,DT=7,MT=8,db=typeof self=="object"?self:globalThis,KV=(t,e)=>{const n=(s,i)=>(t.set(i,s),s),r=s=>{if(t.has(s))return t.get(s);const[i,o]=e[s];switch(i){case Fh:case RT:return n(o,s);case Il:{const l=n([],s);for(const c of o)l.push(r(c));return l}case Gd:{const l=n({},s);for(const[c,u]of o)l[r(c)]=r(u);return l}case J0:return n(new Date(o),s);case Z0:{const{source:l,flags:c}=o;return n(new RegExp(l,c),s)}case ey:{const l=n(new Map,s);for(const[c,u]of o)l.set(r(c),r(u));return l}case ty:{const l=n(new Set,s);for(const c of o)l.add(r(c));return l}case DT:{const{name:l,message:c}=o;return n(new db[l](c),s)}case MT:return n(BigInt(o),s);case"BigInt":return n(Object(BigInt(o)),s);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:l}=new Uint8Array(o);return n(new DataView(l),o)}}return n(new db[i](o),s)};return r},hb=t=>KV(new Map,t)(0),To="",{toString:QV}={},{keys:YV}=Object,nl=t=>{const e=typeof t;if(e!=="object"||!t)return[Fh,e];const n=QV.call(t).slice(8,-1);switch(n){case"Array":return[Il,To];case"Object":return[Gd,To];case"Date":return[J0,To];case"RegExp":return[Z0,To];case"Map":return[ey,To];case"Set":return[ty,To];case"DataView":return[Il,n]}return n.includes("Array")?[Il,n]:n.includes("Error")?[DT,n]:[Gd,n]},wu=([t,e])=>t===Fh&&(e==="function"||e==="symbol"),XV=(t,e,n,r)=>{const s=(o,l)=>{const c=r.push(o)-1;return n.set(l,c),c},i=o=>{if(n.has(o))return n.get(o);let[l,c]=nl(o);switch(l){case Fh:{let h=o;switch(c){case"bigint":l=MT,h=o.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+c);h=null;break;case"undefined":return s([RT],o)}return s([l,h],o)}case Il:{if(c){let m=o;return c==="DataView"?m=new Uint8Array(o.buffer):c==="ArrayBuffer"&&(m=new Uint8Array(o)),s([c,[...m]],o)}const h=[],f=s([l,h],o);for(const m of o)h.push(i(m));return f}case Gd:{if(c)switch(c){case"BigInt":return s([c,o.toString()],o);case"Boolean":case"Number":case"String":return s([c,o.valueOf()],o)}if(e&&"toJSON"in o)return i(o.toJSON());const h=[],f=s([l,h],o);for(const m of YV(o))(t||!wu(nl(o[m])))&&h.push([i(m),i(o[m])]);return f}case J0:return s([l,o.toISOString()],o);case Z0:{const{source:h,flags:f}=o;return s([l,{source:h,flags:f}],o)}case ey:{const h=[],f=s([l,h],o);for(const[m,p]of o)(t||!(wu(nl(m))||wu(nl(p))))&&h.push([i(m),i(p)]);return f}case ty:{const h=[],f=s([l,h],o);for(const m of o)(t||!wu(nl(m)))&&h.push(i(m));return f}}const{message:u}=o;return s([l,{name:c,message:u}],o)};return i},fb=(t,{json:e,lossy:n}={})=>{const r=[];return XV(!(e||n),!!e,new Map,r)(t),r},Wd=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?hb(fb(t,e)):structuredClone(t):(t,e)=>hb(fb(t,e));function JV(t,e){const n=[{type:"text",value:"↩"}];return e>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),n}function ZV(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function eF(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=t.options.footnoteBackContent||JV,r=t.options.footnoteBackLabel||ZV,s=t.options.footnoteLabel||"Footnotes",i=t.options.footnoteLabelTagName||"h2",o=t.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let c=-1;for(;++c0&&y.push({type:"text",value:" "});let w=typeof n=="string"?n:n(c,p);typeof w=="string"&&(w={type:"text",value:w}),y.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+m+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,p),className:["data-footnote-backref"]},children:Array.isArray(w)?w:[w]})}const C=h[h.length-1];if(C&&C.type==="element"&&C.tagName==="p"){const w=C.children[C.children.length-1];w&&w.type==="text"?w.value+=" ":C.children.push({type:"text",value:" "}),C.children.push(...y)}else h.push(...y);const v={type:"element",tagName:"li",properties:{id:e+"fn-"+m},children:t.wrap(h,!0)};t.patch(u,v),l.push(v)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...Wd(o),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:` +`},{type:"element",tagName:"ol",properties:{},children:t.wrap(l,!0)},{type:"text",value:` +`}]}}const LT=function(t){if(t==null)return sF;if(typeof t=="function")return zh(t);if(typeof t=="object")return Array.isArray(t)?tF(t):nF(t);if(typeof t=="string")return rF(t);throw new Error("Expected function, string, or object as test")};function tF(t){const e=[];let n=-1;for(;++n":""))+")"})}return m;function m(){let p=OT,y,_,C;if((!e||i(c,u,h[h.length-1]||void 0))&&(p=cF(n(c,h)),p[0]===pb))return p;if("children"in c&&c.children){const v=c;if(v.children&&p[0]!==aF)for(_=(r?v.children.length:-1)+o,C=h.concat(v);_>-1&&_0&&n.push({type:"text",value:` +`}),n}function mb(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function gb(t,e){const n=dF(t,e),r=n.one(t,void 0),s=eF(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&i.children.push({type:"text",value:` +`},s),i}function gF(t,e){return t&&"run"in t?async function(n,r){const s=gb(n,{file:r,...e});await t.run(s,r)}:function(n,r){return gb(n,{file:r,...t||e})}}function yb(t){if(t)throw t}var Gu=Object.prototype.hasOwnProperty,FT=Object.prototype.toString,xb=Object.defineProperty,vb=Object.getOwnPropertyDescriptor,wb=function(e){return typeof Array.isArray=="function"?Array.isArray(e):FT.call(e)==="[object Array]"},bb=function(e){if(!e||FT.call(e)!=="[object Object]")return!1;var n=Gu.call(e,"constructor"),r=e.constructor&&e.constructor.prototype&&Gu.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!r)return!1;var s;for(s in e);return typeof s>"u"||Gu.call(e,s)},_b=function(e,n){xb&&n.name==="__proto__"?xb(e,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):e[n.name]=n.newValue},Eb=function(e,n){if(n==="__proto__")if(Gu.call(e,n)){if(vb)return vb(e,n).value}else return;return e[n]},yF=function t(){var e,n,r,s,i,o,l=arguments[0],c=1,u=arguments.length,h=!1;for(typeof l=="boolean"&&(h=l,l=arguments[1]||{},c=2),(l==null||typeof l!="object"&&typeof l!="function")&&(l={});co.length;let c;l&&o.push(s);try{c=t.apply(this,o)}catch(u){const h=u;if(l&&n)throw h;return s(h)}l||(c&&c.then&&typeof c.then=="function"?c.then(i,s):c instanceof Error?s(c):i(c))}function s(o,...l){n||(n=!0,e(o,...l))}function i(o){s(null,o)}}const Gr={basename:wF,dirname:bF,extname:_F,join:EF,sep:"/"};function wF(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');Ac(t);let n=0,r=-1,s=t.length,i;if(e===void 0||e.length===0||e.length>t.length){for(;s--;)if(t.codePointAt(s)===47){if(i){n=s+1;break}}else r<0&&(i=!0,r=s+1);return r<0?"":t.slice(n,r)}if(e===t)return"";let o=-1,l=e.length-1;for(;s--;)if(t.codePointAt(s)===47){if(i){n=s+1;break}}else o<0&&(i=!0,o=s+1),l>-1&&(t.codePointAt(s)===e.codePointAt(l--)?l<0&&(r=s):(l=-1,r=o));return n===r?r=o:r<0&&(r=t.length),t.slice(n,r)}function bF(t){if(Ac(t),t.length===0)return".";let e=-1,n=t.length,r;for(;--n;)if(t.codePointAt(n)===47){if(r){e=n;break}}else r||(r=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function _F(t){Ac(t);let e=t.length,n=-1,r=0,s=-1,i=0,o;for(;e--;){const l=t.codePointAt(e);if(l===47){if(o){r=e+1;break}continue}n<0&&(o=!0,n=e+1),l===46?s<0?s=e:i!==1&&(i=1):s>-1&&(i=-1)}return s<0||n<0||i===0||i===1&&s===n-1&&s===r+1?"":t.slice(s,n)}function EF(...t){let e=-1,n;for(;++e0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function TF(t,e){let n="",r=0,s=-1,i=0,o=-1,l,c;for(;++o<=t.length;){if(o2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),s=o,i=0;continue}}else if(n.length>0){n="",r=0,s=o,i=0;continue}}e&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+t.slice(s+1,o):n=t.slice(s+1,o),r=o-s-1;s=o,i=0}else l===46&&i>-1?i++:i=-1}return n}function Ac(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const NF={cwd:kF};function kF(){return"/"}function Fm(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function IF(t){if(typeof t=="string")t=new URL(t);else if(!Fm(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return CF(t)}function CF(t){if(t.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const e=t.pathname;let n=-1;for(;++n0){let[p,...y]=h;const _=r[m][1];Vm(_)&&Vm(p)&&(p=Gf(!0,_,p)),r[m]=[u,p,...y]}}}}const RF=new ny().freeze();function Yf(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function Xf(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function Jf(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Tb(t){if(!Vm(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function Nb(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function bu(t){return DF(t)?t:new zT(t)}function DF(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function MF(t){return typeof t=="string"||LF(t)}function LF(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const OF="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",kb=[],Ib={allowDangerousHtml:!0},VF=/^(https?|ircs?|mailto|xmpp)$/i,FF=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function zF(t){const e=UF(t),n=BF(t);return $F(e.runSync(e.parse(n),n),t)}function UF(t){const e=t.rehypePlugins||kb,n=t.remarkPlugins||kb,r=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...Ib}:Ib;return RF().use(bV).use(n).use(gF,r).use(e)}function BF(t){const e=t.children||"",n=new zT;return typeof e=="string"&&(n.value=e),n}function $F(t,e){const n=e.allowedElements,r=e.allowElement,s=e.components,i=e.disallowedElements,o=e.skipHtml,l=e.unwrapDisallowed,c=e.urlTransform||HF;for(const h of FF)Object.hasOwn(e,h.from)&&(""+h.from+(h.to?"use `"+h.to+"` instead":"remove it")+OF+h.id,void 0);return VT(t,u),eL(t,{Fragment:a.Fragment,components:s,ignoreInvalidStyle:!0,jsx:a.jsx,jsxs:a.jsxs,passKeys:!0,passNode:!0});function u(h,f,m){if(h.type==="raw"&&m&&typeof f=="number")return o?m.children.splice(f,1):m.children[f]={type:"text",value:h.value},f;if(h.type==="element"){let p;for(p in $f)if(Object.hasOwn($f,p)&&Object.hasOwn(h.properties,p)){const y=h.properties[p],_=$f[p];(_===null||_.includes(h.tagName))&&(h.properties[p]=c(String(y||""),p,h))}}if(h.type==="element"){let p=n?!n.includes(h.tagName):i?i.includes(h.tagName):!1;if(!p&&r&&typeof f=="number"&&(p=!r(h,f,m)),p&&m&&typeof f=="number")return l&&h.children?m.children.splice(f,1,...h.children):m.children.splice(f,1),f}}}function HF(t){const e=t.indexOf(":"),n=t.indexOf("?"),r=t.indexOf("#"),s=t.indexOf("/");return e===-1||s!==-1&&e>s||n!==-1&&e>n||r!==-1&&e>r||VF.test(t.slice(0,e))?t:""}function qF({onBack:t,isAdmin:e}){const[n,r]=L.useState(""),[s,i]=L.useState(!1),[o,l]=L.useState(""),[c,u]=L.useState(!0);L.useEffect(()=>{const m=r6(p=>{p&&r(p.content),u(!1)});return()=>m()},[]);const h=async()=>{try{await n6(o),i(!1)}catch(m){console.error("Error saving info:",m),alert("Error al guardar la información.")}},f=()=>{l(n),i(!0)};return a.jsx("div",{className:"min-h-screen bg-[#0a0a0a] text-white p-4 sm:p-6 md:p-12 animate-in fade-in slide-in-from-bottom-4 duration-300",children:a.jsxs("div",{className:"max-w-4xl mx-auto",children:[a.jsxs("button",{onClick:t,className:"flex items-center gap-2 text-gray-400 hover:text-white transition-colors mb-8 group",children:[a.jsx(Is,{className:"w-5 h-5 group-hover:-translate-x-1 transition-transform"}),a.jsx("span",{className:"font-medium",children:"Volver al inicio"})]}),a.jsxs("div",{className:"bg-[#1a1a1a] rounded-2xl border border-gray-800 p-8 sm:p-12 shadow-2xl relative",children:[e&&!s&&a.jsx("button",{onClick:f,className:"absolute top-8 right-8 p-2 rounded-lg bg-gray-800 text-gray-400 hover:text-[#bb86fc] hover:bg-[#bb86fc]/10 transition-colors",title:"Editar información",children:a.jsx(J_,{className:"w-5 h-5"})}),a.jsxs("div",{className:"flex items-center gap-4 mb-8 border-b border-gray-800 pb-8",children:[a.jsx("div",{className:"p-3 bg-gradient-to-br from-[#bb86fc] to-[#9966dd] rounded-xl shadow-lg shadow-[#bb86fc]/20",children:a.jsx(Y_,{className:"w-8 h-8 text-white"})}),a.jsxs("div",{children:[a.jsx("h1",{className:"text-3xl font-bold bg-gradient-to-r from-white to-gray-400 bg-clip-text text-transparent",children:"Información"}),a.jsx("p",{className:"text-gray-400 mt-1",children:"Sobre Twisted Brody MangaFlow"})]})]}),s?a.jsxs("div",{className:"space-y-4",children:[a.jsx("textarea",{value:o,onChange:m=>l(m.target.value),className:"w-full h-[500px] bg-black/50 border border-[#bb86fc]/50 rounded-lg p-4 text-sm text-white focus:outline-none focus:border-[#bb86fc] font-mono",placeholder:"Escribe el contenido en Markdown..."}),a.jsxs("div",{className:"flex gap-3 justify-end",children:[a.jsxs("button",{onClick:()=>i(!1),className:"px-4 py-2 rounded-lg font-semibold text-gray-400 hover:text-white hover:bg-white/10 transition-colors flex items-center gap-2",children:[a.jsx(gt,{className:"w-4 h-4"}),"Cancelar"]}),a.jsxs("button",{onClick:h,className:"px-4 py-2 rounded-lg font-semibold bg-[#bb86fc] hover:bg-[#9966dd] text-white transition-colors shadow-lg shadow-[#bb86fc]/20 flex items-center gap-2",children:[a.jsx(Ea,{className:"w-4 h-4"}),"Guardar Cambios"]})]})]}):a.jsx("div",{className:"prose prose-invert prose-p:text-gray-300 prose-headings:text-white prose-a:no-underline max-w-none",children:a.jsx(zF,{components:{h1:({node:m,...p})=>a.jsx("h1",{className:"text-3xl font-bold bg-gradient-to-r from-[#bb86fc] to-[#7744cc] bg-clip-text text-transparent mb-6 pb-2 border-b border-gray-800",...p}),h2:({node:m,...p})=>a.jsx("h2",{className:"text-xl font-semibold text-white mt-8 mb-4 flex items-center gap-2",...p}),p:({node:m,...p})=>a.jsx("p",{className:"text-gray-300 leading-relaxed mb-4",...p}),ul:({node:m,...p})=>a.jsx("ul",{className:"space-y-2 mb-6",...p}),li:({node:m,...p})=>a.jsx("li",{className:"flex items-start gap-2 text-gray-300",...p}),a:({node:m,href:p,children:y,..._})=>{const C=p==null?void 0:p.startsWith("http");if((p==null?void 0:p.includes("t.me"))||(p==null?void 0:p.includes("patreon.com"))||(p==null?void 0:p.includes("x.com"))){let w="bg-[#1a1a1a] border border-gray-700 hover:border-gray-500",E="text-gray-300 hover:text-white";return p!=null&&p.includes("patreon")&&(w="bg-[#1a1a1a] border border-gray-700 hover:border-[#FF424D] hover:text-[#FF424D]"),p!=null&&p.includes("t.me")&&(w="bg-[#1a1a1a] border border-gray-700 hover:border-[#24A1DE] hover:text-[#24A1DE]"),p!=null&&p.includes("x.com")&&(w="bg-[#1a1a1a] border border-gray-700 hover:border-white hover:text-white"),a.jsx("a",{href:p,target:C?"_blank":void 0,rel:C?"noopener noreferrer":void 0,className:`inline-flex items-center gap-2 px-3 py-1.5 rounded-lg transition-all transform hover:scale-105 shadow-sm my-1 mr-2 no-underline text-xs sm:text-sm font-medium ${w} ${E}`,..._,children:y})}return a.jsx("a",{href:p,className:"text-[#bb86fc] hover:underline",target:C?"_blank":void 0,rel:C?"noopener noreferrer":void 0,..._,children:y})},blockquote:({node:m,...p})=>a.jsx("blockquote",{className:"border-l-4 border-[#bb86fc] pl-4 py-2 bg-[#bb86fc]/10 rounded-r-lg italic text-gray-400 my-6",...p}),hr:({node:m,...p})=>a.jsx("hr",{className:"border-gray-800 my-8",...p}),img:()=>null},children:n})}),!s&&a.jsxs("div",{className:"pt-8 border-t border-gray-800 text-center text-sm text-gray-500 mt-8",children:["© ",new Date().getFullYear()," Twisted Brody. Todos los derechos reservados."]})]})]})})}function GF({label:t,authors:e,value:n,onChange:r,onDelete:s,placeholder:i="Añadir autor...",colorClass:o="text-gray-400"}){const[l,c]=L.useState(""),[u,h]=L.useState(!1),f=L.useRef(null),m=L.useMemo(()=>l.trim()?e.filter(w=>w.toLowerCase().includes(l.toLowerCase())):e,[e,l]);L.useEffect(()=>{const w=E=>{f.current&&!f.current.contains(E.target)&&h(!1)};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[]);const p=w=>{w.key==="Enter"&&(w.preventDefault(),y())},y=()=>{const w=l.trim();w&&(n.includes(w)||r([...n,w]),c(""),h(!1))},_=w=>{const E=w.trim();E&&!n.includes(E)&&r([...n,E]),c(""),h(!1)},C=w=>{r(n.filter(E=>E!==w))},v=(w,E)=>{w.stopPropagation(),w.preventDefault(),s&&s(E)};return a.jsxs("div",{className:"space-y-3 mb-6",ref:f,children:[a.jsx("label",{className:`text-xs uppercase font-bold tracking-wider ${o}`,children:t}),a.jsxs("div",{className:"relative",children:[a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("div",{className:"relative flex-1",children:[a.jsx("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none",children:a.jsx(Lg,{className:"h-4 w-4 text-gray-500"})}),a.jsx("input",{type:"text",value:l,onChange:w=>{c(w.target.value),h(!0)},onFocus:()=>h(!0),onKeyDown:p,placeholder:i,className:"w-full bg-[#1a1a1a] border border-gray-600/50 rounded-lg pl-10 pr-10 py-2.5 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-[#bb86fc] transition-all"}),l&&a.jsx("button",{onClick:()=>c(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-500 hover:text-white",children:a.jsx(gt,{className:"w-3.5 h-3.5"})})]}),a.jsx("button",{onClick:y,disabled:!l.trim(),className:"bg-[#bb86fc]/20 hover:bg-[#bb86fc]/30 text-[#bb86fc] px-4 rounded-lg flex items-center justify-center transition-all disabled:opacity-50 disabled:cursor-not-allowed",children:a.jsx(Kr,{className:"w-5 h-5"})})]}),u&&(m.length>0||l)&&a.jsx("div",{className:"absolute top-full left-0 right-0 mt-1 bg-[#1a1a1a] border border-gray-700/50 rounded-lg shadow-xl z-50 max-h-60 overflow-y-auto w-full custom-scrollbar",children:m.length>0?m.map((w,E)=>{const D=n.includes(w);return a.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5 hover:bg-white/5 cursor-pointer group",onMouseDown:M=>{M.preventDefault(),_(w)},children:[a.jsx("span",{className:`text-sm ${D?"text-[#bb86fc]":"text-gray-300"}`,children:w}),a.jsxs("div",{className:"flex items-center gap-2",children:[D&&a.jsx(dc,{className:"w-4 h-4 text-[#bb86fc]"}),s&&a.jsx("button",{onMouseDown:M=>v(M,w),className:"opacity-0 group-hover:opacity-100 p-1 hover:bg-red-500/20 text-gray-500 hover:text-red-400 rounded transition-all",title:"Eliminar autor de todos los mangas",children:a.jsx(tn,{className:"w-3.5 h-3.5"})})]})]},E)}):a.jsxs("div",{className:"px-4 py-3 text-center",children:[a.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"No encontrado."}),a.jsxs("button",{onMouseDown:w=>{w.preventDefault(),y()},className:"text-xs text-[#bb86fc] hover:underline font-semibold",children:['Añadir "',l,'"']})]})})]}),a.jsx("div",{className:"flex gap-2 flex-wrap mt-3",children:n.map((w,E)=>a.jsxs("span",{className:"px-3 py-1 bg-[#2a2a2a] text-[#bb86fc] text-xs rounded-full border border-gray-600/50 flex items-center gap-2",children:[w,a.jsx("button",{onClick:()=>C(w),className:"hover:text-white",children:a.jsx(gt,{className:"w-3 h-3"})})]},E))}),a.jsx("p",{className:"text-[10px] text-gray-500 mt-2",children:n.length>0?`Autores seleccionados: ${n.join(", ")}`:"Deja en blanco para no modificar el autor."})]})}function WF({isOpen:t,onClose:e,selectedMangaIds:n,onSaveComplete:r}){const[s,i]=L.useState([]),[o,l]=L.useState([]),[c,u]=L.useState([]),[h,f]=L.useState([]),[m,p]=L.useState(!1),[y,_]=L.useState(!1),[C,v]=L.useState(!1),[w,E]=L.useState(!1),[D,M]=L.useState(!1);L.useEffect(()=>{t&&(T(),l([]),f([]),p(!1),_(!1),v(!1))},[t]);const T=async()=>{try{M(!0);const k=await j2();i(k);const B=await DD();u(B)}catch(k){console.error("Error loading categories:",k)}finally{M(!1)}},S=async(k,B)=>{if(k.trim()){if(B==="tag"){const z=k.split(" ").map(W=>W.trim()).filter(W=>W.length>0);for(const W of z)await x(W,B);return}await x(k,B)}},x=async(k,B)=>{try{const z=s.find(W=>W.name.toLowerCase()===k.trim().toLowerCase()&&W.type===B);if(z)l(W=>W.includes(z.id)?W:[...W,z.id]);else{const W=await P2(k.trim(),B);i(ee=>ee.find(F=>F.id===W.id)?ee:[...ee,W]),l(ee=>ee.includes(W.id)?ee:[...ee,W.id])}}catch(z){console.error("Error creating category:",z)}},N=k=>{l(B=>B.filter(z=>z!==k))},A=async k=>{try{await R2(k),i(B=>B.filter(z=>z.id!==k)),l(B=>B.filter(z=>z!==k))}catch(B){console.error("Error deleting category:",B),we.error("Error al eliminar la categoría")}},I=k=>{we(`¿Eliminar al autor "${k}" permanentemente?`,{description:"Se eliminará este autor de TODOS los mangas. Esta acción no se puede deshacer.",action:{label:"Eliminar",onClick:async()=>{try{M(!0),await RD(k),we.success(`Autor "${k}" eliminado correctamente.`),u(B=>B.filter(z=>z!==k)),h.includes(k)&&f(B=>B.filter(z=>z!==k))}catch(B){console.error("Error deleting author:",B),we.error("Error al eliminar el autor.")}finally{M(!1)}}},cancel:{label:"Cancelar",onClick:()=>{}},duration:5e3})},P=async()=>{if(o.length===0&&h.length===0&&!m&&!y&&!C){we.error("Selecciona al menos una categoría, autor o clasificación para aplicar.");return}E(!0);try{const k=n.map(async B=>{var z;try{const W=await Ni(B);if(!W)return;const ee=((z=W.categories)==null?void 0:z.map(R=>R.id))||[],F=Array.from(new Set([...ee,...o])),K={title:W.title,author:W.author,categoryIds:F};h.length>0&&(K.author=h.join(", ")),m&&(K.is_decensored=!0),y&&(K.is_bn=!0,K.is_color=!1),C&&(K.is_color=!0,K.is_bn=!1),await Lh(B,K)}catch(W){console.error(`Error updating manga ${B}`,W)}});await Promise.all(k),we.success("Categorías aplicadas correctamente."),r(),e()}catch(k){console.error("Error bulk updating mangas:",k),we.error("Error al aplicar cambios.")}finally{E(!1)}};return t?a.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50 p-4 animate-in fade-in duration-200",children:a.jsxs("div",{className:"bg-[#121212] rounded-2xl border border-gray-800 w-full max-w-2xl shadow-2xl overflow-hidden flex flex-col max-h-[90vh]",children:[a.jsxs("div",{className:"bg-[#1a1a1a] border-b border-gray-800 px-6 py-4 flex items-center justify-between sticky top-0 z-10",children:[a.jsxs("h2",{className:"text-xl font-bold text-white",children:["Aplicar Categorías a ",n.length," Mangas"]}),a.jsx("button",{onClick:e,className:"text-gray-400 hover:text-white transition-colors p-2 hover:bg-white/5 rounded-lg",children:a.jsx(gt,{className:"w-5 h-5"})})]}),a.jsx("div",{className:"p-6 overflow-y-auto custom-scrollbar flex-1",children:D?a.jsx("div",{className:"flex justify-center p-8",children:a.jsx(Sr,{size:32})}):a.jsxs("div",{className:"space-y-6",children:[a.jsx("div",{className:"bg-[#1f1f1f] p-4 rounded-xl border border-gray-800",children:a.jsx(GF,{label:"Autor",authors:c,value:h,onChange:f,onDelete:I,placeholder:"Seleccionar o escribir autor..."})}),a.jsxs("div",{className:"bg-[#1f1f1f] p-4 rounded-xl border border-gray-800 space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-semibold text-white",children:"Sin censura"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Marcar todos como sin censura"})]}),a.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[a.jsx("input",{type:"checkbox",className:"sr-only peer",checked:m,onChange:k=>p(k.target.checked)}),a.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-[#bb86fc]"})]})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-semibold text-white",children:"B/N"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Marcar todos como Blanco y Negro"})]}),a.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[a.jsx("input",{type:"checkbox",className:"sr-only peer",checked:y,onChange:k=>{_(k.target.checked),k.target.checked&&v(!1)}}),a.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-[#bb86fc]"})]})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-semibold text-white",children:"a color"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Marcar todos como a color"})]}),a.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[a.jsx("input",{type:"checkbox",className:"sr-only peer",checked:C,onChange:k=>{v(k.target.checked),k.target.checked&&_(!1)}}),a.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-[#bb86fc]"})]})]})]}),a.jsx(ri,{label:"Personajes",type:"character",categories:s,selectedIds:o,onSelect:k=>{o.includes(k)||l(B=>[...B,k])},onRemove:N,onCreate:k=>S(k,"character"),onDeleteCategory:A,colorClass:"text-blue-400",placeholder:"Añadir personaje..."}),a.jsx(ri,{label:"Series",type:"series",categories:s,selectedIds:o,onSelect:k=>{o.includes(k)||l(B=>[...B,k])},onRemove:N,onCreate:k=>S(k,"series"),onDeleteCategory:A,colorClass:"text-green-400",placeholder:"Añadir serie..."}),a.jsx(ri,{label:"Géneros",type:"genre",categories:s,selectedIds:o,onSelect:k=>{o.includes(k)||l(B=>[...B,k])},onRemove:N,onCreate:k=>S(k,"genre"),onDeleteCategory:A,colorClass:"text-purple-400",placeholder:"Añadir género..."}),a.jsx(ri,{label:"Etiquetas",type:"tag",categories:s,selectedIds:o,onSelect:k=>{o.includes(k)||l(B=>[...B,k])},onRemove:N,onCreate:k=>S(k,"tag"),onDeleteCategory:A,colorClass:"text-pink-400",placeholder:"Añadir etiqueta..."})]})}),a.jsxs("div",{className:"p-6 border-t border-gray-800 flex justify-end gap-3 bg-[#1a1a1a]",children:[a.jsx("button",{onClick:e,className:"px-4 py-2 rounded-lg text-sm font-semibold text-gray-300 hover:text-white transition-colors",children:"Cancelar"}),a.jsx("button",{onClick:P,disabled:w||o.length===0&&h.length===0&&!m&&!y&&!C,className:"bg-[#bb86fc] hover:bg-[#9966dd] text-white px-6 py-2 rounded-lg font-semibold text-sm transition-all shadow-lg shadow-[#bb86fc]/20 flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",children:w?a.jsxs(a.Fragment,{children:[a.jsx(Sr,{size:16}),"Guardando..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Ea,{className:"w-4 h-4"}),"Aplicar Cambios"]})})]})]})}):null}function KF({isOpen:t,onClose:e,selectedMangaIds:n,onSaveComplete:r}){const[s,i]=L.useState([]),[o,l]=L.useState([]),[c,u]=L.useState([]),[h,f]=L.useState([]),[m,p]=L.useState(!1),[y,_]=L.useState(!1);L.useEffect(()=>{t&&(C(),u([]),f([]))},[t]);const C=async()=>{try{_(!0);const T=(await Promise.all(n.map(N=>Ni(N).catch(()=>null)))).filter(Boolean),S=new Map,x=new Set;T.forEach(N=>{N.author&&x.add(N.author),N.categories&&N.categories.forEach(A=>S.set(A.id,A))}),i(Array.from(S.values())),l(Array.from(x))}catch(M){console.error("Error loading mangas data:",M),we.error("Error al cargar datos de los mangas")}finally{_(!1)}},v=M=>{u(T=>T.includes(M)?T.filter(S=>S!==M):[...T,M])},w=M=>{f(T=>T.includes(M)?T.filter(S=>S!==M):[...T,M])},E=async()=>{if(c.length===0&&h.length===0){we.error("Selecciona al menos una categoría o autor para eliminar.");return}p(!0);try{const M=n.map(async T=>{try{const S=await Ni(T);if(!S)return;let x=!1;const N={title:S.title,author:S.author};if(h.includes(S.author)&&(N.author="Desconocido",x=!0),S.categories&&S.categories.length>0){const A=S.categories.map(P=>P.id),I=A.filter(P=>!c.includes(P));I.length!==A.length?(N.categoryIds=I,x=!0):N.categoryIds=A}else N.categoryIds=[];x&&await Lh(T,N)}catch(S){console.error(`Error updating manga ${T}`,S)}});await Promise.all(M),we.success("Categorías eliminadas de los mangas correctamente."),r(),e()}catch(M){console.error("Error bulk updating mangas:",M),we.error("Error al aplicar cambios.")}finally{p(!1)}};if(!t)return null;const D=(M,T,S)=>{const x=s.filter(N=>N.type===M);return x.length===0?null:a.jsxs("div",{className:"bg-[#1f1f1f] p-4 rounded-xl border border-gray-800 space-y-3",children:[a.jsx("span",{className:"text-xs font-bold text-gray-400 uppercase tracking-wider",children:T}),a.jsx("div",{className:"flex flex-wrap gap-2",children:x.map(N=>{const A=c.includes(N.id);return a.jsxs("button",{onClick:()=>v(N.id),className:`px-3 py-1.5 rounded-full text-sm font-medium flex items-center gap-2 border transition-all ${A?"bg-red-500/20 text-red-500 border-red-500/50 hover:bg-red-500/30":`bg-[#1a1a1a] ${S} border-gray-700 hover:border-gray-500`}`,children:[N.name,A&&a.jsx(tn,{className:"w-3.5 h-3.5"})]},N.id)})})]})};return a.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50 p-4 animate-in fade-in duration-200",children:a.jsxs("div",{className:"bg-[#121212] rounded-2xl border border-gray-800 w-full max-w-2xl shadow-2xl overflow-hidden flex flex-col max-h-[90vh]",children:[a.jsxs("div",{className:"bg-[#1a1a1a] border-b border-gray-800 px-6 py-4 flex items-center justify-between sticky top-0 z-10",children:[a.jsxs("h2",{className:"text-xl font-bold text-white flex items-center gap-2",children:[a.jsx(tn,{className:"w-5 h-5 text-red-500"}),"Remover Categorías en ",n.length," Mangas"]}),a.jsx("button",{onClick:e,className:"text-gray-400 hover:text-white transition-colors p-2 hover:bg-white/5 rounded-lg",children:a.jsx(gt,{className:"w-5 h-5"})})]}),a.jsx("div",{className:"p-6 overflow-y-auto custom-scrollbar flex-1",children:y?a.jsxs("div",{className:"flex flex-col items-center justify-center py-12 gap-4",children:[a.jsx(Sr,{size:32}),a.jsx("p",{className:"text-gray-400 text-sm",children:"Escaneando mangas seleccionados..."})]}):s.length===0&&o.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[a.jsx(tn,{className:"w-12 h-12 text-gray-600 mb-3"}),a.jsx("h3",{className:"text-lg font-semibold text-white",children:"Sin categorías"}),a.jsx("p",{className:"text-gray-400 text-sm max-w-sm mt-1",children:"Los mangas seleccionados no tienen autores ni categorías para remover."})]}):a.jsxs("div",{className:"space-y-6",children:[a.jsxs("p",{className:"text-sm text-gray-400",children:["Selecciona los autores y categorías que deseas ",a.jsx("b",{className:"text-red-400",children:"eliminar"})," de los mangas seleccionados."]}),o.length>0&&a.jsxs("div",{className:"bg-[#1f1f1f] p-4 rounded-xl border border-gray-800 space-y-3",children:[a.jsx("span",{className:"text-xs font-bold text-gray-400 uppercase tracking-wider",children:"Autor"}),a.jsx("div",{className:"flex flex-wrap gap-2",children:o.map(M=>{const T=h.includes(M);return a.jsxs("button",{onClick:()=>w(M),className:`px-3 py-1.5 rounded-full text-sm font-medium flex items-center gap-2 border transition-all ${T?"bg-red-500/20 text-red-500 border-red-500/50 hover:bg-red-500/30":"bg-[#1a1a1a] text-purple-400 border-gray-700 hover:border-gray-500"}`,children:[M,T&&a.jsx(tn,{className:"w-3.5 h-3.5"})]},M)})}),a.jsx("p",{className:"text-xs text-red-500/80 mt-2",children:'* Remover al autor lo dejará como "Desconocido".'})]}),D("character","Personajes","text-blue-400"),D("series","Series","text-green-400"),D("genre","Géneros","text-purple-400"),D("tag","Etiquetas","text-pink-400")]})}),a.jsxs("div",{className:"p-6 border-t border-gray-800 flex justify-end gap-3 bg-[#1a1a1a]",children:[a.jsx("button",{onClick:e,className:"px-4 py-2 rounded-lg text-sm font-semibold text-gray-300 hover:text-white transition-colors",children:"Cancelar"}),a.jsx("button",{onClick:E,disabled:m||c.length===0&&h.length===0,className:"bg-red-600 hover:bg-red-700 text-white px-6 py-2 rounded-lg font-semibold text-sm transition-all shadow-lg shadow-red-600/20 flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",children:m?a.jsxs(a.Fragment,{children:[a.jsx(Sr,{size:16}),"Eliminando..."]}):a.jsxs(a.Fragment,{children:[a.jsx(tn,{className:"w-4 h-4"}),"Remover Selección"]})})]})]})})}const Cb=["series","character","genre","tag","other"],QF={series:"Series",character:"Personajes",genre:"Géneros",tag:"Etiquetas",other:"Otros"};function YF({isOpen:t,onClose:e,categories:n,selectedCategories:r,onToggleCategory:s,onClearFilters:i,filterDecensored:o,setFilterDecensored:l,filterBN:c,setFilterBN:u,filterColor:h,setFilterColor:f}){const[m,p]=L.useState(""),y=L.useMemo(()=>{const _=n.filter(v=>v.name.toLowerCase().includes(m.toLowerCase())),C={};return Cb.forEach(v=>{C[v]=[]}),C.other=[],_.forEach(v=>{const w=v.type||"other";C[w]||(C[w]=[]),C[w].push(v)}),C},[n,m]);return t?a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/80 backdrop-blur-sm animate-in fade-in duration-200",children:a.jsxs("div",{className:"bg-[#1a1a1a] w-full max-w-4xl max-h-[85vh] rounded-2xl border border-gray-800 shadow-2xl flex flex-col overflow-hidden animate-in zoom-in-95 duration-200",onClick:_=>_.stopPropagation(),children:[a.jsxs("div",{className:"p-4 sm:p-6 border-b border-gray-800 flex items-center justify-between bg-[#1a1a1a]",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"bg-purple-500/20 p-2 rounded-lg",children:a.jsx(K_,{className:"w-5 h-5 text-purple-400"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-xl font-bold text-white",children:"Filtrar por Categorías"}),a.jsx("p",{className:"text-sm text-gray-400",children:"Selecciona múltiples opciones para refinar tu búsqueda"})]})]}),a.jsx("button",{onClick:e,className:"text-gray-400 hover:text-white hover:bg-gray-800 p-2 rounded-lg transition-all",children:a.jsx(gt,{className:"w-5 h-5"})})]}),a.jsx("div",{className:"p-4 border-b border-gray-800 bg-[#151515]",children:a.jsxs("div",{className:"relative",children:[a.jsx(no,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400"}),a.jsx("input",{type:"text",placeholder:"Buscar categorías...",value:m,onChange:_=>p(_.target.value),className:"w-full bg-[#0f0f0f] border border-gray-700/50 rounded-lg pl-10 pr-4 py-2.5 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-purple-500/50 focus:ring-1 focus:ring-purple-500/50 transition-all"})]})}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-4 sm:p-6 space-y-8 custom-scrollbar",children:[a.jsxs("div",{className:"animate-in slide-in-from-bottom-2 duration-300",children:[a.jsxs("h3",{className:"text-sm font-bold text-purple-400 uppercase tracking-wider mb-3 flex items-center gap-2",children:[a.jsx("span",{className:"w-1 h-4 bg-purple-500 rounded-full"}),"Propiedades Especiales"]}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3 mb-8",children:[a.jsxs("button",{onClick:()=>l(!o),className:`relative group flex flex-col p-3 rounded-lg text-left transition-all duration-200 border ${o?"bg-purple-500/20 border-purple-500/50 shadow-[0_0_15px_-3px_rgba(168,85,247,0.3)]":"bg-[#252525] border-transparent hover:bg-[#2a2a2a] hover:border-gray-700"}`,children:[a.jsxs("div",{className:"flex items-center justify-between w-full mb-1",children:[a.jsx("span",{className:"font-bold text-white text-sm",children:"Sin censura"}),a.jsx("div",{className:`w-8 h-4 rounded-full transition-colors ${o?"bg-purple-500":"bg-gray-600"} relative`,children:a.jsx("div",{className:`absolute top-0.5 left-0.5 w-3 h-3 rounded-full bg-white transition-transform duration-200 ${o?"translate-x-4":"translate-x-0"}`})})]}),a.jsx("span",{className:"text-xs text-gray-400",children:"Mostrar solo contenido sin censura"})]}),a.jsxs("button",{onClick:()=>u(!c),className:`relative group flex flex-col p-3 rounded-lg text-left transition-all duration-200 border ${c?"bg-purple-500/20 border-purple-500/50 shadow-[0_0_15px_-3px_rgba(168,85,247,0.3)]":"bg-[#252525] border-transparent hover:bg-[#2a2a2a] hover:border-gray-700"}`,children:[a.jsxs("div",{className:"flex items-center justify-between w-full mb-1",children:[a.jsx("span",{className:"font-bold text-white text-sm",children:"B/N"}),a.jsx("div",{className:`w-8 h-4 rounded-full transition-colors ${c?"bg-purple-500":"bg-gray-600"} relative`,children:a.jsx("div",{className:`absolute top-0.5 left-0.5 w-3 h-3 rounded-full bg-white transition-transform duration-200 ${c?"translate-x-4":"translate-x-0"}`})})]}),a.jsx("span",{className:"text-xs text-gray-400",children:"Mostrar solo Blanco y Negro"})]}),a.jsxs("button",{onClick:()=>f(!h),className:`relative group flex flex-col p-3 rounded-lg text-left transition-all duration-200 border ${h?"bg-purple-500/20 border-purple-500/50 shadow-[0_0_15px_-3px_rgba(168,85,247,0.3)]":"bg-[#252525] border-transparent hover:bg-[#2a2a2a] hover:border-gray-700"}`,children:[a.jsxs("div",{className:"flex items-center justify-between w-full mb-1",children:[a.jsx("span",{className:"font-bold text-white text-sm",children:"A color"}),a.jsx("div",{className:`w-8 h-4 rounded-full transition-colors ${h?"bg-purple-500":"bg-gray-600"} relative`,children:a.jsx("div",{className:`absolute top-0.5 left-0.5 w-3 h-3 rounded-full bg-white transition-transform duration-200 ${h?"translate-x-4":"translate-x-0"}`})})]}),a.jsx("span",{className:"text-xs text-gray-400",children:"Mostrar solo contenido a color"})]})]})]}),Cb.map(_=>{const C=y[_];return!C||C.length===0?null:a.jsxs("div",{className:"animate-in slide-in-from-bottom-2 duration-300",children:[a.jsxs("h3",{className:"text-sm font-bold text-purple-400 uppercase tracking-wider mb-3 flex items-center gap-2",children:[a.jsx("span",{className:"w-1 h-4 bg-purple-500 rounded-full"}),QF[_]||_]}),a.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-2",children:C.sort((v,w)=>v.name.localeCompare(w.name)).map(v=>{const w=r.includes(v.name);return a.jsxs("button",{onClick:()=>s(v.name),className:` + relative group flex items-center justify-between px-3 py-2 rounded-lg text-sm text-left transition-all duration-200 border + ${w?"bg-purple-500/20 border-purple-500/50 text-purple-100 shadow-[0_0_15px_-3px_rgba(168,85,247,0.3)]":"bg-[#252525] border-transparent text-gray-300 hover:bg-[#2a2a2a] hover:border-gray-700"} + `,children:[a.jsx("span",{className:"truncate mr-2 font-medium",children:v.name}),w&&a.jsx("div",{className:"bg-purple-500 rounded-full p-0.5 animate-in zoom-in duration-200",children:a.jsx(dc,{className:"w-3 h-3 text-white"})})]},v.id)})})]},_)})]}),a.jsxs("div",{className:"p-4 border-t border-gray-800 bg-[#1a1a1a] flex items-center justify-between",children:[a.jsxs("div",{className:"text-sm text-gray-400",children:[r.length+(o?1:0)+(c?1:0)+(h?1:0)," filtros activos"]}),a.jsxs("div",{className:"flex items-center gap-3",children:[(r.length>0||o||c||h)&&a.jsx("button",{onClick:i,className:"px-4 py-2 text-sm text-gray-400 hover:text-white transition-colors",children:"Limpiar todo"}),a.jsx("button",{onClick:e,className:"px-6 py-2 bg-purple-600 hover:bg-purple-700 text-white rounded-lg text-sm font-semibold shadow-lg shadow-purple-900/20 transition-all hover:scale-105 active:scale-95",children:"Listo"})]})]})]})}):null}function XF({isOpen:t,onClose:e,mangas:n,onSaveComplete:r}){const[s,i]=L.useState(""),[o,l]=L.useState({}),[c,u]=L.useState(!1);L.useEffect(()=>{t&&(i(""),l({}))},[t]);const h=L.useMemo(()=>{let p=[...n];if(s){const y=s.toLowerCase();p=p.filter(_=>_.title.toLowerCase().includes(y))}return p.sort((y,_)=>y.title.localeCompare(_.title))},[n,s]),f=(p,y)=>{l(_=>({..._,[p]:y}))},m=async()=>{const p=Object.entries(o).filter(([y,_])=>{const C=n.find(v=>v.id===y);return C&&C.title!==_.trim()&&_.trim()!==""});if(p.length===0){we.info("No hay cambios para guardar");return}try{u(!0);const y=p.map(([_,C])=>({id:_,title:C.trim()}));await O0(y),we.success(`Se actualizaron ${y.length} nombres correctamente`),r(),e()}catch(y){console.error("Error saving titles:",y),we.error("Error al guardar los cambios")}finally{u(!1)}};return t?a.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-[60] p-4 animate-in fade-in duration-200",children:a.jsxs("div",{className:"bg-[#121212] rounded-2xl border border-gray-800 w-full max-w-2xl shadow-2xl overflow-hidden flex flex-col max-h-[85vh]",children:[a.jsxs("div",{className:"bg-[#1a1a1a] border-b border-gray-800 px-6 py-4 flex items-center justify-between sticky top-0 z-10 flex-shrink-0",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-blue-500/10 rounded-lg text-blue-400",children:a.jsx(Yo,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-xl font-bold text-white",children:"Gestor de Nombres"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Edita los títulos de los mangas masivamente"})]})]}),a.jsx("button",{onClick:e,className:"text-gray-400 hover:text-white transition-colors p-2 hover:bg-white/5 rounded-lg",children:a.jsx(gt,{className:"w-5 h-5"})})]}),a.jsx("div",{className:"p-4 border-b border-gray-800 bg-[#121212] flex-shrink-0",children:a.jsxs("div",{className:"relative",children:[a.jsx(no,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400"}),a.jsx("input",{type:"text",value:s,onChange:p=>i(p.target.value),placeholder:"Buscar manga por título...",className:"w-full bg-[#1a1a1a] border border-gray-700 rounded-xl pl-10 pr-4 py-3 text-sm text-white focus:outline-none focus:border-blue-500 transition-colors"})]})}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-2 custom-scrollbar",children:[h.map(p=>{const y=p.cover_url||p.thumbnail_url,_=y?Ks(y):void 0;return a.jsxs("div",{className:"flex items-center gap-3 bg-[#1a1a1a] p-3 rounded-lg border border-gray-800/50 hover:border-gray-700 transition-colors",children:[_?a.jsx("img",{src:_,alt:"",className:"w-10 h-10 rounded object-cover"}):a.jsx("div",{className:"w-10 h-10 rounded bg-gray-800 flex items-center justify-center",children:a.jsx("span",{className:"text-xs text-gray-500 text-center",children:"Sin img"})}),a.jsx("div",{className:"flex-1",children:a.jsx("input",{type:"text",value:o[p.id]!==void 0?o[p.id]:p.title,onChange:C=>f(p.id,C.target.value),className:`w-full bg-transparent border-b pl-2 py-1 text-sm focus:outline-none transition-colors ${o[p.id]!==void 0&&o[p.id].trim()!==p.title?"border-blue-500 text-blue-300":"border-transparent hover:border-gray-700 text-white focus:border-gray-600"}`,placeholder:"Título del manga"})})]},p.id)}),h.length===0&&a.jsx("div",{className:"text-center py-8 text-gray-500",children:"No se encontraron mangas con ese nombre"})]}),a.jsxs("div",{className:"bg-[#1a1a1a] border-t border-gray-800 px-6 py-4 flex justify-between items-center sticky bottom-0 flex-shrink-0",children:[a.jsxs("span",{className:"text-sm text-gray-400",children:[Object.keys(o).filter(p=>{var y;return o[p].trim()!==((y=n.find(_=>_.id===p))==null?void 0:y.title)}).length," cambios pendientes"]}),a.jsxs("div",{className:"flex gap-3",children:[a.jsx("button",{onClick:e,className:"px-4 py-2 text-sm font-semibold text-gray-300 hover:text-white transition-colors",disabled:c,children:"Cancelar"}),a.jsx("button",{onClick:m,disabled:c,className:"bg-blue-600 hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed text-white px-6 py-2 rounded-lg text-sm font-bold shadow-lg shadow-blue-500/20 transition-all flex items-center gap-2",children:c?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Ea,{className:"w-4 h-4"}),"Guardar Cambios"]})})]})]})]})}):null}function JF({isOpen:t,onClose:e,mangas:n,selectedMangaIds:r,onSaveComplete:s}){const[i,o]=L.useState(""),[l,c]=L.useState(""),[u,h]=L.useState({}),[f,m]=L.useState(!1);L.useEffect(()=>{t&&(o(""),c(""),h({}))},[t]);const p=()=>{if(!l.trim())return;const v={...u};n.filter(w=>r.includes(w.id)).forEach(w=>{v[w.id]=l}),h(v),we.success(`Nombre aplicado a ${r.length} mangas localmente`)},y=L.useMemo(()=>{let v=n.filter(w=>r.includes(w.id));if(i){const w=i.toLowerCase();v=v.filter(E=>E.title.toLowerCase().includes(w))}return v.sort((w,E)=>w.title.localeCompare(E.title))},[n,r,i]),_=(v,w)=>{h(E=>({...E,[v]:w}))},C=async()=>{const v=Object.entries(u).filter(([w,E])=>{const D=n.find(M=>M.id===w);return D&&D.title!==E.trim()&&E.trim()!==""});if(v.length===0){we.info("No hay cambios para guardar");return}try{m(!0);const w=v.map(([E,D])=>({id:E,title:D.trim()}));await O0(w),we.success(`Se actualizaron ${w.length} nombres correctamente`),s(),e()}catch(w){console.error("Error saving titles:",w),we.error("Error al guardar los cambios")}finally{m(!1)}};return t?a.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-[60] p-4 animate-in fade-in duration-200",children:a.jsxs("div",{className:"bg-[#121212] rounded-2xl border border-gray-800 w-full max-w-2xl shadow-2xl overflow-hidden flex flex-col max-h-[85vh]",children:[a.jsxs("div",{className:"bg-[#1a1a1a] border-b border-gray-800 px-6 py-4 flex items-center justify-between sticky top-0 z-10 flex-shrink-0",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-pink-500/10 rounded-lg text-pink-400",children:a.jsx(Yo,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-xl font-bold text-white",children:"Editar Nombres"}),a.jsxs("p",{className:"text-xs text-gray-400",children:["Edita los títulos de los ",r.length," mangas seleccionados"]})]})]}),a.jsx("button",{onClick:e,className:"text-gray-400 hover:text-white transition-colors p-2 hover:bg-white/5 rounded-lg",children:a.jsx(gt,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"p-4 border-b border-gray-800 bg-[#121212] flex-shrink-0 space-y-3",children:[a.jsxs("div",{className:"relative",children:[a.jsx(no,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400"}),a.jsx("input",{type:"text",value:i,onChange:v=>o(v.target.value),placeholder:"Filtrar manga por título...",className:"w-full bg-[#1a1a1a] border border-gray-700 rounded-xl pl-10 pr-4 py-3 text-sm text-white focus:outline-none focus:border-pink-500 transition-colors"})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("input",{type:"text",value:l,onChange:v=>c(v.target.value),placeholder:"Pon un nombre para aplicar a todos los seleccionados (Opcional)",className:"flex-1 bg-[#1a1a1a] border border-gray-700 rounded-xl px-4 py-3 text-sm text-white focus:outline-none focus:border-pink-500 transition-colors"}),a.jsx("button",{onClick:p,className:"bg-gray-800 hover:bg-gray-700 text-white px-6 py-3 rounded-xl text-sm font-medium transition-colors whitespace-nowrap",children:"Aplicar a todos"})]})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-2 custom-scrollbar",children:[y.map(v=>{const w=v.cover_url||v.thumbnail_url,E=w?Ks(w):void 0;return a.jsxs("div",{className:"flex items-center gap-3 bg-[#1a1a1a] p-3 rounded-lg border border-gray-800/50 hover:border-gray-700 transition-colors",children:[E?a.jsx("img",{src:E,alt:"",className:"w-10 h-10 rounded object-cover"}):a.jsx("div",{className:"w-10 h-10 rounded bg-gray-800 flex items-center justify-center",children:a.jsx("span",{className:"text-xs text-gray-500 text-center",children:"Sin img"})}),a.jsx("div",{className:"flex-1",children:a.jsx("input",{type:"text",value:u[v.id]!==void 0?u[v.id]:v.title,onChange:D=>_(v.id,D.target.value),className:`w-full bg-transparent border-b pl-2 py-1 text-sm focus:outline-none transition-colors ${u[v.id]!==void 0&&u[v.id].trim()!==v.title?"border-pink-500 text-pink-300":"border-transparent hover:border-gray-700 text-white focus:border-gray-600"}`,placeholder:"Título del manga"})})]},v.id)}),y.length===0&&a.jsx("div",{className:"text-center py-8 text-gray-500",children:"No se encontraron mangas con ese nombre en la selección"})]}),a.jsxs("div",{className:"bg-[#1a1a1a] border-t border-gray-800 px-6 py-4 flex justify-between items-center sticky bottom-0 flex-shrink-0",children:[a.jsxs("span",{className:"text-sm text-gray-400",children:[Object.keys(u).filter(v=>{var w;return u[v].trim()!==((w=n.find(E=>E.id===v))==null?void 0:w.title)}).length," cambios pendientes"]}),a.jsxs("div",{className:"flex gap-3",children:[a.jsx("button",{onClick:e,className:"px-4 py-2 text-sm font-semibold text-gray-300 hover:text-white transition-colors",disabled:f,children:"Cancelar"}),a.jsx("button",{onClick:C,disabled:f,className:"bg-pink-600 hover:bg-pink-700 disabled:opacity-50 disabled:cursor-not-allowed text-white px-6 py-2 rounded-lg text-sm font-bold shadow-lg shadow-pink-500/20 transition-all flex items-center gap-2",children:f?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Guardando..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Ea,{className:"w-4 h-4"}),"Guardar Cambios"]})})]})]})]})}):null}function ZF({isOpen:t,onClose:e,selectedMangaIds:n,onSaveComplete:r}){const[s,i]=L.useState([]),[o,l]=L.useState(!1),[c,u]=L.useState(!1),[h,f]=L.useState(!1),[m,p]=L.useState(!1),[y,_]=L.useState(!1);L.useEffect(()=>{t&&(C(),f(!1),p(!1),_(!1))},[t,n]);const C=async()=>{l(!0);try{const T=await Promise.all(n.map(async S=>{const x=await Ni(S);return x?{id:x.id,title:x.title,is_decensored:!!x.is_decensored,is_bn:!!x.is_bn,is_color:!!x.is_color,hasChanged:!1}:null}));i(T.filter(S=>S!==null))}catch(T){console.error("Error loading mangas:",T),we.error("Error al cargar la información de los mangas")}finally{l(!1)}},v=T=>{f(T),i(S=>S.map(x=>({...x,is_decensored:T,hasChanged:!0})))},w=T=>{p(T),T&&_(!1),i(S=>S.map(x=>({...x,is_bn:T,is_color:T?!1:x.is_color,hasChanged:!0})))},E=T=>{_(T),T&&p(!1),i(S=>S.map(x=>({...x,is_color:T,is_bn:T?!1:x.is_bn,hasChanged:!0})))},D=(T,S,x)=>{i(N=>N.map(A=>{if(A.id!==T)return A;const I={...A,[S]:x,hasChanged:!0};return S==="is_bn"&&x&&(I.is_color=!1),S==="is_color"&&x&&(I.is_bn=!1),I}))},M=async()=>{const T=s.filter(S=>S.hasChanged);if(T.length===0){we.info("No hay cambios para guardar"),e();return}u(!0);try{const S=T.map(x=>Lh(x.id,{is_decensored:x.is_decensored,is_bn:x.is_bn,is_color:x.is_color}));await Promise.all(S),we.success(`Se actualizaron las etiquetas de ${T.length} mangas`),r(),e()}catch(S){console.error("Error updating mangas:",S),we.error("Ocurrió un error al guardar los cambios")}finally{u(!1)}};return t?a.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50 p-4 animate-in fade-in duration-200",children:a.jsxs("div",{className:"bg-[#121212] rounded-2xl border border-gray-800 w-full max-w-4xl shadow-2xl overflow-hidden flex flex-col max-h-[90vh]",children:[a.jsxs("div",{className:"bg-[#1a1a1a] border-b border-gray-800 px-6 py-4 flex items-center justify-between sticky top-0 z-10",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-[#bb86fc]/10 rounded-lg text-[#bb86fc]",children:a.jsx(vd,{className:"w-5 h-5"})}),a.jsxs("h2",{className:"text-xl font-bold text-white",children:["Etiquetadora (",n.length," mangas)"]})]}),a.jsx("button",{onClick:e,className:"text-gray-400 hover:text-white transition-colors p-2 hover:bg-white/5 rounded-lg",children:a.jsx(gt,{className:"w-5 h-5"})})]}),a.jsx("div",{className:"p-6 overflow-y-auto custom-scrollbar flex-1 space-y-6",children:o?a.jsx("div",{className:"flex justify-center p-8",children:a.jsx(Sr,{size:32})}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"bg-[#1f1f1f] p-5 rounded-xl border border-gray-700 shadow-lg",children:[a.jsxs("h3",{className:"text-md font-bold text-white mb-4 flex items-center gap-2",children:[a.jsx(vd,{className:"w-4 h-4 text-[#bb86fc]"})," Opciones Generales"]}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-6",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[a.jsx("input",{type:"checkbox",className:"sr-only peer",checked:h,onChange:T=>v(T.target.checked)}),a.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-[#bb86fc]"})]}),a.jsx("div",{children:a.jsx("span",{className:"text-sm font-semibold text-white",children:"Sin censura (Todos)"})})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[a.jsx("input",{type:"checkbox",className:"sr-only peer",checked:m,onChange:T=>w(T.target.checked)}),a.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-[#bb86fc]"})]}),a.jsx("div",{children:a.jsx("span",{className:"text-sm font-semibold text-white",children:"B/N (Todos)"})})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[a.jsx("input",{type:"checkbox",className:"sr-only peer",checked:y,onChange:T=>E(T.target.checked)}),a.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-[#bb86fc]"})]}),a.jsx("div",{children:a.jsx("span",{className:"text-sm font-semibold text-white",children:"a color (Todos)"})})]})]})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("h3",{className:"text-sm font-bold text-gray-400 uppercase tracking-wider px-2",children:["Mangas Individuales (",s.length,")"]}),a.jsx("div",{className:"bg-[#1a1a1a] rounded-xl border border-gray-800 divide-y divide-gray-800",children:s.map(T=>a.jsxs("div",{className:`p-4 flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4 transition-colors ${T.hasChanged?"bg-[#bb86fc]/5":"hover:bg-[#1f1f1f]"}`,children:[a.jsxs("div",{className:"flex-1 min-w-0 pr-4",children:[a.jsx("h4",{className:"text-sm font-semibold text-white truncate",title:T.title,children:T.title}),T.hasChanged&&a.jsx("span",{className:"text-[10px] text-[#bb86fc] uppercase tracking-widest font-bold",children:"Modificado"})]}),a.jsxs("div",{className:"flex items-center gap-4 sm:gap-6 shrink-0",children:[a.jsxs("div",{className:"flex flex-col items-center gap-1",children:[a.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[a.jsx("input",{type:"checkbox",className:"sr-only peer",checked:T.is_decensored,onChange:S=>D(T.id,"is_decensored",S.target.checked)}),a.jsx("div",{className:"w-9 h-5 bg-gray-700 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-[#bb86fc]"})]}),a.jsx("span",{className:"text-[10px] text-gray-400 font-medium",children:"Sin censura"})]}),a.jsxs("div",{className:"flex flex-col items-center gap-1",children:[a.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[a.jsx("input",{type:"checkbox",className:"sr-only peer",checked:T.is_bn,onChange:S=>D(T.id,"is_bn",S.target.checked)}),a.jsx("div",{className:"w-9 h-5 bg-gray-700 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-[#bb86fc]"})]}),a.jsx("span",{className:"text-[10px] text-gray-400 font-medium",children:"B/N"})]}),a.jsxs("div",{className:"flex flex-col items-center gap-1",children:[a.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[a.jsx("input",{type:"checkbox",className:"sr-only peer",checked:T.is_color,onChange:S=>D(T.id,"is_color",S.target.checked)}),a.jsx("div",{className:"w-9 h-5 bg-gray-700 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-4 after:w-4 after:transition-all peer-checked:bg-[#bb86fc]"})]}),a.jsx("span",{className:"text-[10px] text-gray-400 font-medium",children:"a color"})]})]})]},T.id))})]})]})}),a.jsxs("div",{className:"p-6 border-t border-gray-800 flex justify-end gap-3 bg-[#1a1a1a]",children:[a.jsx("button",{onClick:e,className:"px-4 py-2 rounded-lg text-sm font-semibold text-gray-300 hover:text-white transition-colors",children:"Cancelar"}),a.jsx("button",{onClick:M,disabled:c||o||s.filter(T=>T.hasChanged).length===0,className:"bg-[#bb86fc] hover:bg-[#9966dd] text-white px-6 py-2 rounded-lg font-semibold text-sm transition-all shadow-lg shadow-[#bb86fc]/20 flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",children:c?a.jsxs(a.Fragment,{children:[a.jsx(Sr,{size:16}),"Guardando..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Ea,{className:"w-4 h-4"}),"Guardar Cambios (",s.filter(T=>T.hasChanged).length,")"]})})]})]})}):null}function e8({isOpen:t,onClose:e,selectedMangaIds:n,onSaveComplete:r,currentFolderId:s,currentSection:i}){const[o,l]=L.useState(""),[c,u]=L.useState(!1),h=async()=>{if(!o.trim()){we.error("Gamba: Escribe un nombre para la carpeta");return}try{u(!0),await MD(o.trim(),n,s,i),we.success(`Carpeta "${o}" creada exitosamente.`),r(),e(),l("")}catch(f){console.error("Error creating folder:",f),we.error("Error al crear la carpeta")}finally{u(!1)}};return t?a.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-[70] p-4 animate-in fade-in duration-200",children:a.jsxs("div",{className:"bg-[#121212] rounded-2xl border border-gray-800 w-full max-w-sm shadow-2xl overflow-hidden flex flex-col",children:[a.jsxs("div",{className:"bg-[#1a1a1a] border-b border-gray-800 px-6 py-4 flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-purple-500/10 rounded-lg text-purple-400",children:a.jsx(Q_,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-xl font-bold text-white",children:"Crear Carpeta"}),a.jsxs("p",{className:"text-xs text-gray-400",children:[n.length," elementos seleccionados"]})]})]}),a.jsx("button",{onClick:e,className:"text-gray-400 hover:text-white transition-colors p-2 hover:bg-white/5 rounded-lg",children:a.jsx(gt,{className:"w-5 h-5"})})]}),a.jsx("div",{className:"p-6",children:a.jsx("input",{type:"text",value:o,onChange:f=>l(f.target.value),placeholder:"Nombre de la nueva carpeta",className:"w-full bg-[#1a1a1a] border border-gray-700 rounded-xl px-4 py-3 text-sm text-white focus:outline-none focus:border-purple-500 transition-colors",autoFocus:!0})}),a.jsxs("div",{className:"bg-[#1a1a1a] border-t border-gray-800 px-6 py-4 flex justify-end gap-3",children:[a.jsx("button",{onClick:e,className:"px-4 py-2 text-sm font-semibold text-gray-300 hover:text-white transition-colors",disabled:c,children:"Cancelar"}),a.jsx("button",{onClick:h,disabled:c||!o.trim(),className:"bg-purple-600 hover:bg-purple-700 disabled:opacity-50 disabled:cursor-not-allowed text-white px-6 py-2 rounded-lg text-sm font-bold shadow-lg shadow-purple-500/20 transition-all flex items-center gap-2",children:c?"Creando...":"Crear"})]})]})}):null}function t8({isOpen:t,onClose:e,selectedMangaIds:n,mangas:r,onSaveComplete:s}){const[i,o]=L.useState(""),[l,c]=L.useState(!1),[u,h]=L.useState(null),[f,m]=L.useState(new Set),p=(w,E)=>{w.stopPropagation(),m(D=>{const M=new Set(D);return M.has(E)?M.delete(E):M.add(E),M})},y=L.useMemo(()=>{const w=r.filter(T=>T.is_folder&&!n.includes(T.id)),E=new Map;w.forEach(T=>{E.set(T.id,{folder:T,children:[]})});const D=[];w.forEach(T=>{const S=E.get(T.id);T.folder_id&&E.has(T.folder_id)?E.get(T.folder_id).children.push(S):D.push(S)});const M=T=>{T.sort((S,x)=>S.folder.title.localeCompare(x.folder.title)),T.forEach(S=>M(S.children))};return M(D),D},[r,n]),_=L.useMemo(()=>{const w=[],E=i.toLowerCase(),D=T=>!E||T.folder.title.toLowerCase().includes(E)?!0:T.children.some(D),M=(T,S,x)=>{T.forEach(N=>{if(D(N)){w.push({folder:N.folder,level:S,hasChildren:N.children.length>0});const I=x||f.has(N.folder.id);N.children.length>0&&I&&M(N.children,S+1,x)}})};return M(y,0,!!E),w},[y,f,i]),C=async w=>{try{c(!0);const E=new Set(r.filter(T=>n.includes(T.id)&&T.is_folder).map(T=>T.id)),D=T=>{var N,A;let S=(N=r.find(I=>I.id===T))==null?void 0:N.folder_id,x=0;for(;S&&x<20;){if(E.has(S))return!0;S=(A=r.find(I=>I.id===S))==null?void 0:A.folder_id,x++}return!1},M=n.filter(T=>!D(T));await M2(M,w),w?we.success("Movido exitosamente a la carpeta."):we.success("Removido de la carpeta exitosamente."),s(),e()}catch(E){console.error("Error moving to folder:",E),we.error("Error al mover a la carpeta")}finally{c(!1)}},v=async w=>{try{c(!0),await Ud(w),we.success("Carpeta eliminada correctamente"),h(null),s()}catch(E){console.error("Error deleting folder:",E),we.error("Error al eliminar la carpeta")}finally{c(!1)}};return t?a.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-[70] p-4 animate-in fade-in duration-200",children:a.jsxs("div",{className:"bg-[#121212] rounded-2xl border border-gray-800 w-full max-w-4xl shadow-2xl overflow-hidden flex flex-col max-h-[90vh] min-h-[60vh]",children:[a.jsxs("div",{className:"bg-[#1a1a1a] border-b border-gray-800 px-6 py-4 flex items-center justify-between sticky top-0 z-10 flex-shrink-0",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-blue-500/10 rounded-lg text-blue-400",children:a.jsx(zx,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-xl font-bold text-white",children:"Mover a Carpeta"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Selecciona la carpeta de destino"})]})]}),a.jsx("button",{onClick:e,className:"text-gray-400 hover:text-white transition-colors p-2 hover:bg-white/5 rounded-lg",children:a.jsx(gt,{className:"w-5 h-5"})})]}),a.jsx("div",{className:"p-4 border-b border-gray-800 bg-[#121212] flex-shrink-0",children:a.jsxs("div",{className:"relative",children:[a.jsx(no,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400"}),a.jsx("input",{type:"text",value:i,onChange:w=>o(w.target.value),placeholder:"Buscar carpeta...",className:"w-full bg-[#1a1a1a] border border-gray-700 rounded-xl pl-10 pr-4 py-3 text-sm text-white focus:outline-none focus:border-blue-500 transition-colors"})]})}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-2 custom-scrollbar overscroll-contain",style:{contain:"content"},children:[a.jsxs("button",{onClick:()=>C(null),disabled:l,className:"w-full flex items-center gap-3 p-3 rounded-xl border border-dashed border-gray-700 hover:border-blue-500 hover:bg-blue-500/5 transition-colors text-left group",children:[a.jsx("div",{className:"w-10 h-10 rounded-lg bg-gray-800 flex items-center justify-center group-hover:bg-blue-500/20 transition-colors",children:a.jsx("span",{className:"text-lg",children:"🏠"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h3",{className:"text-sm font-semibold text-white",children:"Raíz (Pantalla principal)"}),a.jsx("p",{className:"text-xs text-gray-400 border-gray-700",children:"Sacar de cualquier carpeta"})]})]}),a.jsx("div",{className:"h-px bg-gray-800 my-4"}),_.map(({folder:w,level:E,hasChildren:D})=>{const M=!!i||f.has(w.id);return a.jsxs("div",{className:"w-full flex items-center gap-2",style:{contentVisibility:"auto",containIntrinsicSize:"0 64px"},children:[a.jsx("div",{style:{width:`${E*1.5}rem`},className:"flex-shrink-0"}),a.jsx("div",{className:"w-6 flex items-center justify-center flex-shrink-0",children:D&&a.jsx("button",{onClick:T=>p(T,w.id),className:"p-1 rounded hover:bg-gray-700 text-gray-400 hover:text-white transition-colors",children:M?a.jsx(DI,{className:"w-4 h-4"}):a.jsx(hc,{className:"w-4 h-4"})})}),a.jsxs("button",{onClick:()=>C(w.id),disabled:l,className:"flex-1 flex items-center gap-3 p-3 rounded-xl border border-gray-800 bg-[#1a1a1a] hover:border-blue-500 transition-colors text-left group",children:[a.jsx("div",{className:"w-10 h-10 rounded-lg bg-gray-800 flex items-center justify-center overflow-hidden flex-shrink-0",children:a.jsx(zx,{className:"w-5 h-5 text-gray-400 group-hover:text-blue-400 transition-colors"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("h3",{className:"text-sm font-semibold text-white group-hover:text-blue-400 transition-colors truncate",children:w.title}),a.jsx("p",{className:"text-xs text-gray-400",children:"Carpeta"})]})]}),a.jsx("button",{onClick:T=>{T.stopPropagation(),h(w.id)},disabled:l,className:"p-3 rounded-xl border border-gray-800 bg-[#1a1a1a] hover:bg-red-600 hover:border-red-500 transition-colors text-gray-400 hover:text-white flex items-center justify-center flex-shrink-0",title:"Eliminar carpeta",children:a.jsx(tn,{className:"w-5 h-5"})})]},w.id)}),_.length===0&&a.jsx("div",{className:"text-center py-8 text-gray-500",children:"No hay carpetas disponibles"})]}),u&&a.jsxs("div",{className:"absolute inset-0 bg-black/80 backdrop-blur-sm flex flex-col items-center justify-center gap-4 rounded-2xl z-[80] animate-in fade-in duration-200",children:[a.jsxs("p",{className:"text-white text-base font-semibold text-center px-6",children:["¿Seguro que deseas eliminar esta carpeta?",a.jsx("br",{}),a.jsx("span",{className:"text-gray-400 text-sm font-normal mt-2 block",children:"Los cómics dentro de ella volverán a la vista principal."})]}),a.jsxs("div",{className:"flex gap-3",children:[a.jsx("button",{onClick:w=>{w.stopPropagation(),h(null)},disabled:l,className:"bg-gray-700 hover:bg-gray-600 text-white px-5 py-2.5 rounded-xl text-sm font-semibold transition-all duration-200 transform hover:scale-105 active:scale-95",children:"Cancelar"}),a.jsx("button",{onClick:w=>{w.stopPropagation(),v(u)},disabled:l,className:"bg-red-600 hover:bg-red-700 text-white px-5 py-2.5 rounded-xl text-sm font-semibold transition-all duration-200 transform hover:scale-105 active:scale-95",children:l?"Eliminando...":"Eliminar"})]})]})]})}):null}function UT({className:t=""}){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:t,children:a.jsx("path",{d:"M12 0C5.373 0 0 5.373 0 12c0 6.628 5.373 12 12 12 6.628 0 12-5.373 12-12C24 5.373 18.628 0 12 0zm5.663 11.233c-.015.004-.37.108-1.077.306a4.426 4.426 0 00-2.316-1.527c1.332-.387 2.37-1.4 2.37-2.671 0-1.637-1.464-2.964-3.266-2.964-1.801 0-3.264 1.327-3.264 2.964 0 .918.461 1.745 1.189 2.29.076.057.155.112.235.163-.64.062-1.242.062-1.803.04l-.066-.003c-2.387-.145-3.593-1.603-3.615-1.636l-.612-.872-1.073.49s1.396 3.1 4.545 3.327c.489.034.996.035 1.503.003-.021.054-.04.11-.059.167-.718 1.956-1.248 3.906-1.264 3.966l-.161.642.553.376c1.037.706 2.308 1.08 3.611 1.08h.084c3.42 0 6.138-2.607 6.138-5.91 0-.916-.217-1.782-.6-2.553l-.052-.1zM11.964 5.568c1.139 0 2.064.881 2.064 1.964 0 .864-.593 1.6-1.405 1.86a4.576 4.576 0 00-1.318-1.583c.196-1.198.814-2.241 2.241-2.241z"})})}function BT({className:t=""}){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:t,children:a.jsx("path",{d:"M11.5 0a1.5 1.5 0 00-1.42.997A49.192 49.192 0 009.68 5.68a49.192 49.192 0 00-4.683.4A1.5 1.5 0 004 7.5c0 .762.568 1.402 1.325 1.488a49.192 49.192 0 004.354.346 49.192 49.192 0 00.346 4.354A1.5 1.5 0 0011.5 15c.762 0 1.402-.568 1.488-1.325a49.192 49.192 0 00.346-4.354 49.192 49.192 0 004.354-.346A1.5 1.5 0 0019 7.5c0-.762-.568-1.402-1.325-1.488a49.192 49.192 0 00-4.683-.4 49.192 49.192 0 00-.399-4.683A1.5 1.5 0 0011.5 0z",fill:"currentColor"})})}function n8({isOpen:t,onClose:e,selectedMangaIds:n,onSaveComplete:r,currentSection:s}){const[i,o]=L.useState(s==="flow"?"patreon":"flow"),[l,c]=L.useState(!1),u=async()=>{if(i===s){we.error("Gamba: Ya estás en esta sección");return}try{c(!0),await LD(n,i);let h="Flow";i==="patreon"&&(h="Patreon"),i==="onlyfans"&&(h="OnlyFans"),i==="grok"&&(h="Grok"),we.success(`${n.length} elementos movidos a ${h}`),r(),e()}catch(h){console.error("Error moving section:",h),we.error("Error al mover los elementos de sección")}finally{c(!1)}};return t?a.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-[70] p-4 animate-in fade-in duration-200",children:a.jsxs("div",{className:"bg-[#121212] rounded-2xl border border-gray-800 w-full max-w-sm shadow-2xl overflow-hidden flex flex-col",children:[a.jsxs("div",{className:"bg-[#1a1a1a] border-b border-gray-800 px-6 py-4 flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-indigo-500/10 rounded-lg text-indigo-400",children:a.jsx(Dg,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-xl font-bold text-white",children:"Mover a Sección"}),a.jsxs("p",{className:"text-xs text-gray-400",children:[n.length," elementos seleccionados"]})]})]}),a.jsx("button",{onClick:e,className:"text-gray-400 hover:text-white transition-colors p-2 hover:bg-white/5 rounded-lg",children:a.jsx(gt,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"p-6 space-y-4",children:[a.jsx("p",{className:"text-sm text-gray-300 text-center mb-4",children:"¿A qué sección deseas enviar estos elementos?"}),a.jsxs("button",{onClick:()=>o("flow"),disabled:s==="flow",className:`w-full flex items-center justify-between p-4 rounded-xl border transition-all ${s==="flow"?"border-gray-800 bg-[#121212] opacity-50 cursor-not-allowed":i==="flow"?"border-[#bb86fc] bg-[#bb86fc]/10 text-white":"border-gray-700 bg-[#1a1a1a] text-gray-400 hover:border-gray-500"}`,children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`p-2 rounded-lg ${s==="flow"?"bg-gray-800 text-gray-500":i==="flow"?"bg-[#bb86fc]/20 text-[#bb86fc]":"bg-gray-800 text-gray-400"}`,children:a.jsx(Pr,{className:"w-5 h-5"})}),a.jsxs("div",{className:"text-left",children:[a.jsx("h3",{className:"font-semibold text-sm",children:"Flow"}),a.jsx("p",{className:"text-xs opacity-70",children:"Galería principal"})]})]}),s==="flow"&&a.jsx("span",{className:"text-xs font-bold px-2 py-1 rounded bg-gray-800 text-gray-400",children:"Actual"})]}),a.jsxs("button",{onClick:()=>o("patreon"),disabled:s==="patreon",className:`w-full flex items-center justify-between p-4 rounded-xl border transition-all ${s==="patreon"?"border-gray-800 bg-[#121212] opacity-50 cursor-not-allowed":i==="patreon"?"border-[#f96854] bg-[#f96854]/10 text-white":"border-gray-700 bg-[#1a1a1a] text-gray-400 hover:border-gray-500"}`,children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`p-2 rounded-lg ${s==="patreon"?"bg-gray-800 text-gray-500":i==="patreon"?"bg-[#f96854]/20 text-[#f96854]":"bg-gray-800 text-gray-400"}`,children:a.jsx(sc,{className:"w-5 h-5"})}),a.jsxs("div",{className:"text-left",children:[a.jsx("h3",{className:"font-semibold text-sm",children:"Patreon"}),a.jsx("p",{className:"text-xs opacity-70",children:"Contenido exclusivo"})]})]}),s==="patreon"&&a.jsx("span",{className:"text-xs font-bold px-2 py-1 rounded bg-gray-800 text-gray-400",children:"Actual"})]}),a.jsxs("button",{onClick:()=>o("onlyfans"),disabled:s==="onlyfans",className:`w-full flex items-center justify-between p-4 rounded-xl border transition-all ${s==="onlyfans"?"border-gray-800 bg-[#121212] opacity-50 cursor-not-allowed":i==="onlyfans"?"border-[#00AFF0] bg-[#00AFF0]/10 text-white":"border-gray-700 bg-[#1a1a1a] text-gray-400 hover:border-gray-500"}`,children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`p-2 rounded-lg ${s==="onlyfans"?"bg-gray-800 text-gray-500":i==="onlyfans"?"bg-[#00AFF0]/20 text-[#00AFF0]":"bg-gray-800 text-gray-400"}`,children:a.jsx(UT,{className:"w-5 h-5"})}),a.jsxs("div",{className:"text-left",children:[a.jsx("h3",{className:"font-semibold text-sm",children:"OnlyFans"}),a.jsx("p",{className:"text-xs opacity-70",children:"Contenido premium"})]})]}),s==="onlyfans"&&a.jsx("span",{className:"text-xs font-bold px-2 py-1 rounded bg-gray-800 text-gray-400",children:"Actual"})]}),a.jsxs("button",{onClick:()=>o("grok"),disabled:s==="grok",className:`w-full flex items-center justify-between p-4 rounded-xl border transition-all ${s==="grok"?"border-gray-800 bg-[#121212] opacity-50 cursor-not-allowed":i==="grok"?"border-[#1D9BF0] bg-[#1D9BF0]/10 text-white":"border-gray-700 bg-[#1a1a1a] text-gray-400 hover:border-gray-500"}`,children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`p-2 rounded-lg ${s==="grok"?"bg-gray-800 text-gray-500":i==="grok"?"bg-[#1D9BF0]/20 text-[#1D9BF0]":"bg-gray-800 text-gray-400"}`,children:a.jsx(BT,{className:"w-5 h-5"})}),a.jsxs("div",{className:"text-left",children:[a.jsx("h3",{className:"font-semibold text-sm",children:"Grok"}),a.jsx("p",{className:"text-xs opacity-70",children:"Contenido IA"})]})]}),s==="grok"&&a.jsx("span",{className:"text-xs font-bold px-2 py-1 rounded bg-gray-800 text-gray-400",children:"Actual"})]})]}),a.jsxs("div",{className:"bg-[#1a1a1a] border-t border-gray-800 px-6 py-4 flex justify-end gap-3",children:[a.jsx("button",{onClick:e,className:"px-4 py-2 text-sm font-semibold text-gray-300 hover:text-white transition-colors",disabled:l,children:"Cancelar"}),a.jsx("button",{onClick:u,disabled:l||i===s,className:"bg-indigo-600 hover:bg-indigo-700 disabled:opacity-50 disabled:cursor-not-allowed text-white px-6 py-2 rounded-lg text-sm font-bold shadow-lg shadow-indigo-500/20 transition-all flex items-center gap-2",children:l?"Moviendo...":"Mover"})]})]})}):null}function r8({isOpen:t,onClose:e,mangas:n}){const r=L.useMemo(()=>{const i=new Map;n.forEach(l=>{i.set(l.id,{item:l,children:[]})});const o=[];return n.forEach(l=>{const c=i.get(l.id);l.folder_id&&i.has(l.folder_id)?i.get(l.folder_id).children.push(c):o.push(c)}),o},[n]);if(!t)return null;const s=(i,o=0)=>{if(i.length===0)return null;const l=[...i].sort((c,u)=>c.item.is_folder&&!u.item.is_folder?-1:!c.item.is_folder&&u.item.is_folder?1:c.item.title.localeCompare(u.item.title));return a.jsxs("div",{className:"flex flex-col gap-3 relative",style:{marginLeft:o>0?"2.5rem":"0"},children:[o>0&&a.jsx("div",{className:"absolute -left-6 top-0 bottom-6 w-px bg-gray-700/50"}),l.map((c,u)=>{var m;const h=u===l.length-1,f=o===0&&c.item.is_folder;return a.jsxs("div",{className:"relative",children:[o>0&&a.jsx("div",{className:"absolute -left-6 top-6 w-6 h-px bg-gray-700/50"}),o>0&&h&&a.jsx("div",{className:"absolute -left-6 top-6 bottom-0 w-px bg-[#1a1a1a]"}),a.jsxs("div",{className:`p-4 rounded-xl border flex flex-col gap-3 transition-colors ${c.item.is_folder?f?"bg-purple-900/10 border-purple-500/30":"bg-blue-900/10 border-blue-500/20":"bg-gray-800/40 border-gray-700/50"}`,children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:`p-2 rounded-lg ${c.item.is_folder?f?"bg-purple-500/20 text-purple-400":"bg-blue-500/20 text-blue-400":"bg-emerald-500/10 text-emerald-500"}`,children:c.item.is_folder?a.jsx(xr,{className:"w-5 h-5"}):a.jsx(Yp,{className:"w-5 h-5"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h4",{className:"text-sm font-bold text-white whitespace-normal",children:c.item.title}),a.jsx("span",{className:"text-xs text-gray-500",children:c.item.is_folder?`Carpeta (${c.children.length} elementos)`:`Manga (${((m=c.item.chapters)==null?void 0:m.length)||0} caps)`})]})]}),c.children.length>0&&a.jsx("div",{className:"mt-2",children:s(c.children,o+1)})]})]},c.item.id)})]})};return a.jsx("div",{className:"fixed inset-0 bg-black/80 backdrop-blur-md flex items-center justify-center z-[80] p-4 animate-in fade-in duration-200",children:a.jsxs("div",{className:"bg-[#121212] rounded-2xl border border-gray-800 w-full max-w-6xl shadow-2xl overflow-hidden flex flex-col h-[90vh]",children:[a.jsxs("div",{className:"bg-[#1a1a1a] border-b border-gray-800 px-6 py-4 flex items-center justify-between sticky top-0 z-10 flex-shrink-0",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-indigo-500/10 rounded-lg text-indigo-400",children:a.jsx(FI,{className:"w-6 h-6"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-xl font-bold text-white",children:"Mapa Mental de Organización"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Vista general de toda tu estructura de carpetas y mangas"})]})]}),a.jsx("button",{onClick:e,className:"text-gray-400 hover:text-white transition-colors p-2 hover:bg-white/5 rounded-lg border border-transparent hover:border-gray-700",children:a.jsx(gt,{className:"w-6 h-6"})})]}),a.jsx("div",{className:"flex-1 overflow-auto p-8 custom-scrollbar relative bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGNpcmNsZSBjeD0iMSIgY3k9IjEiIHI9IjEiIGZpbGw9IiMzMzMiLz48L3N2Zz4=')]",children:a.jsx("div",{className:"max-w-4xl mx-auto",children:s(r)})})]})})}function s8({isOpen:t,onClose:e,deletedMangas:n,onRestore:r,onPermanentDelete:s}){const[i,o]=L.useState(new Set);if(!t)return null;const l=async u=>{o(h=>new Set(h).add(u));try{await r(u),we.success("Elemento restaurado. Sus hijos también fueron recuperados si era una carpeta.")}catch{we.error("Error al restaurar elemento")}finally{o(h=>{const f=new Set(h);return f.delete(u),f})}},c=async u=>{if(window.confirm("¿ELIMINAR DEFINITIVAMENTE? Esta acción borrará el registro y los capítulos para siempre de la base de datos y no se puede deshacer.")){o(h=>new Set(h).add(u));try{await s(u),we.success("Elemento purgado de la base de datos.")}catch{we.error("Error purgando elemento")}finally{o(h=>{const f=new Set(h);return f.delete(u),f})}}};return a.jsx("div",{className:"fixed inset-0 bg-black/80 flex items-center justify-center z-50 p-4 sm:p-6 backdrop-blur-sm animate-[fadeIn_0.2s_ease-out]",children:a.jsxs("div",{className:"bg-[#121212] rounded-2xl w-full max-w-4xl max-h-[90vh] flex flex-col shadow-2xl border border-gray-800 animate-[scaleIn_0.2s_ease-out] relative overflow-hidden",children:[a.jsxs("div",{className:"flex items-center justify-between px-6 py-5 border-b border-gray-800/50 bg-[#1a1a1a]",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2.5 bg-red-500/10 rounded-xl text-red-500",children:a.jsx(tn,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-xl font-bold tracking-tight text-white flex items-center gap-2",children:"Papelera de Reciclaje"}),a.jsx("p",{className:"text-sm text-gray-400 mt-0.5",children:"Estos elementos están ocultos a los usuarios."})]})]}),a.jsx("button",{onClick:e,className:"p-2 hover:bg-white/10 rounded-xl transition-colors shrink-0 group right-4 absolute md:relative top-4 md:top-0",children:a.jsx(gt,{className:"w-5 h-5 text-gray-400 group-hover:text-white"})})]}),a.jsx("div",{className:"flex-1 overflow-y-auto p-4 sm:p-6 space-y-3 custom-scrollbar",children:n.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center h-48 text-gray-400 opacity-50",children:[a.jsx(tn,{className:"w-16 h-16 mb-4"}),a.jsx("p",{className:"text-lg font-medium",children:"La papelera está vacía"})]}):n.map(u=>a.jsxs("div",{className:"flex flex-col sm:flex-row items-center gap-4 bg-gray-900/50 p-3 sm:p-4 rounded-xl border border-gray-800 hover:border-gray-700 transition-colors",children:[a.jsx("div",{className:"w-16 h-16 shrink-0 bg-gray-800 rounded-lg overflow-hidden flex items-center justify-center",children:u.thumbnail_url||u.cover_url?a.jsx("img",{src:u.thumbnail_url||u.cover_url,alt:"",className:"w-full h-full object-cover opacity-70 grayscale hover:grayscale-0 transition-all"}):u.is_folder?a.jsx(xr,{className:"w-8 h-8 text-gray-500"}):a.jsx("div",{className:"w-6 h-6 bg-gray-700 rounded-sm"})}),a.jsxs("div",{className:"flex-1 min-w-0 w-full text-center sm:text-left",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1 justify-center sm:justify-start",children:[u.is_folder&&a.jsx(xr,{className:"w-3.5 h-3.5 text-blue-400"}),a.jsx("h3",{className:"font-bold text-white truncate text-sm sm:text-base",title:u.title,children:u.title})]}),a.jsxs("p",{className:"text-xs text-gray-400 truncate",children:[u.author||"Sin autor"," • Eliminado el ",new Date(u.updated_at).toLocaleDateString()]})]}),a.jsxs("div",{className:"flex items-center gap-2 w-full sm:w-auto",children:[a.jsxs("button",{onClick:()=>l(u.id),disabled:i.has(u.id),className:"flex-1 sm:flex-none flex items-center justify-center gap-1.5 px-3 py-2 bg-emerald-500/10 hover:bg-emerald-500/20 text-emerald-500 rounded-lg text-xs font-semibold transition-colors disabled:opacity-50",children:[a.jsx(zI,{className:"w-3.5 h-3.5"}),"Restaurar"]}),a.jsxs("button",{onClick:()=>c(u.id),disabled:i.has(u.id),className:"flex-1 sm:flex-none flex items-center justify-center gap-1.5 px-3 py-2 bg-red-500/10 hover:bg-red-500/20 text-red-500 rounded-lg text-xs font-semibold transition-colors disabled:opacity-50",children:[a.jsx(tn,{className:"w-3.5 h-3.5"}),"Purgar"]})]})]},u.id))})]})})}function i8({isOpen:t,onClose:e,mangaIds:n,onSaveComplete:r}){const[s,i]=L.useState(null),[o,l]=L.useState(null),[c,u]=L.useState([]),[h,f]=L.useState([]),[m,p]=L.useState(new Set),[y,_]=L.useState(new Set),[C,v]=L.useState(!1),[w,E]=L.useState(!1),[D,M]=L.useState({active:!1,selecting:!0,source:null});L.useEffect(()=>{const B=()=>M({active:!1,selecting:!0,source:null});return window.addEventListener("mouseup",B),()=>window.removeEventListener("mouseup",B)},[]),L.useEffect(()=>{t&&n.length===2?T():(i(null),l(null),u([]),f([]),p(new Set),_(new Set))},[t,n]);const T=async()=>{var B,z;E(!0);try{const[W,ee]=await Promise.all([Ni(n[0]),Ni(n[1])]);i(W),l(ee);let F=[];(B=W==null?void 0:W.chapters)==null||B.forEach(R=>F.push(...R.pages||[])),u(F);let K=[];(z=ee==null?void 0:ee.chapters)==null||z.forEach(R=>K.push(...R.pages||[])),f(K),p(new Set),_(new Set)}catch{we.error("Error al cargar los mangas")}finally{E(!1)}},S=()=>{if(m.size===0)return;const z=Array.from(m).sort((ee,F)=>ee-F).map(ee=>c[ee]),W=c.filter((ee,F)=>!m.has(F));u(W),f(ee=>[...ee,...z]),p(new Set)},x=()=>{if(y.size===0)return;const z=Array.from(y).sort((ee,F)=>ee-F).map(ee=>h[ee]),W=h.filter((ee,F)=>!y.has(F));f(W),u(ee=>[...ee,...z]),_(new Set)},N=(B,z)=>{const W=B==="A"?m.has(z):y.has(z);M({active:!0,selecting:!W,source:B}),A(B,z,!W)},A=(B,z,W)=>{if(!D.active&&W===void 0||D.source!==null&&D.source!==B&&W===void 0)return;const ee=W!==void 0?W:D.selecting;B==="A"?p(F=>{const K=new Set(F);return ee?K.add(z):K.delete(z),K}):_(F=>{const K=new Set(F);return ee?K.add(z):K.delete(z),K})},I=()=>{m.size===c.length?p(new Set):p(new Set(c.map((B,z)=>z)))},P=()=>{y.size===h.length?_(new Set):_(new Set(h.map((B,z)=>z)))},k=async()=>{if(!(!s||!o)){v(!0);try{await OD(s.id,o.id,c,h),we.success("Páginas transferidas correctamente."),r(),e()}catch(B){console.error(B),we.error("Ocurrió un error al guardar los cambios.")}finally{v(!1)}}};return t?a.jsx("div",{className:"fixed inset-0 bg-black/80 backdrop-blur-sm z-[70] flex items-center justify-center p-4 sm:p-6 animate-in fade-in duration-200",children:a.jsxs("div",{className:"bg-[#121212] border border-gray-700 w-full max-w-7xl h-[90vh] rounded-2xl shadow-2xl flex flex-col overflow-hidden animate-in zoom-in-95 duration-200",children:[a.jsxs("div",{className:"bg-[#1a1a1a] border-b border-gray-800 px-6 py-4 flex items-center justify-between shrink-0",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"p-2 bg-amber-500/10 rounded-lg text-amber-500",children:a.jsx(OI,{className:"w-5 h-5"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-xl font-bold text-white",children:"Transferencia de Páginas"}),a.jsx("p",{className:"text-sm text-gray-400",children:"Mueve páginas de un manga a otro"})]})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("button",{onClick:k,disabled:C||w,className:"bg-emerald-600 hover:bg-emerald-700 disabled:opacity-50 disabled:cursor-not-allowed text-white px-4 py-2 rounded-lg font-semibold text-sm transition-all shadow-lg shadow-emerald-500/20 flex items-center gap-2",children:[C?a.jsx(Bx,{className:"w-4 h-4 animate-spin"}):a.jsx(Ea,{className:"w-4 h-4"}),"Guardar Cambios"]}),a.jsx("button",{onClick:e,className:"text-gray-400 hover:text-white transition-colors p-2 hover:bg-white/5 rounded-lg",children:a.jsx(gt,{className:"w-5 h-5"})})]})]}),w?a.jsx("div",{className:"flex-1 flex items-center justify-center",children:a.jsx(Bx,{className:"w-12 h-12 text-amber-500 animate-spin"})}):a.jsxs("div",{className:"flex-1 flex flex-col md:flex-row min-h-0",children:[a.jsxs("div",{className:"flex-1 flex flex-col min-h-0 border-r border-gray-800 bg-[#151515]",children:[a.jsxs("div",{className:"p-4 border-b border-gray-800 bg-[#1a1a1a] shrink-0 sticky top-0 z-10 flex flex-col gap-2",children:[a.jsx("h3",{className:"font-bold text-lg text-amber-400 truncate",title:s==null?void 0:s.title,children:(s==null?void 0:s.title)||"Cargando..."}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-sm text-gray-400",children:[c.length," páginas"]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{onClick:I,className:"text-xs text-blue-400 hover:text-blue-300",children:m.size===c.length&&c.length>0?"Deseleccionar todo":"Seleccionar todo"}),m.size>0&&a.jsxs("span",{className:"text-xs bg-amber-500/20 text-amber-300 px-2 py-0.5 rounded-full font-bold",children:[m.size," sel."]})]})]})]}),a.jsx("div",{className:"flex-1 overflow-y-auto p-4 custom-scrollbar",children:a.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3",children:[c.map((B,z)=>a.jsxs("div",{onMouseDown:W=>{W.preventDefault(),N("A",z)},onMouseEnter:()=>A("A",z),className:`relative aspect-[2/3] rounded-lg overflow-hidden cursor-pointer border-2 transition-all group select-none ${m.has(z)?"border-amber-500 shadow-[0_0_15px_rgba(245,158,11,0.4)]":"border-transparent hover:border-gray-500 bg-gray-800"}`,children:[a.jsx("img",{src:B,alt:`A-${z}`,className:"w-full h-full object-cover",loading:"lazy"}),a.jsx("div",{className:`absolute top-2 right-2 w-6 h-6 rounded-full border-2 flex items-center justify-center transition-colors ${m.has(z)?"bg-amber-500 border-amber-500":"bg-black/50 border-gray-300 group-hover:border-amber-500/50"}`,children:m.has(z)&&a.jsx("div",{className:"w-2.5 h-2.5 bg-white rounded-full"})}),a.jsx("div",{className:"absolute bottom-2 left-2 px-2 py-1 bg-black/70 text-xs font-bold text-white rounded backdrop-blur-md",children:z+1})]},`a-${z}`)),c.length===0&&a.jsx("div",{className:"col-span-full h-32 flex items-center justify-center text-gray-500 text-sm italic",children:"Vacío"})]})})]}),a.jsxs("div",{className:"w-full md:w-24 shrink-0 bg-[#0f0f0f] flex flex-row md:flex-col items-center justify-center gap-4 py-4 md:py-0 border-y md:border-y-0 border-gray-800",children:[a.jsxs("button",{onClick:S,disabled:m.size===0,className:"w-14 h-14 rounded-full bg-[#1a1a1a] hover:bg-amber-600 disabled:opacity-50 disabled:hover:bg-[#1a1a1a] border border-gray-700 flex items-center justify-center transition-colors text-white disabled:text-gray-600 shadow-xl group",title:"Mover selección a la derecha",children:[a.jsx(Ox,{className:"w-6 h-6 hidden md:block group-hover:scale-110 transition-transform"}),a.jsx(Ox,{className:"w-6 h-6 block md:hidden rotate-90 group-hover:scale-110 transition-transform"})]}),a.jsxs("button",{onClick:x,disabled:y.size===0,className:"w-14 h-14 rounded-full bg-[#1a1a1a] hover:bg-amber-600 disabled:opacity-50 disabled:hover:bg-[#1a1a1a] border border-gray-700 flex items-center justify-center transition-colors text-white disabled:text-gray-600 shadow-xl group",title:"Mover selección a la izquierda",children:[a.jsx(Is,{className:"w-6 h-6 hidden md:block group-hover:scale-110 transition-transform"}),a.jsx(Is,{className:"w-6 h-6 block md:hidden rotate-90 group-hover:scale-110 transition-transform"})]})]}),a.jsxs("div",{className:"flex-1 flex flex-col min-h-0 bg-[#151515]",children:[a.jsxs("div",{className:"p-4 border-b border-gray-800 bg-[#1a1a1a] shrink-0 sticky top-0 z-10 flex flex-col gap-2",children:[a.jsx("h3",{className:"font-bold text-lg text-amber-400 truncate",title:o==null?void 0:o.title,children:(o==null?void 0:o.title)||"Cargando..."}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-sm text-gray-400",children:[h.length," páginas"]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("button",{onClick:P,className:"text-xs text-blue-400 hover:text-blue-300",children:y.size===h.length&&h.length>0?"Deseleccionar todo":"Seleccionar todo"}),y.size>0&&a.jsxs("span",{className:"text-xs bg-amber-500/20 text-amber-300 px-2 py-0.5 rounded-full font-bold",children:[y.size," sel."]})]})]})]}),a.jsx("div",{className:"flex-1 overflow-y-auto p-4 custom-scrollbar",children:a.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3",children:[h.map((B,z)=>a.jsxs("div",{onMouseDown:W=>{W.preventDefault(),N("B",z)},onMouseEnter:()=>A("B",z),className:`relative aspect-[2/3] rounded-lg overflow-hidden cursor-pointer border-2 transition-all group select-none ${y.has(z)?"border-amber-500 shadow-[0_0_15px_rgba(245,158,11,0.4)]":"border-transparent hover:border-gray-500 bg-gray-800"}`,children:[a.jsx("img",{src:B,alt:`B-${z}`,className:"w-full h-full object-cover",loading:"lazy"}),a.jsx("div",{className:`absolute top-2 right-2 w-6 h-6 rounded-full border-2 flex items-center justify-center transition-colors ${y.has(z)?"bg-amber-500 border-amber-500":"bg-black/50 border-gray-300 group-hover:border-amber-500/50"}`,children:y.has(z)&&a.jsx("div",{className:"w-2.5 h-2.5 bg-white rounded-full"})}),a.jsx("div",{className:"absolute bottom-2 left-2 px-2 py-1 bg-black/70 text-xs font-bold text-white rounded backdrop-blur-md",children:z+1})]},`b-${z}`)),h.length===0&&a.jsx("div",{className:"col-span-full h-32 flex items-center justify-center text-gray-500 text-sm italic",children:"Vacío"})]})})]})]})]})}):null}function o8({currentSection:t,onSectionChange:e}){const[n,r]=L.useState(!1);return a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>r(!0),className:"p-2 sm:p-2.5 hover:bg-white/10 rounded-full text-white transition-colors flex-shrink-0",children:a.jsx(VI,{className:"w-5 h-5 sm:w-6 sm:h-6"})}),a.jsx("div",{className:`fixed inset-0 bg-black/70 z-[45] transition-opacity duration-300 ${n?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none"}`,onClick:()=>r(!1)}),a.jsxs("div",{className:`fixed inset-y-0 left-0 w-72 bg-[#1a1a1a] shadow-2xl border-r border-[#333] z-50 transform transition-transform duration-300 ease-out will-change-transform ${n?"translate-x-0":"-translate-x-full"}`,children:[a.jsxs("div",{className:"p-4 sm:p-6 border-b border-gray-800 flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("img",{src:"/icons/icones.png",alt:"Logo",className:"w-8 h-8 sm:w-10 sm:h-10 object-contain"}),a.jsx("span",{className:"font-bold text-white text-lg",children:"Twisted Brody"})]}),a.jsx("button",{onClick:()=>r(!1),className:"p-2 text-gray-400 hover:text-white rounded-full hover:bg-white/10 transition-colors",children:a.jsx(gt,{className:"w-5 h-5"})})]}),a.jsxs("div",{className:"p-4 flex flex-col gap-2",children:[a.jsx("div",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2 px-2",children:"Navegación principal"}),a.jsxs("button",{onClick:()=>{e("flow"),r(!1)},className:`flex items-center gap-3 w-full p-3 rounded-xl font-semibold transition-all active:scale-95 ${t==="flow"?"bg-[#bb86fc]/10 text-[#bb86fc] border border-[#bb86fc]/20 hover:bg-[#bb86fc]/20":"text-gray-300 hover:bg-white/5 border border-transparent"}`,children:[a.jsx(Pr,{className:"w-5 h-5"}),"Flow"]}),a.jsxs("button",{onClick:()=>{e("patreon"),r(!1)},className:`flex items-center gap-3 w-full p-3 rounded-xl font-semibold transition-all active:scale-95 ${t==="patreon"?"bg-[#f96854]/10 text-[#f96854] border border-[#f96854]/20 hover:bg-[#f96854]/20":"text-gray-300 hover:bg-white/5 border border-transparent"}`,children:[a.jsx(sc,{className:"w-5 h-5"}),"Patreon"]}),a.jsxs("button",{onClick:()=>{e("onlyfans"),r(!1)},className:`flex items-center gap-3 w-full p-3 rounded-xl font-semibold transition-all active:scale-95 ${t==="onlyfans"?"bg-[#00AFF0]/10 text-[#00AFF0] border border-[#00AFF0]/20 hover:bg-[#00AFF0]/20":"text-gray-300 hover:bg-white/5 border border-transparent"}`,children:[a.jsx(UT,{className:"w-5 h-5"}),"OnlyFans"]}),a.jsxs("button",{onClick:()=>{e("grok"),r(!1)},className:`flex items-center gap-3 w-full p-3 rounded-xl font-semibold transition-all active:scale-95 ${t==="grok"?"bg-[#1D9BF0]/10 text-[#1D9BF0] border border-[#1D9BF0]/20 hover:bg-[#1D9BF0]/20":"text-gray-300 hover:bg-white/5 border border-transparent"}`,children:[a.jsx(BT,{className:"w-5 h-5"}),"Grok"]})]})]})]})}const Ab={random:"Aleatorio",name:"Nombre",date:"Fecha de creación",modified:"Última modificación",pages:"Páginas",views:"Vistas"};function a8({value:t,onChange:e,placeholder:n="Buscar manga...",sortType:r="random",onSortTypeChange:s,sortDirection:i="asc",onSortDirectionChange:o,onOpenFilter:l}){const[c,u]=L.useState(!1),h=()=>{e("")},f=()=>{const y=["modified","name","date","pages","views","random"],C=(y.indexOf(r)+1)%y.length,v=y[C];s==null||s(v),window.innerWidth<640&&we.success(`Ordenado por: ${Ab[v]}`,{position:"top-center",duration:1500,className:"bg-purple-900/90 text-white border-purple-500/50"})},m=()=>{const y=i==="asc"?"desc":"asc";if(o==null||o(y),window.innerWidth<640){let _=y==="asc"?"Ascendente (A-Z)":"Descendente (Z-A)";r==="views"?_=y==="asc"?"Menos vistos primero":"Más vistos primero":r==="date"||r==="modified"?_=y==="asc"?"Más antiguos primero":"Más recientes primero":r==="pages"&&(_=y==="asc"?"Menos páginas":"Más páginas"),we.success(`Orden: ${_}`,{position:"top-center",duration:1500,className:"bg-purple-900/90 text-white border-purple-500/50"})}},p=()=>r==="views"?i==="asc"?"Menos vistos":"Más vistos":i==="asc"?"ASC":"DESC";return a.jsxs("div",{className:"w-full flex gap-2 items-center",children:[a.jsxs("div",{className:"relative flex-1",children:[a.jsx(no,{className:`absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 pointer-events-none ${c?"text-purple-400":"text-gray-400"}`}),a.jsx("input",{type:"text",placeholder:n,value:t,onChange:y=>e(y.target.value),onFocus:()=>u(!0),onBlur:()=>u(!1),className:"w-full bg-[#1a1a1a] text-white rounded-lg pl-10 pr-10 py-2.5 text-sm placeholder-gray-400 border border-gray-700/50 focus:border-purple-500 focus:outline-none"}),t&&a.jsx("button",{onClick:h,className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-400 hover:text-purple-400 transition-all p-1 hover:scale-125 hover:rotate-90 duration-300",title:"Limpiar búsqueda",children:a.jsx(gt,{className:"w-4 h-4"})})]}),a.jsx("button",{onClick:l,className:"bg-gray-800 hover:bg-gray-700 border border-gray-700 hover:border-purple-500/50 text-white p-2.5 rounded-lg transition-all duration-300 hover:shadow-lg hover:shadow-purple-500/10 group",title:"Filtrar por categorías",children:a.jsx(K_,{className:"w-4 h-4 text-gray-400 group-hover:text-purple-400 transition-colors"})}),a.jsxs("button",{onClick:f,className:"bg-gradient-to-r from-gray-700/40 to-gray-600/40 hover:from-gray-700/60 hover:to-gray-600/60 border border-gray-600/50 hover:border-purple-500/50 text-white px-2.5 py-2.5 rounded-lg flex items-center justify-center gap-1.5 font-medium text-xs transition-all duration-300 active:scale-95 whitespace-nowrap hover:scale-110 hover:shadow-lg hover:shadow-purple-500/20 hover:border-purple-500",title:"Cambiar tipo de ordenamiento",children:[a.jsx(MI,{className:"w-3.5 h-3.5 transition-transform duration-300 hover:rotate-180"}),a.jsx("span",{className:"hidden sm:inline",children:Ab[r]})]}),a.jsxs("button",{onClick:m,className:"bg-gradient-to-r from-gray-700/40 to-gray-600/40 hover:from-gray-700/60 hover:to-gray-600/60 border border-gray-600/50 hover:border-purple-500/50 text-white px-2.5 py-2.5 rounded-lg flex items-center justify-center gap-1.5 font-medium text-xs transition-all duration-300 active:scale-95 whitespace-nowrap hover:scale-110 hover:shadow-lg hover:shadow-purple-500/20 hover:border-purple-500",title:i==="asc"?"Cambiar a descendente":"Cambiar a ascendente",children:[a.jsx(PI,{className:`w-3.5 h-3.5 transition-all duration-500 ${i==="desc"?"rotate-180":""} hover:scale-125`}),a.jsx("span",{className:"hidden sm:inline text-[10px]",children:p()})]})]})}function l8(){return a.jsxs("div",{className:"flex flex-col w-full max-w-xs",children:[a.jsx("div",{className:"relative bg-black rounded-lg shadow-lg overflow-hidden aspect-[2/3] mb-2",children:a.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:a.jsx("div",{className:"rounded-full animate-spin",style:{width:"30px",height:"30px",borderWidth:"2px",borderStyle:"solid",borderColor:"rgba(187, 134, 252, 0.2)",borderTopColor:"#bb86fc",animation:"spin 0.6s linear infinite"}})})}),a.jsxs("div",{className:"flex flex-col gap-2 items-center animate-pulse",children:[a.jsx("div",{className:"h-4 bg-gray-800 rounded w-3/4"}),a.jsx("div",{className:"h-3 bg-gray-800 rounded w-1/2"})]})]})}const Zf=24;function $T(t,e,n=new Set){if(n.has(t))return[];n.add(t);const r=e.filter(i=>i.folder_id===t),s=[];for(const i of r){const o=i.cover_url||i.thumbnail_url;if(o&&!s.includes(o)&&s.push(o),i.is_folder){const l=$T(i.id,e,n);for(const c of l)s.includes(c)||s.push(c)}}return s}function c8(t,e,n=12){const r=e.filter(h=>h.folder_id===t),s=r.filter(h=>h.is_folder),i=r.filter(h=>!h.is_folder&&(h.cover_url||h.thumbnail_url)),o=[];for(const h of s){const f=$T(h.id,e,new Set);f.length>0&&o.push(f)}if(i.length>0){const h=i.map(f=>f.cover_url||f.thumbnail_url).filter(Boolean);h.length>0&&o.push(h)}const l=[];let c=!0,u=0;for(;c&&l.length=n)break;u{const x=()=>{p.isDragging&&y({isDragging:!1,action:null,startId:null,hasDragged:!1})};return window.addEventListener("mouseup",x),()=>window.removeEventListener("mouseup",x)},[p.isDragging]);const _=(x,N)=>{u&&u(x,N)},C=(x,N)=>{if(x.button!==0)return;const I=c.includes(N)?"deselect":"select";y({isDragging:!0,action:I,startId:N,hasDragged:!1})},v=x=>{!p.isDragging||!p.action||(!p.hasDragged&&p.startId&&(_(p.startId,p.action==="select"),y(N=>({...N,hasDragged:!0}))),_(x,p.action==="select"))},[w,E]=L.useState(()=>{const N=new URLSearchParams(window.location.search).get("page");return N?Math.max(1,Number(N)):1});L.useEffect(()=>{const x=()=>{const A=new URLSearchParams(window.location.search).get("page");E(A?Math.max(1,Number(A)):1)};return window.addEventListener("popstate",x),()=>window.removeEventListener("popstate",x)},[]);const D=Math.ceil(t.length/Zf);L.useEffect(()=>{if(D>0&&w>D){E(D);const x=new URL(window.location.href);x.searchParams.set("page",String(D)),window.history.replaceState({},"",x)}},[D,w]),L.useEffect(()=>{if(e){E(1);const x=new URL(window.location.href);x.searchParams.delete("page"),window.history.replaceState({},"",x)}},[e]);const M=t.slice((w-1)*Zf,w*Zf),T=x=>{E(x);const N=new URL(window.location.href);N.searchParams.set("page",String(x)),window.history.pushState({},"",N),window.scrollTo({top:0,behavior:"smooth"})},S=()=>{if(D<=1)return null;const x=[],N=5;let A=Math.max(1,w-Math.floor(N/2)),I=Math.min(D,A+N-1);I-A+1T(1),disabled:w===1,className:"p-2 rounded-lg bg-[#1a1a1a] text-white hover:bg-[#bb86fc] disabled:opacity-50 disabled:hover:bg-[#1a1a1a] transition-colors",title:"Primera página",children:a.jsx(q_,{className:"w-4 h-4"})}),a.jsx("button",{onClick:()=>T(w-1),disabled:w===1,className:"p-2 rounded-lg bg-[#1a1a1a] text-white hover:bg-[#bb86fc] disabled:opacity-50 disabled:hover:bg-[#1a1a1a] transition-colors",title:"Anterior",children:a.jsx(dh,{className:"w-4 h-4"})}),A>1&&a.jsx("span",{className:"text-gray-500 px-1",children:"..."}),x.map(P=>a.jsx("button",{onClick:()=>T(P),className:`w-8 h-8 rounded-lg text-sm font-medium transition-colors ${w===P?"bg-[#bb86fc] text-white":"bg-[#1a1a1a] text-gray-400 hover:bg-[#333] hover:text-white"}`,children:P},P)),IT(w+1),disabled:w===D,className:"p-2 rounded-lg bg-[#1a1a1a] text-white hover:bg-[#bb86fc] disabled:opacity-50 disabled:hover:bg-[#1a1a1a] transition-colors",title:"Siguiente",children:a.jsx(hc,{className:"w-4 h-4"})}),a.jsx("button",{onClick:()=>T(D),disabled:w===D,className:"p-2 rounded-lg bg-[#1a1a1a] text-white hover:bg-[#bb86fc] disabled:opacity-50 disabled:hover:bg-[#1a1a1a] transition-colors",title:"Última página",children:a.jsx(G_,{className:"w-4 h-4"})})]})};return n&&e?a.jsx("div",{className:"flex flex-col items-center justify-center py-16 animate-in fade-in duration-300",children:a.jsxs("div",{className:"text-gray-400 text-sm animate-pulse",children:['Buscando "',e,'"...']})}):o?a.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 2xl:grid-cols-6 gap-1.5 sm:gap-2 md:gap-3 justify-center items-start animate-in fade-in duration-300",children:Array.from({length:12}).map((x,N)=>a.jsx(l8,{},N))}):e&&t.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center py-16 animate-in fade-in duration-300",children:[a.jsx(fa,{className:"w-16 h-16 text-gray-600 mb-4 animate-bounce"}),a.jsx("p",{className:"text-gray-400 text-lg mb-2",children:"No se encontraron resultados"}),a.jsx("p",{className:"text-gray-500 text-sm",children:"Intenta con otros términos de búsqueda"})]}):!e&&t.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center py-20 animate-in fade-in duration-300",children:[a.jsx(fa,{className:"w-16 h-16 text-gray-600 mb-4 animate-bounce"}),a.jsx("p",{className:"text-gray-400 text-lg mb-2",children:"No hay mangas disponibles"}),a.jsx("p",{className:"text-gray-500 text-sm",children:'Crea tu primer manga usando el botón "Nuevo"'})]}):a.jsxs("div",{className:"flex flex-col gap-6",children:[a.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 2xl:grid-cols-6 gap-1.5 sm:gap-2 md:gap-3 justify-center items-start",children:M.map(x=>{var N,A,I;return a.jsx("div",{children:a.jsx(nT,{id:x.id,title:x.title,author:x.author,pageCount:x.pageCount,thumbnail:x.thumbnail,manga:x.manga,onSelect:()=>r(x.id),onEdit:s,onDelete:i?()=>i(x.id):void 0,isCategoryPlusEnabled:l,isSelected:c.includes(x.id),onMouseDown:P=>C(P,x.id),onMouseEnter:()=>v(x.id),dragStateParams:p,hasAnySelection:c.length>0,onToggleSelect:()=>_(x.id,!c.includes(x.id)),folderItemCount:(N=x.manga)!=null&&N.is_folder?h.filter(P=>P.folder_id===x.id).length:void 0,folderThumbnails:(A=x.manga)!=null&&A.is_folder?c8(x.id,h):void 0,hasSubfolders:(I=x.manga)!=null&&I.is_folder?h.some(P=>P.folder_id===x.id&&P.is_folder):!1,isFolderAnimationEnabled:f,currentSection:m})},x.id)})}),S()]})}function $o(t){return t.toLowerCase().trim().normalize("NFD").replace(/[\u0300-\u036f]/g,"")}function ep(t,e){const n=$o(t),r=$o(e);if(n===r)return 1;if(n.length<2||r.length<2)return n.includes(r)?.8:0;const s=n.length>r.length?n:r,i=n.length>r.length?r:n,o=d8(i,s);return(s.length-o)/s.length}function d8(t,e){const n=[];for(let r=0;r<=t.length;r++){let s=r;for(let i=0;i<=e.length;i++)if(r===0)n[i]=i;else if(i>0){let o=n[i-1];t.charAt(r-1)!==e.charAt(i-1)&&(o=Math.min(Math.min(o,s),n[i])+1),n[i-1]=s,s=o}r>0&&(n[e.length]=s)}return n[e.length]}function h8(t,e,n={}){const{minChars:r=1,fuzzyMatch:s=!0}=n;if(!e.trim()||e.length{let c=0;const u=ep(l.title,e),h=ep(l.author,e),f=$o(l.title).includes(i)?.3:0,m=$o(l.author).includes(i)?.2:0;let p=0,y=0;if(l.categories&&l.categories.length>0){const _=l.categories.map(v=>ep(v,e));p=Math.max(..._),y=l.categories.some(v=>$o(v).includes(i))?.3:0}return c=Math.max(u*.6+f,h*.4+m,p*.5+y),{item:l,score:c}}).filter(l=>s?l.score>.3:l.score>.7).sort((l,c)=>c.score-l.score).map(l=>l.item);return{items:o,query:e,resultCount:o.length}}function f8(){const[t,e]=L.useState(!1),[n,r]=L.useState(!1),[s,i]=L.useState(!1),[o,l]=L.useState(!1),[c,u]=L.useState(null),[h,f]=L.useState(!1),[m,p]=L.useState(!1),[y,_]=L.useState(!1),[C,v]=L.useState([]),[w,E]=L.useState(!1),[D,M]=L.useState(!1),[T,S]=L.useState(!1),[x,N]=L.useState(!1),[A,I]=L.useState(!1),[P,k]=L.useState(!1),[B,z]=L.useState(!1),[W,ee]=L.useState(!1),[F,K]=L.useState(!1),[R,ne]=L.useState(()=>localStorage.getItem("isFolderAnimationEnabled")==="true"),[pe,O]=L.useState(!1),[Q,oe]=L.useState(!1),[ce,Ie]=L.useState(!1),[te,it]=L.useState(!1),[pt,Vt]=L.useState(!1),[st,yt]=L.useState(!1),[jt,_n]=L.useState(!1),[xt,tt]=L.useState(null),[Bn,Ue]=L.useState(!1),[vt,Pn]=L.useState(!1),[Pt,on]=L.useState(!1),[fn,wt]=L.useState(null),[G,ie]=L.useState([]),[_e,Se]=L.useState(null),[$,X]=L.useState([]),[re,de]=L.useState(()=>{const le=new URLSearchParams(window.location.search).get("section");return le==="flow"||le==="patreon"||le==="onlyfans"||le==="grok"?le:localStorage.getItem("currentSection")||"flow"}),[Le,H]=L.useState(!1),[J,me]=L.useState(!1),[ye,Ee]=L.useState(!0),[Ve,Be]=L.useState(""),[De,$n]=L.useState("all"),[be,Ze]=L.useState([]),[ot,$e]=L.useState([]),[He,ft]=L.useState(!1),[bt,ct]=L.useState(!1),[Ge,Bt]=L.useState(!1),[pn,Rn]=L.useState(()=>localStorage.getItem("sortType")||"modified"),[Ls,Ur]=L.useState(()=>localStorage.getItem("sortDirection")||"desc");L.useEffect(()=>{const le=new URLSearchParams(window.location.search).get("admin")==="true";l(le)},[]),L.useEffect(()=>{localStorage.setItem("sortType",pn)},[pn]),L.useEffect(()=>{localStorage.setItem("isFolderAnimationEnabled",String(R))},[R]),L.useEffect(()=>{localStorage.setItem("sortDirection",Ls)},[Ls]),L.useEffect(()=>{localStorage.setItem("currentSection",re);const V=new URL(window.location.href);re==="patreon"||re==="onlyfans"||re==="grok"?V.searchParams.set("section",re):V.searchParams.delete("section"),window.history.replaceState({},"",V.toString())},[re]),L.useEffect(()=>{var ge;(ge=window.Telegram)!=null&&ge.WebApp&&window.Telegram.WebApp.ready(),$t();const V=window.location.hash.slice(1);if(V&&V.startsWith("manga/"))if(V.endsWith("/hd")){const Ce=V.replace("manga/","").replace("/hd","");wt(Ce),H(!0)}else{const Ce=V.replace("manga/","");wt(Ce),H(!1)}else if(V&&V.startsWith("folder/")){const Ce=V.replace("folder/","");tt(Ce)}else V==="info"&&me(!0);const le=()=>{const Ce=window.location.hash.slice(1);if(!Ce)wt(null),Se(null),me(!1),H(!1),tt(null);else if(Ce.startsWith("manga/")){if(Ce.endsWith("/hd")){const dt=Ce.replace("manga/","").replace("/hd","");wt(dt),H(!0)}else{const dt=Ce.replace("manga/","");wt(dt),H(!1)}Se(null),me(!1),tt(null)}else Ce.startsWith("folder/")?(tt(Ce.replace("folder/","")),wt(null),Se(null),me(!1),H(!1)):Ce==="info"&&(me(!0),wt(null),Se(null),tt(null))};return window.addEventListener("hashchange",le),()=>window.removeEventListener("hashchange",le)},[]),L.useEffect(()=>{},[]);async function $t(){try{Ee(!0);const V=await Mh();X(V)}catch(V){console.error("Error loading mangas:",V)}finally{Ee(!1)}}const kt=L.useMemo(()=>$.filter(V=>!V.is_deleted&&(V.section||"flow")===re),[$,re]),Ra=L.useMemo(()=>$.filter(V=>V.is_deleted),[$]),Da=L.useMemo(()=>{const V=new Map;return kt.forEach(le=>{var ge;(ge=le.categories)==null||ge.forEach(Ce=>{V.has(Ce.id)||V.set(Ce.id,Ce)})}),Array.from(V.values())},[kt]),ds=L.useMemo(()=>Ve.trim()?h8(kt.filter(V=>!V.is_folder).map(V=>({id:V.id,title:V.title,author:V.author,categories:V.categories?V.categories.map(le=>le.name):[]})),Ve,{fuzzyMatch:!0,minChars:1}):{items:kt,query:"",resultCount:kt.length},[kt,Ve]),Ma=L.useMemo(()=>{let V=ds.items.length>0?ds.items.map(ke=>kt.find(We=>We.id===ke.id)).filter(Boolean):[];be.length>0&&(V=V.filter(ke=>be.some(We=>{var qe;return(qe=ke.categories)==null?void 0:qe.some(Hn=>Hn.name===We)}))),ot.length>0&&(V=V.filter(ke=>ot.includes(ke.author))),He&&(V=V.filter(ke=>ke.is_decensored)),bt&&(V=V.filter(ke=>ke.is_bn)),Ge&&(V=V.filter(ke=>ke.is_color));const le=[...V],ge=be.length>0||ot.length>0||He||bt||Ge,Ce=Ve.trim().length>0;let dt;if(ge)dt=le;else if(Ce){const ke=new Set(le.map(qe=>qe.id)),We=new Set;for(const qe of le){let Hn=qe.folder_id,nt=0;for(;Hn&&nt<20;){We.add(Hn);const rr=kt.find(sr=>sr.id===Hn);if(rr)Hn=rr.folder_id;else break;nt++}}dt=kt.filter(qe=>(qe.folder_id&&kt.some(nt=>nt.id===qe.folder_id)?qe.folder_id:null)!==(xt||null)?!1:qe.is_folder?ke.has(qe.id)||We.has(qe.id):ke.has(qe.id))}else dt=le.filter(ke=>(ke.folder_id&&kt.some(qe=>qe.id===ke.folder_id)?ke.folder_id:null)===(xt||null));let at=dt;return De==="mangas"?at=at.filter(ke=>!ke.is_folder):De==="folders"&&(at=at.filter(ke=>ke.is_folder)),pn==="random"?at.sort(()=>Math.random()-.5):(at.sort((ke,We)=>{var Hn,nt;let qe=0;if(pn==="name")qe=ke.title.localeCompare(We.title);else if(pn==="date"){const rr=new Date(ke.created_at||0).getTime(),sr=new Date(We.created_at||0).getTime();qe=rr-sr}else if(pn==="modified"){const rr=new Date(ke.updated_at||ke.created_at||0).getTime(),sr=new Date(We.updated_at||We.created_at||0).getTime();qe=rr-sr}else if(pn==="pages"){const rr=((Hn=ke.chapters)==null?void 0:Hn.reduce((hs,Va)=>{var Vs;return hs+(((Vs=Va.pages)==null?void 0:Vs.length)||0)},0))||0,sr=((nt=We.chapters)==null?void 0:nt.reduce((hs,Va)=>{var Vs;return hs+(((Vs=Va.pages)==null?void 0:Vs.length)||0)},0))||0;qe=rr-sr}else pn==="views"&&(qe=(ke.views||0)-(We.views||0));return Ls==="asc"?qe:-qe}),at)},[kt,Ve,ds.items,pn,Ls,be,ot,xt,De,He,bt,Ge]),jc=V=>{u(V),e(!0)},Pc=async V=>{try{await Ud(V),await $t()}catch(le){console.error("Error deleting manga:",le),alert("Error al eliminar el manga. Por favor intenta de nuevo.")}},vo=async()=>{const V=/\s*\[\d+\]\s*$/,le=$.filter(ge=>V.test(ge.title)).map(ge=>{let Ce=ge.title.replace(V,"").trim();return Ce||(Ce=ge.title),{id:ge.id,title:Ce}}).filter(ge=>{var Ce;return ge.title!==((Ce=$.find(dt=>dt.id===ge.id))==null?void 0:Ce.title)});if(le.length===0){we.info("No hay nombres con formato [ID] que requieran limpieza.");return}try{await O0(le),we.success(`Se limpiaron ${le.length} nombres correctamente.`),$t()}catch(ge){console.error(ge),we.error("Ocurrió un error al intentar limpiar los nombres.")}},Rc=()=>{let V=[];const le=dt=>{let at=[];const ke=kt.filter(We=>We.folder_id===dt);for(const We of ke)at.push(We.id),We.is_folder&&(at=at.concat(le(We.id)));return at};Ma.forEach(dt=>{V.push(dt.id),dt.is_folder&&(V=V.concat(le(dt.id)))});const ge=Array.from(new Set(V)),Ce=ge.length>0&&ge.every(dt=>C.includes(dt));v(Ce?[]:ge)},wo=V=>{const le=kt.find(ge=>ge.id===V);if(le){if(le.is_folder){const ge=at=>{let ke=[];const We=kt.filter(qe=>qe.folder_id===at);for(const qe of We)ke.push(qe.id),qe.is_folder&&(ke=ke.concat(ge(qe.id)));return ke},Ce=ge(V),dt=[V,...Ce];v(at=>{if(at.includes(V))return at.filter(We=>!dt.includes(We));{const We=[...at];return dt.forEach(qe=>{We.includes(qe)||We.push(qe)}),We}});return}v(ge=>ge.includes(V)?ge.filter(Ce=>Ce!==V):[...ge,V])}},Os=V=>{if(h||m||y||pe||Q||ce||te||pt||st||jt){wo(V);return}const le=kt.find(ge=>ge.id===V);if(le!=null&&le.is_folder){window.location.hash=`folder/${V}`;return}window.location.hash=`manga/${V}`,wt(V),H(!1)},Jt=()=>{window.location.hash="",wt(null),me(!1)},La=V=>{fn&&ie([...G,fn]),window.location.hash=`manga/${V}`,wt(V)},Dc=V=>{Ze(le=>le.includes(V)?le.filter(ge=>ge!==V):[...le,V]),Jt()},Mc=V=>{Ze(le=>le.filter(ge=>ge!==V))},Lc=V=>{$e(le=>le.includes(V)?le.filter(ge=>ge!==V):[...le,V]),Jt()},Oc=V=>{$e(le=>le.filter(ge=>ge!==V))},Oa=L.useMemo(()=>Ma.map(V=>{var Ce,dt;const le=((Ce=V.chapters)==null?void 0:Ce.length)||0,ge=((dt=V.chapters)==null?void 0:dt.reduce((at,ke)=>{var We;return at+(((We=ke.pages)==null?void 0:We.length)||0)},0))||0;return{id:V.id,title:V.title,author:V.author,chapterCount:le,pageCount:ge,thumbnail:V.cover_url||V.thumbnail_url||void 0,manga:V}}),[Ma]);if(_e)return a.jsx(e6,{manga:_e.manga,chapter:_e.chapter,onBack:()=>Se(null)});if(J)return a.jsx(qF,{onBack:Jt,isAdmin:o});if(fn!==null){let V=$.find(le=>le.id===fn);return Le&&V?a.jsx($I,{manga:V,onBack:()=>{V&&(window.location.hash=`manga/${V.id}`),H(!1)}}):a.jsx(Z3,{id:fn,onBack:()=>{if(G.length>0){const le=G[G.length-1];ie(G.slice(0,-1)),window.location.hash=`manga/${le}`,wt(le)}else V!=null&&V.folder_id?(window.location.hash=`folder/${V.folder_id}`,tt(V.folder_id),wt(null)):Jt()},onReadChapter:le=>{V&&Se({manga:V,chapter:le})},onMangaLoaded:le=>{V||(V=le)},onNavigateToManga:La,onSelectCategory:Dc,onSelectAuthor:Lc,isAdmin:o})}return a.jsxs("div",{className:"min-h-screen bg-[#121212] text-white flex flex-col",children:[a.jsx("header",{className:"border-b border-gray-800/50 px-3 sm:px-6 md:px-12 py-4 sm:py-6 flex-shrink-0 transition-all duration-300",children:a.jsxs("div",{className:"max-w-[1800px] mx-auto flex items-center justify-between gap-2 sm:gap-0",children:[a.jsxs("div",{className:"flex items-center gap-1 sm:gap-3",children:[a.jsx(o8,{currentSection:re,onSectionChange:de}),a.jsxs("div",{className:"flex items-center gap-2 sm:gap-3 group cursor-pointer",children:[a.jsx("img",{src:"/icons/icones.png",alt:"Twisted Brody Logo",className:"w-10 h-10 sm:w-14 sm:h-14 object-contain transition-all duration-300 group-hover:rotate-12 group-hover:scale-110"}),a.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-1 sm:gap-3",children:[a.jsx("h1",{className:"text-base sm:text-2xl font-bold text-white transition-colors duration-300 group-hover:text-[#bb86fc] leading-tight",children:"Twisted Brody MangaFlow"}),a.jsxs("div",{className:"flex items-center gap-1.5 bg-[#1a1a1a] border border-[#333] px-2 sm:px-3 py-1 rounded-full shadow-inner w-fit mt-0.5 sm:mt-0",children:[a.jsxs("button",{onClick:()=>$n(V=>V==="mangas"?"all":"mangas"),className:`flex items-center gap-1.5 px-2 py-0.5 rounded-full transition-colors ${De==="mangas"?"bg-[#bb86fc]/20 border border-[#bb86fc]/50":"hover:bg-white/5 border border-transparent cursor-pointer"}`,children:[a.jsx(fa,{className:"w-4 h-4 text-[#bb86fc]"}),a.jsxs("span",{className:"text-sm font-bold text-gray-300",children:[kt.filter(V=>!V.is_folder).length," ",a.jsx("span",{className:"text-xs text-gray-500 font-normal",children:"mangas"})]})]}),a.jsx("span",{className:"text-gray-600 mx-1",children:"|"}),a.jsxs("button",{onClick:()=>$n(V=>V==="folders"?"all":"folders"),className:`flex items-center gap-1.5 px-2 py-0.5 rounded-full transition-colors ${De==="folders"?"bg-[#bb86fc]/20 border border-[#bb86fc]/50":"hover:bg-white/5 border border-transparent cursor-pointer"}`,children:[a.jsx(xr,{className:"w-4 h-4 text-[#bb86fc]"}),a.jsxs("span",{className:"text-sm font-bold text-gray-300",children:[kt.filter(V=>V.is_folder).length," ",a.jsx("span",{className:"text-xs text-gray-500 font-normal",children:"carpetas"})]})]})]})]})]})]}),a.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-3",children:[(h||m||y||pe||Q||ce||te||pt||jt)&&a.jsxs("div",{className:"hidden sm:flex items-center gap-2 mr-2 px-3 py-1.5 bg-purple-500/10 rounded-lg border border-purple-500/20",children:[a.jsx(Pr,{className:"w-4 h-4 text-purple-400"}),a.jsx("span",{className:"text-xs font-semibold text-purple-300",children:ce?"Modo Etiquetar Activo":pt?"Portal Plus Activo":te?"Carpetas Plus Activo":Q?"Modo Nombres Activo":m?"Modo Copiar Activo":y?"Modo Eliminar Activo":pe?"Modo Minus Activo":jt?"Transferencia Activa":"Modo Plus Activo"}),a.jsx("span",{className:"text-xs bg-purple-500/20 px-2 py-0.5 rounded text-purple-200",children:C.length})]}),o&&a.jsxs(a.Fragment,{children:[a.jsxs("button",{onClick:()=>r(!0),className:"bg-gray-800 hover:bg-gray-700 active:scale-95 text-white px-2 py-2 sm:px-4 sm:py-2.5 rounded-lg flex items-center gap-1.5 sm:gap-2 font-semibold transition-all duration-300 border border-gray-700/50 hover:border-gray-600 text-xs sm:text-sm hover:scale-110 hover:shadow-lg hover:shadow-700/50",title:"Ajustes y Admin",children:[a.jsx(Z_,{className:"w-4 h-4 sm:w-5 sm:h-5 transition-transform duration-300 hover:rotate-180"}),a.jsx("span",{className:"hidden sm:inline",children:"Ajustes"})]}),a.jsxs("button",{onClick:()=>e(!0),className:"bg-purple-600 hover:bg-purple-700 active:scale-95 text-white px-2 py-2 sm:px-4 sm:py-2.5 rounded-lg flex items-center gap-1.5 sm:gap-2 font-semibold transition-all duration-300 shadow-lg shadow-purple-600/30 hover:shadow-purple-600/50 text-xs sm:text-sm hover:scale-110",children:[a.jsx(Kr,{className:"w-4 h-4 sm:w-5 sm:h-5 transition-transform duration-300 hover:rotate-180"}),a.jsx("span",{className:"hidden sm:inline",children:re==="patreon"?"Subir Imágenes":re==="onlyfans"?"Subir Only":re==="grok"?"Subir Grok":"Nuevo Manga"})]})]})]})]})}),a.jsxs("main",{className:"flex-1 px-4 sm:px-6 md:px-12 py-8",children:[a.jsx(mM,{isAdmin:o}),a.jsxs("div",{className:"max-w-[1800px] mx-auto mb-8 flex-shrink-0",children:[a.jsx(a8,{value:Ve,onChange:Be,placeholder:"Buscar por título, autor...",sortType:pn,onSortTypeChange:Rn,sortDirection:Ls,onSortDirectionChange:Ur,onOpenFilter:()=>i(!0)}),Ve&&a.jsxs("div",{className:"mt-2 text-sm text-gray-400",children:[ds.resultCount," resultado",ds.resultCount!==1?"s":""," encontrado",ds.resultCount!==1?"s":""]}),(be.length>0||ot.length>0||He||bt||Ge)&&a.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-2 animate-in fade-in slide-in-from-top-2 duration-300",children:[a.jsx("span",{className:"text-sm text-gray-400",children:"Filtrado por:"}),be.map(V=>a.jsxs("button",{onClick:()=>Mc(V),className:"bg-purple-500/20 hover:bg-purple-500/30 text-purple-300 px-3 py-1 rounded-full text-sm font-medium flex items-center gap-2 border border-purple-500/30 hover:border-purple-500/50 transition-all group",children:[V,a.jsx("div",{className:"bg-purple-500/20 rounded-full p-0.5 group-hover:bg-purple-500/40 transition-colors",children:a.jsx(Kr,{className:"w-3 h-3 transform rotate-45"})})]},V)),ot.map(V=>a.jsxs("button",{onClick:()=>Oc(V),className:"bg-[#bb86fc]/20 hover:bg-[#bb86fc]/30 text-[#bb86fc] px-3 py-1 rounded-full text-sm font-medium flex items-center gap-2 border border-[#bb86fc]/30 hover:border-[#bb86fc]/50 transition-all group",children:[a.jsx(Lg,{size:14}),V,a.jsx("div",{className:"bg-[#bb86fc]/20 rounded-full p-0.5 group-hover:bg-[#bb86fc]/40 transition-colors",children:a.jsx(Kr,{className:"w-3 h-3 transform rotate-45"})})]},V)),He&&a.jsxs("button",{onClick:()=>{ft(!1),Jt()},className:"bg-purple-500/20 hover:bg-purple-500/30 text-purple-300 px-3 py-1 rounded-full text-sm font-medium flex items-center gap-2 border border-purple-500/30 hover:border-purple-500/50 transition-all group",children:["Sin censura",a.jsx("div",{className:"bg-purple-500/20 rounded-full p-0.5 group-hover:bg-purple-500/40 transition-colors",children:a.jsx(Kr,{className:"w-3 h-3 transform rotate-45"})})]}),bt&&a.jsxs("button",{onClick:()=>{ct(!1),Jt()},className:"bg-purple-500/20 hover:bg-purple-500/30 text-purple-300 px-3 py-1 rounded-full text-sm font-medium flex items-center gap-2 border border-purple-500/30 hover:border-purple-500/50 transition-all group",children:["B/N",a.jsx("div",{className:"bg-purple-500/20 rounded-full p-0.5 group-hover:bg-purple-500/40 transition-colors",children:a.jsx(Kr,{className:"w-3 h-3 transform rotate-45"})})]}),Ge&&a.jsxs("button",{onClick:()=>{Bt(!1),Jt()},className:"bg-purple-500/20 hover:bg-purple-500/30 text-purple-300 px-3 py-1 rounded-full text-sm font-medium flex items-center gap-2 border border-purple-500/30 hover:border-purple-500/50 transition-all group",children:["A color",a.jsx("div",{className:"bg-purple-500/20 rounded-full p-0.5 group-hover:bg-purple-500/40 transition-colors",children:a.jsx(Kr,{className:"w-3 h-3 transform rotate-45"})})]}),(be.length>0||ot.length>0||He||bt||Ge)&&a.jsx("button",{onClick:()=>{Ze([]),$e([]),ft(!1),ct(!1),Bt(!1)},className:"text-xs text-gray-400 hover:text-white underline decoration-gray-600 hover:decoration-white transition-colors ml-2",children:"Limpiar todo"})]})]}),a.jsxs("div",{className:"max-w-[1800px] mx-auto",children:[xt&&(()=>{const V=$.find(le=>le.id===xt);return V?a.jsxs("div",{className:"mb-6 flex items-center gap-4 bg-[#1a1a1a] p-4 rounded-xl border border-gray-800 animate-in slide-in-from-top-2",children:[a.jsx("button",{onClick:()=>{V.folder_id?window.location.hash=`folder/${V.folder_id}`:window.location.hash=""},className:"p-2 hover:bg-gray-800 rounded-lg text-white transition-colors",children:a.jsx(Is,{className:"w-5 h-5"})}),a.jsx("div",{className:"w-10 h-10 rounded-lg bg-gray-800 flex items-center justify-center",children:!V.folder_id&&V.title.toLowerCase().includes("patreon")?a.jsx(sc,{className:"w-6 h-6 text-white"}):a.jsx(xr,{className:"w-6 h-6 text-purple-400"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-xl font-bold text-white uppercase tracking-wider",children:V.title}),a.jsxs("p",{className:"text-sm text-gray-400",children:["Carpeta • ",kt.filter(le=>le.folder_id===V.id).length," elementos"]})]})]}):null})(),a.jsx(u8,{items:Oa,searchTerm:Ve,isSearching:!1,isLoading:ye,onSelectComic:Os,onEditManga:o?jc:void 0,onDeleteManga:o?Pc:void 0,isCategoryPlusEnabled:h||m||y||pe||Q||ce||te||pt||st||jt,selectedMangaIds:C,onToggleSelectManga:wo,allMangas:kt,isFolderAnimationEnabled:R,currentSection:re})]})]}),C.length>0&&a.jsx("div",{className:"fixed bottom-6 left-1/2 transform -translate-x-1/2 z-40 animate-in slide-in-from-bottom-4 duration-200",children:a.jsxs("div",{className:"bg-[#1a1a1a] border border-gray-700/50 shadow-2xl rounded-xl px-6 py-3 flex items-center gap-4",children:[a.jsxs("div",{className:"flex flex-col",children:[a.jsx("span",{className:"text-sm font-bold text-white",children:(()=>{const V=C.filter(Ce=>{var dt;return(dt=$.find(at=>at.id===Ce))==null?void 0:dt.is_folder}).length,le=C.length-V,ge=[];return le>0&&ge.push(`${le} manga${le!==1?"s":""}`),V>0&&ge.push(`${V} carpeta${V!==1?"s":""}`),ge.length>0?ge.join(" y ")+" seleccionad"+(V>0&&le===0?"as":"os"):"0 seleccionados"})()}),a.jsx("button",{onClick:Rc,className:"text-xs text-[#bb86fc] hover:text-white transition-colors text-left mt-0.5 underline decoration-[#bb86fc]/30 underline-offset-2",children:"Seleccionar todo"})]}),a.jsx("div",{className:"h-8 w-px bg-gray-700"}),a.jsxs("div",{className:"flex gap-2",children:[te?a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{onClick:()=>Pn(!0),className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg text-sm font-bold shadow-lg shadow-blue-500/20 transition-all transform hover:scale-105 active:scale-95",children:"Mover a Carpeta"}),!xt&&a.jsx("button",{onClick:()=>Ue(!0),className:"bg-indigo-600 hover:bg-indigo-700 text-white px-4 py-2 rounded-lg text-sm font-bold shadow-lg shadow-indigo-500/20 transition-all transform hover:scale-105 active:scale-95",children:"Crear Carpeta"})]}):pt?a.jsxs("button",{onClick:()=>on(!0),className:"bg-indigo-600 hover:bg-indigo-700 text-white px-4 py-2 rounded-lg text-sm font-bold shadow-lg shadow-indigo-500/20 transition-all transform hover:scale-105 active:scale-95 flex items-center gap-2",children:[a.jsx(Dg,{className:"w-4 h-4"}),"Mover de Sección"]}):h?a.jsx("button",{onClick:()=>E(!0),className:"bg-[#bb86fc] hover:bg-[#9966dd] text-white px-4 py-2 rounded-lg text-sm font-bold shadow-lg shadow-purple-500/20 transition-all transform hover:scale-105 active:scale-95",children:"Aplicar Categorías"}):ce?a.jsxs("button",{onClick:()=>N(!0),className:"bg-[#bb86fc] hover:bg-[#9966dd] text-white px-4 py-2 rounded-lg text-sm font-bold shadow-lg shadow-[#bb86fc]/20 transition-all transform hover:scale-105 active:scale-95 flex items-center gap-2",children:[a.jsx(vd,{className:"w-4 h-4"}),"Etiquetar"]}):pe?a.jsx("button",{onClick:()=>M(!0),className:"bg-orange-500 hover:bg-orange-600 text-white px-4 py-2 rounded-lg text-sm font-bold shadow-lg shadow-orange-500/20 transition-all transform hover:scale-105 active:scale-95",children:"Remover Categorías"}):Q?a.jsxs("button",{onClick:()=>S(!0),className:"bg-pink-500 hover:bg-pink-600 text-white px-4 py-2 rounded-lg text-sm font-bold shadow-lg shadow-pink-500/20 transition-all transform hover:scale-105 active:scale-95 flex items-center gap-2",children:[a.jsx(Yo,{className:"w-4 h-4"}),"Editar Nombres"]}):m?a.jsxs("button",{onClick:()=>{const V=C.filter(le=>{var ge;return!((ge=$.find(Ce=>Ce.id===le))!=null&&ge.is_folder)});navigator.clipboard.writeText(V.join(", ")),we.success(`Se copiaron ${V.length} IDs`),v([])},className:"bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg text-sm font-bold shadow-lg shadow-blue-500/20 transition-all transform hover:scale-105 active:scale-95 flex items-center gap-2",children:[a.jsx(W_,{className:"w-4 h-4"}),"Copiar IDs"]}):y?a.jsx("button",{onClick:async()=>{if(window.confirm(`¿Seguro que quieres eliminar ${C.length} elementos?`))try{for(const V of C)await Ud(V);we.success(`Se eliminaron ${C.length} elementos.`),v([]),$t()}catch{we.error("Error al eliminar")}},className:"bg-red-600 hover:bg-red-700 text-white px-4 py-2 rounded-lg text-sm font-bold shadow-lg shadow-red-500/20 transition-all transform hover:scale-105 active:scale-95",children:"Eliminar Selección"}):st?a.jsxs("button",{onClick:async()=>{const V=C.filter(le=>{var ge;return!((ge=$.find(Ce=>Ce.id===le))!=null&&ge.is_folder)});if(V.length<2){we.error("Debes seleccionar al menos 2 mangas para unirlos (las carpetas son ignoradas).");return}if(window.confirm(`¿Seguro que quieres unir ${V.length} mangas en uno solo? Los originales serán eliminados.`))try{await Tw(V),we.success(`Se fusionaron ${V.length} mangas correctamente.`),v([]),$t()}catch{we.error("Error al unir mangas")}},className:"bg-emerald-600 hover:bg-emerald-700 text-white px-4 py-2 rounded-lg text-sm font-bold shadow-lg shadow-emerald-500/20 transition-all transform hover:scale-105 active:scale-95 flex items-center gap-2",children:[a.jsx(xd,{className:"w-4 h-4"}),"Unir Mangas"]}):jt?a.jsxs("button",{onClick:()=>{if(C.filter(le=>{var ge;return!((ge=$.find(Ce=>Ce.id===le))!=null&&ge.is_folder)}).length!==2){we.error("Debes seleccionar exactamente 2 mangas para transferir páginas.");return}ee(!0)},className:`bg-amber-600 hover:bg-amber-700 text-white px-4 py-2 rounded-lg text-sm font-bold shadow-lg shadow-amber-500/20 transition-all transform flex items-center gap-2 ${C.filter(V=>{var le;return!((le=$.find(ge=>ge.id===V))!=null&&le.is_folder)}).length!==2?"opacity-50 cursor-not-allowed":"hover:scale-105 active:scale-95"}`,children:[a.jsx(Pr,{className:"w-4 h-4"}),"Transferir Páginas"]}):a.jsxs(a.Fragment,{children:[C.filter(V=>{var le;return!((le=$.find(ge=>ge.id===V))!=null&&le.is_folder)}).length===2&&a.jsxs("button",{onClick:()=>ee(!0),className:"bg-amber-600 hover:bg-amber-700 text-white px-4 py-2 rounded-lg text-sm font-bold shadow-lg shadow-amber-500/20 transition-all transform hover:scale-105 active:scale-95 flex items-center gap-2",children:[a.jsx(Pr,{className:"w-4 h-4"}),"Transferir Páginas"]}),C.filter(V=>{var le;return!((le=$.find(ge=>ge.id===V))!=null&&le.is_folder)}).length>1&&a.jsxs("button",{onClick:async()=>{const V=C.filter(le=>{var ge;return!((ge=$.find(Ce=>Ce.id===le))!=null&&ge.is_folder)});if(window.confirm(`¿Seguro que quieres unir ${V.length} mangas en uno solo? Los originales serán eliminados.`))try{await Tw(V),we.success(`Se fusionaron ${V.length} mangas correctamente.`),v([]),$t()}catch{we.error("Error al unir mangas")}},className:"bg-emerald-600 hover:bg-emerald-700 text-white px-4 py-2 rounded-lg text-sm font-bold shadow-lg shadow-emerald-500/20 transition-all transform hover:scale-105 active:scale-95 flex items-center gap-2",children:[a.jsx(xd,{className:"w-4 h-4"}),"Unir Mangas"]})]}),a.jsx("button",{onClick:()=>v([]),className:"text-gray-400 hover:text-white text-sm font-semibold transition-colors px-2",children:"Cancelar"})]})]})}),a.jsx(hh,{isAdmin:o,onOpenTrash:()=>z(!0)}),a.jsx(dM,{currentSection:re,isOpen:t,onClose:()=>{e(!1),u(null)},editingManga:c,onMangaCreated:V=>{$t(),u(null),V&&!c&&setTimeout(()=>{Os(V)},500)},onDelete:o?Pc:void 0}),a.jsx(WF,{isOpen:w,onClose:()=>E(!1),selectedMangaIds:C,onSaveComplete:()=>{$t(),v([])}}),a.jsx(KF,{isOpen:D,onClose:()=>M(!1),selectedMangaIds:C,onSaveComplete:()=>{$t(),v([])}}),a.jsx(JF,{isOpen:T,onClose:()=>S(!1),mangas:$,selectedMangaIds:C,onSaveComplete:()=>{$t(),v([])}}),a.jsx(ZF,{isOpen:x,onClose:()=>N(!1),selectedMangaIds:C,onSaveComplete:()=>{$t(),v([])}}),a.jsx(e8,{isOpen:Bn,onClose:()=>Ue(!1),selectedMangaIds:C,onSaveComplete:()=>{$t(),v([])},currentFolderId:xt,currentSection:re}),a.jsx(t8,{isOpen:vt,onClose:()=>Pn(!1),selectedMangaIds:C,mangas:kt,onSaveComplete:()=>{$t(),v([])}}),a.jsx(n8,{isOpen:Pt,onClose:()=>on(!1),selectedMangaIds:C,currentSection:re,onSaveComplete:()=>{$t(),v([])}}),a.jsx(pM,{isOpen:n,onClose:()=>r(!1),isAdmin:o,onAdminChange:l,isCategoryPlusEnabled:h,onCategoryPlusChange:f,isCopyIdsEnabled:m,onCopyIdsChange:p,isDeletePlusEnabled:y,onDeletePlusChange:_,isCategoryMinusEnabled:pe,onCategoryMinusChange:O,isEditTitlePlusEnabled:Q,onEditTitlePlusChange:oe,isEtiquetadoraEnabled:ce,onEtiquetadoraChange:Ie,isFolderPlusEnabled:te,onFolderPlusChange:V=>{it(V),V||v([])},isPortalPlusEnabled:pt,onPortalPlusChange:V=>{Vt(V),V||v([])},isMergePlusEnabled:st,onMergePlusChange:V=>{yt(V),V||v([])},isTransferPlusEnabled:jt,onTransferPlusChange:V=>{_n(V),V||v([])},isFolderAnimationEnabled:R,onFolderAnimationChange:ne,onOpenTitleManager:()=>I(!0),onOpenFolderMap:()=>k(!0),onCleanKemonoTitles:()=>K(!0)}),a.jsx(XF,{isOpen:A,onClose:()=>I(!1),mangas:$,onSaveComplete:()=>$t()}),a.jsx(YF,{isOpen:s,onClose:()=>i(!1),categories:Da,selectedCategories:be,onToggleCategory:Dc,onClearFilters:()=>{Ze([]),ft(!1),ct(!1),Bt(!1),Jt()},filterDecensored:He,setFilterDecensored:V=>{ft(V),Jt()},filterBN:bt,setFilterBN:V=>{ct(V),Jt()},filterColor:Ge,setFilterColor:V=>{Bt(V),Jt()}}),a.jsx(r8,{isOpen:P,onClose:()=>k(!1),mangas:kt}),a.jsx(Nm,{isOpen:F,onClose:()=>K(!1),onConfirm:vo,title:"Limpiar IDs de Kemono",message:"¿Seguro que quieres eliminar las etiquetas [Numeros] del final de todos los mangas y carpetas? Esta acción se aplicará automáticamente a toda la base de datos.",confirmText:"Sí, limpiar nombres",cancelText:"Cancelar",variant:"warning"}),a.jsx(s8,{isOpen:B,onClose:()=>z(!1),deletedMangas:Ra,onRestore:async V=>{await ID(V),await $t()},onPermanentDelete:async V=>{await CD(V),await $t()}}),a.jsx(i8,{isOpen:W,onClose:()=>{ee(!1),v([])},mangaIds:C.filter(V=>{var le;return!((le=$.find(ge=>ge.id===V))!=null&&le.is_folder)}).slice(0,2),onSaveComplete:()=>{$t(),v([])}}),a.jsx(uM,{position:"top-center",richColors:!0,theme:"dark"})]})}H_(document.getElementById("root")).render(a.jsx(L.StrictMode,{children:a.jsx(f8,{})})); diff --git a/dist/assets/index-KKRSwvot.css b/dist/assets/index-KKRSwvot.css new file mode 100644 index 0000000000000000000000000000000000000000..d578fb28f4771d34fb224cf63c1612bad7ea89a7 --- /dev/null +++ b/dist/assets/index-KKRSwvot.css @@ -0,0 +1 @@ +*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.visible{visibility:visible}.invisible{visibility:hidden}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.bottom-0{bottom:0}.bottom-2{bottom:.5rem}.bottom-6{bottom:1.5rem}.left-0{left:0}.left-1\.5{left:.375rem}.left-1\/2{left:50%}.left-2{left:.5rem}.left-3{left:.75rem}.left-4{left:1rem}.left-6{left:1.5rem}.right-0{right:0}.right-2{right:.5rem}.right-3{right:.75rem}.right-4{right:1rem}.right-6{right:1.5rem}.right-8{right:2rem}.top-0{top:0}.top-1\.5{top:.375rem}.top-1\/2{top:50%}.top-2{top:.5rem}.top-6{top:1.5rem}.top-8{top:2rem}.top-full{top:100%}.z-10{z-index:10}.z-20{z-index:20}.z-40{z-index:40}.z-50{z-index:50}.mx-1{margin-left:.25rem;margin-right:.25rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-auto{margin-left:auto;margin-right:auto}.my-1{margin-top:.25rem;margin-bottom:.25rem}.my-6{margin-top:1.5rem;margin-bottom:1.5rem}.my-8{margin-top:2rem;margin-bottom:2rem}.mb-0\.5{margin-bottom:.125rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-2\.5{margin-bottom:.625rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-5{margin-bottom:1.25rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-2{margin-left:.5rem}.ml-auto{margin-left:auto}.mr-2{margin-right:.5rem}.mr-auto{margin-right:auto}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-2{margin-top:.5rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-8{margin-top:2rem}.mt-auto{margin-top:auto}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.block{display:block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.grid{display:grid}.hidden{display:none}.aspect-\[2\/3\]{aspect-ratio:2/3}.aspect-\[3\/4\]{aspect-ratio:3/4}.h-1{height:.25rem}.h-1\/3{height:33.333333%}.h-10{height:2.5rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-16{height:4rem}.h-2{height:.5rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-\[500px\]{height:500px}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.max-h-60{max-height:15rem}.max-h-\[80vh\]{max-height:80vh}.max-h-\[85vh\]{max-height:85vh}.max-h-\[90vh\]{max-height:90vh}.max-h-screen{max-height:100vh}.min-h-\[100px\]{min-height:100px}.min-h-\[300px\]{min-height:300px}.min-h-screen{min-height:100vh}.w-1{width:.25rem}.w-1\/2{width:50%}.w-1\/3{width:33.333333%}.w-10{width:2.5rem}.w-11{width:2.75rem}.w-12{width:3rem}.w-14{width:3.5rem}.w-16{width:4rem}.w-2{width:.5rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-3\/4{width:75%}.w-4{width:1rem}.w-5{width:1.25rem}.w-56{width:14rem}.w-6{width:1.5rem}.w-64{width:16rem}.w-7{width:1.75rem}.w-8{width:2rem}.w-\[300\%\]{width:300%}.w-full{width:100%}.w-px{width:1px}.min-w-0{min-width:0px}.min-w-\[200px\]{min-width:200px}.min-w-\[3ch\]{min-width:3ch}.max-w-2xl{max-width:42rem}.max-w-4xl{max-width:56rem}.max-w-5xl{max-width:64rem}.max-w-7xl{max-width:80rem}.max-w-\[150px\]{max-width:150px}.max-w-\[1800px\]{max-width:1800px}.max-w-\[1920px\]{max-width:1920px}.max-w-\[200px\]{max-width:200px}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-none{max-width:none}.max-w-sm{max-width:24rem}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.flex-shrink-0{flex-shrink:0}.origin-left{transform-origin:left}.origin-right{transform-origin:right}.-translate-x-1\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-45{--tw-rotate: 45deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-100{--tw-scale-x: 1;--tw-scale-y: 1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-95{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform-gpu{transform:translate3d(var(--tw-translate-x),var(--tw-translate-y),0) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.animate-\[fadeIn_0\.7s_ease-out_forwards\]{animation:fadeIn .7s ease-out forwards}@keyframes bounce{0%,to{transform:translateY(-25%);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;animation-timing-function:cubic-bezier(0,0,.2,1)}}.animate-bounce{animation:bounce 1s infinite}@keyframes ping{75%,to{transform:scale(2);opacity:0}}.animate-ping{animation:ping 1s cubic-bezier(0,0,.2,1) infinite}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.cursor-move{cursor:move}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-none{resize:none}.resize{resize:both}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-3\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.875rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.875rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-xl{border-radius:.75rem}.rounded-r-lg{border-top-right-radius:.5rem;border-bottom-right-radius:.5rem}.border{border-width:1px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-l{border-left-width:1px}.border-l-4{border-left-width:4px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-\[\#bb86fc\]{--tw-border-opacity: 1;border-color:rgb(187 134 252 / var(--tw-border-opacity, 1))}.border-\[\#bb86fc\]\/30{border-color:#bb86fc4d}.border-\[\#bb86fc\]\/40{border-color:#bb86fc66}.border-\[\#bb86fc\]\/50{border-color:#bb86fc80}.border-blue-500\/30{border-color:#3b82f64d}.border-gray-500\/30{border-color:#6b72804d}.border-gray-600{--tw-border-opacity: 1;border-color:rgb(75 85 99 / var(--tw-border-opacity, 1))}.border-gray-600\/50{border-color:#4b556380}.border-gray-700{--tw-border-opacity: 1;border-color:rgb(55 65 81 / var(--tw-border-opacity, 1))}.border-gray-700\/30{border-color:#3741514d}.border-gray-700\/40{border-color:#37415166}.border-gray-700\/50{border-color:#37415180}.border-gray-700\/60{border-color:#37415199}.border-gray-800{--tw-border-opacity: 1;border-color:rgb(31 41 55 / var(--tw-border-opacity, 1))}.border-gray-800\/50{border-color:#1f293780}.border-green-500{--tw-border-opacity: 1;border-color:rgb(34 197 94 / var(--tw-border-opacity, 1))}.border-green-500\/20{border-color:#22c55e33}.border-green-500\/30{border-color:#22c55e4d}.border-pink-500\/30{border-color:#ec48994d}.border-purple-500\/20{border-color:#a855f733}.border-purple-500\/30{border-color:#a855f74d}.border-purple-500\/50{border-color:#a855f780}.border-red-500\/20{border-color:#ef444433}.border-red-500\/30{border-color:#ef44444d}.border-transparent{border-color:transparent}.border-white\/50{border-color:#ffffff80}.border-t-transparent{border-top-color:transparent}.bg-\[\#050505\]{--tw-bg-opacity: 1;background-color:rgb(5 5 5 / var(--tw-bg-opacity, 1))}.bg-\[\#0a0a0a\]{--tw-bg-opacity: 1;background-color:rgb(10 10 10 / var(--tw-bg-opacity, 1))}.bg-\[\#0f0f0f\]{--tw-bg-opacity: 1;background-color:rgb(15 15 15 / var(--tw-bg-opacity, 1))}.bg-\[\#121212\]{--tw-bg-opacity: 1;background-color:rgb(18 18 18 / var(--tw-bg-opacity, 1))}.bg-\[\#121212\]\/90{background-color:#121212e6}.bg-\[\#151515\]{--tw-bg-opacity: 1;background-color:rgb(21 21 21 / var(--tw-bg-opacity, 1))}.bg-\[\#1a1a1a\]{--tw-bg-opacity: 1;background-color:rgb(26 26 26 / var(--tw-bg-opacity, 1))}.bg-\[\#1a1a1a\]\/50{background-color:#1a1a1a80}.bg-\[\#1f1f1f\]{--tw-bg-opacity: 1;background-color:rgb(31 31 31 / var(--tw-bg-opacity, 1))}.bg-\[\#252525\]{--tw-bg-opacity: 1;background-color:rgb(37 37 37 / var(--tw-bg-opacity, 1))}.bg-\[\#bb86fc\]{--tw-bg-opacity: 1;background-color:rgb(187 134 252 / var(--tw-bg-opacity, 1))}.bg-\[\#bb86fc\]\/10{background-color:#bb86fc1a}.bg-\[\#bb86fc\]\/20{background-color:#bb86fc33}.bg-\[\#bb86fc\]\/90{background-color:#bb86fce6}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-black\/30{background-color:#0000004d}.bg-black\/40{background-color:#0006}.bg-black\/50{background-color:#00000080}.bg-black\/60{background-color:#0009}.bg-black\/70{background-color:#000000b3}.bg-black\/80{background-color:#000c}.bg-black\/95{background-color:#000000f2}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.bg-blue-500\/10{background-color:#3b82f61a}.bg-blue-500\/20{background-color:#3b82f633}.bg-gray-500\/20{background-color:#6b728033}.bg-gray-600{--tw-bg-opacity: 1;background-color:rgb(75 85 99 / var(--tw-bg-opacity, 1))}.bg-gray-700{--tw-bg-opacity: 1;background-color:rgb(55 65 81 / var(--tw-bg-opacity, 1))}.bg-gray-700\/40{background-color:#37415166}.bg-gray-800{--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.bg-green-500\/10{background-color:#22c55e1a}.bg-green-500\/20{background-color:#22c55e33}.bg-green-600\/90{background-color:#16a34ae6}.bg-pink-500\/20{background-color:#ec489933}.bg-purple-500{--tw-bg-opacity: 1;background-color:rgb(168 85 247 / var(--tw-bg-opacity, 1))}.bg-purple-500\/10{background-color:#a855f71a}.bg-purple-500\/20{background-color:#a855f733}.bg-purple-600{--tw-bg-opacity: 1;background-color:rgb(147 51 234 / var(--tw-bg-opacity, 1))}.bg-purple-900\/90{background-color:#581c87e6}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-500\/10{background-color:#ef44441a}.bg-red-600{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.bg-red-600\/80{background-color:#dc2626cc}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-white\/10{background-color:#ffffff1a}.bg-white\/20{background-color:#fff3}.bg-gradient-to-b{background-image:linear-gradient(to bottom,var(--tw-gradient-stops))}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.bg-gradient-to-t{background-image:linear-gradient(to top,var(--tw-gradient-stops))}.from-\[\#1a1a1a\]{--tw-gradient-from: #1a1a1a var(--tw-gradient-from-position);--tw-gradient-to: rgb(26 26 26 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-\[\#1f1f1f\]{--tw-gradient-from: #1f1f1f var(--tw-gradient-from-position);--tw-gradient-to: rgb(31 31 31 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-\[\#1f1f1f\]\/80{--tw-gradient-from: rgb(31 31 31 / .8) var(--tw-gradient-from-position);--tw-gradient-to: rgb(31 31 31 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-\[\#242424\]{--tw-gradient-from: #242424 var(--tw-gradient-from-position);--tw-gradient-to: rgb(36 36 36 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-\[\#2a2a2a\]{--tw-gradient-from: #2a2a2a var(--tw-gradient-from-position);--tw-gradient-to: rgb(42 42 42 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-\[\#2a2a2a\]\/80{--tw-gradient-from: rgb(42 42 42 / .8) var(--tw-gradient-from-position);--tw-gradient-to: rgb(42 42 42 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-\[\#9966dd\]{--tw-gradient-from: #9966dd var(--tw-gradient-from-position);--tw-gradient-to: rgb(153 102 221 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-\[\#bb86fc\]{--tw-gradient-from: #bb86fc var(--tw-gradient-from-position);--tw-gradient-to: rgb(187 134 252 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-\[\#bb86fc\]\/20{--tw-gradient-from: rgb(187 134 252 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(187 134 252 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-black\/60{--tw-gradient-from: rgb(0 0 0 / .6) var(--tw-gradient-from-position);--tw-gradient-to: rgb(0 0 0 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-gray-700\/40{--tw-gradient-from: rgb(55 65 81 / .4) var(--tw-gradient-from-position);--tw-gradient-to: rgb(55 65 81 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-gray-800{--tw-gradient-from: #1f2937 var(--tw-gradient-from-position);--tw-gradient-to: rgb(31 41 55 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-transparent{--tw-gradient-from: transparent var(--tw-gradient-from-position);--tw-gradient-to: rgb(0 0 0 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-white{--tw-gradient-from: #fff var(--tw-gradient-from-position);--tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.via-\[\#9966dd\]{--tw-gradient-to: rgb(153 102 221 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), #9966dd var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-white\/20{--tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), rgb(255 255 255 / .2) var(--tw-gradient-via-position), var(--tw-gradient-to)}.to-\[\#0f0f0f\]{--tw-gradient-to: #0f0f0f var(--tw-gradient-to-position)}.to-\[\#121212\]{--tw-gradient-to: #121212 var(--tw-gradient-to-position)}.to-\[\#1a1a1a\]{--tw-gradient-to: #1a1a1a var(--tw-gradient-to-position)}.to-\[\#1a1a1a\]\/80{--tw-gradient-to: rgb(26 26 26 / .8) var(--tw-gradient-to-position)}.to-\[\#1f1f1f\]{--tw-gradient-to: #1f1f1f var(--tw-gradient-to-position)}.to-\[\#1f1f1f\]\/80{--tw-gradient-to: rgb(31 31 31 / .8) var(--tw-gradient-to-position)}.to-\[\#252525\]{--tw-gradient-to: #252525 var(--tw-gradient-to-position)}.to-\[\#7744cc\]{--tw-gradient-to: #7744cc var(--tw-gradient-to-position)}.to-\[\#9966dd\]{--tw-gradient-to: #9966dd var(--tw-gradient-to-position)}.to-\[\#bb86fc\]{--tw-gradient-to: #bb86fc var(--tw-gradient-to-position)}.to-gray-400{--tw-gradient-to: #9ca3af var(--tw-gradient-to-position)}.to-gray-600\/40{--tw-gradient-to: rgb(75 85 99 / .4) var(--tw-gradient-to-position)}.to-gray-900{--tw-gradient-to: #111827 var(--tw-gradient-to-position)}.to-transparent{--tw-gradient-to: transparent var(--tw-gradient-to-position)}.bg-clip-text{-webkit-background-clip:text;background-clip:text}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.object-left{-o-object-position:left;object-position:left}.object-right{-o-object-position:right;object-position:right}.p-0\.5{padding:.125rem}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-2{padding:.5rem}.p-2\.5{padding:.625rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-0{padding-left:0;padding-right:0}.px-1{padding-left:.25rem;padding-right:.25rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-8{padding-left:2rem;padding-right:2rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-16{padding-top:4rem;padding-bottom:4rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-20{padding-top:5rem;padding-bottom:5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-2{padding-bottom:.5rem}.pb-8{padding-bottom:2rem}.pl-10{padding-left:2.5rem}.pl-2{padding-left:.5rem}.pl-3{padding-left:.75rem}.pl-4{padding-left:1rem}.pr-10{padding-right:2.5rem}.pr-3{padding-right:.75rem}.pr-4{padding-right:1rem}.pt-2{padding-top:.5rem}.pt-4{padding-top:1rem}.pt-6{padding-top:1.5rem}.pt-8{padding-top:2rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-\[10px\]{font-size:10px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.italic{font-style:italic}.leading-relaxed{line-height:1.625}.tracking-wide{letter-spacing:.025em}.tracking-wider{letter-spacing:.05em}.text-\[\#bb86fc\]{--tw-text-opacity: 1;color:rgb(187 134 252 / var(--tw-text-opacity, 1))}.text-blue-300{--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.text-gray-200{--tw-text-opacity: 1;color:rgb(229 231 235 / var(--tw-text-opacity, 1))}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-green-300{--tw-text-opacity: 1;color:rgb(134 239 172 / var(--tw-text-opacity, 1))}.text-green-400{--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.text-pink-300{--tw-text-opacity: 1;color:rgb(249 168 212 / var(--tw-text-opacity, 1))}.text-pink-400{--tw-text-opacity: 1;color:rgb(244 114 182 / var(--tw-text-opacity, 1))}.text-purple-100{--tw-text-opacity: 1;color:rgb(243 232 255 / var(--tw-text-opacity, 1))}.text-purple-200{--tw-text-opacity: 1;color:rgb(233 213 255 / var(--tw-text-opacity, 1))}.text-purple-300{--tw-text-opacity: 1;color:rgb(216 180 254 / var(--tw-text-opacity, 1))}.text-purple-400{--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-transparent{color:transparent}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-white\/40{color:#fff6}.text-white\/70{color:#ffffffb3}.underline{text-decoration-line:underline}.no-underline{text-decoration-line:none}.decoration-gray-600{text-decoration-color:#4b5563}.placeholder-gray-400::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(156 163 175 / var(--tw-placeholder-opacity, 1))}.placeholder-gray-400::placeholder{--tw-placeholder-opacity: 1;color:rgb(156 163 175 / var(--tw-placeholder-opacity, 1))}.placeholder-gray-500::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(107 114 128 / var(--tw-placeholder-opacity, 1))}.placeholder-gray-500::placeholder{--tw-placeholder-opacity: 1;color:rgb(107 114 128 / var(--tw-placeholder-opacity, 1))}.placeholder-gray-600::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(75 85 99 / var(--tw-placeholder-opacity, 1))}.placeholder-gray-600::placeholder{--tw-placeholder-opacity: 1;color:rgb(75 85 99 / var(--tw-placeholder-opacity, 1))}.accent-\[\#bb86fc\]{accent-color:#bb86fc}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\[0_0_15px_-3px_rgba\(168\,85\,247\,0\.3\)\]{--tw-shadow: 0 0 15px -3px rgba(168,85,247,.3);--tw-shadow-colored: 0 0 15px -3px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-inner{--tw-shadow: inset 0 2px 4px 0 rgb(0 0 0 / .05);--tw-shadow-colored: inset 0 2px 4px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\[\#bb86fc\]\/10{--tw-shadow-color: rgb(187 134 252 / .1);--tw-shadow: var(--tw-shadow-colored)}.shadow-\[\#bb86fc\]\/20{--tw-shadow-color: rgb(187 134 252 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-\[\#bb86fc\]\/30{--tw-shadow-color: rgb(187 134 252 / .3);--tw-shadow: var(--tw-shadow-colored)}.shadow-\[\#bb86fc\]\/40{--tw-shadow-color: rgb(187 134 252 / .4);--tw-shadow: var(--tw-shadow-colored)}.shadow-black\/50{--tw-shadow-color: rgb(0 0 0 / .5);--tw-shadow: var(--tw-shadow-colored)}.shadow-green-500\/40{--tw-shadow-color: rgb(34 197 94 / .4);--tw-shadow: var(--tw-shadow-colored)}.shadow-purple-500\/20{--tw-shadow-color: rgb(168 85 247 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-purple-600\/30{--tw-shadow-color: rgb(147 51 234 / .3);--tw-shadow: var(--tw-shadow-colored)}.shadow-purple-900\/20{--tw-shadow-color: rgb(88 28 135 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-red-500\/20{--tw-shadow-color: rgb(239 68 68 / .2);--tw-shadow: var(--tw-shadow-colored)}.ring-4{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-\[\#bb86fc\]{--tw-ring-opacity: 1;--tw-ring-color: rgb(187 134 252 / var(--tw-ring-opacity, 1))}.blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-md{--tw-backdrop-blur: blur(12px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-none{transition-property:none}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-1000{transition-duration:1s}.duration-150{transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}.duration-700{transition-duration:.7s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.ease-linear{transition-timing-function:linear}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}@keyframes fadeIn{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}@keyframes fadeOut{0%{opacity:1}to{opacity:0}}@keyframes fadeInUp{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}@keyframes quickFadeIn{0%{opacity:0;transform:scale(.98)}to{opacity:1;transform:scale(1)}}.animate-quick-fade-in{animation:quickFadeIn .15s ease-out forwards}@keyframes smoothFadeIn{0%{opacity:0;transform:scale(.98)}50%{opacity:.5}to{opacity:1;transform:scale(1)}}.animate-smooth-fade-in{animation:smoothFadeIn 1.2s ease-out forwards}.masonry-container{-moz-column-count:2;column-count:2;-moz-column-gap:4px;column-gap:4px}@media (min-width: 640px){.masonry-container{-moz-column-count:3;column-count:3}}@media (min-width: 768px){.masonry-container{-moz-column-count:4;column-count:4}}@media (min-width: 1024px){.masonry-container{-moz-column-count:5;column-count:5}}@media (min-width: 1280px){.masonry-container{-moz-column-count:6;column-count:6}}@keyframes shimmer{0%{background-position:-1000px 0}to{background-position:1000px 0}}.animate-shimmer{animation:shimmer 2.5s infinite}.masonry-item{-moz-column-break-inside:avoid;break-inside:avoid;margin-bottom:4px;display:inline-block;width:100%}@keyframes slideInUp{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}@keyframes slideInDown{0%{opacity:0;transform:translateY(-20px)}to{opacity:1;transform:translateY(0)}}@keyframes slideInLeft{0%{opacity:0;transform:translate(-20px)}to{opacity:1;transform:translate(0)}}@keyframes slideInRight{0%{opacity:0;transform:translate(20px)}to{opacity:1;transform:translate(0)}}@keyframes glow{0%,to{box-shadow:0 0 5px #8b5cf61a}50%{box-shadow:0 0 20px #8b5cf64d}}@keyframes pulse-color{0%,to{color:currentColor}50%{color:#8b5cf699}}.animate-slide-in-up{animation:slideInUp .5s ease-out forwards}.animate-slide-in-down{animation:slideInDown .5s ease-out forwards}.animate-slide-in-left{animation:slideInLeft .5s ease-out forwards}.animate-slide-in-right{animation:slideInRight .5s ease-out forwards}.animate-glow{animation:glow 2s ease-in-out infinite}.animate-pulse-color{animation:pulse-color 2s ease-in-out infinite}.after\:absolute:after{content:var(--tw-content);position:absolute}.after\:left-\[2px\]:after{content:var(--tw-content);left:2px}.after\:top-\[2px\]:after{content:var(--tw-content);top:2px}.after\:h-5:after{content:var(--tw-content);height:1.25rem}.after\:w-5:after{content:var(--tw-content);width:1.25rem}.after\:rounded-full:after{content:var(--tw-content);border-radius:9999px}.after\:border:after{content:var(--tw-content);border-width:1px}.after\:border-gray-300:after{content:var(--tw-content);--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.after\:bg-white:after{content:var(--tw-content);--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.after\:transition-all:after{content:var(--tw-content);transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.after\:content-\[\'\'\]:after{--tw-content: "";content:var(--tw-content)}.hover\:rotate-180:hover{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:rotate-90:hover{--tw-rotate: 90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:scale-105:hover{--tw-scale-x: 1.05;--tw-scale-y: 1.05;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:scale-110:hover{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:scale-125:hover{--tw-scale-x: 1.25;--tw-scale-y: 1.25;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:scale-\[1\.02\]:hover{--tw-scale-x: 1.02;--tw-scale-y: 1.02;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:border-\[\#24A1DE\]:hover{--tw-border-opacity: 1;border-color:rgb(36 161 222 / var(--tw-border-opacity, 1))}.hover\:border-\[\#FF424D\]:hover{--tw-border-opacity: 1;border-color:rgb(255 66 77 / var(--tw-border-opacity, 1))}.hover\:border-\[\#bb86fc\]:hover{--tw-border-opacity: 1;border-color:rgb(187 134 252 / var(--tw-border-opacity, 1))}.hover\:border-\[\#bb86fc\]\/50:hover{border-color:#bb86fc80}.hover\:border-gray-500:hover{--tw-border-opacity: 1;border-color:rgb(107 114 128 / var(--tw-border-opacity, 1))}.hover\:border-gray-600:hover{--tw-border-opacity: 1;border-color:rgb(75 85 99 / var(--tw-border-opacity, 1))}.hover\:border-gray-600\/70:hover{border-color:#4b5563b3}.hover\:border-gray-700:hover{--tw-border-opacity: 1;border-color:rgb(55 65 81 / var(--tw-border-opacity, 1))}.hover\:border-gray-700\/60:hover{border-color:#37415199}.hover\:border-purple-500:hover{--tw-border-opacity: 1;border-color:rgb(168 85 247 / var(--tw-border-opacity, 1))}.hover\:border-purple-500\/50:hover{border-color:#a855f780}.hover\:border-red-500\/40:hover{border-color:#ef444466}.hover\:border-white:hover{--tw-border-opacity: 1;border-color:rgb(255 255 255 / var(--tw-border-opacity, 1))}.hover\:bg-\[\#1f1f1f\]:hover{--tw-bg-opacity: 1;background-color:rgb(31 31 31 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#242424\]:hover{--tw-bg-opacity: 1;background-color:rgb(36 36 36 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#2a2a2a\]:hover{--tw-bg-opacity: 1;background-color:rgb(42 42 42 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#333\]:hover{--tw-bg-opacity: 1;background-color:rgb(51 51 51 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#9966dd\]:hover{--tw-bg-opacity: 1;background-color:rgb(153 102 221 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#bb86fc\]:hover{--tw-bg-opacity: 1;background-color:rgb(187 134 252 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#bb86fc\]\/10:hover{background-color:#bb86fc1a}.hover\:bg-\[\#bb86fc\]\/20:hover{background-color:#bb86fc33}.hover\:bg-\[\#bb86fc\]\/30:hover{background-color:#bb86fc4d}.hover\:bg-\[\#bb86fc\]\/5:hover{background-color:#bb86fc0d}.hover\:bg-gray-700:hover{--tw-bg-opacity: 1;background-color:rgb(55 65 81 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-800:hover{--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.hover\:bg-purple-500\/30:hover{background-color:#a855f74d}.hover\:bg-purple-600:hover{--tw-bg-opacity: 1;background-color:rgb(147 51 234 / var(--tw-bg-opacity, 1))}.hover\:bg-purple-700:hover{--tw-bg-opacity: 1;background-color:rgb(126 34 206 / var(--tw-bg-opacity, 1))}.hover\:bg-red-500\/20:hover{background-color:#ef444433}.hover\:bg-red-600:hover{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.hover\:bg-red-700:hover{--tw-bg-opacity: 1;background-color:rgb(185 28 28 / var(--tw-bg-opacity, 1))}.hover\:bg-white\/10:hover{background-color:#ffffff1a}.hover\:bg-white\/20:hover{background-color:#fff3}.hover\:bg-white\/5:hover{background-color:#ffffff0d}.hover\:from-\[\#9966dd\]:hover{--tw-gradient-from: #9966dd var(--tw-gradient-from-position);--tw-gradient-to: rgb(153 102 221 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.hover\:from-gray-700\/60:hover{--tw-gradient-from: rgb(55 65 81 / .6) var(--tw-gradient-from-position);--tw-gradient-to: rgb(55 65 81 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.hover\:to-\[\#7744cc\]:hover{--tw-gradient-to: #7744cc var(--tw-gradient-to-position)}.hover\:to-gray-600\/60:hover{--tw-gradient-to: rgb(75 85 99 / .6) var(--tw-gradient-to-position)}.hover\:text-\[\#24A1DE\]:hover{--tw-text-opacity: 1;color:rgb(36 161 222 / var(--tw-text-opacity, 1))}.hover\:text-\[\#FF424D\]:hover{--tw-text-opacity: 1;color:rgb(255 66 77 / var(--tw-text-opacity, 1))}.hover\:text-\[\#bb86fc\]:hover{--tw-text-opacity: 1;color:rgb(187 134 252 / var(--tw-text-opacity, 1))}.hover\:text-purple-400:hover{--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.hover\:text-red-400:hover{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.hover\:text-white:hover{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:decoration-white:hover{text-decoration-color:#fff}.hover\:opacity-100:hover{opacity:1}.hover\:opacity-80:hover{opacity:.8}.hover\:shadow-lg:hover{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-\[\#bb86fc\]\/60:hover{--tw-shadow-color: rgb(187 134 252 / .6);--tw-shadow: var(--tw-shadow-colored)}.hover\:shadow-purple-500\/10:hover{--tw-shadow-color: rgb(168 85 247 / .1);--tw-shadow: var(--tw-shadow-colored)}.hover\:shadow-purple-500\/20:hover{--tw-shadow-color: rgb(168 85 247 / .2);--tw-shadow: var(--tw-shadow-colored)}.hover\:shadow-purple-600\/50:hover{--tw-shadow-color: rgb(147 51 234 / .5);--tw-shadow: var(--tw-shadow-colored)}.focus\:border-\[\#bb86fc\]:focus{--tw-border-opacity: 1;border-color:rgb(187 134 252 / var(--tw-border-opacity, 1))}.focus\:border-purple-500:focus{--tw-border-opacity: 1;border-color:rgb(168 85 247 / var(--tw-border-opacity, 1))}.focus\:border-purple-500\/50:focus{border-color:#a855f780}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-\[\#bb86fc\]:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(187 134 252 / var(--tw-ring-opacity, 1))}.focus\:ring-\[\#bb86fc\]\/30:focus{--tw-ring-color: rgb(187 134 252 / .3)}.focus\:ring-purple-500\/50:focus{--tw-ring-color: rgb(168 85 247 / .5)}.active\:scale-95:active{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.disabled\:hover\:border-gray-700:hover:disabled{--tw-border-opacity: 1;border-color:rgb(55 65 81 / var(--tw-border-opacity, 1))}.disabled\:hover\:bg-\[\#1a1a1a\]:hover:disabled{--tw-bg-opacity: 1;background-color:rgb(26 26 26 / var(--tw-bg-opacity, 1))}.disabled\:hover\:text-gray-500:hover:disabled{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:-translate-x-1{--tw-translate-x: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:rotate-12{--tw-rotate: 12deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:scale-110{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:scale-\[1\.08\]{--tw-scale-x: 1.08;--tw-scale-y: 1.08;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:scale-\[1\.10\]{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:bg-\[\#bb86fc\]\/40{background-color:#bb86fc66}.group:hover .group-hover\:bg-purple-500\/40{background-color:#a855f766}.group:hover .group-hover\:text-\[\#bb86fc\]{--tw-text-opacity: 1;color:rgb(187 134 252 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-purple-400{--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-white\/60{color:#fff9}.group:hover .group-hover\:opacity-100{opacity:1}.group:hover .group-hover\:shadow-\[\#bb86fc\]\/30{--tw-shadow-color: rgb(187 134 252 / .3);--tw-shadow: var(--tw-shadow-colored)}.group:hover .group-hover\:shadow-\[\#bb86fc\]\/60{--tw-shadow-color: rgb(187 134 252 / .6);--tw-shadow: var(--tw-shadow-colored)}.peer:checked~.peer-checked\:bg-\[\#bb86fc\]{--tw-bg-opacity: 1;background-color:rgb(187 134 252 / var(--tw-bg-opacity, 1))}.peer:checked~.peer-checked\:after\:translate-x-full:after{content:var(--tw-content);--tw-translate-x: 100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.peer:checked~.peer-checked\:after\:border-white:after{content:var(--tw-content);--tw-border-opacity: 1;border-color:rgb(255 255 255 / var(--tw-border-opacity, 1))}.peer:focus~.peer-focus\:outline-none{outline:2px solid transparent;outline-offset:2px}.peer:focus~.peer-focus\:ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.peer:focus~.peer-focus\:ring-purple-300{--tw-ring-opacity: 1;--tw-ring-color: rgb(216 180 254 / var(--tw-ring-opacity, 1))}@media (min-width: 640px){.sm\:left-8{left:2rem}.sm\:right-8{right:2rem}.sm\:mx-0{margin-left:0;margin-right:0}.sm\:mb-4{margin-bottom:1rem}.sm\:mb-6{margin-bottom:1.5rem}.sm\:mt-12{margin-top:3rem}.sm\:mt-2{margin-top:.5rem}.sm\:mt-8{margin-top:2rem}.sm\:inline-block{display:inline-block}.sm\:inline{display:inline}.sm\:flex{display:flex}.sm\:hidden{display:none}.sm\:h-10{height:2.5rem}.sm\:h-14{height:3.5rem}.sm\:h-4{height:1rem}.sm\:h-5{height:1.25rem}.sm\:w-10{width:2.5rem}.sm\:w-14{width:3.5rem}.sm\:w-4{width:1rem}.sm\:w-5{width:1.25rem}.sm\:w-64{width:16rem}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:gap-0{gap:0px}.sm\:gap-1\.5{gap:.375rem}.sm\:gap-2{gap:.5rem}.sm\:gap-3{gap:.75rem}.sm\:gap-4{gap:1rem}.sm\:gap-6{gap:1.5rem}.sm\:p-12{padding:3rem}.sm\:p-2{padding:.5rem}.sm\:p-4{padding:1rem}.sm\:p-6{padding:1.5rem}.sm\:px-10{padding-left:2.5rem;padding-right:2.5rem}.sm\:px-3{padding-left:.75rem;padding-right:.75rem}.sm\:px-4{padding-left:1rem;padding-right:1rem}.sm\:px-6{padding-left:1.5rem;padding-right:1.5rem}.sm\:py-2{padding-top:.5rem;padding-bottom:.5rem}.sm\:py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.sm\:py-4{padding-top:1rem;padding-bottom:1rem}.sm\:py-6{padding-top:1.5rem;padding-bottom:1.5rem}.sm\:py-8{padding-top:2rem;padding-bottom:2rem}.sm\:pt-12{padding-top:3rem}.sm\:pt-8{padding-top:2rem}.sm\:text-2xl{font-size:1.5rem;line-height:2rem}.sm\:text-4xl{font-size:2.25rem;line-height:2.5rem}.sm\:text-lg{font-size:1.125rem;line-height:1.75rem}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}}@media (min-width: 768px){.md\:absolute{position:absolute}.md\:right-8{right:2rem}.md\:flex{display:flex}.md\:hidden{display:none}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:gap-3{gap:.75rem}.md\:p-12{padding:3rem}.md\:px-12{padding-left:3rem;padding-right:3rem}}@media (min-width: 1024px){.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.lg\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}}@media (min-width: 1280px){.xl\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.xl\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}}@media (min-width: 1536px){.\32xl\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}}@media (prefers-color-scheme: dark){.dark\:border-gray-600{--tw-border-opacity: 1;border-color:rgb(75 85 99 / var(--tw-border-opacity, 1))}.dark\:bg-gray-700{--tw-bg-opacity: 1;background-color:rgb(55 65 81 / var(--tw-bg-opacity, 1))}.peer:focus~.dark\:peer-focus\:ring-purple-800{--tw-ring-opacity: 1;--tw-ring-color: rgb(107 33 168 / var(--tw-ring-opacity, 1))}} diff --git a/dist/assets/index-a10d52vi.css b/dist/assets/index-a10d52vi.css new file mode 100644 index 0000000000000000000000000000000000000000..0bfec63254077978d0094d2b423080559475f5db --- /dev/null +++ b/dist/assets/index-a10d52vi.css @@ -0,0 +1 @@ +:root{--swiper-theme-color: #007aff}:host{position:relative;display:block;margin-left:auto;margin-right:auto;z-index:1}.swiper{margin-left:auto;margin-right:auto;position:relative;overflow:hidden;list-style:none;padding:0;z-index:1;display:block}.swiper-vertical>.swiper-wrapper{flex-direction:column}.swiper-wrapper{position:relative;width:100%;height:100%;z-index:1;display:flex;transition-property:transform;transition-timing-function:var(--swiper-wrapper-transition-timing-function, initial);box-sizing:content-box}.swiper-android .swiper-slide,.swiper-ios .swiper-slide,.swiper-wrapper{transform:translateZ(0)}.swiper-horizontal{touch-action:pan-y}.swiper-vertical{touch-action:pan-x}.swiper-slide{flex-shrink:0;width:100%;height:100%;position:relative;transition-property:transform;display:block}.swiper-slide-invisible-blank{visibility:hidden}.swiper-autoheight,.swiper-autoheight .swiper-slide{height:auto}.swiper-autoheight .swiper-wrapper{align-items:flex-start;transition-property:transform,height}.swiper-backface-hidden .swiper-slide{transform:translateZ(0);backface-visibility:hidden}.swiper-3d.swiper-css-mode .swiper-wrapper{perspective:1200px}.swiper-3d .swiper-wrapper{transform-style:preserve-3d}.swiper-3d{perspective:1200px}.swiper-3d .swiper-slide,.swiper-3d .swiper-cube-shadow{transform-style:preserve-3d}.swiper-css-mode>.swiper-wrapper{overflow:auto;scrollbar-width:none;-ms-overflow-style:none}.swiper-css-mode>.swiper-wrapper::-webkit-scrollbar{display:none}.swiper-css-mode>.swiper-wrapper>.swiper-slide{scroll-snap-align:start start}.swiper-css-mode.swiper-horizontal>.swiper-wrapper{scroll-snap-type:x mandatory}.swiper-css-mode.swiper-horizontal>.swiper-wrapper>.swiper-slide:first-child{margin-inline-start:var(--swiper-slides-offset-before);scroll-margin-inline-start:var(--swiper-slides-offset-before)}.swiper-css-mode.swiper-horizontal>.swiper-wrapper>.swiper-slide:last-child{margin-inline-end:var(--swiper-slides-offset-after)}.swiper-css-mode.swiper-vertical>.swiper-wrapper{scroll-snap-type:y mandatory}.swiper-css-mode.swiper-vertical>.swiper-wrapper>.swiper-slide:first-child{margin-block-start:var(--swiper-slides-offset-before);scroll-margin-block-start:var(--swiper-slides-offset-before)}.swiper-css-mode.swiper-vertical>.swiper-wrapper>.swiper-slide:last-child{margin-block-end:var(--swiper-slides-offset-after)}.swiper-css-mode.swiper-free-mode>.swiper-wrapper{scroll-snap-type:none}.swiper-css-mode.swiper-free-mode>.swiper-wrapper>.swiper-slide{scroll-snap-align:none}.swiper-css-mode.swiper-centered>.swiper-wrapper:before{content:"";flex-shrink:0;order:9999}.swiper-css-mode.swiper-centered>.swiper-wrapper>.swiper-slide{scroll-snap-align:center center;scroll-snap-stop:always}.swiper-css-mode.swiper-centered.swiper-horizontal>.swiper-wrapper>.swiper-slide:first-child{margin-inline-start:var(--swiper-centered-offset-before)}.swiper-css-mode.swiper-centered.swiper-horizontal>.swiper-wrapper:before{height:100%;min-height:1px;width:var(--swiper-centered-offset-after)}.swiper-css-mode.swiper-centered.swiper-vertical>.swiper-wrapper>.swiper-slide:first-child{margin-block-start:var(--swiper-centered-offset-before)}.swiper-css-mode.swiper-centered.swiper-vertical>.swiper-wrapper:before{width:100%;min-width:1px;height:var(--swiper-centered-offset-after)}.swiper-3d .swiper-slide-shadow,.swiper-3d .swiper-slide-shadow-left,.swiper-3d .swiper-slide-shadow-right,.swiper-3d .swiper-slide-shadow-top,.swiper-3d .swiper-slide-shadow-bottom{position:absolute;left:0;top:0;width:100%;height:100%;pointer-events:none;z-index:10}.swiper-3d .swiper-slide-shadow{background:#00000026}.swiper-3d .swiper-slide-shadow-left{background-image:linear-gradient(to left,#00000080,#0000)}.swiper-3d .swiper-slide-shadow-right{background-image:linear-gradient(to right,#00000080,#0000)}.swiper-3d .swiper-slide-shadow-top{background-image:linear-gradient(to top,#00000080,#0000)}.swiper-3d .swiper-slide-shadow-bottom{background-image:linear-gradient(to bottom,#00000080,#0000)}.swiper-lazy-preloader{width:42px;height:42px;position:absolute;left:50%;top:50%;margin-left:-21px;margin-top:-21px;z-index:10;transform-origin:50%;box-sizing:border-box;border:4px solid var(--swiper-preloader-color, var(--swiper-theme-color));border-radius:50%;border-top-color:transparent}.swiper:not(.swiper-watch-progress) .swiper-lazy-preloader,.swiper-watch-progress .swiper-slide-visible .swiper-lazy-preloader{animation:swiper-preloader-spin 1s infinite linear}.swiper-lazy-preloader-white{--swiper-preloader-color: #fff}.swiper-lazy-preloader-black{--swiper-preloader-color: #000}@keyframes swiper-preloader-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.swiper-creative .swiper-slide{backface-visibility:hidden;overflow:hidden;transition-property:transform,opacity,height}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.visible{visibility:visible}.invisible{visibility:hidden}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.-left-6{left:-1.5rem}.-right-32{right:-8rem}.-top-32{top:-8rem}.bottom-0{bottom:0}.bottom-2{bottom:.5rem}.bottom-6{bottom:1.5rem}.left-0{left:0}.left-0\.5{left:.125rem}.left-1\/2{left:50%}.left-2{left:.5rem}.left-3{left:.75rem}.left-4{left:1rem}.left-6{left:1.5rem}.right-0{right:0}.right-2{right:.5rem}.right-3{right:.75rem}.right-4{right:1rem}.right-6{right:1.5rem}.right-8{right:2rem}.top-0{top:0}.top-0\.5{top:.125rem}.top-1\/2{top:50%}.top-2{top:.5rem}.top-4{top:1rem}.top-6{top:1.5rem}.top-8{top:2rem}.top-full{top:100%}.z-0{z-index:0}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.z-40{z-index:40}.z-50{z-index:50}.z-\[100\]{z-index:100}.z-\[45\]{z-index:45}.z-\[60\]{z-index:60}.z-\[70\]{z-index:70}.z-\[80\]{z-index:80}.col-span-2{grid-column:span 2 / span 2}.col-span-full{grid-column:1 / -1}.mx-1{margin-left:.25rem;margin-right:.25rem}.mx-auto{margin-left:auto;margin-right:auto}.my-1{margin-top:.25rem;margin-bottom:.25rem}.my-4{margin-top:1rem;margin-bottom:1rem}.my-6{margin-top:1.5rem;margin-bottom:1.5rem}.my-8{margin-top:2rem;margin-bottom:2rem}.mb-0\.5{margin-bottom:.125rem}.mb-1{margin-bottom:.25rem}.mb-1\.5{margin-bottom:.375rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-5{margin-bottom:1.25rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-1{margin-left:.25rem}.ml-2{margin-left:.5rem}.mr-2{margin-right:.5rem}.mr-3{margin-right:.75rem}.mr-auto{margin-right:auto}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-8{margin-top:2rem}.mt-auto{margin-top:auto}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.line-clamp-\[8\]{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:8}.block{display:block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.grid{display:grid}.hidden{display:none}.aspect-\[2\/3\]{aspect-ratio:2/3}.aspect-square{aspect-ratio:1 / 1}.aspect-video{aspect-ratio:16 / 9}.h-1\.5{height:.375rem}.h-1\/3{height:33.333333%}.h-10{height:2.5rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-32{height:8rem}.h-4{height:1rem}.h-48{height:12rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-64{height:16rem}.h-8{height:2rem}.h-\[20px\]{height:20px}.h-\[40\%\]{height:40%}.h-\[500px\]{height:500px}.h-\[90vh\]{height:90vh}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.max-h-60{max-height:15rem}.max-h-72{max-height:18rem}.max-h-\[85vh\]{max-height:85vh}.max-h-\[90vh\]{max-height:90vh}.max-h-screen{max-height:100vh}.min-h-0{min-height:0px}.min-h-\[100px\]{min-height:100px}.min-h-\[300px\]{min-height:300px}.min-h-\[60vh\]{min-height:60vh}.min-h-screen{min-height:100vh}.w-1{width:.25rem}.w-1\.5{width:.375rem}.w-1\/2{width:50%}.w-1\/3{width:33.333333%}.w-10{width:2.5rem}.w-11{width:2.75rem}.w-12{width:3rem}.w-14{width:3.5rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-3\/4{width:75%}.w-4{width:1rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-64{width:16rem}.w-72{width:18rem}.w-8{width:2rem}.w-9{width:2.25rem}.w-\[20px\]{width:20px}.w-\[250px\]{width:250px}.w-\[300\%\]{width:300%}.w-\[40\%\]{width:40%}.w-\[55\%\]{width:55%}.w-full{width:100%}.w-px{width:1px}.min-w-0{min-width:0px}.min-w-\[24px\]{min-width:24px}.min-w-\[3ch\]{min-width:3ch}.max-w-2xl{max-width:42rem}.max-w-4xl{max-width:56rem}.max-w-5xl{max-width:64rem}.max-w-6xl{max-width:72rem}.max-w-7xl{max-width:80rem}.max-w-\[1600px\]{max-width:1600px}.max-w-\[1800px\]{max-width:1800px}.max-w-\[1920px\]{max-width:1920px}.max-w-\[200px\]{max-width:200px}.max-w-\[80vw\]{max-width:80vw}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-none{max-width:none}.max-w-sm{max-width:24rem}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.flex-shrink-0,.shrink-0{flex-shrink:0}.origin-center{transform-origin:center}.origin-left{transform-origin:left}.origin-right{transform-origin:right}.-translate-x-1\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-x-full{--tw-translate-x: -100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-4{--tw-translate-x: 1rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-45{--tw-rotate: 45deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-90{--tw-rotate: 90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-\[135deg\]{--tw-rotate: 135deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-100{--tw-scale-x: 1;--tw-scale-y: 1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-110{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-\[0\.80\]{--tw-scale-x: .8;--tw-scale-y: .8;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-\[1\.01\]{--tw-scale-x: 1.01;--tw-scale-y: 1.01;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.animate-\[fadeIn_0\.2s_ease-out\]{animation:fadeIn .2s ease-out}.animate-\[scaleIn_0\.2s_ease-out\]{animation:scaleIn .2s ease-out}@keyframes bounce{0%,to{transform:translateY(-25%);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;animation-timing-function:cubic-bezier(0,0,.2,1)}}.animate-bounce{animation:bounce 1s infinite}@keyframes ping{75%,to{transform:scale(2);opacity:0}}.animate-ping{animation:ping 1s cubic-bezier(0,0,.2,1) infinite}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.cursor-default{cursor:default}.cursor-grab{cursor:grab}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-none{resize:none}.resize{resize:both}.snap-x{scroll-snap-type:x var(--tw-scroll-snap-strictness)}.snap-start{scroll-snap-align:start}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0{gap:0px}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-10{gap:2.5rem}.gap-2{gap:.5rem}.gap-2\.5{gap:.625rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.gap-8{gap:2rem}.gap-\[3px\]{gap:3px}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse: 0;border-top-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(1px * var(--tw-divide-y-reverse))}.divide-gray-800>:not([hidden])~:not([hidden]){--tw-divide-opacity: 1;border-color:rgb(31 41 55 / var(--tw-divide-opacity, 1))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overscroll-contain{overscroll-behavior:contain}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-normal{white-space:normal}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-3xl{border-radius:1.5rem}.rounded-\[3px\]{border-radius:3px}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-sm{border-radius:.125rem}.rounded-xl{border-radius:.75rem}.rounded-r-lg{border-top-right-radius:.5rem;border-bottom-right-radius:.5rem}.border{border-width:1px}.border-2{border-width:2px}.border-y{border-top-width:1px;border-bottom-width:1px}.border-b{border-bottom-width:1px}.border-l-4{border-left-width:4px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-none{border-style:none}.border-\[\#00AFF0\]{--tw-border-opacity: 1;border-color:rgb(0 175 240 / var(--tw-border-opacity, 1))}.border-\[\#00AFF0\]\/20{border-color:#00aff033}.border-\[\#00AFF0\]\/30{border-color:#00aff04d}.border-\[\#00d1ff\]\/20{border-color:#00d1ff33}.border-\[\#1D9BF0\]{--tw-border-opacity: 1;border-color:rgb(29 155 240 / var(--tw-border-opacity, 1))}.border-\[\#333\]{--tw-border-opacity: 1;border-color:rgb(51 51 51 / var(--tw-border-opacity, 1))}.border-\[\#bb86fc\]{--tw-border-opacity: 1;border-color:rgb(187 134 252 / var(--tw-border-opacity, 1))}.border-\[\#bb86fc\]\/20{border-color:#bb86fc33}.border-\[\#bb86fc\]\/30{border-color:#bb86fc4d}.border-\[\#bb86fc\]\/40{border-color:#bb86fc66}.border-\[\#bb86fc\]\/50{border-color:#bb86fc80}.border-\[\#f96854\]{--tw-border-opacity: 1;border-color:rgb(249 104 84 / var(--tw-border-opacity, 1))}.border-\[\#f96854\]\/20{border-color:#f9685433}.border-amber-500{--tw-border-opacity: 1;border-color:rgb(245 158 11 / var(--tw-border-opacity, 1))}.border-blue-500{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.border-blue-500\/20{border-color:#3b82f633}.border-blue-500\/30{border-color:#3b82f64d}.border-gray-300{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.border-gray-500\/30{border-color:#6b72804d}.border-gray-500\/50{border-color:#6b728080}.border-gray-600\/40{border-color:#4b556366}.border-gray-600\/50{border-color:#4b556380}.border-gray-700{--tw-border-opacity: 1;border-color:rgb(55 65 81 / var(--tw-border-opacity, 1))}.border-gray-700\/30{border-color:#3741514d}.border-gray-700\/40{border-color:#37415166}.border-gray-700\/50{border-color:#37415180}.border-gray-700\/60{border-color:#37415199}.border-gray-800{--tw-border-opacity: 1;border-color:rgb(31 41 55 / var(--tw-border-opacity, 1))}.border-gray-800\/30{border-color:#1f29374d}.border-gray-800\/50{border-color:#1f293780}.border-gray-800\/80{border-color:#1f2937cc}.border-gray-900{--tw-border-opacity: 1;border-color:rgb(17 24 39 / var(--tw-border-opacity, 1))}.border-green-500\/30{border-color:#22c55e4d}.border-pink-500{--tw-border-opacity: 1;border-color:rgb(236 72 153 / var(--tw-border-opacity, 1))}.border-pink-500\/30{border-color:#ec48994d}.border-purple-500\/20{border-color:#a855f733}.border-purple-500\/30{border-color:#a855f74d}.border-purple-500\/50{border-color:#a855f780}.border-red-500\/20{border-color:#ef444433}.border-red-500\/30{border-color:#ef44444d}.border-red-500\/50{border-color:#ef444480}.border-transparent{border-color:transparent}.border-white\/10{border-color:#ffffff1a}.border-white\/30{border-color:#ffffff4d}.border-white\/5{border-color:#ffffff0d}.border-white\/50{border-color:#ffffff80}.border-t-transparent{border-top-color:transparent}.border-t-white{--tw-border-opacity: 1;border-top-color:rgb(255 255 255 / var(--tw-border-opacity, 1))}.bg-\[\#000000\],.bg-\[\#000\]{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-\[\#00AFF0\]\/10{background-color:#00aff01a}.bg-\[\#00AFF0\]\/20{background-color:#00aff033}.bg-\[\#00AFF0\]\/90{background-color:#00aff0e6}.bg-\[\#00d1ff\]\/10{background-color:#00d1ff1a}.bg-\[\#00d1ff\]\/5{background-color:#00d1ff0d}.bg-\[\#050505\]{--tw-bg-opacity: 1;background-color:rgb(5 5 5 / var(--tw-bg-opacity, 1))}.bg-\[\#0a0a0a\]{--tw-bg-opacity: 1;background-color:rgb(10 10 10 / var(--tw-bg-opacity, 1))}.bg-\[\#0f0f0f\]{--tw-bg-opacity: 1;background-color:rgb(15 15 15 / var(--tw-bg-opacity, 1))}.bg-\[\#111\]{--tw-bg-opacity: 1;background-color:rgb(17 17 17 / var(--tw-bg-opacity, 1))}.bg-\[\#121212\]{--tw-bg-opacity: 1;background-color:rgb(18 18 18 / var(--tw-bg-opacity, 1))}.bg-\[\#121212\]\/90{background-color:#121212e6}.bg-\[\#151515\]{--tw-bg-opacity: 1;background-color:rgb(21 21 21 / var(--tw-bg-opacity, 1))}.bg-\[\#161616\]{--tw-bg-opacity: 1;background-color:rgb(22 22 22 / var(--tw-bg-opacity, 1))}.bg-\[\#1D9BF0\]\/10{background-color:#1d9bf01a}.bg-\[\#1D9BF0\]\/20{background-color:#1d9bf033}.bg-\[\#1a1a1a\]{--tw-bg-opacity: 1;background-color:rgb(26 26 26 / var(--tw-bg-opacity, 1))}.bg-\[\#1a1a1a\]\/30{background-color:#1a1a1a4d}.bg-\[\#1a1a1a\]\/50{background-color:#1a1a1a80}.bg-\[\#1f1f1f\]{--tw-bg-opacity: 1;background-color:rgb(31 31 31 / var(--tw-bg-opacity, 1))}.bg-\[\#252525\]{--tw-bg-opacity: 1;background-color:rgb(37 37 37 / var(--tw-bg-opacity, 1))}.bg-\[\#2a2a2a\]{--tw-bg-opacity: 1;background-color:rgb(42 42 42 / var(--tw-bg-opacity, 1))}.bg-\[\#bb86fc\]{--tw-bg-opacity: 1;background-color:rgb(187 134 252 / var(--tw-bg-opacity, 1))}.bg-\[\#bb86fc\]\/10{background-color:#bb86fc1a}.bg-\[\#bb86fc\]\/20{background-color:#bb86fc33}.bg-\[\#bb86fc\]\/5{background-color:#bb86fc0d}.bg-\[\#f96854\]\/10{background-color:#f968541a}.bg-\[\#f96854\]\/20{background-color:#f9685433}.bg-amber-500{--tw-bg-opacity: 1;background-color:rgb(245 158 11 / var(--tw-bg-opacity, 1))}.bg-amber-500\/10{background-color:#f59e0b1a}.bg-amber-500\/20{background-color:#f59e0b33}.bg-amber-600{--tw-bg-opacity: 1;background-color:rgb(217 119 6 / var(--tw-bg-opacity, 1))}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-black\/20{background-color:#0003}.bg-black\/30{background-color:#0000004d}.bg-black\/40{background-color:#0006}.bg-black\/50{background-color:#00000080}.bg-black\/60{background-color:#0009}.bg-black\/70{background-color:#000000b3}.bg-black\/80{background-color:#000c}.bg-black\/95{background-color:#000000f2}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.bg-blue-500\/10{background-color:#3b82f61a}.bg-blue-500\/20{background-color:#3b82f633}.bg-blue-600{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.bg-blue-900\/10{background-color:#1e3a8a1a}.bg-emerald-500\/10{background-color:#10b9811a}.bg-emerald-600{--tw-bg-opacity: 1;background-color:rgb(5 150 105 / var(--tw-bg-opacity, 1))}.bg-gray-500\/20{background-color:#6b728033}.bg-gray-600{--tw-bg-opacity: 1;background-color:rgb(75 85 99 / var(--tw-bg-opacity, 1))}.bg-gray-700{--tw-bg-opacity: 1;background-color:rgb(55 65 81 / var(--tw-bg-opacity, 1))}.bg-gray-700\/50{background-color:#37415180}.bg-gray-800{--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.bg-gray-800\/30{background-color:#1f29374d}.bg-gray-800\/40{background-color:#1f293766}.bg-gray-800\/50{background-color:#1f293780}.bg-gray-800\/70{background-color:#1f2937b3}.bg-gray-900{--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity, 1))}.bg-gray-900\/50{background-color:#11182780}.bg-green-500\/20{background-color:#22c55e33}.bg-indigo-500\/10{background-color:#6366f11a}.bg-indigo-600{--tw-bg-opacity: 1;background-color:rgb(79 70 229 / var(--tw-bg-opacity, 1))}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.bg-pink-500{--tw-bg-opacity: 1;background-color:rgb(236 72 153 / var(--tw-bg-opacity, 1))}.bg-pink-500\/10{background-color:#ec48991a}.bg-pink-500\/20{background-color:#ec489933}.bg-pink-600{--tw-bg-opacity: 1;background-color:rgb(219 39 119 / var(--tw-bg-opacity, 1))}.bg-purple-500{--tw-bg-opacity: 1;background-color:rgb(168 85 247 / var(--tw-bg-opacity, 1))}.bg-purple-500\/10{background-color:#a855f71a}.bg-purple-500\/20{background-color:#a855f733}.bg-purple-600{--tw-bg-opacity: 1;background-color:rgb(147 51 234 / var(--tw-bg-opacity, 1))}.bg-purple-900\/10{background-color:#581c871a}.bg-purple-900\/90{background-color:#581c87e6}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-500\/10{background-color:#ef44441a}.bg-red-500\/20{background-color:#ef444433}.bg-red-600{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-white\/10{background-color:#ffffff1a}.bg-white\/20{background-color:#fff3}.bg-yellow-500\/10{background-color:#eab3081a}.bg-\[url\(\'data\:image\/svg\+xml\;base64\,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI\+PGNpcmNsZSBjeD0iMSIgY3k9IjEiIHI9IjEiIGZpbGw9IiMzMzMiLz48L3N2Zz4\=\'\)\]{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGNpcmNsZSBjeD0iMSIgY3k9IjEiIHI9IjEiIGZpbGw9IiMzMzMiLz48L3N2Zz4=)}.bg-gradient-to-b{background-image:linear-gradient(to bottom,var(--tw-gradient-stops))}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.bg-gradient-to-t{background-image:linear-gradient(to top,var(--tw-gradient-stops))}.from-\[\#1a1a1a\]{--tw-gradient-from: #1a1a1a var(--tw-gradient-from-position);--tw-gradient-to: rgb(26 26 26 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-\[\#1f1f1f\]{--tw-gradient-from: #1f1f1f var(--tw-gradient-from-position);--tw-gradient-to: rgb(31 31 31 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-\[\#2a2a2a\]{--tw-gradient-from: #2a2a2a var(--tw-gradient-from-position);--tw-gradient-to: rgb(42 42 42 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-\[\#2a2a2a\]\/80{--tw-gradient-from: rgb(42 42 42 / .8) var(--tw-gradient-from-position);--tw-gradient-to: rgb(42 42 42 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-\[\#bb86fc\]{--tw-gradient-from: #bb86fc var(--tw-gradient-from-position);--tw-gradient-to: rgb(187 134 252 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-\[\#bb86fc\]\/20{--tw-gradient-from: rgb(187 134 252 / .2) var(--tw-gradient-from-position);--tw-gradient-to: rgb(187 134 252 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-black\/60{--tw-gradient-from: rgb(0 0 0 / .6) var(--tw-gradient-from-position);--tw-gradient-to: rgb(0 0 0 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-blue-500{--tw-gradient-from: #3b82f6 var(--tw-gradient-from-position);--tw-gradient-to: rgb(59 130 246 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-gray-200{--tw-gradient-from: #e5e7eb var(--tw-gradient-from-position);--tw-gradient-to: rgb(229 231 235 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-gray-700\/40{--tw-gradient-from: rgb(55 65 81 / .4) var(--tw-gradient-from-position);--tw-gradient-to: rgb(55 65 81 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-gray-800{--tw-gradient-from: #1f2937 var(--tw-gradient-from-position);--tw-gradient-to: rgb(31 41 55 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-red-500{--tw-gradient-from: #ef4444 var(--tw-gradient-from-position);--tw-gradient-to: rgb(239 68 68 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-white{--tw-gradient-from: #fff var(--tw-gradient-from-position);--tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.via-\[\#222\]{--tw-gradient-to: rgb(34 34 34 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), #222 var(--tw-gradient-via-position), var(--tw-gradient-to)}.to-\[\#121212\]{--tw-gradient-to: #121212 var(--tw-gradient-to-position)}.to-\[\#1a1a1a\]{--tw-gradient-to: #1a1a1a var(--tw-gradient-to-position)}.to-\[\#1f1f1f\]{--tw-gradient-to: #1f1f1f var(--tw-gradient-to-position)}.to-\[\#1f1f1f\]\/80{--tw-gradient-to: rgb(31 31 31 / .8) var(--tw-gradient-to-position)}.to-\[\#252525\]{--tw-gradient-to: #252525 var(--tw-gradient-to-position)}.to-\[\#2a2a2a\]{--tw-gradient-to: #2a2a2a var(--tw-gradient-to-position)}.to-\[\#7744cc\]{--tw-gradient-to: #7744cc var(--tw-gradient-to-position)}.to-\[\#9966dd\]{--tw-gradient-to: #9966dd var(--tw-gradient-to-position)}.to-blue-600{--tw-gradient-to: #2563eb var(--tw-gradient-to-position)}.to-gray-400{--tw-gradient-to: #9ca3af var(--tw-gradient-to-position)}.to-gray-600\/40{--tw-gradient-to: rgb(75 85 99 / .4) var(--tw-gradient-to-position)}.to-gray-900{--tw-gradient-to: #111827 var(--tw-gradient-to-position)}.to-red-600{--tw-gradient-to: #dc2626 var(--tw-gradient-to-position)}.to-transparent{--tw-gradient-to: transparent var(--tw-gradient-to-position)}.bg-clip-text{-webkit-background-clip:text;background-clip:text}.fill-black\/20{fill:#0003}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.object-left{-o-object-position:left;object-position:left}.object-right{-o-object-position:right;object-position:right}.p-0\.5{padding:.125rem}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-2{padding:.5rem}.p-2\.5{padding:.625rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.p-\[3px\]{padding:3px}.px-0{padding-left:0;padding-right:0}.px-1{padding-left:.25rem;padding-right:.25rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-8{padding-left:2rem;padding-right:2rem}.py-0{padding-top:0;padding-bottom:0}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-16{padding-top:4rem;padding-bottom:4rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-20{padding-top:5rem;padding-bottom:5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-5{padding-top:1.25rem;padding-bottom:1.25rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-2{padding-bottom:.5rem}.pb-24{padding-bottom:6rem}.pb-8{padding-bottom:2rem}.pl-10{padding-left:2.5rem}.pl-2{padding-left:.5rem}.pl-3{padding-left:.75rem}.pl-4{padding-left:1rem}.pr-1{padding-right:.25rem}.pr-10{padding-right:2.5rem}.pr-2{padding-right:.5rem}.pr-4{padding-right:1rem}.pt-0\.5{padding-top:.125rem}.pt-1{padding-top:.25rem}.pt-2{padding-top:.5rem}.pt-24{padding-top:6rem}.pt-4{padding-top:1rem}.pt-8{padding-top:2rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[8px\]{font-size:8px}.text-\[9px\]{font-size:9px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-black{font-weight:900}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.capitalize{text-transform:capitalize}.italic{font-style:italic}.leading-relaxed{line-height:1.625}.leading-tight{line-height:1.25}.tracking-tight{letter-spacing:-.025em}.tracking-tighter{letter-spacing:-.05em}.tracking-wide{letter-spacing:.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-\[\#0088cc\]{--tw-text-opacity: 1;color:rgb(0 136 204 / var(--tw-text-opacity, 1))}.text-\[\#00AFF0\]{--tw-text-opacity: 1;color:rgb(0 175 240 / var(--tw-text-opacity, 1))}.text-\[\#00d1ff\]{--tw-text-opacity: 1;color:rgb(0 209 255 / var(--tw-text-opacity, 1))}.text-\[\#1D9BF0\]{--tw-text-opacity: 1;color:rgb(29 155 240 / var(--tw-text-opacity, 1))}.text-\[\#3ea6ff\]{--tw-text-opacity: 1;color:rgb(62 166 255 / var(--tw-text-opacity, 1))}.text-\[\#bb86fc\]{--tw-text-opacity: 1;color:rgb(187 134 252 / var(--tw-text-opacity, 1))}.text-\[\#f96854\]{--tw-text-opacity: 1;color:rgb(249 104 84 / var(--tw-text-opacity, 1))}.text-amber-300{--tw-text-opacity: 1;color:rgb(252 211 77 / var(--tw-text-opacity, 1))}.text-amber-400{--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.text-amber-500{--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}.text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity, 1))}.text-blue-300{--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-emerald-500{--tw-text-opacity: 1;color:rgb(16 185 129 / var(--tw-text-opacity, 1))}.text-gray-200{--tw-text-opacity: 1;color:rgb(229 231 235 / var(--tw-text-opacity, 1))}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-green-300{--tw-text-opacity: 1;color:rgb(134 239 172 / var(--tw-text-opacity, 1))}.text-green-400{--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.text-indigo-400{--tw-text-opacity: 1;color:rgb(129 140 248 / var(--tw-text-opacity, 1))}.text-pink-300{--tw-text-opacity: 1;color:rgb(249 168 212 / var(--tw-text-opacity, 1))}.text-pink-400{--tw-text-opacity: 1;color:rgb(244 114 182 / var(--tw-text-opacity, 1))}.text-purple-100{--tw-text-opacity: 1;color:rgb(243 232 255 / var(--tw-text-opacity, 1))}.text-purple-200{--tw-text-opacity: 1;color:rgb(233 213 255 / var(--tw-text-opacity, 1))}.text-purple-300{--tw-text-opacity: 1;color:rgb(216 180 254 / var(--tw-text-opacity, 1))}.text-purple-400{--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-red-500\/50{color:#ef444480}.text-red-500\/80{color:#ef4444cc}.text-transparent{color:transparent}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-white\/40{color:#fff6}.text-white\/50{color:#ffffff80}.text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.text-yellow-500\/80{color:#eab308cc}.underline{text-decoration-line:underline}.no-underline{text-decoration-line:none}.decoration-\[\#bb86fc\]\/30{text-decoration-color:#bb86fc4d}.decoration-gray-600{text-decoration-color:#4b5563}.underline-offset-2{text-underline-offset:2px}.placeholder-gray-400::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(156 163 175 / var(--tw-placeholder-opacity, 1))}.placeholder-gray-400::placeholder{--tw-placeholder-opacity: 1;color:rgb(156 163 175 / var(--tw-placeholder-opacity, 1))}.placeholder-gray-500::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(107 114 128 / var(--tw-placeholder-opacity, 1))}.placeholder-gray-500::placeholder{--tw-placeholder-opacity: 1;color:rgb(107 114 128 / var(--tw-placeholder-opacity, 1))}.placeholder-gray-600::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(75 85 99 / var(--tw-placeholder-opacity, 1))}.placeholder-gray-600::placeholder{--tw-placeholder-opacity: 1;color:rgb(75 85 99 / var(--tw-placeholder-opacity, 1))}.accent-\[\#bb86fc\]{accent-color:#bb86fc}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-30{opacity:.3}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.opacity-70{opacity:.7}.opacity-80{opacity:.8}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\[0_0_15px_-3px_rgba\(168\,85\,247\,0\.3\)\]{--tw-shadow: 0 0 15px -3px rgba(168,85,247,.3);--tw-shadow-colored: 0 0 15px -3px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\[0_0_15px_rgba\(187\,134\,252\,0\.2\)\]{--tw-shadow: 0 0 15px rgba(187,134,252,.2);--tw-shadow-colored: 0 0 15px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\[0_0_15px_rgba\(245\,158\,11\,0\.4\)\]{--tw-shadow: 0 0 15px rgba(245,158,11,.4);--tw-shadow-colored: 0 0 15px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\[0_0_8px_\#bb86fc\]{--tw-shadow: 0 0 8px #bb86fc;--tw-shadow-colored: 0 0 8px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\[0_20px_50px_rgba\(0\,0\,0\,0\.8\)\]{--tw-shadow: 0 20px 50px rgba(0,0,0,.8);--tw-shadow-colored: 0 20px 50px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\[0_8px_32px_0_rgba\(0\,0\,0\,0\.5\)\]{--tw-shadow: 0 8px 32px 0 rgba(0,0,0,.5);--tw-shadow-colored: 0 8px 32px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-none{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\[\#00AFF0\]\/20{--tw-shadow-color: rgb(0 175 240 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-\[\#bb86fc\]\/10{--tw-shadow-color: rgb(187 134 252 / .1);--tw-shadow: var(--tw-shadow-colored)}.shadow-\[\#bb86fc\]\/20{--tw-shadow-color: rgb(187 134 252 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-\[\#bb86fc\]\/30{--tw-shadow-color: rgb(187 134 252 / .3);--tw-shadow: var(--tw-shadow-colored)}.shadow-amber-500\/20{--tw-shadow-color: rgb(245 158 11 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-blue-500\/20{--tw-shadow-color: rgb(59 130 246 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-emerald-500\/20{--tw-shadow-color: rgb(16 185 129 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-indigo-500\/20{--tw-shadow-color: rgb(99 102 241 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-orange-500\/20{--tw-shadow-color: rgb(249 115 22 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-pink-500\/20{--tw-shadow-color: rgb(236 72 153 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-purple-500\/20{--tw-shadow-color: rgb(168 85 247 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-purple-600\/30{--tw-shadow-color: rgb(147 51 234 / .3);--tw-shadow: var(--tw-shadow-colored)}.shadow-purple-900\/20{--tw-shadow-color: rgb(88 28 135 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-red-500\/20{--tw-shadow-color: rgb(239 68 68 / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-red-600\/20{--tw-shadow-color: rgb(220 38 38 / .2);--tw-shadow: var(--tw-shadow-colored)}.ring-1{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-4{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-\[\#bb86fc\]{--tw-ring-opacity: 1;--tw-ring-color: rgb(187 134 252 / var(--tw-ring-opacity, 1))}.ring-\[\#bb86fc\]\/10{--tw-ring-color: rgb(187 134 252 / .1)}.ring-\[\#bb86fc\]\/20{--tw-ring-color: rgb(187 134 252 / .2)}.blur-0{--tw-blur: blur(0);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.blur-3xl{--tw-blur: blur(64px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.blur-md{--tw-blur: blur(12px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.drop-shadow-\[0_0_5px_rgba\(255\,255\,255\,0\.5\)\]{--tw-drop-shadow: drop-shadow(0 0 5px rgba(255,255,255,.5));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.drop-shadow-\[0_2px_4px_rgba\(0\,0\,0\,0\.6\)\]{--tw-drop-shadow: drop-shadow(0 2px 4px rgba(0,0,0,.6));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.grayscale{--tw-grayscale: grayscale(100%);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-\[8px\]{--tw-backdrop-blur: blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-md{--tw-backdrop-blur: blur(12px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-none{transition-property:none}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.delay-300{transition-delay:.3s}.duration-1000{transition-duration:1s}.duration-150{transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}.duration-700{transition-duration:.7s}.duration-\[400ms\]{transition-duration:.4s}.duration-\[600ms\]{transition-duration:.6s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.ease-linear{transition-timing-function:linear}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}.will-change-transform{will-change:transform}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}@keyframes fadeIn{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}@keyframes fadeOut{0%{opacity:1}to{opacity:0}}@keyframes fadeInUp{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}@keyframes quickFadeIn{0%{opacity:0;transform:scale(.98)}to{opacity:1;transform:scale(1)}}.animate-quick-fade-in{animation:quickFadeIn .15s ease-out forwards}@keyframes smoothFadeIn{0%{opacity:0;transform:scale(.98)}50%{opacity:.5}to{opacity:1;transform:scale(1)}}.animate-smooth-fade-in{animation:smoothFadeIn 1.2s ease-out forwards}.masonry-container{-moz-column-count:2;column-count:2;-moz-column-gap:4px;column-gap:4px}@media (min-width: 640px){.masonry-container{-moz-column-count:3;column-count:3}}@media (min-width: 768px){.masonry-container{-moz-column-count:4;column-count:4}}@media (min-width: 1024px){.masonry-container{-moz-column-count:5;column-count:5}}@media (min-width: 1280px){.masonry-container{-moz-column-count:6;column-count:6}}@keyframes shimmer{0%{background-position:-1000px 0}to{background-position:1000px 0}}.animate-shimmer{animation:shimmer 2.5s infinite}.masonry-item{-moz-column-break-inside:avoid;break-inside:avoid;margin-bottom:4px;display:inline-block;width:100%}@keyframes slideInUp{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}@keyframes slideInDown{0%{opacity:0;transform:translateY(-20px)}to{opacity:1;transform:translateY(0)}}@keyframes slideInLeft{0%{opacity:0;transform:translate(-20px)}to{opacity:1;transform:translate(0)}}@keyframes slideInRight{0%{opacity:0;transform:translate(20px)}to{opacity:1;transform:translate(0)}}@keyframes glow{0%,to{box-shadow:0 0 5px #8b5cf61a}50%{box-shadow:0 0 20px #8b5cf64d}}@keyframes pulse-color{0%,to{color:currentColor}50%{color:#8b5cf699}}.animate-slide-in-up{animation:slideInUp .5s ease-out forwards}.animate-slide-in-down{animation:slideInDown .5s ease-out forwards}.animate-slide-in-left{animation:slideInLeft .5s ease-out forwards}.animate-slide-in-right{animation:slideInRight .5s ease-out forwards}.animate-glow{animation:glow 2s ease-in-out infinite}.animate-pulse-color{animation:pulse-color 2s ease-in-out infinite}::-webkit-scrollbar,html::-webkit-scrollbar,body::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-track,html::-webkit-scrollbar-track,body::-webkit-scrollbar-track{background:transparent}::-webkit-scrollbar-thumb,html::-webkit-scrollbar-thumb,body::-webkit-scrollbar-thumb{background-color:#4b5563;border-radius:10px;border:2px solid transparent;background-clip:padding-box}::-webkit-scrollbar-thumb:hover,html::-webkit-scrollbar-thumb:hover,body::-webkit-scrollbar-thumb:hover{background-color:#bb86fc;border:2px solid transparent;background-clip:padding-box}*{scrollbar-width:thin;scrollbar-color:#4b5563 transparent}html,body{scrollbar-width:thin;scrollbar-color:#4b5563 #121212}.after\:absolute:after{content:var(--tw-content);position:absolute}.after\:left-\[2px\]:after{content:var(--tw-content);left:2px}.after\:top-\[2px\]:after{content:var(--tw-content);top:2px}.after\:h-4:after{content:var(--tw-content);height:1rem}.after\:h-5:after{content:var(--tw-content);height:1.25rem}.after\:w-4:after{content:var(--tw-content);width:1rem}.after\:w-5:after{content:var(--tw-content);width:1.25rem}.after\:rounded-full:after{content:var(--tw-content);border-radius:9999px}.after\:border:after{content:var(--tw-content);border-width:1px}.after\:border-gray-300:after{content:var(--tw-content);--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.after\:bg-white:after{content:var(--tw-content);--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.after\:transition-all:after{content:var(--tw-content);transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.after\:content-\[\'\'\]:after{--tw-content: "";content:var(--tw-content)}.hover\:rotate-180:hover{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:rotate-90:hover{--tw-rotate: 90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:scale-105:hover{--tw-scale-x: 1.05;--tw-scale-y: 1.05;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:scale-110:hover{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:scale-125:hover{--tw-scale-x: 1.25;--tw-scale-y: 1.25;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:scale-\[1\.02\]:hover{--tw-scale-x: 1.02;--tw-scale-y: 1.02;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:border-\[\#24A1DE\]:hover{--tw-border-opacity: 1;border-color:rgb(36 161 222 / var(--tw-border-opacity, 1))}.hover\:border-\[\#FF424D\]:hover{--tw-border-opacity: 1;border-color:rgb(255 66 77 / var(--tw-border-opacity, 1))}.hover\:border-\[\#bb86fc\]\/30:hover{border-color:#bb86fc4d}.hover\:border-\[\#bb86fc\]\/50:hover{border-color:#bb86fc80}.hover\:border-blue-500:hover{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.hover\:border-gray-500:hover{--tw-border-opacity: 1;border-color:rgb(107 114 128 / var(--tw-border-opacity, 1))}.hover\:border-gray-600:hover{--tw-border-opacity: 1;border-color:rgb(75 85 99 / var(--tw-border-opacity, 1))}.hover\:border-gray-600\/70:hover{border-color:#4b5563b3}.hover\:border-gray-700:hover{--tw-border-opacity: 1;border-color:rgb(55 65 81 / var(--tw-border-opacity, 1))}.hover\:border-purple-500:hover{--tw-border-opacity: 1;border-color:rgb(168 85 247 / var(--tw-border-opacity, 1))}.hover\:border-purple-500\/50:hover{border-color:#a855f780}.hover\:border-red-500:hover{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.hover\:border-white:hover{--tw-border-opacity: 1;border-color:rgb(255 255 255 / var(--tw-border-opacity, 1))}.hover\:border-white\/10:hover{border-color:#ffffff1a}.hover\:bg-\[\#00AFF0\]\/20:hover{background-color:#00aff033}.hover\:bg-\[\#00d1ff\]\/20:hover{background-color:#00d1ff33}.hover\:bg-\[\#1f1f1f\]:hover{--tw-bg-opacity: 1;background-color:rgb(31 31 31 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#242424\]:hover{--tw-bg-opacity: 1;background-color:rgb(36 36 36 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#2a2a2a\]:hover{--tw-bg-opacity: 1;background-color:rgb(42 42 42 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#333\]:hover{--tw-bg-opacity: 1;background-color:rgb(51 51 51 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#9966dd\]:hover{--tw-bg-opacity: 1;background-color:rgb(153 102 221 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#bb86fc\]:hover{--tw-bg-opacity: 1;background-color:rgb(187 134 252 / var(--tw-bg-opacity, 1))}.hover\:bg-\[\#bb86fc\]\/10:hover{background-color:#bb86fc1a}.hover\:bg-\[\#bb86fc\]\/20:hover{background-color:#bb86fc33}.hover\:bg-\[\#bb86fc\]\/30:hover{background-color:#bb86fc4d}.hover\:bg-\[\#bb86fc\]\/5:hover{background-color:#bb86fc0d}.hover\:bg-\[\#f96854\]\/20:hover{background-color:#f9685433}.hover\:bg-amber-600:hover{--tw-bg-opacity: 1;background-color:rgb(217 119 6 / var(--tw-bg-opacity, 1))}.hover\:bg-amber-700:hover{--tw-bg-opacity: 1;background-color:rgb(180 83 9 / var(--tw-bg-opacity, 1))}.hover\:bg-blue-500\/5:hover{background-color:#3b82f60d}.hover\:bg-blue-700:hover{--tw-bg-opacity: 1;background-color:rgb(29 78 216 / var(--tw-bg-opacity, 1))}.hover\:bg-emerald-500\/20:hover{background-color:#10b98133}.hover\:bg-emerald-700:hover{--tw-bg-opacity: 1;background-color:rgb(4 120 87 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-600:hover{--tw-bg-opacity: 1;background-color:rgb(75 85 99 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-700:hover{--tw-bg-opacity: 1;background-color:rgb(55 65 81 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-800:hover{--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.hover\:bg-indigo-700:hover{--tw-bg-opacity: 1;background-color:rgb(67 56 202 / var(--tw-bg-opacity, 1))}.hover\:bg-orange-600:hover{--tw-bg-opacity: 1;background-color:rgb(234 88 12 / var(--tw-bg-opacity, 1))}.hover\:bg-pink-600:hover{--tw-bg-opacity: 1;background-color:rgb(219 39 119 / var(--tw-bg-opacity, 1))}.hover\:bg-pink-700:hover{--tw-bg-opacity: 1;background-color:rgb(190 24 93 / var(--tw-bg-opacity, 1))}.hover\:bg-purple-500\/30:hover{background-color:#a855f74d}.hover\:bg-purple-600:hover{--tw-bg-opacity: 1;background-color:rgb(147 51 234 / var(--tw-bg-opacity, 1))}.hover\:bg-purple-700:hover{--tw-bg-opacity: 1;background-color:rgb(126 34 206 / var(--tw-bg-opacity, 1))}.hover\:bg-red-400\/10:hover{background-color:#f871711a}.hover\:bg-red-500\/10:hover{background-color:#ef44441a}.hover\:bg-red-500\/20:hover{background-color:#ef444433}.hover\:bg-red-500\/30:hover{background-color:#ef44444d}.hover\:bg-red-600:hover{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.hover\:bg-red-700:hover{--tw-bg-opacity: 1;background-color:rgb(185 28 28 / var(--tw-bg-opacity, 1))}.hover\:bg-white\/10:hover{background-color:#ffffff1a}.hover\:bg-white\/20:hover{background-color:#fff3}.hover\:bg-white\/5:hover{background-color:#ffffff0d}.hover\:from-\[\#9966dd\]:hover{--tw-gradient-from: #9966dd var(--tw-gradient-from-position);--tw-gradient-to: rgb(153 102 221 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.hover\:from-gray-700\/60:hover{--tw-gradient-from: rgb(55 65 81 / .6) var(--tw-gradient-from-position);--tw-gradient-to: rgb(55 65 81 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.hover\:to-\[\#7744cc\]:hover{--tw-gradient-to: #7744cc var(--tw-gradient-to-position)}.hover\:to-gray-600\/60:hover{--tw-gradient-to: rgb(75 85 99 / .6) var(--tw-gradient-to-position)}.hover\:text-\[\#24A1DE\]:hover{--tw-text-opacity: 1;color:rgb(36 161 222 / var(--tw-text-opacity, 1))}.hover\:text-\[\#FF424D\]:hover{--tw-text-opacity: 1;color:rgb(255 66 77 / var(--tw-text-opacity, 1))}.hover\:text-\[\#bb86fc\]:hover{--tw-text-opacity: 1;color:rgb(187 134 252 / var(--tw-text-opacity, 1))}.hover\:text-blue-300:hover{--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.hover\:text-purple-400:hover{--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.hover\:text-red-400:hover{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.hover\:text-red-500:hover{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.hover\:text-white:hover{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:decoration-white:hover{text-decoration-color:#fff}.hover\:opacity-100:hover{opacity:1}.hover\:shadow-lg:hover{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-purple-500\/20:hover{--tw-shadow-color: rgb(168 85 247 / .2);--tw-shadow: var(--tw-shadow-colored)}.hover\:shadow-purple-600\/50:hover{--tw-shadow-color: rgb(147 51 234 / .5);--tw-shadow: var(--tw-shadow-colored)}.hover\:brightness-110:hover{--tw-brightness: brightness(1.1);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.hover\:grayscale-0:hover{--tw-grayscale: grayscale(0);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.focus\:border-\[\#00d1ff\]\/50:focus{border-color:#00d1ff80}.focus\:border-\[\#bb86fc\]:focus{--tw-border-opacity: 1;border-color:rgb(187 134 252 / var(--tw-border-opacity, 1))}.focus\:border-blue-500:focus{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.focus\:border-gray-600:focus{--tw-border-opacity: 1;border-color:rgb(75 85 99 / var(--tw-border-opacity, 1))}.focus\:border-pink-500:focus{--tw-border-opacity: 1;border-color:rgb(236 72 153 / var(--tw-border-opacity, 1))}.focus\:border-purple-500:focus{--tw-border-opacity: 1;border-color:rgb(168 85 247 / var(--tw-border-opacity, 1))}.focus\:border-purple-500\/50:focus{border-color:#a855f780}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-\[\#bb86fc\]\/30:focus{--tw-ring-color: rgb(187 134 252 / .3)}.focus\:ring-purple-500\/50:focus{--tw-ring-color: rgb(168 85 247 / .5)}.active\:scale-95:active{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.active\:scale-\[0\.98\]:active{--tw-scale-x: .98;--tw-scale-y: .98;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.active\:cursor-grabbing:active{cursor:grabbing}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:text-gray-600:disabled{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.disabled\:opacity-50:disabled{opacity:.5}.disabled\:hover\:bg-\[\#1a1a1a\]:hover:disabled{--tw-bg-opacity: 1;background-color:rgb(26 26 26 / var(--tw-bg-opacity, 1))}.group\/next:hover .group-hover\/next\:translate-x-0\.5{--tw-translate-x: .125rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group\/prev:hover .group-hover\/prev\:-translate-x-0\.5{--tw-translate-x: -.125rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:-translate-x-1{--tw-translate-x: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:-translate-y-0\.5{--tw-translate-y: -.125rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:translate-x-0\.5{--tw-translate-x: .125rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:rotate-12{--tw-rotate: 12deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:scale-105{--tw-scale-x: 1.05;--tw-scale-y: 1.05;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:scale-110{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:border-amber-500\/50{border-color:#f59e0b80}.group:hover .group-hover\:border-purple-500\/50{border-color:#a855f780}.group:hover .group-hover\:bg-\[\#bb86fc\]\/40{background-color:#bb86fc66}.group:hover .group-hover\:bg-blue-500\/20{background-color:#3b82f633}.group:hover .group-hover\:bg-gray-700\/80{background-color:#374151cc}.group:hover .group-hover\:bg-purple-500\/40{background-color:#a855f766}.group\/btn:hover .group-hover\/btn\:text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.group\/next:hover .group-hover\/next\:text-\[\#bb86fc\]{--tw-text-opacity: 1;color:rgb(187 134 252 / var(--tw-text-opacity, 1))}.group\/next:hover .group-hover\/next\:text-\[\#bb86fc\]\/80{color:#bb86fccc}.group\/next:hover .group-hover\/next\:text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.group\/prev:hover .group-hover\/prev\:text-\[\#bb86fc\]{--tw-text-opacity: 1;color:rgb(187 134 252 / var(--tw-text-opacity, 1))}.group\/prev:hover .group-hover\/prev\:text-\[\#bb86fc\]\/80{color:#bb86fccc}.group\/prev:hover .group-hover\/prev\:text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-\[\#bb86fc\]{--tw-text-opacity: 1;color:rgb(187 134 252 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-purple-400{--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-white\/60{color:#fff9}.group:hover .group-hover\:opacity-100{opacity:1}.peer:checked~.peer-checked\:bg-\[\#bb86fc\]{--tw-bg-opacity: 1;background-color:rgb(187 134 252 / var(--tw-bg-opacity, 1))}.peer:checked~.peer-checked\:bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.peer:checked~.peer-checked\:bg-pink-500{--tw-bg-opacity: 1;background-color:rgb(236 72 153 / var(--tw-bg-opacity, 1))}.peer:checked~.peer-checked\:bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.peer:checked~.peer-checked\:after\:translate-x-full:after{content:var(--tw-content);--tw-translate-x: 100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.peer:checked~.peer-checked\:after\:border-white:after{content:var(--tw-content);--tw-border-opacity: 1;border-color:rgb(255 255 255 / var(--tw-border-opacity, 1))}.peer:focus~.peer-focus\:outline-none{outline:2px solid transparent;outline-offset:2px}@media (min-width: 640px){.sm\:left-8{left:2rem}.sm\:right-8{right:2rem}.sm\:mt-2{margin-top:.5rem}.sm\:inline{display:inline}.sm\:flex{display:flex}.sm\:h-10{height:2.5rem}.sm\:h-14{height:3.5rem}.sm\:h-5{height:1.25rem}.sm\:h-6{height:1.5rem}.sm\:w-10{width:2.5rem}.sm\:w-14{width:3.5rem}.sm\:w-5{width:1.25rem}.sm\:w-56{width:14rem}.sm\:w-6{width:1.5rem}.sm\:w-auto{width:auto}.sm\:w-fit{width:-moz-fit-content;width:fit-content}.sm\:max-w-md{max-width:28rem}.sm\:flex-none{flex:none}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:justify-start{justify-content:flex-start}.sm\:gap-0{gap:0px}.sm\:gap-1{gap:.25rem}.sm\:gap-2{gap:.5rem}.sm\:gap-3{gap:.75rem}.sm\:gap-4{gap:1rem}.sm\:gap-6{gap:1.5rem}.sm\:p-12{padding:3rem}.sm\:p-2\.5{padding:.625rem}.sm\:p-4{padding:1rem}.sm\:p-6{padding:1.5rem}.sm\:px-10{padding-left:2.5rem;padding-right:2.5rem}.sm\:px-4{padding-left:1rem;padding-right:1rem}.sm\:px-6{padding-left:1.5rem;padding-right:1.5rem}.sm\:py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.sm\:py-6{padding-top:1.5rem;padding-bottom:1.5rem}.sm\:text-left{text-align:left}.sm\:text-2xl{font-size:1.5rem;line-height:2rem}.sm\:text-\[11px\]{font-size:11px}.sm\:text-base{font-size:1rem;line-height:1.5rem}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}.sm\:text-xl{font-size:1.25rem;line-height:1.75rem}}@media (min-width: 768px){.md\:absolute{position:absolute}.md\:relative{position:relative}.md\:right-8{right:2rem}.md\:top-0{top:0}.md\:mx-0{margin-left:0;margin-right:0}.md\:block{display:block}.md\:flex{display:flex}.md\:hidden{display:none}.md\:w-24{width:6rem}.md\:flex-none{flex:none}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:flex-col{flex-direction:column}.md\:gap-5{gap:1.25rem}.md\:border-y-0{border-top-width:0px;border-bottom-width:0px}.md\:p-12{padding:3rem}.md\:px-12{padding-left:3rem;padding-right:3rem}.md\:px-8{padding-left:2rem;padding-right:2rem}.md\:py-0{padding-top:0;padding-bottom:0}}@media (min-width: 1024px){.lg\:w-64{width:16rem}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.lg\:gap-12{gap:3rem}.lg\:text-2xl{font-size:1.5rem;line-height:2rem}.lg\:text-base{font-size:1rem;line-height:1.5rem}}@media (min-width: 1280px){.xl\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.xl\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.xl\:flex-row{flex-direction:row}} diff --git a/dist/assets/index-qBndKydj.js b/dist/assets/index-qBndKydj.js new file mode 100644 index 0000000000000000000000000000000000000000..cfad9673608f1ce7ba13080e733e208283114932 --- /dev/null +++ b/dist/assets/index-qBndKydj.js @@ -0,0 +1,3687 @@ +(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();var ec=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Yc(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Uw={exports:{}},Xc={},zw={exports:{}},ze={};/** + * @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 Tl=Symbol.for("react.element"),YT=Symbol.for("react.portal"),XT=Symbol.for("react.fragment"),JT=Symbol.for("react.strict_mode"),ZT=Symbol.for("react.profiler"),eS=Symbol.for("react.provider"),tS=Symbol.for("react.context"),nS=Symbol.for("react.forward_ref"),rS=Symbol.for("react.suspense"),iS=Symbol.for("react.memo"),sS=Symbol.for("react.lazy"),Ky=Symbol.iterator;function oS(t){return t===null||typeof t!="object"?null:(t=Ky&&t[Ky]||t["@@iterator"],typeof t=="function"?t:null)}var Bw={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},$w=Object.assign,Hw={};function Fo(t,e,n){this.props=t,this.context=e,this.refs=Hw,this.updater=n||Bw}Fo.prototype.isReactComponent={};Fo.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=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,t,e,"setState")};Fo.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function qw(){}qw.prototype=Fo.prototype;function Gp(t,e,n){this.props=t,this.context=e,this.refs=Hw,this.updater=n||Bw}var Kp=Gp.prototype=new qw;Kp.constructor=Gp;$w(Kp,Fo.prototype);Kp.isPureReactComponent=!0;var Qy=Array.isArray,Ww=Object.prototype.hasOwnProperty,Qp={current:null},Gw={key:!0,ref:!0,__self:!0,__source:!0};function Kw(t,e,n){var r,i={},s=null,o=null;if(e!=null)for(r in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(s=""+e.key),e)Ww.call(e,r)&&!Gw.hasOwnProperty(r)&&(i[r]=e[r]);var a=arguments.length-2;if(a===1)i.children=n;else if(1>>1,ye=q[ge];if(0>>1;gei(Z,k))iei(Te,Z)?(q[ge]=Te,q[ie]=k,ge=ie):(q[ge]=Z,q[$]=k,ge=$);else if(iei(Te,k))q[ge]=Te,q[ie]=k,ge=ie;else break e}}return oe}function i(q,oe){var k=q.sortIndex-oe.sortIndex;return k!==0?k:q.id-oe.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;t.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();t.unstable_now=function(){return o.now()-a}}var u=[],c=[],f=1,h=null,p=3,g=!1,_=!1,S=!1,P=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,x=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function E(q){for(var oe=n(c);oe!==null;){if(oe.callback===null)r(c);else if(oe.startTime<=q)r(c),oe.sortIndex=oe.expirationTime,e(u,oe);else break;oe=n(c)}}function O(q){if(S=!1,E(q),!_)if(n(u)!==null)_=!0,le(L);else{var oe=n(c);oe!==null&&me(O,oe.startTime-q)}}function L(q,oe){_=!1,S&&(S=!1,v(w),w=-1),g=!0;var k=p;try{for(E(oe),h=n(u);h!==null&&(!(h.expirationTime>oe)||q&&!N());){var ge=h.callback;if(typeof ge=="function"){h.callback=null,p=h.priorityLevel;var ye=ge(h.expirationTime<=oe);oe=t.unstable_now(),typeof ye=="function"?h.callback=ye:h===n(u)&&r(u),E(oe)}else r(u);h=n(u)}if(h!==null)var R=!0;else{var $=n(c);$!==null&&me(O,$.startTime-oe),R=!1}return R}finally{h=null,p=k,g=!1}}var D=!1,b=null,w=-1,T=5,A=-1;function N(){return!(t.unstable_now()-Aq||125ge?(q.sortIndex=k,e(c,q),n(u)===null&&q===n(c)&&(S?(v(w),w=-1):S=!0,me(O,k-ge))):(q.sortIndex=ye,e(u,q),_||g||(_=!0,le(L))),q},t.unstable_shouldYield=N,t.unstable_wrapCallback=function(q){var oe=p;return function(){var k=p;p=oe;try{return q.apply(this,arguments)}finally{p=k}}}})(Zw);Jw.exports=Zw;var yS=Jw.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 vS=F,Fn=yS;function Y(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),df=Object.prototype.hasOwnProperty,xS=/^[: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]*$/,Xy={},Jy={};function wS(t){return df.call(Jy,t)?!0:df.call(Xy,t)?!1:xS.test(t)?Jy[t]=!0:(Xy[t]=!0,!1)}function _S(t,e,n,r){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function bS(t,e,n,r){if(e===null||typeof e>"u"||_S(t,e,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function mn(t,e,n,r,i,s,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=s,this.removeEmptyString=o}var Zt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Zt[t]=new mn(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Zt[e]=new mn(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Zt[t]=new mn(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Zt[t]=new mn(t,2,!1,t,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(t){Zt[t]=new mn(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Zt[t]=new mn(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Zt[t]=new mn(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Zt[t]=new mn(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Zt[t]=new mn(t,5,!1,t.toLowerCase(),null,!1,!1)});var Xp=/[\-:]([a-z])/g;function Jp(t){return t[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(t){var e=t.replace(Xp,Jp);Zt[e]=new mn(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(Xp,Jp);Zt[e]=new mn(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(Xp,Jp);Zt[e]=new mn(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Zt[t]=new mn(t,1,!1,t.toLowerCase(),null,!1,!1)});Zt.xlinkHref=new mn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Zt[t]=new mn(t,1,!1,t.toLowerCase(),null,!0,!0)});function Zp(t,e,n,r){var i=Zt.hasOwnProperty(e)?Zt[e]:null;(i!==null?i.type!==0:r||!(2a||i[o]!==s[a]){var u=` +`+i[o].replace(" at new "," at ");return t.displayName&&u.includes("")&&(u=u.replace("",t.displayName)),u}while(1<=o&&0<=a);break}}}finally{fh=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?wa(t):""}function ES(t){switch(t.tag){case 5:return wa(t.type);case 16:return wa("Lazy");case 13:return wa("Suspense");case 19:return wa("SuspenseList");case 0:case 2:case 15:return t=ph(t.type,!1),t;case 11:return t=ph(t.type.render,!1),t;case 1:return t=ph(t.type,!0),t;default:return""}}function mf(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case Xs:return"Fragment";case Ys:return"Portal";case hf:return"Profiler";case em:return"StrictMode";case ff:return"Suspense";case pf:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case n_:return(t.displayName||"Context")+".Consumer";case t_:return(t._context.displayName||"Context")+".Provider";case tm:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case nm:return e=t.displayName||null,e!==null?e:mf(t.type)||"Memo";case yi:e=t._payload,t=t._init;try{return mf(t(e))}catch{}}return null}function IS(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return mf(e);case 8:return e===em?"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 e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function Ui(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function i_(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function TS(t){var e=i_(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,s=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,s.call(this,o)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function tu(t){t._valueTracker||(t._valueTracker=TS(t))}function s_(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=i_(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function tc(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function gf(t,e){var n=e.checked;return gt({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function e0(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=Ui(e.value!=null?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function o_(t,e){e=e.checked,e!=null&&Zp(t,"checked",e,!1)}function yf(t,e){o_(t,e);var n=Ui(e.value),r=e.type;if(n!=null)r==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?vf(t,e.type,n):e.hasOwnProperty("defaultValue")&&vf(t,e.type,Ui(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function t0(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function vf(t,e,n){(e!=="number"||tc(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var _a=Array.isArray;function uo(t,e,n,r){if(t=t.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=nu.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Ya(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var Aa={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},SS=["Webkit","ms","Moz","O"];Object.keys(Aa).forEach(function(t){SS.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),Aa[e]=Aa[t]})});function c_(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||Aa.hasOwnProperty(t)&&Aa[t]?(""+e).trim():e+"px"}function d_(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=c_(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,i):t[n]=i}}var kS=gt({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 _f(t,e){if(e){if(kS[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(Y(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(Y(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(Y(61))}if(e.style!=null&&typeof e.style!="object")throw Error(Y(62))}}function bf(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){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 Ef=null;function rm(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var If=null,co=null,ho=null;function i0(t){if(t=Cl(t)){if(typeof If!="function")throw Error(Y(280));var e=t.stateNode;e&&(e=nd(e),If(t.stateNode,t.type,e))}}function h_(t){co?ho?ho.push(t):ho=[t]:co=t}function f_(){if(co){var t=co,e=ho;if(ho=co=null,i0(t),e)for(t=0;t>>=0,t===0?32:31-(VS(t)/FS|0)|0}var ru=64,iu=4194304;function ba(t){switch(t&-t){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 t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function sc(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,i=t.suspendedLanes,s=t.pingedLanes,o=n&268435455;if(o!==0){var a=o&~i;a!==0?r=ba(a):(s&=o,s!==0&&(r=ba(s)))}else o=n&~i,o!==0?r=ba(o):s!==0&&(r=ba(s));if(r===0)return 0;if(e!==0&&e!==r&&!(e&i)&&(i=r&-r,s=e&-e,i>=s||i===16&&(s&4194240)!==0))return e;if(r&4&&(r|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0n;n++)e.push(t);return e}function Sl(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-ar(e),t[e]=n}function $S(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var r=t.eventTimes;for(t=t.expirationTimes;0=Ra),f0=" ",p0=!1;function D_(t,e){switch(t){case"keyup":return yk.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function j_(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Js=!1;function xk(t,e){switch(t){case"compositionend":return j_(e);case"keypress":return e.which!==32?null:(p0=!0,f0);case"textInput":return t=e.data,t===f0&&p0?null:t;default:return null}}function wk(t,e){if(Js)return t==="compositionend"||!dm&&D_(t,e)?(t=P_(),Du=lm=Ii=null,Js=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=v0(n)}}function V_(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?V_(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function F_(){for(var t=window,e=tc();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=tc(t.document)}return e}function hm(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function Nk(t){var e=F_(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&V_(n.ownerDocument.documentElement,n)){if(r!==null&&hm(n)){if(e=r.start,t=r.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var i=n.textContent.length,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!t.extend&&s>r&&(i=r,r=s,s=i),i=x0(n,s);var o=x0(n,r);i&&o&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==o.node||t.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),s>r?(t.addRange(e),t.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Zs=null,Af=null,ja=null,Pf=!1;function w0(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Pf||Zs==null||Zs!==tc(r)||(r=Zs,"selectionStart"in r&&hm(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),ja&&nl(ja,r)||(ja=r,r=lc(Af,"onSelect"),0no||(t.current=Mf[no],Mf[no]=null,no--)}function ot(t,e){no++,Mf[no]=t.current,t.current=e}var zi={},un=Yi(zi),En=Yi(!1),Es=zi;function Eo(t,e){var n=t.type.contextTypes;if(!n)return zi;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in n)i[s]=e[s];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function In(t){return t=t.childContextTypes,t!=null}function cc(){ct(En),ct(un)}function k0(t,e,n){if(un.current!==zi)throw Error(Y(168));ot(un,e),ot(En,n)}function K_(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in e))throw Error(Y(108,IS(t)||"Unknown",i));return gt({},n,r)}function dc(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||zi,Es=un.current,ot(un,t),ot(En,En.current),!0}function C0(t,e,n){var r=t.stateNode;if(!r)throw Error(Y(169));n?(t=K_(t,e,Es),r.__reactInternalMemoizedMergedChildContext=t,ct(En),ct(un),ot(un,t)):ct(En),ot(En,n)}var Mr=null,rd=!1,Ch=!1;function Q_(t){Mr===null?Mr=[t]:Mr.push(t)}function zk(t){rd=!0,Q_(t)}function Xi(){if(!Ch&&Mr!==null){Ch=!0;var t=0,e=et;try{var n=Mr;for(et=1;t>=o,i-=o,Fr=1<<32-ar(e)+i|n<w?(T=b,b=null):T=b.sibling;var A=p(v,b,E[w],O);if(A===null){b===null&&(b=T);break}t&&b&&A.alternate===null&&e(v,b),x=s(A,x,w),D===null?L=A:D.sibling=A,D=A,b=T}if(w===E.length)return n(v,b),dt&&us(v,w),L;if(b===null){for(;ww?(T=b,b=null):T=b.sibling;var N=p(v,b,A.value,O);if(N===null){b===null&&(b=T);break}t&&b&&N.alternate===null&&e(v,b),x=s(N,x,w),D===null?L=N:D.sibling=N,D=N,b=T}if(A.done)return n(v,b),dt&&us(v,w),L;if(b===null){for(;!A.done;w++,A=E.next())A=h(v,A.value,O),A!==null&&(x=s(A,x,w),D===null?L=A:D.sibling=A,D=A);return dt&&us(v,w),L}for(b=r(v,b);!A.done;w++,A=E.next())A=g(b,v,w,A.value,O),A!==null&&(t&&A.alternate!==null&&b.delete(A.key===null?w:A.key),x=s(A,x,w),D===null?L=A:D.sibling=A,D=A);return t&&b.forEach(function(j){return e(v,j)}),dt&&us(v,w),L}function P(v,x,E,O){if(typeof E=="object"&&E!==null&&E.type===Xs&&E.key===null&&(E=E.props.children),typeof E=="object"&&E!==null){switch(E.$$typeof){case eu:e:{for(var L=E.key,D=x;D!==null;){if(D.key===L){if(L=E.type,L===Xs){if(D.tag===7){n(v,D.sibling),x=i(D,E.props.children),x.return=v,v=x;break e}}else if(D.elementType===L||typeof L=="object"&&L!==null&&L.$$typeof===yi&&P0(L)===D.type){n(v,D.sibling),x=i(D,E.props),x.ref=fa(v,D,E),x.return=v,v=x;break e}n(v,D);break}else e(v,D);D=D.sibling}E.type===Xs?(x=xs(E.props.children,v.mode,O,E.key),x.return=v,v=x):(O=zu(E.type,E.key,E.props,null,v.mode,O),O.ref=fa(v,x,E),O.return=v,v=O)}return o(v);case Ys:e:{for(D=E.key;x!==null;){if(x.key===D)if(x.tag===4&&x.stateNode.containerInfo===E.containerInfo&&x.stateNode.implementation===E.implementation){n(v,x.sibling),x=i(x,E.children||[]),x.return=v,v=x;break e}else{n(v,x);break}else e(v,x);x=x.sibling}x=Lh(E,v.mode,O),x.return=v,v=x}return o(v);case yi:return D=E._init,P(v,x,D(E._payload),O)}if(_a(E))return _(v,x,E,O);if(la(E))return S(v,x,E,O);du(v,E)}return typeof E=="string"&&E!==""||typeof E=="number"?(E=""+E,x!==null&&x.tag===6?(n(v,x.sibling),x=i(x,E),x.return=v,v=x):(n(v,x),x=Oh(E,v.mode,O),x.return=v,v=x),o(v)):n(v,x)}return P}var To=Z_(!0),e1=Z_(!1),pc=Yi(null),mc=null,so=null,gm=null;function ym(){gm=so=mc=null}function vm(t){var e=pc.current;ct(pc),t._currentValue=e}function Uf(t,e,n){for(;t!==null;){var r=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),t===n)break;t=t.return}}function po(t,e){mc=t,gm=so=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(bn=!0),t.firstContext=null)}function Jn(t){var e=t._currentValue;if(gm!==t)if(t={context:t,memoizedValue:e,next:null},so===null){if(mc===null)throw Error(Y(308));so=t,mc.dependencies={lanes:0,firstContext:t}}else so=so.next=t;return e}var ps=null;function xm(t){ps===null?ps=[t]:ps.push(t)}function t1(t,e,n,r){var i=e.interleaved;return i===null?(n.next=n,xm(e)):(n.next=i.next,i.next=n),e.interleaved=n,Yr(t,r)}function Yr(t,e){t.lanes|=e;var n=t.alternate;for(n!==null&&(n.lanes|=e),n=t,t=t.return;t!==null;)t.childLanes|=e,n=t.alternate,n!==null&&(n.childLanes|=e),n=t,t=t.return;return n.tag===3?n.stateNode:null}var vi=!1;function wm(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function n1(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function Hr(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function Ri(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,Ke&2){var i=r.pending;return i===null?e.next=e:(e.next=i.next,i.next=e),r.pending=e,Yr(t,n)}return i=r.interleaved,i===null?(e.next=e,xm(r)):(e.next=i.next,i.next=e),r.interleaved=e,Yr(t,n)}function Ou(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,sm(t,n)}}function R0(t,e){var n=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?i=s=o:s=s.next=o,n=n.next}while(n!==null);s===null?i=s=e:s=s.next=e}else i=s=e;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:r.shared,effects:r.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function gc(t,e,n,r){var i=t.updateQueue;vi=!1;var s=i.firstBaseUpdate,o=i.lastBaseUpdate,a=i.shared.pending;if(a!==null){i.shared.pending=null;var u=a,c=u.next;u.next=null,o===null?s=c:o.next=c,o=u;var f=t.alternate;f!==null&&(f=f.updateQueue,a=f.lastBaseUpdate,a!==o&&(a===null?f.firstBaseUpdate=c:a.next=c,f.lastBaseUpdate=u))}if(s!==null){var h=i.baseState;o=0,f=c=u=null,a=s;do{var p=a.lane,g=a.eventTime;if((r&p)===p){f!==null&&(f=f.next={eventTime:g,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var _=t,S=a;switch(p=e,g=n,S.tag){case 1:if(_=S.payload,typeof _=="function"){h=_.call(g,h,p);break e}h=_;break e;case 3:_.flags=_.flags&-65537|128;case 0:if(_=S.payload,p=typeof _=="function"?_.call(g,h,p):_,p==null)break e;h=gt({},h,p);break e;case 2:vi=!0}}a.callback!==null&&a.lane!==0&&(t.flags|=64,p=i.effects,p===null?i.effects=[a]:p.push(a))}else g={eventTime:g,lane:p,tag:a.tag,payload:a.payload,callback:a.callback,next:null},f===null?(c=f=g,u=h):f=f.next=g,o|=p;if(a=a.next,a===null){if(a=i.shared.pending,a===null)break;p=a,a=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(!0);if(f===null&&(u=h),i.baseState=u,i.firstBaseUpdate=c,i.lastBaseUpdate=f,e=i.shared.interleaved,e!==null){i=e;do o|=i.lane,i=i.next;while(i!==e)}else s===null&&(i.shared.lanes=0);Ss|=o,t.lanes=o,t.memoizedState=h}}function D0(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;en?n:4,t(!0);var r=Ah.transition;Ah.transition={};try{t(!1),e()}finally{et=n,Ah.transition=r}}function x1(){return Zn().memoizedState}function qk(t,e,n){var r=ji(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},w1(t))_1(e,n);else if(n=t1(t,e,n,r),n!==null){var i=fn();lr(n,t,r,i),b1(n,e,r)}}function Wk(t,e,n){var r=ji(t),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(w1(t))_1(e,i);else{var s=t.alternate;if(t.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var o=e.lastRenderedState,a=s(o,n);if(i.hasEagerState=!0,i.eagerState=a,cr(a,o)){var u=e.interleaved;u===null?(i.next=i,xm(e)):(i.next=u.next,u.next=i),e.interleaved=i;return}}catch{}finally{}n=t1(t,e,i,r),n!==null&&(i=fn(),lr(n,t,r,i),b1(n,e,r))}}function w1(t){var e=t.alternate;return t===mt||e!==null&&e===mt}function _1(t,e){Oa=vc=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function b1(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,sm(t,n)}}var xc={readContext:Jn,useCallback:nn,useContext:nn,useEffect:nn,useImperativeHandle:nn,useInsertionEffect:nn,useLayoutEffect:nn,useMemo:nn,useReducer:nn,useRef:nn,useState:nn,useDebugValue:nn,useDeferredValue:nn,useTransition:nn,useMutableSource:nn,useSyncExternalStore:nn,useId:nn,unstable_isNewReconciler:!1},Gk={readContext:Jn,useCallback:function(t,e){return yr().memoizedState=[t,e===void 0?null:e],t},useContext:Jn,useEffect:O0,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,Mu(4194308,4,p1.bind(null,e,t),n)},useLayoutEffect:function(t,e){return Mu(4194308,4,t,e)},useInsertionEffect:function(t,e){return Mu(4,2,t,e)},useMemo:function(t,e){var n=yr();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=yr();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=qk.bind(null,mt,t),[r.memoizedState,t]},useRef:function(t){var e=yr();return t={current:t},e.memoizedState=t},useState:j0,useDebugValue:Cm,useDeferredValue:function(t){return yr().memoizedState=t},useTransition:function(){var t=j0(!1),e=t[0];return t=Hk.bind(null,t[1]),yr().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=mt,i=yr();if(dt){if(n===void 0)throw Error(Y(407));n=n()}else{if(n=e(),$t===null)throw Error(Y(349));Ts&30||o1(r,e,n)}i.memoizedState=n;var s={value:n,getSnapshot:e};return i.queue=s,O0(l1.bind(null,r,s,t),[t]),r.flags|=2048,cl(9,a1.bind(null,r,s,n,e),void 0,null),n},useId:function(){var t=yr(),e=$t.identifierPrefix;if(dt){var n=Ur,r=Fr;n=(r&~(1<<32-ar(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=ll++,0<\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=o.createElement(n,{is:r.is}):(t=o.createElement(n),n==="select"&&(o=t,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):t=o.createElementNS(t,n),t[wr]=e,t[sl]=r,R1(t,e,!1,!1),e.stateNode=t;e:{switch(o=bf(n,r),n){case"dialog":ut("cancel",t),ut("close",t),i=r;break;case"iframe":case"object":case"embed":ut("load",t),i=r;break;case"video":case"audio":for(i=0;iCo&&(e.flags|=128,r=!0,pa(s,!1),e.lanes=4194304)}else{if(!r)if(t=yc(o),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),pa(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!dt)return rn(e),null}else 2*St()-s.renderingStartTime>Co&&n!==1073741824&&(e.flags|=128,r=!0,pa(s,!1),e.lanes=4194304);s.isBackwards?(o.sibling=e.child,e.child=o):(n=s.last,n!==null?n.sibling=o:e.child=o,s.last=o)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=St(),e.sibling=null,n=pt.current,ot(pt,r?n&1|2:n&1),e):(rn(e),null);case 22:case 23:return jm(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?Dn&1073741824&&(rn(e),e.subtreeFlags&6&&(e.flags|=8192)):rn(e),null;case 24:return null;case 25:return null}throw Error(Y(156,e.tag))}function t2(t,e){switch(pm(e),e.tag){case 1:return In(e.type)&&cc(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return So(),ct(En),ct(un),Em(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return bm(e),null;case 13:if(ct(pt),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(Y(340));Io()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return ct(pt),null;case 4:return So(),null;case 10:return vm(e.type._context),null;case 22:case 23:return jm(),null;case 24:return null;default:return null}}var fu=!1,an=!1,n2=typeof WeakSet=="function"?WeakSet:Set,ce=null;function oo(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Et(t,e,r)}else n.current=null}function Qf(t,e,n){try{n()}catch(r){Et(t,e,r)}}var W0=!1;function r2(t,e){if(Rf=oc,t=F_(),hm(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var o=0,a=-1,u=-1,c=0,f=0,h=t,p=null;t:for(;;){for(var g;h!==n||i!==0&&h.nodeType!==3||(a=o+i),h!==s||r!==0&&h.nodeType!==3||(u=o+r),h.nodeType===3&&(o+=h.nodeValue.length),(g=h.firstChild)!==null;)p=h,h=g;for(;;){if(h===t)break t;if(p===n&&++c===i&&(a=o),p===s&&++f===r&&(u=o),(g=h.nextSibling)!==null)break;h=p,p=h.parentNode}h=g}n=a===-1||u===-1?null:{start:a,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(Df={focusedElem:t,selectionRange:n},oc=!1,ce=e;ce!==null;)if(e=ce,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,ce=t;else for(;ce!==null;){e=ce;try{var _=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(_!==null){var S=_.memoizedProps,P=_.memoizedState,v=e.stateNode,x=v.getSnapshotBeforeUpdate(e.elementType===e.type?S:nr(e.type,S),P);v.__reactInternalSnapshotBeforeUpdate=x}break;case 3:var E=e.stateNode.containerInfo;E.nodeType===1?E.textContent="":E.nodeType===9&&E.documentElement&&E.removeChild(E.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Y(163))}}catch(O){Et(e,e.return,O)}if(t=e.sibling,t!==null){t.return=e.return,ce=t;break}ce=e.return}return _=W0,W0=!1,_}function La(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&t)===t){var s=i.destroy;i.destroy=void 0,s!==void 0&&Qf(e,n,s)}i=i.next}while(i!==r)}}function od(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function Yf(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function O1(t){var e=t.alternate;e!==null&&(t.alternate=null,O1(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[wr],delete e[sl],delete e[Lf],delete e[Fk],delete e[Uk])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function L1(t){return t.tag===5||t.tag===3||t.tag===4}function G0(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||L1(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Xf(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=uc));else if(r!==4&&(t=t.child,t!==null))for(Xf(t,e,n),t=t.sibling;t!==null;)Xf(t,e,n),t=t.sibling}function Jf(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(Jf(t,e,n),t=t.sibling;t!==null;)Jf(t,e,n),t=t.sibling}var Qt=null,rr=!1;function fi(t,e,n){for(n=n.child;n!==null;)M1(t,e,n),n=n.sibling}function M1(t,e,n){if(br&&typeof br.onCommitFiberUnmount=="function")try{br.onCommitFiberUnmount(Jc,n)}catch{}switch(n.tag){case 5:an||oo(n,e);case 6:var r=Qt,i=rr;Qt=null,fi(t,e,n),Qt=r,rr=i,Qt!==null&&(rr?(t=Qt,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):Qt.removeChild(n.stateNode));break;case 18:Qt!==null&&(rr?(t=Qt,n=n.stateNode,t.nodeType===8?kh(t.parentNode,n):t.nodeType===1&&kh(t,n),el(t)):kh(Qt,n.stateNode));break;case 4:r=Qt,i=rr,Qt=n.stateNode.containerInfo,rr=!0,fi(t,e,n),Qt=r,rr=i;break;case 0:case 11:case 14:case 15:if(!an&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&Qf(n,e,o),i=i.next}while(i!==r)}fi(t,e,n);break;case 1:if(!an&&(oo(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){Et(n,e,a)}fi(t,e,n);break;case 21:fi(t,e,n);break;case 22:n.mode&1?(an=(r=an)||n.memoizedState!==null,fi(t,e,n),an=r):fi(t,e,n);break;default:fi(t,e,n)}}function K0(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new n2),e.forEach(function(r){var i=h2.bind(null,t,r);n.has(r)||(n.add(r),r.then(i,i))})}}function tr(t,e){var n=e.deletions;if(n!==null)for(var r=0;ri&&(i=o),r&=~s}if(r=i,r=St()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*s2(r/1960))-r,10t?16:t,Ti===null)var r=!1;else{if(t=Ti,Ti=null,bc=0,Ke&6)throw Error(Y(331));var i=Ke;for(Ke|=4,ce=t.current;ce!==null;){var s=ce,o=s.child;if(ce.flags&16){var a=s.deletions;if(a!==null){for(var u=0;uSt()-Rm?vs(t,0):Pm|=n),Tn(t,e)}function q1(t,e){e===0&&(t.mode&1?(e=iu,iu<<=1,!(iu&130023424)&&(iu=4194304)):e=1);var n=fn();t=Yr(t,e),t!==null&&(Sl(t,e,n),Tn(t,n))}function d2(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),q1(t,n)}function h2(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,i=t.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(Y(314))}r!==null&&r.delete(e),q1(t,n)}var W1;W1=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||En.current)bn=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return bn=!1,Zk(t,e,n);bn=!!(t.flags&131072)}else bn=!1,dt&&e.flags&1048576&&Y_(e,fc,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;Vu(t,e),t=e.pendingProps;var i=Eo(e,un.current);po(e,n),i=Tm(null,e,r,t,i,n);var s=Sm();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,In(r)?(s=!0,dc(e)):s=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,wm(e),i.updater=sd,e.stateNode=i,i._reactInternals=e,Bf(e,r,t,n),e=qf(null,e,r,!0,s,n)):(e.tag=0,dt&&s&&fm(e),hn(null,e,i,n),e=e.child),e;case 16:r=e.elementType;e:{switch(Vu(t,e),t=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=p2(r),t=nr(r,t),i){case 0:e=Hf(null,e,r,t,n);break e;case 1:e=$0(null,e,r,t,n);break e;case 11:e=z0(null,e,r,t,n);break e;case 14:e=B0(null,e,r,nr(r.type,t),n);break e}throw Error(Y(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:nr(r,i),Hf(t,e,r,i,n);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:nr(r,i),$0(t,e,r,i,n);case 3:e:{if(N1(e),t===null)throw Error(Y(387));r=e.pendingProps,s=e.memoizedState,i=s.element,n1(t,e),gc(e,r,null,n);var o=e.memoizedState;if(r=o.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){i=ko(Error(Y(423)),e),e=H0(t,e,r,n,i);break e}else if(r!==i){i=ko(Error(Y(424)),e),e=H0(t,e,r,n,i);break e}else for(jn=Pi(e.stateNode.containerInfo.firstChild),Mn=e,dt=!0,ir=null,n=e1(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Io(),r===i){e=Xr(t,e,n);break e}hn(t,e,r,n)}e=e.child}return e;case 5:return r1(e),t===null&&Ff(e),r=e.type,i=e.pendingProps,s=t!==null?t.memoizedProps:null,o=i.children,jf(r,i)?o=null:s!==null&&jf(r,s)&&(e.flags|=32),C1(t,e),hn(t,e,o,n),e.child;case 6:return t===null&&Ff(e),null;case 13:return A1(t,e,n);case 4:return _m(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=To(e,null,r,n):hn(t,e,r,n),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:nr(r,i),z0(t,e,r,i,n);case 7:return hn(t,e,e.pendingProps,n),e.child;case 8:return hn(t,e,e.pendingProps.children,n),e.child;case 12:return hn(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,i=e.pendingProps,s=e.memoizedProps,o=i.value,ot(pc,r._currentValue),r._currentValue=o,s!==null)if(cr(s.value,o)){if(s.children===i.children&&!En.current){e=Xr(t,e,n);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var u=a.firstContext;u!==null;){if(u.context===r){if(s.tag===1){u=Hr(-1,n&-n),u.tag=2;var c=s.updateQueue;if(c!==null){c=c.shared;var f=c.pending;f===null?u.next=u:(u.next=f.next,f.next=u),c.pending=u}}s.lanes|=n,u=s.alternate,u!==null&&(u.lanes|=n),Uf(s.return,n,e),a.lanes|=n;break}u=u.next}}else if(s.tag===10)o=s.type===e.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(Y(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),Uf(o,n,e),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===e){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}hn(t,e,i.children,n),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,po(e,n),i=Jn(i),r=r(i),e.flags|=1,hn(t,e,r,n),e.child;case 14:return r=e.type,i=nr(r,e.pendingProps),i=nr(r.type,i),B0(t,e,r,i,n);case 15:return S1(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:nr(r,i),Vu(t,e),e.tag=1,In(r)?(t=!0,dc(e)):t=!1,po(e,n),E1(e,r,i),Bf(e,r,i,n),qf(null,e,r,!0,t,n);case 19:return P1(t,e,n);case 22:return k1(t,e,n)}throw Error(Y(156,e.tag))};function G1(t,e){return w_(t,e)}function f2(t,e,n,r){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Gn(t,e,n,r){return new f2(t,e,n,r)}function Lm(t){return t=t.prototype,!(!t||!t.isReactComponent)}function p2(t){if(typeof t=="function")return Lm(t)?1:0;if(t!=null){if(t=t.$$typeof,t===tm)return 11;if(t===nm)return 14}return 2}function Oi(t,e){var n=t.alternate;return n===null?(n=Gn(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function zu(t,e,n,r,i,s){var o=2;if(r=t,typeof t=="function")Lm(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case Xs:return xs(n.children,i,s,e);case em:o=8,i|=8;break;case hf:return t=Gn(12,n,e,i|2),t.elementType=hf,t.lanes=s,t;case ff:return t=Gn(13,n,e,i),t.elementType=ff,t.lanes=s,t;case pf:return t=Gn(19,n,e,i),t.elementType=pf,t.lanes=s,t;case r_:return ld(n,i,s,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case t_:o=10;break e;case n_:o=9;break e;case tm:o=11;break e;case nm:o=14;break e;case yi:o=16,r=null;break e}throw Error(Y(130,t==null?t:typeof t,""))}return e=Gn(o,n,e,i),e.elementType=t,e.type=r,e.lanes=s,e}function xs(t,e,n,r){return t=Gn(7,t,r,e),t.lanes=n,t}function ld(t,e,n,r){return t=Gn(22,t,r,e),t.elementType=r_,t.lanes=n,t.stateNode={isHidden:!1},t}function Oh(t,e,n){return t=Gn(6,t,null,e),t.lanes=n,t}function Lh(t,e,n){return e=Gn(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function m2(t,e,n,r,i){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=gh(0),this.expirationTimes=gh(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=gh(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function Mm(t,e,n,r,i,s,o,a,u){return t=new m2(t,e,n,a,u),e===1?(e=1,s===!0&&(e|=8)):e=0,s=Gn(3,null,null,e),t.current=s,s.stateNode=t,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},wm(s),t}function g2(t,e,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(X1)}catch(t){console.error(t)}}X1(),Xw.exports=Un;var J1=Xw.exports;const _2=Yc(J1);var Z1,nv=J1;Z1=nv.createRoot,nv.hydrateRoot;/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */var b2={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"};/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const E2=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),ke=(t,e)=>{const n=F.forwardRef(({color:r="currentColor",size:i=24,strokeWidth:s=2,absoluteStrokeWidth:o,className:a="",children:u,...c},f)=>F.createElement("svg",{ref:f,...b2,width:i,height:i,stroke:r,strokeWidth:o?Number(s)*24/Number(i):s,className:["lucide",`lucide-${E2(t)}`,a].join(" "),...c},[...e.map(([h,p])=>F.createElement(h,p)),...Array.isArray(u)?u:[u]]));return n.displayName=`${t}`,n};/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const No=ke("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const I2=ke("ArrowUpDown",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const rv=ke("BookMarked",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H20v20H6.5a2.5 2.5 0 0 1 0-5H20",key:"t4utmx"}],["polyline",{points:"10 2 10 10 13 7 16 10 16 2",key:"13o6vz"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const hl=ke("BookOpen",[["path",{d:"M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z",key:"vv98re"}],["path",{d:"M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z",key:"1cyq3y"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const T2=ke("Book",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H20v20H6.5a2.5 2.5 0 0 1 0-5H20",key:"t4utmx"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const fd=ke("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const pd=ke("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const md=ke("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const eb=ke("ChevronsLeft",[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const tb=ke("ChevronsRight",[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const S2=ke("ChevronsUpDown",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const k2=ke("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ga=ke("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const rp=ke("Eye",[["path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z",key:"rwhkz3"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ya=ke("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const nb=ke("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ip=ke("Grid2x2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M12 3v18",key:"108xh3"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const sp=ke("Grid3x3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const iv=ke("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const sv=ke("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const rb=ke("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const C2=ke("Key",[["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["path",{d:"m15.5 7.5 3 3L22 7l-3-3",key:"1rn1fs"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ib=ke("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const N2=ke("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const A2=ke("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const P2=ke("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const sb=ke("Megaphone",[["path",{d:"m3 11 18-5v12L3 14v-3z",key:"n962bs"}],["path",{d:"M11.6 16.8a3 3 0 1 1-5.8-1.6",key:"1yl0tm"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ob=ke("Pen",[["path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z",key:"5qss01"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const fl=ke("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ab=ke("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const op=ke("Rows2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 12h18",key:"1i2n21"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const zm=ke("Save",[["path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z",key:"1owoqh"}],["polyline",{points:"17 21 17 13 7 13 7 21",key:"1md35c"}],["polyline",{points:"7 3 7 8 15 8",key:"8nz8an"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Tc=ke("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const R2=ke("Send",[["path",{d:"m22 2-7 20-4-9-9-4Z",key:"1q3vgg"}],["path",{d:"M22 2 11 13",key:"nzbqef"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ov=ke("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const lb=ke("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const av=ke("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const D2=ke("Timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const zr=ke("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const j2=ke("Unlock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const O2=ke("UserMinus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const L2=ke("UserPlus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const M2=ke("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Vn=ke("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Bm=ke("ZoomIn",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);/** + * @license lucide-react v0.344.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const $m=ke("ZoomOut",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);function Kn({src:t,alt:e,className:n="",imgClassName:r="",objectFit:i="contain",aspectRatio:s,loading:o,draggable:a}){const[u,c]=F.useState(!1);return d.jsxs("div",{className:`relative w-full h-full overflow-hidden ${n}`,style:s&&s!=="auto"?{aspectRatio:s}:void 0,children:[d.jsx("div",{className:`absolute inset-0 flex items-center justify-center transition-opacity duration-500 ${u?"opacity-0 pointer-events-none":"opacity-100"}`,children:d.jsx("div",{className:"w-8 h-8 border-2 border-purple-500 border-t-transparent rounded-full animate-spin"})}),d.jsx("img",{src:t,alt:e,loading:o,draggable:a,className:`w-full h-full object-${i} transition-all duration-1000 ease-linear ${r} ${u?"opacity-100":"opacity-0"}`,onLoad:()=>c(!0)})]})}function ub({images:t,initialIndex:e,onClose:n}){const[r,i]=F.useState(e),[s,o]=F.useState(!1),[a,u]=F.useState(0),[c,f]=F.useState(1),[h,p]=F.useState({x:0,y:0}),[g,_]=F.useState(!1),[S,P]=F.useState({x:0,y:0}),[v,x]=F.useState(null),[E,O]=F.useState(1),L=F.useRef(null);F.useEffect(()=>(document.body.style.overflow="hidden",()=>{document.body.style.overflow="unset"}),[]);const D=$=>{const Z=t.length;return($%Z+Z)%Z},b=$=>Math.hypot($[0].clientX-$[1].clientX,$[0].clientY-$[1].clientY),w=($,Z)=>{const ie=window.innerWidth,Te=window.innerHeight,fe=(ie*Z-ie)/2,Fe=(Te*Z-Te)/2;return{x:Math.min(Math.max($.x,-fe),fe),y:Math.min(Math.max($.y,-Fe),Fe)}},T=s?2:1,A=()=>{i($=>D($-T)),u(0),f(1),p({x:0,y:0})},N=()=>{i($=>D($+T)),u(0),f(1),p({x:0,y:0})},j=($,Z)=>{_(!0),P({x:$,y:Z})},C=($,Z)=>{if(g)if(c>1){const ie=$-S.x,Te=Z-S.y;p(fe=>({x:fe.x+ie,y:fe.y+Te})),P({x:$,y:Z})}else{const ie=$-S.x;u(ie)}},se=()=>{var ie;if(_(!1),x(null),c>1)return;const Z=(((ie=L.current)==null?void 0:ie.clientWidth)||window.innerWidth)*.25;Math.abs(a)>Z?a>0?A():N():u(0)},he=$=>{$.preventDefault(),j($.clientX,$.clientY)},le=$=>{$.preventDefault(),C($.clientX,$.clientY)},me=()=>se(),q=$=>{if($.touches.length===2){const Z=b($.touches);x(Z),O(c),_(!1)}else $.touches.length===1&&j($.touches[0].clientX,$.touches[0].clientY)},oe=$=>{if($.touches.length===2&&v!==null){const ie=b($.touches)/v,Te=Math.min(Math.max(E*ie,1),4);f(Te),p(fe=>w(fe,Te))}else $.touches.length===1&&C($.touches[0].clientX,$.touches[0].clientY)},k=$=>{if(v!==null&&$.touches.length<2){x(null);return}se()};F.useEffect(()=>{function $(Z){Z.key==="Escape"?n():Z.key==="ArrowLeft"?A():Z.key==="ArrowRight"?N():Z.key==="+"||Z.key==="="?f(ie=>{const Te=Math.min(ie+.5,4);return p(fe=>w(fe,Te)),Te}):Z.key==="-"&&f(ie=>{const Te=Math.max(ie-.5,1);return p(fe=>w(fe,Te)),Te})}return window.addEventListener("keydown",$),()=>window.removeEventListener("keydown",$)},[c,s]);let ge=`translateX(calc(-33.333333% + ${a}px))`,ye=g?"none":"transform 0.1s ease-out";a===0&&(ye="none");const R=$=>{const Z=D($);if(s){const ie=D($+1);return d.jsxs("div",{className:"flex w-full h-full items-center justify-center px-2 sm:px-10",children:[d.jsx("div",{className:"flex-1 h-full flex items-center justify-end",children:d.jsx(Kn,{src:t[Z],alt:`Página ${Z+1}`,aspectRatio:"auto",objectFit:"contain",loading:"lazy",draggable:!1,imgClassName:"max-w-full max-h-screen object-contain select-none shadow-lg origin-right object-right"})}),d.jsx("div",{className:"flex-1 h-full flex items-center justify-start",children:d.jsx(Kn,{src:t[ie],alt:`Página ${ie+1}`,aspectRatio:"auto",objectFit:"contain",loading:"lazy",draggable:!1,imgClassName:"max-w-full max-h-screen object-contain select-none shadow-lg origin-left object-left"})})]})}else return d.jsx(Kn,{src:t[Z],alt:`Página ${Z+1}`,aspectRatio:"auto",objectFit:"contain",loading:"lazy",draggable:!1,imgClassName:"max-w-full max-h-screen object-contain select-none shadow-2xl"})};return d.jsxs("div",{className:"fixed inset-0 bg-black/95 flex items-center justify-center z-50 select-none touch-none overflow-hidden",style:{touchAction:"none"},ref:L,onWheel:$=>{$.stopPropagation();const Z=$.deltaY<0?.5:-.5;f(ie=>{const Te=Math.min(Math.max(ie+Z,1),4);return p(fe=>w(fe,Te)),Te})},onMouseDown:he,onMouseMove:le,onMouseUp:me,onMouseLeave:()=>{_(!1),c===1&&u(0)},onTouchStart:q,onTouchMove:oe,onTouchEnd:k,children:[d.jsxs("div",{className:"absolute top-6 right-6 flex items-center gap-4 z-50",children:[d.jsxs("div",{className:"flex items-center gap-2 bg-black/50 rounded-lg p-1",children:[d.jsx("button",{onClick:()=>o(!s),className:`p-2 transition-colors ${s?"text-[#bb86fc]":"text-white hover:text-[#bb86fc]"}`,title:s?"Vista Individual":"Vista de Libro",children:s?d.jsx(hl,{className:"w-5 h-5"}):d.jsx(T2,{className:"w-5 h-5"})}),d.jsx("div",{className:"w-px h-4 bg-white/20 mx-1"}),d.jsx("button",{onClick:()=>f($=>{const Z=Math.max($-.5,1);return p(ie=>w(ie,Z)),Z}),className:"p-2 text-white hover:text-[#bb86fc] transition-colors",children:d.jsx($m,{className:"w-5 h-5"})}),d.jsxs("span",{className:"text-white text-sm min-w-[3ch] text-center",children:[Math.round(c*100),"%"]}),d.jsx("button",{onClick:()=>f($=>{const Z=Math.min($+.5,4);return p(ie=>w(ie,Z)),Z}),className:"p-2 text-white hover:text-[#bb86fc] transition-colors",children:d.jsx(Bm,{className:"w-5 h-5"})})]}),d.jsx("button",{onClick:n,className:"p-2 rounded-lg bg-white/10 hover:bg-white/20 text-white transition-all duration-200",children:d.jsx(Vn,{className:"w-6 h-6"})})]}),d.jsxs("div",{className:"flex h-full w-[300%] absolute top-0 left-0",style:{transform:ge,transition:ye,willChange:"transform"},children:[d.jsx("div",{className:"w-1/3 h-full flex items-center justify-center relative",children:R(r-T)}),d.jsx("div",{className:"w-1/3 h-full flex items-center justify-center relative",children:d.jsx("div",{className:"relative flex items-center justify-center w-full h-full",style:{transform:`translate(${h.x}px, ${h.y}px) scale(${c})`,transition:g?"none":"transform 0.1s ease-out",cursor:c>1?g?"grabbing":"grab":"default"},onDoubleClick:$=>{$.stopPropagation(),f(Z=>Z>1?1:2.5),p({x:0,y:0})},children:R(r)})}),d.jsx("div",{className:"w-1/3 h-full flex items-center justify-center relative",children:R(r+T)})]}),c===1&&d.jsxs(d.Fragment,{children:[d.jsx("button",{onClick:$=>{$.stopPropagation(),A()},className:"absolute left-4 sm:left-8 top-1/2 -translate-y-1/2 p-3 sm:p-4 rounded-lg text-white opacity-40 hover:opacity-100 transition-opacity duration-200 z-40",children:d.jsx(pd,{className:"w-8 h-8 sm:w-10 sm:h-10"})}),d.jsx("button",{onClick:$=>{$.stopPropagation(),N()},className:"absolute right-4 sm:right-8 top-1/2 -translate-y-1/2 p-3 sm:p-4 rounded-lg text-white opacity-40 hover:opacity-100 transition-opacity duration-200 z-40",children:d.jsx(md,{className:"w-8 h-8 sm:w-10 sm:h-10"})})]}),d.jsx("div",{className:"absolute bottom-6 left-1/2 -translate-x-1/2 bg-black/60 text-white px-4 py-2 rounded-lg text-sm font-medium z-40 pointer-events-none",children:s?`${r+1}-${Math.min(r+2,t.length)} / ${t.length}`:`${r+1} / ${t.length}`})]})}function gd(){return d.jsxs("footer",{className:"py-6 border-t border-gray-800/50 flex flex-col md:flex-row items-center justify-between gap-4 text-gray-400 text-sm mt-auto w-full px-8 relative",children:[d.jsxs("div",{className:"flex flex-wrap justify-center gap-6 mx-auto",children:[d.jsxs("a",{href:"https://t.me/twistedbrody",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 hover:text-[#bb86fc] transition-colors",children:[d.jsx("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"currentColor",children:d.jsx("path",{d:"M12 0C5.373 0 0 5.373 0 12s5.373 12 12 12 12-5.373 12-12S18.627 0 12 0zm5.894 8.221l-1.97 9.28c-.145.658-.537.818-1.084.508l-3-2.21-1.446 1.394c-.16.16-.295.295-.605.295l.213-3.054 5.56-5.022c.242-.213-.054-.333-.373-.121l-6.869 4.326-2.96-.924c-.64-.203-.658-.64.135-.954l11.566-4.458c.538-.196 1.006.128.832.941z"})}),"Twisted Brody"]}),d.jsxs("a",{href:"https://t.me/+CmmZFHM9hpViYzMx",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 hover:text-[#bb86fc] transition-colors",children:[d.jsx("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"currentColor",children:d.jsx("path",{d:"M12 0C5.373 0 0 5.373 0 12s5.373 12 12 12 12-5.373 12-12S18.627 0 12 0zm5.894 8.221l-1.97 9.28c-.145.658-.537.818-1.084.508l-3-2.21-1.446 1.394c-.16.16-.295.295-.605.295l.213-3.054 5.56-5.022c.242-.213-.054-.333-.373-.121l-6.869 4.326-2.96-.924c-.64-.203-.658-.64.135-.954l11.566-4.458c.538-.196 1.006.128.832.941z"})}),"Canal Hub"]}),d.jsxs("a",{href:"https://x.com/TwistedBrody",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 hover:text-[#bb86fc] transition-colors",children:[d.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:d.jsx("path",{d:"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"})}),"X"]}),d.jsxs("a",{href:"https://www.patreon.com/cw/Twistedbrody",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 hover:text-[#bb86fc] transition-colors",children:[d.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"currentColor",children:d.jsx("path",{d:"M0 .48v23.04h4.22V.48zm15.385 0c-4.764 0-8.641 3.88-8.641 8.65 0 4.755 3.877 8.623 8.641 8.623 4.75 0 8.615-3.868 8.615-8.623C24 4.36 20.136.48 15.385.48z"})}),"Patreon"]}),d.jsxs("button",{onClick:()=>{window.location.hash="info"},className:"flex items-center gap-2 hover:text-[#bb86fc] transition-colors",children:[d.jsx(rb,{className:"w-4 h-4"}),d.jsx("span",{children:"Info"})]})]}),d.jsxs("div",{className:"md:absolute md:right-8 text-xs opacity-50",children:["Twisted Brody MangaFlow © ",new Date().getFullYear()]})]})}function V2({manga:t,onBack:e}){const n=t.chapters&&t.chapters.length>0?t.chapters[0]:null,r=n?n.original_pages&&n.original_pages.length>0?n.original_pages:n.pages:[],[i,s]=F.useState("vertical"),[o,a]=F.useState(1),[u,c]=F.useState(!1),[f,h]=F.useState(0);if(!r||r.length===0)return d.jsxs("div",{className:"min-h-screen bg-[#121212] flex flex-col items-center justify-center",children:[d.jsx("button",{onClick:e,className:"absolute top-6 left-6 p-2 hover:bg-[#333] rounded-lg transition-colors text-white",children:d.jsx(No,{className:"w-6 h-6"})}),d.jsx("div",{className:"text-gray-400 text-lg",children:"No hay páginas disponibles"})]});const p=()=>a(S=>Math.min(S+.25,3)),g=()=>a(S=>Math.max(S-.25,.5)),_=()=>a(1);return d.jsxs("div",{className:"min-h-screen flex flex-col bg-[#121212]",children:[d.jsxs("header",{className:"sticky top-0 z-50 bg-[#121212]/90 backdrop-blur-md border-b border-gray-800 px-4 py-3 flex items-center justify-between gap-4",children:[d.jsx("div",{className:"flex items-center gap-2 flex-shrink-0",children:d.jsxs("button",{onClick:e,className:"p-2 hover:bg-[#333] rounded-lg transition-colors text-white flex items-center gap-2",children:[d.jsx(No,{className:"w-5 h-5"}),d.jsx("span",{className:"font-semibold text-sm hidden sm:inline",children:"Volver"})]})}),d.jsx("div",{className:"flex-1 flex justify-center min-w-0",children:d.jsxs("h1",{className:"text-white font-bold truncate text-center max-w-full",children:[t.title," ",d.jsx("span",{className:"text-[#bb86fc] text-xs ml-2 border border-[#bb86fc] px-1 rounded",children:"HD"})]})}),d.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[d.jsxs("div",{className:"flex items-center gap-1 bg-[#0a0a0a] border border-gray-800 rounded-lg p-1 hidden md:flex",children:[d.jsx("button",{onClick:()=>s("vertical"),className:`p-2 rounded-md transition-all duration-200 ${i==="vertical"?"bg-[#bb86fc] text-white":"text-gray-400 hover:text-white"}`,title:"Vertical",children:d.jsx(op,{className:"w-4 h-4"})}),d.jsx("button",{onClick:()=>s("gallery"),className:`p-2 rounded-md transition-all duration-200 ${i==="gallery"?"bg-[#bb86fc] text-white":"text-gray-400 hover:text-white"}`,title:"Galería",children:d.jsx(ip,{className:"w-4 h-4"})}),d.jsx("button",{onClick:()=>s("grid"),className:`p-2 rounded-md transition-all duration-200 ${i==="grid"?"bg-[#bb86fc] text-white":"text-gray-400 hover:text-white"}`,title:"Cuadrícula",children:d.jsx(sp,{className:"w-4 h-4"})})]}),i==="vertical"&&d.jsxs("div",{className:"flex items-center gap-1 bg-[#0a0a0a] border border-gray-800 rounded-lg p-1",children:[d.jsx("button",{onClick:g,className:"p-2 text-gray-400 hover:text-white hover:bg-[#333] rounded",children:d.jsx($m,{className:"w-4 h-4"})}),d.jsxs("span",{className:"text-xs text-gray-300 w-8 text-center",children:[Math.round(o*100),"%"]}),d.jsx("button",{onClick:p,className:"p-2 text-gray-400 hover:text-white hover:bg-[#333] rounded",children:d.jsx(Bm,{className:"w-4 h-4"})}),d.jsx("button",{onClick:_,className:"p-2 text-gray-400 hover:text-white hover:bg-[#333] rounded",title:"Reset",children:d.jsx(ab,{className:"w-3 h-3"})})]})]})]}),d.jsx("div",{className:"md:hidden px-4 py-2 border-b border-gray-800 bg-[#121212] flex justify-center",children:d.jsxs("div",{className:"flex items-center gap-1 bg-[#0a0a0a] border border-gray-800 rounded-lg p-1",children:[d.jsxs("button",{onClick:()=>s("vertical"),className:`px-3 py-1.5 rounded-md flex items-center gap-2 text-xs font-medium ${i==="vertical"?"bg-[#bb86fc] text-white":"text-gray-400"}`,children:[d.jsx(op,{className:"w-3 h-3"})," Vertical"]}),d.jsxs("button",{onClick:()=>s("gallery"),className:`px-3 py-1.5 rounded-md flex items-center gap-2 text-xs font-medium ${i==="gallery"?"bg-[#bb86fc] text-white":"text-gray-400"}`,children:[d.jsx(ip,{className:"w-3 h-3"})," Galería"]}),d.jsxs("button",{onClick:()=>s("grid"),className:`px-3 py-1.5 rounded-md flex items-center gap-2 text-xs font-medium ${i==="grid"?"bg-[#bb86fc] text-white":"text-gray-400"}`,children:[d.jsx(sp,{className:"w-3 h-3"})," Cuadrícula"]})]})}),d.jsx("main",{className:"flex-1 w-full max-w-[1920px] mx-auto px-0 sm:px-4 py-6",children:d.jsx("div",{className:` + bg-[#050505] min-h-screen transition-all duration-150 ease-out + ${i==="vertical"?"flex flex-col items-center gap-1":""} + ${i==="gallery"?"masonry-container p-2":""} + ${i==="grid"?"grid grid-cols-3 md:grid-cols-5 gap-2 p-2":""} + `,children:r.map((S,P)=>{const v=S;return i==="vertical"?d.jsx("div",{className:"relative transition-all duration-200",style:{width:o===1?"100%":`${100*o}%`,maxWidth:o>1?"none":"80rem"},children:d.jsx("div",{className:`mx-auto ${o<=1?"max-w-5xl":""}`,children:d.jsx(Kn,{src:v,alt:`Página ${P+1}`,aspectRatio:"auto",objectFit:"contain",loading:P<3?"eager":"lazy",className:"w-full h-auto",imgClassName:"w-full h-auto block"})})},P):d.jsx("div",{className:` + group cursor-pointer relative bg-black rounded-lg shadow-lg overflow-hidden transition-transform duration-300 hover:scale-[1.02] + ${i==="gallery"?"masonry-item":""} + `,onClick:()=>{h(P),c(!0)},children:d.jsx(Kn,{src:v,alt:`Página ${P+1}`,aspectRatio:i==="grid"?"1/1":"auto",objectFit:i==="grid"?"cover":"contain",loading:P<5?"eager":"lazy",className:"w-full h-auto rounded-lg",imgClassName:"group-hover:scale-110"})},P)})})}),d.jsx(gd,{}),u&&d.jsx(ub,{images:r,initialIndex:f,onClose:()=>c(!1)})]})}async function lv(t,e,n){const r=await F2(t),i=U2(t);try{const s=await fetch("/api/process-image",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({image:r,name:t.name,index:e,total:n})});if(!s.ok)throw new Error(`Server processing failed: ${s.statusText}`);const o=await s.json();if(!o.success||!o.data)throw new Error("Invalid response from processing server");return{thumbnail:o.data.thumbnail,original:r,webpDisplay:o.data.webp,webpCover:o.data.webp,originalFormat:i,originalBase64:r,originalUnmodified:r}}catch(s){throw console.error("Error processing image on server, falling back to local:",s),s}}async function F2(t){return new Promise((e,n)=>{const r=new FileReader;r.onload=i=>{var s;return e((s=i.target)==null?void 0:s.result)},r.onerror=()=>n(new Error("Failed to read file")),r.readAsDataURL(t)})}function U2(t){var r;const e=t.type;if(e==="image/png")return"png";if(e==="image/jpeg")return"jpg";if(e==="image/gif")return"gif";if(e==="image/webp")return"webp";const n=(r=t.name.split(".").pop())==null?void 0:r.toLowerCase();return n&&["png","jpg","jpeg","gif","webp"].includes(n)?n==="jpeg"?"jpg":n:"jpg"}async function z2(t){return new Promise((e,n)=>{const r=new Image;r.crossOrigin="anonymous",r.onload=()=>{const i=r.width/r.height;i<.9?e("portrait"):i>1.1?e("landscape"):e("square")},r.onerror=()=>n(new Error("Failed to load image")),r.src=t})}const Hm="userApiKey";function B2(t){if(!t||t.trim()==="")throw new Error("API key no puede estar vacía");localStorage.setItem(Hm,t.trim())}function cb(){return localStorage.getItem(Hm)}function $2(){localStorage.removeItem(Hm)}const db="imageBatchSize",uv=10;function gu(t){if(t<0)throw new Error("El tamaño del lote no puede ser negativo");localStorage.setItem(db,t.toString())}function hb(){const t=localStorage.getItem(db);if(!t)return uv;const e=parseInt(t,10);return isNaN(e)||e<0?uv:e>=999999?0:e}const H2="90ba8efe6890e9e76175089dc182a22a",q2="https://api.imgbb.com/1/upload";function W2(){return cb()||H2}async function Sc(t,e){const n=t.includes(",")?t.split(",")[1]:t,r=W2(),i=`${q2}?key=${r}`,s=new FormData;s.append("image",n),e&&s.append("name",e);const o=await fetch(i,{method:"POST",body:s});if(!o.ok){const u=await o.text();throw o.status===429||u.includes("rate limit")?new Error("API_BURNED"):o.status===403||o.status===401?new Error("API_INVALID_KEY"):new Error(`Error al subir imagen a ImgBB: ${u}`)}const a=await o.json();if(!a.success)throw new Error("API_BURNED");return a}async function yu(t,e,n){const r=hb(),i=[];if(r===0||r>=t.length){const s=t.map((a,u)=>{const c=e?`${e}_${u+1}`:void 0;return Sc(a,c)}),o=await Promise.all(s);i.push(...o),n&&n(t.length,t.length)}else for(let s=0;s{const h=s+f,p=e?`${e}_${h+1}`:void 0;return Sc(c,p)}),u=await Promise.all(a);i.push(...u),n&&n(Math.min(s+r,t.length),t.length)}return i}const G2=()=>{};var cv={};/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const fb=function(t){const e=[];let n=0;for(let r=0;r>6|192,e[n++]=i&63|128):(i&64512)===55296&&r+1>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=i&63|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=i&63|128)}return e},K2=function(t){const e=[];let n=0,r=0;for(;n191&&i<224){const s=t[n++];e[r++]=String.fromCharCode((i&31)<<6|s&63)}else if(i>239&&i<365){const s=t[n++],o=t[n++],a=t[n++],u=((i&7)<<18|(s&63)<<12|(o&63)<<6|a&63)-65536;e[r++]=String.fromCharCode(55296+(u>>10)),e[r++]=String.fromCharCode(56320+(u&1023))}else{const s=t[n++],o=t[n++];e[r++]=String.fromCharCode((i&15)<<12|(s&63)<<6|o&63)}}return e.join("")},pb={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let i=0;i>2,h=(s&3)<<4|a>>4;let p=(a&15)<<2|c>>6,g=c&63;u||(g=64,o||(p=64)),r.push(n[f],n[h],n[p],n[g])}return r.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(fb(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):K2(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();const n=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let i=0;i>4;if(r.push(p),c!==64){const g=a<<4&240|c>>2;if(r.push(g),h!==64){const _=c<<6&192|h;r.push(_)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let t=0;t=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}};class Q2 extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const Y2=function(t){const e=fb(t);return pb.encodeByteArray(e,!0)},kc=function(t){return Y2(t).replace(/\./g,"")},mb=function(t){try{return pb.decodeString(t,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};/** + * @license + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function X2(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}/** + * @license + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const J2=()=>X2().__FIREBASE_DEFAULTS__,Z2=()=>{if(typeof process>"u"||typeof cv>"u")return;const t=cv.__FIREBASE_DEFAULTS__;if(t)return JSON.parse(t)},eC=()=>{if(typeof document>"u")return;let t;try{t=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const e=t&&mb(t[1]);return e&&JSON.parse(e)},yd=()=>{try{return G2()||J2()||Z2()||eC()}catch(t){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${t}`);return}},gb=t=>{var e,n;return(n=(e=yd())==null?void 0:e.emulatorHosts)==null?void 0:n[t]},yb=t=>{const e=gb(t);if(!e)return;const n=e.lastIndexOf(":");if(n<=0||n+1===e.length)throw new Error(`Invalid host ${e} with no separate hostname and port!`);const r=parseInt(e.substring(n+1),10);return e[0]==="["?[e.substring(1,n-1),r]:[e.substring(0,n),r]},vb=()=>{var t;return(t=yd())==null?void 0:t.config},xb=t=>{var e;return(e=yd())==null?void 0:e[`_${t}`]};/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class tC{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}wrapCallback(e){return(n,r)=>{n?this.reject(n):this.resolve(r),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(n):e(n,r))}}}/** + * @license + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Ls(t){try{return(t.startsWith("http://")||t.startsWith("https://")?new URL(t).hostname:t).endsWith(".cloudworkstations.dev")}catch{return!1}}async function qm(t){return(await fetch(t,{credentials:"include"})).ok}/** + * @license + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function wb(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const n={alg:"none",type:"JWT"},r=e||"demo-project",i=t.iat||0,s=t.sub||t.user_id;if(!s)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const o={iss:`https://securetoken.google.com/${r}`,aud:r,iat:i,exp:i+3600,auth_time:i,sub:s,user_id:s,firebase:{sign_in_provider:"custom",identities:{}},...t};return[kc(JSON.stringify(n)),kc(JSON.stringify(o)),""].join(".")}const Fa={};function nC(){const t={prod:[],emulator:[]};for(const e of Object.keys(Fa))Fa[e]?t.emulator.push(e):t.prod.push(e);return t}function rC(t){let e=document.getElementById(t),n=!1;return e||(e=document.createElement("div"),e.setAttribute("id",t),n=!0),{created:n,element:e}}let dv=!1;function Wm(t,e){if(typeof window>"u"||typeof document>"u"||!Ls(window.location.host)||Fa[t]===e||Fa[t]||dv)return;Fa[t]=e;function n(p){return`__firebase__banner__${p}`}const r="__firebase__banner",s=nC().prod.length>0;function o(){const p=document.getElementById(r);p&&p.remove()}function a(p){p.style.display="flex",p.style.background="#7faaf0",p.style.position="fixed",p.style.bottom="5px",p.style.left="5px",p.style.padding=".5em",p.style.borderRadius="5px",p.style.alignItems="center"}function u(p,g){p.setAttribute("width","24"),p.setAttribute("id",g),p.setAttribute("height","24"),p.setAttribute("viewBox","0 0 24 24"),p.setAttribute("fill","none"),p.style.marginLeft="-6px"}function c(){const p=document.createElement("span");return p.style.cursor="pointer",p.style.marginLeft="16px",p.style.fontSize="24px",p.innerHTML=" ×",p.onclick=()=>{dv=!0,o()},p}function f(p,g){p.setAttribute("id",g),p.innerText="Learn more",p.href="https://firebase.google.com/docs/studio/preview-apps#preview-backend",p.setAttribute("target","__blank"),p.style.paddingLeft="5px",p.style.textDecoration="underline"}function h(){const p=rC(r),g=n("text"),_=document.getElementById(g)||document.createElement("span"),S=n("learnmore"),P=document.getElementById(S)||document.createElement("a"),v=n("preprendIcon"),x=document.getElementById(v)||document.createElementNS("http://www.w3.org/2000/svg","svg");if(p.created){const E=p.element;a(E),f(P,S);const O=c();u(x,v),E.append(x,_,P,O),document.body.appendChild(E)}s?(_.innerText="Preview backend disconnected.",x.innerHTML=` + + + + + + +`):(x.innerHTML=` + + + + + + +`,_.innerText="Preview backend running in this workspace."),_.setAttribute("id",g)}document.readyState==="loading"?window.addEventListener("DOMContentLoaded",h):h()}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function cn(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function iC(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(cn())}function sC(){var e;const t=(e=yd())==null?void 0:e.forceEnvironment;if(t==="node")return!0;if(t==="browser")return!1;try{return Object.prototype.toString.call(global.process)==="[object process]"}catch{return!1}}function oC(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function aC(){const t=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof t=="object"&&t.id!==void 0}function lC(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function uC(){const t=cn();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0}function cC(){return!sC()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}function dC(){try{return typeof indexedDB=="object"}catch{return!1}}function hC(){return new Promise((t,e)=>{try{let n=!0;const r="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(r);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(r),t(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{var s;e(((s=i.error)==null?void 0:s.message)||"")}}catch(n){e(n)}})}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const fC="FirebaseError";class Dr extends Error{constructor(e,n,r){super(n),this.code=e,this.customData=r,this.name=fC,Object.setPrototypeOf(this,Dr.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,Al.prototype.create)}}class Al{constructor(e,n,r){this.service=e,this.serviceName=n,this.errors=r}create(e,...n){const r=n[0]||{},i=`${this.service}/${e}`,s=this.errors[e],o=s?pC(s,r):"Error",a=`${this.serviceName}: ${o} (${i}).`;return new Dr(i,a,r)}}function pC(t,e){return t.replace(mC,(n,r)=>{const i=e[r];return i!=null?String(i):`<${r}?>`})}const mC=/\{\$([^}]+)}/g;function gC(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}function Jr(t,e){if(t===e)return!0;const n=Object.keys(t),r=Object.keys(e);for(const i of n){if(!r.includes(i))return!1;const s=t[i],o=e[i];if(hv(s)&&hv(o)){if(!Jr(s,o))return!1}else if(s!==o)return!1}for(const i of r)if(!n.includes(i))return!1;return!0}function hv(t){return t!==null&&typeof t=="object"}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Pl(t){const e=[];for(const[n,r]of Object.entries(t))Array.isArray(r)?r.forEach(i=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(i))}):e.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return e.length?"&"+e.join("&"):""}function Ia(t){const e={};return t.replace(/^\?/,"").split("&").forEach(r=>{if(r){const[i,s]=r.split("=");e[decodeURIComponent(i)]=decodeURIComponent(s)}}),e}function Ta(t){const e=t.indexOf("?");if(!e)return"";const n=t.indexOf("#",e);return t.substring(e,n>0?n:void 0)}function yC(t,e){const n=new vC(t,e);return n.subscribe.bind(n)}class vC{constructor(e,n){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=n,this.task.then(()=>{e(this)}).catch(r=>{this.error(r)})}next(e){this.forEachObserver(n=>{n.next(e)})}error(e){this.forEachObserver(n=>{n.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,n,r){let i;if(e===void 0&&n===void 0&&r===void 0)throw new Error("Missing Observer.");xC(e,["next","error","complete"])?i=e:i={next:e,error:n,complete:r},i.next===void 0&&(i.next=Mh),i.error===void 0&&(i.error=Mh),i.complete===void 0&&(i.complete=Mh);const s=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?i.error(this.finalError):i.complete()}catch{}}),this.observers.push(i),s}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let n=0;n{if(this.observers!==void 0&&this.observers[e]!==void 0)try{n(this.observers[e])}catch(r){typeof console<"u"&&console.error&&console.error(r)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}}function xC(t,e){if(typeof t!="object"||t===null)return!1;for(const n of e)if(n in t&&typeof t[n]=="function")return!0;return!1}function Mh(){}/** + * @license + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Ft(t){return t&&t._delegate?t._delegate:t}class Bi{constructor(e,n,r){this.name=e,this.instanceFactory=n,this.type=r,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const ds="[DEFAULT]";/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class wC{constructor(e,n){this.name=e,this.container=n,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){const n=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(n)){const r=new tC;if(this.instancesDeferred.set(n,r),this.isInitialized(n)||this.shouldAutoInitialize())try{const i=this.getOrInitializeService({instanceIdentifier:n});i&&r.resolve(i)}catch{}}return this.instancesDeferred.get(n).promise}getImmediate(e){const n=this.normalizeInstanceIdentifier(e==null?void 0:e.identifier),r=(e==null?void 0:e.optional)??!1;if(this.isInitialized(n)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:n})}catch(i){if(r)return null;throw i}else{if(r)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,!!this.shouldAutoInitialize()){if(bC(e))try{this.getOrInitializeService({instanceIdentifier:ds})}catch{}for(const[n,r]of this.instancesDeferred.entries()){const i=this.normalizeInstanceIdentifier(n);try{const s=this.getOrInitializeService({instanceIdentifier:i});r.resolve(s)}catch{}}}}clearInstance(e=ds){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){const e=Array.from(this.instances.values());await Promise.all([...e.filter(n=>"INTERNAL"in n).map(n=>n.INTERNAL.delete()),...e.filter(n=>"_delete"in n).map(n=>n._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=ds){return this.instances.has(e)}getOptions(e=ds){return this.instancesOptions.get(e)||{}}initialize(e={}){const{options:n={}}=e,r=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(r))throw Error(`${this.name}(${r}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const i=this.getOrInitializeService({instanceIdentifier:r,options:n});for(const[s,o]of this.instancesDeferred.entries()){const a=this.normalizeInstanceIdentifier(s);r===a&&o.resolve(i)}return i}onInit(e,n){const r=this.normalizeInstanceIdentifier(n),i=this.onInitCallbacks.get(r)??new Set;i.add(e),this.onInitCallbacks.set(r,i);const s=this.instances.get(r);return s&&e(s,r),()=>{i.delete(e)}}invokeOnInitCallbacks(e,n){const r=this.onInitCallbacks.get(n);if(r)for(const i of r)try{i(e,n)}catch{}}getOrInitializeService({instanceIdentifier:e,options:n={}}){let r=this.instances.get(e);if(!r&&this.component&&(r=this.component.instanceFactory(this.container,{instanceIdentifier:_C(e),options:n}),this.instances.set(e,r),this.instancesOptions.set(e,n),this.invokeOnInitCallbacks(r,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,r)}catch{}return r||null}normalizeInstanceIdentifier(e=ds){return this.component?this.component.multipleInstances?e:ds:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function _C(t){return t===ds?void 0:t}function bC(t){return t.instantiationMode==="EAGER"}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class EC{constructor(e){this.name=e,this.providers=new Map}addComponent(e){const n=this.getProvider(e.name);if(n.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);n.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);const n=new wC(e,this);return this.providers.set(e,n),n}getProviders(){return Array.from(this.providers.values())}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */var Be;(function(t){t[t.DEBUG=0]="DEBUG",t[t.VERBOSE=1]="VERBOSE",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.SILENT=5]="SILENT"})(Be||(Be={}));const IC={debug:Be.DEBUG,verbose:Be.VERBOSE,info:Be.INFO,warn:Be.WARN,error:Be.ERROR,silent:Be.SILENT},TC=Be.INFO,SC={[Be.DEBUG]:"log",[Be.VERBOSE]:"log",[Be.INFO]:"info",[Be.WARN]:"warn",[Be.ERROR]:"error"},kC=(t,e,...n)=>{if(ee.some(n=>t instanceof n);let fv,pv;function NC(){return fv||(fv=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function AC(){return pv||(pv=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const _b=new WeakMap,ap=new WeakMap,bb=new WeakMap,Vh=new WeakMap,Km=new WeakMap;function PC(t){const e=new Promise((n,r)=>{const i=()=>{t.removeEventListener("success",s),t.removeEventListener("error",o)},s=()=>{n(Li(t.result)),i()},o=()=>{r(t.error),i()};t.addEventListener("success",s),t.addEventListener("error",o)});return e.then(n=>{n instanceof IDBCursor&&_b.set(n,t)}).catch(()=>{}),Km.set(e,t),e}function RC(t){if(ap.has(t))return;const e=new Promise((n,r)=>{const i=()=>{t.removeEventListener("complete",s),t.removeEventListener("error",o),t.removeEventListener("abort",o)},s=()=>{n(),i()},o=()=>{r(t.error||new DOMException("AbortError","AbortError")),i()};t.addEventListener("complete",s),t.addEventListener("error",o),t.addEventListener("abort",o)});ap.set(t,e)}let lp={get(t,e,n){if(t instanceof IDBTransaction){if(e==="done")return ap.get(t);if(e==="objectStoreNames")return t.objectStoreNames||bb.get(t);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return Li(t[e])},set(t,e,n){return t[e]=n,!0},has(t,e){return t instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in t}};function DC(t){lp=t(lp)}function jC(t){return t===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...n){const r=t.call(Fh(this),e,...n);return bb.set(r,e.sort?e.sort():[e]),Li(r)}:AC().includes(t)?function(...e){return t.apply(Fh(this),e),Li(_b.get(this))}:function(...e){return Li(t.apply(Fh(this),e))}}function OC(t){return typeof t=="function"?jC(t):(t instanceof IDBTransaction&&RC(t),CC(t,NC())?new Proxy(t,lp):t)}function Li(t){if(t instanceof IDBRequest)return PC(t);if(Vh.has(t))return Vh.get(t);const e=OC(t);return e!==t&&(Vh.set(t,e),Km.set(e,t)),e}const Fh=t=>Km.get(t);function LC(t,e,{blocked:n,upgrade:r,blocking:i,terminated:s}={}){const o=indexedDB.open(t,e),a=Li(o);return r&&o.addEventListener("upgradeneeded",u=>{r(Li(o.result),u.oldVersion,u.newVersion,Li(o.transaction),u)}),n&&o.addEventListener("blocked",u=>n(u.oldVersion,u.newVersion,u)),a.then(u=>{s&&u.addEventListener("close",()=>s()),i&&u.addEventListener("versionchange",c=>i(c.oldVersion,c.newVersion,c))}).catch(()=>{}),a}const MC=["get","getKey","getAll","getAllKeys","count"],VC=["put","add","delete","clear"],Uh=new Map;function mv(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(Uh.get(e))return Uh.get(e);const n=e.replace(/FromIndex$/,""),r=e!==n,i=VC.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(i||MC.includes(n)))return;const s=async function(o,...a){const u=this.transaction(o,i?"readwrite":"readonly");let c=u.store;return r&&(c=c.index(a.shift())),(await Promise.all([c[n](...a),i&&u.done]))[0]};return Uh.set(e,s),s}DC(t=>({...t,get:(e,n,r)=>mv(e,n)||t.get(e,n,r),has:(e,n)=>!!mv(e,n)||t.has(e,n)}));/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class FC{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(UC(n)){const r=n.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(n=>n).join(" ")}}function UC(t){const e=t.getComponent();return(e==null?void 0:e.type)==="VERSION"}const up="@firebase/app",gv="0.14.6";/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Zr=new Gm("@firebase/app"),zC="@firebase/app-compat",BC="@firebase/analytics-compat",$C="@firebase/analytics",HC="@firebase/app-check-compat",qC="@firebase/app-check",WC="@firebase/auth",GC="@firebase/auth-compat",KC="@firebase/database",QC="@firebase/data-connect",YC="@firebase/database-compat",XC="@firebase/functions",JC="@firebase/functions-compat",ZC="@firebase/installations",eN="@firebase/installations-compat",tN="@firebase/messaging",nN="@firebase/messaging-compat",rN="@firebase/performance",iN="@firebase/performance-compat",sN="@firebase/remote-config",oN="@firebase/remote-config-compat",aN="@firebase/storage",lN="@firebase/storage-compat",uN="@firebase/firestore",cN="@firebase/ai",dN="@firebase/firestore-compat",hN="firebase",fN="12.6.0";/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const cp="[DEFAULT]",pN={[up]:"fire-core",[zC]:"fire-core-compat",[$C]:"fire-analytics",[BC]:"fire-analytics-compat",[qC]:"fire-app-check",[HC]:"fire-app-check-compat",[WC]:"fire-auth",[GC]:"fire-auth-compat",[KC]:"fire-rtdb",[QC]:"fire-data-connect",[YC]:"fire-rtdb-compat",[XC]:"fire-fn",[JC]:"fire-fn-compat",[ZC]:"fire-iid",[eN]:"fire-iid-compat",[tN]:"fire-fcm",[nN]:"fire-fcm-compat",[rN]:"fire-perf",[iN]:"fire-perf-compat",[sN]:"fire-rc",[oN]:"fire-rc-compat",[aN]:"fire-gcs",[lN]:"fire-gcs-compat",[uN]:"fire-fst",[dN]:"fire-fst-compat",[cN]:"fire-vertex","fire-js":"fire-js",[hN]:"fire-js-all"};/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Cc=new Map,mN=new Map,dp=new Map;function yv(t,e){try{t.container.addComponent(e)}catch(n){Zr.debug(`Component ${e.name} failed to register with FirebaseApp ${t.name}`,n)}}function Cs(t){const e=t.name;if(dp.has(e))return Zr.debug(`There were multiple attempts to register component ${e}.`),!1;dp.set(e,t);for(const n of Cc.values())yv(n,t);for(const n of mN.values())yv(n,t);return!0}function vd(t,e){const n=t.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),t.container.getProvider(e)}function wn(t){return t==null?!1:t.settings!==void 0}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const gN={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},Mi=new Al("app","Firebase",gN);/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class yN{constructor(e,n,r){this._isDeleted=!1,this._options={...e},this._config={...n},this._name=n.name,this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new Bi("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw Mi.create("app-deleted",{appName:this._name})}}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Ms=fN;function Eb(t,e={}){let n=t;typeof e!="object"&&(e={name:e});const r={name:cp,automaticDataCollectionEnabled:!0,...e},i=r.name;if(typeof i!="string"||!i)throw Mi.create("bad-app-name",{appName:String(i)});if(n||(n=vb()),!n)throw Mi.create("no-options");const s=Cc.get(i);if(s){if(Jr(n,s.options)&&Jr(r,s.config))return s;throw Mi.create("duplicate-app",{appName:i})}const o=new EC(i);for(const u of dp.values())o.addComponent(u);const a=new yN(n,r,o);return Cc.set(i,a),a}function Qm(t=cp){const e=Cc.get(t);if(!e&&t===cp&&vb())return Eb();if(!e)throw Mi.create("no-app",{appName:t});return e}function Ir(t,e,n){let r=pN[t]??t;n&&(r+=`-${n}`);const i=r.match(/\s|\//),s=e.match(/\s|\//);if(i||s){const o=[`Unable to register library "${r}" with version "${e}":`];i&&o.push(`library name "${r}" contains illegal characters (whitespace or "/")`),i&&s&&o.push("and"),s&&o.push(`version name "${e}" contains illegal characters (whitespace or "/")`),Zr.warn(o.join(" "));return}Cs(new Bi(`${r}-version`,()=>({library:r,version:e}),"VERSION"))}/** + * @license + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const vN="firebase-heartbeat-database",xN=1,pl="firebase-heartbeat-store";let zh=null;function Ib(){return zh||(zh=LC(vN,xN,{upgrade:(t,e)=>{switch(e){case 0:try{t.createObjectStore(pl)}catch(n){console.warn(n)}}}}).catch(t=>{throw Mi.create("idb-open",{originalErrorMessage:t.message})})),zh}async function wN(t){try{const n=(await Ib()).transaction(pl),r=await n.objectStore(pl).get(Tb(t));return await n.done,r}catch(e){if(e instanceof Dr)Zr.warn(e.message);else{const n=Mi.create("idb-get",{originalErrorMessage:e==null?void 0:e.message});Zr.warn(n.message)}}}async function vv(t,e){try{const r=(await Ib()).transaction(pl,"readwrite");await r.objectStore(pl).put(e,Tb(t)),await r.done}catch(n){if(n instanceof Dr)Zr.warn(n.message);else{const r=Mi.create("idb-set",{originalErrorMessage:n==null?void 0:n.message});Zr.warn(r.message)}}}function Tb(t){return`${t.name}!${t.options.appId}`}/** + * @license + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const _N=1024,bN=30;class EN{constructor(e){this.container=e,this._heartbeatsCache=null;const n=this.container.getProvider("app").getImmediate();this._storage=new TN(n),this._heartbeatsCachePromise=this._storage.read().then(r=>(this._heartbeatsCache=r,r))}async triggerHeartbeat(){var e,n;try{const i=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),s=xv();if(((e=this._heartbeatsCache)==null?void 0:e.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((n=this._heartbeatsCache)==null?void 0:n.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===s||this._heartbeatsCache.heartbeats.some(o=>o.date===s))return;if(this._heartbeatsCache.heartbeats.push({date:s,agent:i}),this._heartbeatsCache.heartbeats.length>bN){const o=SN(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(o,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(r){Zr.warn(r)}}async getHeartbeatsHeader(){var e;try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((e=this._heartbeatsCache)==null?void 0:e.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";const n=xv(),{heartbeatsToSend:r,unsentEntries:i}=IN(this._heartbeatsCache.heartbeats),s=kc(JSON.stringify({version:2,heartbeats:r}));return this._heartbeatsCache.lastSentHeartbeatDate=n,i.length>0?(this._heartbeatsCache.heartbeats=i,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),s}catch(n){return Zr.warn(n),""}}}function xv(){return new Date().toISOString().substring(0,10)}function IN(t,e=_N){const n=[];let r=t.slice();for(const i of t){const s=n.find(o=>o.agent===i.agent);if(s){if(s.dates.push(i.date),wv(n)>e){s.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),wv(n)>e){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}class TN{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return dC()?hC().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const n=await wN(this.app);return n!=null&&n.heartbeats?n:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){if(await this._canUseIndexedDBPromise){const r=await this.read();return vv(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){if(await this._canUseIndexedDBPromise){const r=await this.read();return vv(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:[...r.heartbeats,...e.heartbeats]})}else return}}function wv(t){return kc(JSON.stringify({version:2,heartbeats:t})).length}function SN(t){if(t.length===0)return-1;let e=0,n=t[0].date;for(let r=1;rnew FC(e),"PRIVATE")),Cs(new Bi("heartbeat",e=>new EN(e),"PRIVATE")),Ir(up,gv,t),Ir(up,gv,"esm2020"),Ir("fire-js","")}kN("");var CN="firebase",NN="12.6.0";/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */Ir(CN,NN,"app");var _v=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/** @license +Copyright The Closure Library Authors. +SPDX-License-Identifier: Apache-2.0 +*/var Vi,Sb;(function(){var t;/** @license + + Copyright The Closure Library Authors. + SPDX-License-Identifier: Apache-2.0 +*/function e(b,w){function T(){}T.prototype=w.prototype,b.F=w.prototype,b.prototype=new T,b.prototype.constructor=b,b.D=function(A,N,j){for(var C=Array(arguments.length-2),se=2;se>>25),C=j+(N^w&(T^N))+A[1]+3905402710&4294967295,j=w+(C<<12&4294967295|C>>>20),C=N+(T^j&(w^T))+A[2]+606105819&4294967295,N=j+(C<<17&4294967295|C>>>15),C=T+(w^N&(j^w))+A[3]+3250441966&4294967295,T=N+(C<<22&4294967295|C>>>10),C=w+(j^T&(N^j))+A[4]+4118548399&4294967295,w=T+(C<<7&4294967295|C>>>25),C=j+(N^w&(T^N))+A[5]+1200080426&4294967295,j=w+(C<<12&4294967295|C>>>20),C=N+(T^j&(w^T))+A[6]+2821735955&4294967295,N=j+(C<<17&4294967295|C>>>15),C=T+(w^N&(j^w))+A[7]+4249261313&4294967295,T=N+(C<<22&4294967295|C>>>10),C=w+(j^T&(N^j))+A[8]+1770035416&4294967295,w=T+(C<<7&4294967295|C>>>25),C=j+(N^w&(T^N))+A[9]+2336552879&4294967295,j=w+(C<<12&4294967295|C>>>20),C=N+(T^j&(w^T))+A[10]+4294925233&4294967295,N=j+(C<<17&4294967295|C>>>15),C=T+(w^N&(j^w))+A[11]+2304563134&4294967295,T=N+(C<<22&4294967295|C>>>10),C=w+(j^T&(N^j))+A[12]+1804603682&4294967295,w=T+(C<<7&4294967295|C>>>25),C=j+(N^w&(T^N))+A[13]+4254626195&4294967295,j=w+(C<<12&4294967295|C>>>20),C=N+(T^j&(w^T))+A[14]+2792965006&4294967295,N=j+(C<<17&4294967295|C>>>15),C=T+(w^N&(j^w))+A[15]+1236535329&4294967295,T=N+(C<<22&4294967295|C>>>10),C=w+(N^j&(T^N))+A[1]+4129170786&4294967295,w=T+(C<<5&4294967295|C>>>27),C=j+(T^N&(w^T))+A[6]+3225465664&4294967295,j=w+(C<<9&4294967295|C>>>23),C=N+(w^T&(j^w))+A[11]+643717713&4294967295,N=j+(C<<14&4294967295|C>>>18),C=T+(j^w&(N^j))+A[0]+3921069994&4294967295,T=N+(C<<20&4294967295|C>>>12),C=w+(N^j&(T^N))+A[5]+3593408605&4294967295,w=T+(C<<5&4294967295|C>>>27),C=j+(T^N&(w^T))+A[10]+38016083&4294967295,j=w+(C<<9&4294967295|C>>>23),C=N+(w^T&(j^w))+A[15]+3634488961&4294967295,N=j+(C<<14&4294967295|C>>>18),C=T+(j^w&(N^j))+A[4]+3889429448&4294967295,T=N+(C<<20&4294967295|C>>>12),C=w+(N^j&(T^N))+A[9]+568446438&4294967295,w=T+(C<<5&4294967295|C>>>27),C=j+(T^N&(w^T))+A[14]+3275163606&4294967295,j=w+(C<<9&4294967295|C>>>23),C=N+(w^T&(j^w))+A[3]+4107603335&4294967295,N=j+(C<<14&4294967295|C>>>18),C=T+(j^w&(N^j))+A[8]+1163531501&4294967295,T=N+(C<<20&4294967295|C>>>12),C=w+(N^j&(T^N))+A[13]+2850285829&4294967295,w=T+(C<<5&4294967295|C>>>27),C=j+(T^N&(w^T))+A[2]+4243563512&4294967295,j=w+(C<<9&4294967295|C>>>23),C=N+(w^T&(j^w))+A[7]+1735328473&4294967295,N=j+(C<<14&4294967295|C>>>18),C=T+(j^w&(N^j))+A[12]+2368359562&4294967295,T=N+(C<<20&4294967295|C>>>12),C=w+(T^N^j)+A[5]+4294588738&4294967295,w=T+(C<<4&4294967295|C>>>28),C=j+(w^T^N)+A[8]+2272392833&4294967295,j=w+(C<<11&4294967295|C>>>21),C=N+(j^w^T)+A[11]+1839030562&4294967295,N=j+(C<<16&4294967295|C>>>16),C=T+(N^j^w)+A[14]+4259657740&4294967295,T=N+(C<<23&4294967295|C>>>9),C=w+(T^N^j)+A[1]+2763975236&4294967295,w=T+(C<<4&4294967295|C>>>28),C=j+(w^T^N)+A[4]+1272893353&4294967295,j=w+(C<<11&4294967295|C>>>21),C=N+(j^w^T)+A[7]+4139469664&4294967295,N=j+(C<<16&4294967295|C>>>16),C=T+(N^j^w)+A[10]+3200236656&4294967295,T=N+(C<<23&4294967295|C>>>9),C=w+(T^N^j)+A[13]+681279174&4294967295,w=T+(C<<4&4294967295|C>>>28),C=j+(w^T^N)+A[0]+3936430074&4294967295,j=w+(C<<11&4294967295|C>>>21),C=N+(j^w^T)+A[3]+3572445317&4294967295,N=j+(C<<16&4294967295|C>>>16),C=T+(N^j^w)+A[6]+76029189&4294967295,T=N+(C<<23&4294967295|C>>>9),C=w+(T^N^j)+A[9]+3654602809&4294967295,w=T+(C<<4&4294967295|C>>>28),C=j+(w^T^N)+A[12]+3873151461&4294967295,j=w+(C<<11&4294967295|C>>>21),C=N+(j^w^T)+A[15]+530742520&4294967295,N=j+(C<<16&4294967295|C>>>16),C=T+(N^j^w)+A[2]+3299628645&4294967295,T=N+(C<<23&4294967295|C>>>9),C=w+(N^(T|~j))+A[0]+4096336452&4294967295,w=T+(C<<6&4294967295|C>>>26),C=j+(T^(w|~N))+A[7]+1126891415&4294967295,j=w+(C<<10&4294967295|C>>>22),C=N+(w^(j|~T))+A[14]+2878612391&4294967295,N=j+(C<<15&4294967295|C>>>17),C=T+(j^(N|~w))+A[5]+4237533241&4294967295,T=N+(C<<21&4294967295|C>>>11),C=w+(N^(T|~j))+A[12]+1700485571&4294967295,w=T+(C<<6&4294967295|C>>>26),C=j+(T^(w|~N))+A[3]+2399980690&4294967295,j=w+(C<<10&4294967295|C>>>22),C=N+(w^(j|~T))+A[10]+4293915773&4294967295,N=j+(C<<15&4294967295|C>>>17),C=T+(j^(N|~w))+A[1]+2240044497&4294967295,T=N+(C<<21&4294967295|C>>>11),C=w+(N^(T|~j))+A[8]+1873313359&4294967295,w=T+(C<<6&4294967295|C>>>26),C=j+(T^(w|~N))+A[15]+4264355552&4294967295,j=w+(C<<10&4294967295|C>>>22),C=N+(w^(j|~T))+A[6]+2734768916&4294967295,N=j+(C<<15&4294967295|C>>>17),C=T+(j^(N|~w))+A[13]+1309151649&4294967295,T=N+(C<<21&4294967295|C>>>11),C=w+(N^(T|~j))+A[4]+4149444226&4294967295,w=T+(C<<6&4294967295|C>>>26),C=j+(T^(w|~N))+A[11]+3174756917&4294967295,j=w+(C<<10&4294967295|C>>>22),C=N+(w^(j|~T))+A[2]+718787259&4294967295,N=j+(C<<15&4294967295|C>>>17),C=T+(j^(N|~w))+A[9]+3951481745&4294967295,b.g[0]=b.g[0]+w&4294967295,b.g[1]=b.g[1]+(N+(C<<21&4294967295|C>>>11))&4294967295,b.g[2]=b.g[2]+N&4294967295,b.g[3]=b.g[3]+j&4294967295}r.prototype.v=function(b,w){w===void 0&&(w=b.length);const T=w-this.blockSize,A=this.C;let N=this.h,j=0;for(;j>>A&255;return b};function s(b,w){var T=a;return Object.prototype.hasOwnProperty.call(T,b)?T[b]:T[b]=w(b)}function o(b,w){this.h=w;const T=[];let A=!0;for(let N=b.length-1;N>=0;N--){const j=b[N]|0;A&&j==w||(T[N]=j,A=!1)}this.g=T}var a={};function u(b){return-128<=b&&b<128?s(b,function(w){return new o([w|0],w<0?-1:0)}):new o([b|0],b<0?-1:0)}function c(b){if(isNaN(b)||!isFinite(b))return h;if(b<0)return P(c(-b));const w=[];let T=1;for(let A=0;b>=T;A++)w[A]=b/T|0,T*=4294967296;return new o(w,0)}function f(b,w){if(b.length==0)throw Error("number format error: empty string");if(w=w||10,w<2||36=0)throw Error('number format error: interior "-" character');const T=c(Math.pow(w,8));let A=h;for(let j=0;j=0?A:4294967296+A)*w,w*=4294967296}return b},t.toString=function(b){if(b=b||10,b<2||360?T.g[0]:T.h)>>>0).toString(b);if(T=N,_(T))return j+A;for(;j.length<6;)j="0"+j;A=j+A}},t.i=function(b){return b<0?0:b>>16)+(this.i(N)>>>16)+(b.i(N)>>>16);A=C>>>16,j&=65535,C&=65535,T[N]=C<<16|j}return new o(T,T[T.length-1]&-2147483648?-1:0)};function v(b,w){return b.add(P(w))}t.j=function(b){if(_(this)||_(b))return h;if(S(this))return S(b)?P(this).j(P(b)):P(P(this).j(b));if(S(b))return P(this.j(P(b)));if(this.l(g)<0&&b.l(g)<0)return c(this.m()*b.m());const w=this.g.length+b.g.length,T=[];for(var A=0;A<2*w;A++)T[A]=0;for(A=0;A>>16,C=this.i(A)&65535,se=b.i(N)>>>16,he=b.i(N)&65535;T[2*A+2*N]+=C*he,x(T,2*A+2*N),T[2*A+2*N+1]+=j*he,x(T,2*A+2*N+1),T[2*A+2*N+1]+=C*se,x(T,2*A+2*N+1),T[2*A+2*N+2]+=j*se,x(T,2*A+2*N+2)}for(b=0;b>>16,b[w]&=65535,w++}function E(b,w){this.g=b,this.h=w}function O(b,w){if(_(w))throw Error("division by zero");if(_(b))return new E(h,h);if(S(b))return w=O(P(b),w),new E(P(w.g),P(w.h));if(S(w))return w=O(b,P(w)),new E(P(w.g),w.h);if(b.g.length>30){if(S(b)||S(w))throw Error("slowDivide_ only works with positive integers.");for(var T=p,A=w;A.l(b)<=0;)T=L(T),A=L(A);var N=D(T,1),j=D(A,1);for(A=D(A,2),T=D(T,2);!_(A);){var C=j.add(A);C.l(b)<=0&&(N=N.add(T),j=C),A=D(A,1),T=D(T,1)}return w=v(b,N.j(w)),new E(N,w)}for(N=h;b.l(w)>=0;){for(T=Math.max(1,Math.floor(b.m()/w.m())),A=Math.ceil(Math.log(T)/Math.LN2),A=A<=48?1:Math.pow(2,A-48),j=c(T),C=j.j(w);S(C)||C.l(b)>0;)T-=A,j=c(T),C=j.j(w);_(j)&&(j=p),N=N.add(j),b=v(b,C)}return new E(N,b)}t.B=function(b){return O(this,b).h},t.and=function(b){const w=Math.max(this.g.length,b.g.length),T=[];for(let A=0;A>>31;return new o(T,b.h)}function D(b,w){const T=w>>5;w%=32;const A=b.g.length-T,N=[];for(let j=0;j0?b.i(j+T)>>>w|b.i(j+T+1)<<32-w:b.i(j+T);return new o(N,b.h)}r.prototype.digest=r.prototype.A,r.prototype.reset=r.prototype.u,r.prototype.update=r.prototype.v,Sb=r,o.prototype.add=o.prototype.add,o.prototype.multiply=o.prototype.j,o.prototype.modulo=o.prototype.B,o.prototype.compare=o.prototype.l,o.prototype.toNumber=o.prototype.m,o.prototype.toString=o.prototype.toString,o.prototype.getBits=o.prototype.i,o.fromNumber=c,o.fromString=f,Vi=o}).apply(typeof _v<"u"?_v:typeof self<"u"?self:typeof window<"u"?window:{});var vu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/** @license +Copyright The Closure Library Authors. +SPDX-License-Identifier: Apache-2.0 +*/var kb,Sa,Cb,Bu,hp,Nb,Ab,Pb;(function(){var t,e=Object.defineProperty;function n(l){l=[typeof globalThis=="object"&&globalThis,l,typeof window=="object"&&window,typeof self=="object"&&self,typeof vu=="object"&&vu];for(var m=0;ml&&AsyncContext.Snapshot.wrap(l):l=>l;function g(l){const m=l.length;if(m>0){const y=Array(m);for(let I=0;I0?(this.h--,m=this.g,this.g=m.next,m.next=null):m=this.i(),m}}function P(l){o.setTimeout(()=>{throw l},0)}function v(){var l=b;let m=null;return l.g&&(m=l.g,l.g=l.g.next,l.g||(l.h=null),m.next=null),m}class x{constructor(){this.h=this.g=null}add(m,y){const I=E.get();I.set(m,y),this.h?this.h.next=I:this.g=I,this.h=I}}var E=new S(()=>new O,l=>l.reset());class O{constructor(){this.next=this.g=this.h=null}set(m,y){this.h=m,this.g=y,this.next=null}reset(){this.next=this.g=this.h=null}}let L,D=!1,b=new x,w=()=>{const l=Promise.resolve(void 0);L=()=>{l.then(T)}};function T(){for(var l;l=v();){try{l.h.call(l.g)}catch(y){P(y)}var m=E;m.j(l),m.h<100&&(m.h++,l.next=m.g,m.g=l)}D=!1}function A(){this.u=this.u,this.C=this.C}A.prototype.u=!1,A.prototype.dispose=function(){this.u||(this.u=!0,this.N())},A.prototype[Symbol.dispose]=function(){this.dispose()},A.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()};function N(l,m){this.type=l,this.g=this.target=m,this.defaultPrevented=!1}N.prototype.h=function(){this.defaultPrevented=!0};var j=function(){if(!o.addEventListener||!Object.defineProperty)return!1;var l=!1,m=Object.defineProperty({},"passive",{get:function(){l=!0}});try{const y=()=>{};o.addEventListener("test",y,m),o.removeEventListener("test",y,m)}catch{}return l}();function C(l){return/^[\s\xa0]*$/.test(l)}function se(l,m){N.call(this,l?l.type:""),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType="",this.i=null,l&&this.init(l,m)}h(se,N),se.prototype.init=function(l,m){const y=this.type=l.type,I=l.changedTouches&&l.changedTouches.length?l.changedTouches[0]:null;this.target=l.target||l.srcElement,this.g=m,m=l.relatedTarget,m||(y=="mouseover"?m=l.fromElement:y=="mouseout"&&(m=l.toElement)),this.relatedTarget=m,I?(this.clientX=I.clientX!==void 0?I.clientX:I.pageX,this.clientY=I.clientY!==void 0?I.clientY:I.pageY,this.screenX=I.screenX||0,this.screenY=I.screenY||0):(this.clientX=l.clientX!==void 0?l.clientX:l.pageX,this.clientY=l.clientY!==void 0?l.clientY:l.pageY,this.screenX=l.screenX||0,this.screenY=l.screenY||0),this.button=l.button,this.key=l.key||"",this.ctrlKey=l.ctrlKey,this.altKey=l.altKey,this.shiftKey=l.shiftKey,this.metaKey=l.metaKey,this.pointerId=l.pointerId||0,this.pointerType=l.pointerType,this.state=l.state,this.i=l,l.defaultPrevented&&se.Z.h.call(this)},se.prototype.h=function(){se.Z.h.call(this);const l=this.i;l.preventDefault?l.preventDefault():l.returnValue=!1};var he="closure_listenable_"+(Math.random()*1e6|0),le=0;function me(l,m,y,I,M){this.listener=l,this.proxy=null,this.src=m,this.type=y,this.capture=!!I,this.ha=M,this.key=++le,this.da=this.fa=!1}function q(l){l.da=!0,l.listener=null,l.proxy=null,l.src=null,l.ha=null}function oe(l,m,y){for(const I in l)m.call(y,l[I],I,l)}function k(l,m){for(const y in l)m.call(void 0,l[y],y,l)}function ge(l){const m={};for(const y in l)m[y]=l[y];return m}const ye="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function R(l,m){let y,I;for(let M=1;M-1?(m=l[ne],y||(m.fa=!1)):(m=new me(m,this.src,U,!!I,M),m.fa=y,l.push(m)),m};function Z(l,m){const y=m.type;if(y in l.g){var I=l.g[y],M=Array.prototype.indexOf.call(I,m,void 0),U;(U=M>=0)&&Array.prototype.splice.call(I,M,1),U&&(q(m),l.g[y].length==0&&(delete l.g[y],l.h--))}}function ie(l,m,y,I){for(let M=0;M-1&&(q(m[y]),Array.prototype.splice.call(m,y,1),m.length==0&&(delete l.g[U],l.h--)))):l&&(l=ve(l))&&(m=l.g[m.toString()],l=-1,m&&(l=ie(m,y,I,M)),(y=l>-1?m[l]:null)&&Dt(y))}function Dt(l){if(typeof l!="number"&&l&&!l.da){var m=l.src;if(m&&m[he])Z(m.i,l);else{var y=l.type,I=l.proxy;m.removeEventListener?m.removeEventListener(y,I,l.capture):m.detachEvent?m.detachEvent(jt(y),I):m.addListener&&m.removeListener&&m.removeListener(I),(y=ve(m))?(Z(y,l),y.h==0&&(y.src=null,m[Te]=null)):q(l)}}}function jt(l){return l in fe?fe[l]:fe[l]="on"+l}function te(l,m){if(l.da)l=!0;else{m=new se(m,this);const y=l.listener,I=l.ha||l.src;l.fa&&Dt(l),l=y.call(I,m)}return l}function ve(l){return l=l[Te],l instanceof $?l:null}var Ae="__closure_events_fn_"+(Math.random()*1e9>>>0);function Le(l){return typeof l=="function"?l:(l[Ae]||(l[Ae]=function(m){return l.handleEvent(m)}),l[Ae])}function we(){A.call(this),this.i=new $(this),this.M=this,this.G=null}h(we,A),we.prototype[he]=!0,we.prototype.removeEventListener=function(l,m,y,I){tt(this,l,m,y,I)};function Qe(l,m){var y,I=l.G;if(I)for(y=[];I;I=I.G)y.push(I);if(l=l.M,I=m.type||m,typeof m=="string")m=new N(m,l);else if(m instanceof N)m.target=m.target||l;else{var M=m;m=new N(I,l),R(m,M)}M=!0;let U,ne;if(y)for(ne=y.length-1;ne>=0;ne--)U=m.g=y[ne],M=Ht(U,I,!0,m)&&M;if(U=m.g=l,M=Ht(U,I,!0,m)&&M,M=Ht(U,I,!1,m)&&M,y)for(ne=0;ne2147483647?-1:o.setTimeout(l,m||0)}function ht(l){l.g=Xe(()=>{l.g=null,l.i&&(l.i=!1,ht(l))},l.l);const m=l.h;l.h=null,l.m.apply(null,m)}class tn extends A{constructor(m,y){super(),this.m=m,this.l=y,this.h=null,this.i=!1,this.g=null}j(m){this.h=arguments,this.g?this.i=!0:ht(this)}N(){super.N(),this.g&&(o.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function qt(l){A.call(this),this.h=l,this.g={}}h(qt,A);var z=[];function V(l){oe(l.g,function(m,y){this.g.hasOwnProperty(y)&&Dt(m)},l),l.g={}}qt.prototype.N=function(){qt.Z.N.call(this),V(this)},qt.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var B=o.JSON.stringify,K=o.JSON.parse,J=class{stringify(l){return o.JSON.stringify(l,void 0)}parse(l){return o.JSON.parse(l,void 0)}};function je(){}function Ue(){}var De={OPEN:"a",hb:"b",ERROR:"c",tb:"d"};function H(){N.call(this,"d")}h(H,N);function Q(){N.call(this,"c")}h(Q,N);var de={},Ie=null;function pe(){return Ie=Ie||new we}de.Ia="serverreachability";function qe(l){N.call(this,de.Ia,l)}h(qe,N);function nt(l){const m=pe();Qe(m,new qe(m))}de.STAT_EVENT="statevent";function ft(l,m){N.call(this,de.STAT_EVENT,l),this.stat=m}h(ft,N);function xt(l){const m=pe();Qe(m,new ft(m,l))}de.Ja="timingevent";function Or(l,m){N.call(this,de.Ja,l),this.size=m}h(Or,N);function _e(l,m){if(typeof l!="function")throw Error("Fn must not be null and must be a function");return o.setTimeout(function(){l()},m)}function Pe(){this.g=!0}Pe.prototype.ua=function(){this.g=!1};function wt(l,m,y,I,M,U){l.info(function(){if(l.g)if(U){var ne="",Ve=U.split("&");for(let rt=0;rt1){const Ut=Ot[0];Ot=Ot[1];const pr=Ut.split("_");ne=pr.length>=2&&pr[1]=="type"?ne+(Ut+"="+Ot+"&"):ne+(Ut+"=redacted&")}}}else ne=null;else ne=U;return"XMLHTTP REQ ("+I+") [attempt "+M+"]: "+m+` +`+y+` +`+ne})}function Wt(l,m,y,I,M,U,ne){l.info(function(){return"XMLHTTP RESP ("+I+") [ attempt "+M+"]: "+m+` +`+y+` +`+U+" "+ne})}function Nn(l,m,y,I){l.info(function(){return"XMLHTTP TEXT ("+m+"): "+Gt(l,y)+(I?" "+I:"")})}function _t(l,m){l.info(function(){return"TIMEOUT: "+m})}Pe.prototype.info=function(){};function Gt(l,m){if(!l.g)return m;if(!m)return null;try{const U=JSON.parse(m);if(U){for(l=0;l0&&l.length;)y.push(l.shift()),m--;return l.length&&y.push(l.join(":")),y}function ai(l,m,y,I){this.j=l,this.i=m,this.l=y,this.S=I||1,this.V=new qt(this),this.H=45e3,this.J=null,this.o=!1,this.u=this.B=this.A=this.M=this.F=this.T=this.D=null,this.G=[],this.g=null,this.C=0,this.m=this.v=null,this.X=-1,this.K=!1,this.P=0,this.O=null,this.W=this.L=this.U=this.R=!1,this.h=new dy}function dy(){this.i=null,this.g="",this.h=!1}var hy={},Jd={};function Zd(l,m,y){l.M=1,l.A=ql(fr(m)),l.u=y,l.R=!0,fy(l,null)}function fy(l,m){l.F=Date.now(),Hl(l),l.B=fr(l.A);var y=l.B,I=l.S;Array.isArray(I)||(I=[String(I)]),Sy(y.i,"t",I),l.C=0,y=l.j.L,l.h=new dy,l.g=Hy(l.j,y?m:null,!l.u),l.P>0&&(l.O=new tn(c(l.Y,l,l.g),l.P)),m=l.V,y=l.g,I=l.ba;var M="readystatechange";Array.isArray(M)||(M&&(z[0]=M.toString()),M=z);for(let U=0;U0&&!this.W){this.W=!0;var ne=this.j;ne.g==this&&ne.aa&&!ne.P&&(ne.j.info("Great, no buffering proxy detected. Bytes received: "+y.length),uh(ne),ne.P=!0,xt(11))}}else Nn(this.i,this.l,y,null),th(this,y);Ve==4&&ss(this),this.o&&!this.K&&(Ve==4?Uy(this.j,this):(this.o=!1,Hl(this)))}else KT(this.g),m==400&&y.indexOf("Unknown SID")>0?(this.m=3,xt(12)):(this.m=0,xt(13)),ss(this),Jo(this)}}}catch{}finally{}};function DT(l){if(!py(l))return l.g.la();const m=Dy(l.g);if(m==="")return"";let y="";const I=m.length,M=ci(l.g)==4;if(!l.h.i){if(typeof TextDecoder>"u")return ss(l),Jo(l),"";l.h.i=new o.TextDecoder}for(let U=0;Um.length?Jd:(m=m.slice(I,I+y),l.C=I+y,m)))}ai.prototype.cancel=function(){this.K=!0,ss(this)};function Hl(l){l.T=Date.now()+l.H,my(l,l.H)}function my(l,m){if(l.D!=null)throw Error("WatchDog timer not null");l.D=_e(c(l.aa,l),m)}function eh(l){l.D&&(o.clearTimeout(l.D),l.D=null)}ai.prototype.aa=function(){this.D=null;const l=Date.now();l-this.T>=0?(_t(this.i,this.B),this.M!=2&&(nt(),xt(17)),ss(this),this.m=2,Jo(this)):my(this,this.T-l)};function Jo(l){l.j.I==0||l.K||Uy(l.j,l)}function ss(l){eh(l);var m=l.O;m&&typeof m.dispose=="function"&&m.dispose(),l.O=null,V(l.V),l.g&&(m=l.g,l.g=null,m.abort(),m.dispose())}function th(l,m){try{var y=l.j;if(y.I!=0&&(y.g==l||nh(y.h,l))){if(!l.L&&nh(y.h,l)&&y.I==3){try{var I=y.Ba.g.parse(m)}catch{I=null}if(Array.isArray(I)&&I.length==3){var M=I;if(M[0]==0){e:if(!y.v){if(y.g)if(y.g.F+3e30&&(I=1.5*di,y.O=I,y.j.info("backChannelRequestTimeoutMs_="+I)),I=y;const hi=l.g;if(hi){const Jl=hi.g?hi.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(Jl){var U=I.h;U.g||Jl.indexOf("spdy")==-1&&Jl.indexOf("quic")==-1&&Jl.indexOf("h2")==-1||(U.j=U.l,U.g=new Set,U.h&&(rh(U,U.h),U.h=null))}if(I.G){const ch=hi.g?hi.g.getResponseHeader("X-HTTP-Session-Id"):null;ch&&(I.wa=ch,lt(I.J,I.G,ch))}}y.I=3,y.l&&y.l.ra(),y.aa&&(y.T=Date.now()-l.F,y.j.info("Handshake RTT: "+y.T+"ms")),I=y;var ne=l;if(I.na=$y(I,I.L?I.ba:null,I.W),ne.L){xy(I.h,ne);var Ve=ne,Ot=I.O;Ot&&(Ve.H=Ot),Ve.D&&(eh(Ve),Hl(Ve)),I.g=ne}else Vy(I);y.i.length>0&&Ql(y)}else rt[0]!="stop"&&rt[0]!="close"||as(y,7);else y.I==3&&(rt[0]=="stop"||rt[0]=="close"?rt[0]=="stop"?as(y,7):ah(y):rt[0]!="noop"&&y.l&&y.l.qa(rt),y.A=0)}}nt(4)}catch{}}var OT=class{constructor(l,m){this.g=l,this.map=m}};function gy(l){this.l=l||10,o.PerformanceNavigationTiming?(l=o.performance.getEntriesByType("navigation"),l=l.length>0&&(l[0].nextHopProtocol=="hq"||l[0].nextHopProtocol=="h2")):l=!!(o.chrome&&o.chrome.loadTimes&&o.chrome.loadTimes()&&o.chrome.loadTimes().wasFetchedViaSpdy),this.j=l?this.l:1,this.g=null,this.j>1&&(this.g=new Set),this.h=null,this.i=[]}function yy(l){return l.h?!0:l.g?l.g.size>=l.j:!1}function vy(l){return l.h?1:l.g?l.g.size:0}function nh(l,m){return l.h?l.h==m:l.g?l.g.has(m):!1}function rh(l,m){l.g?l.g.add(m):l.h=m}function xy(l,m){l.h&&l.h==m?l.h=null:l.g&&l.g.has(m)&&l.g.delete(m)}gy.prototype.cancel=function(){if(this.i=wy(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&this.g.size!==0){for(const l of this.g.values())l.cancel();this.g.clear()}};function wy(l){if(l.h!=null)return l.i.concat(l.h.G);if(l.g!=null&&l.g.size!==0){let m=l.i;for(const y of l.g.values())m=m.concat(y.G);return m}return g(l.i)}var _y=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function LT(l,m){if(l){l=l.split("&");for(let y=0;y=0?(M=l[y].substring(0,I),U=l[y].substring(I+1)):M=l[y],m(M,U?decodeURIComponent(U.replace(/\+/g," ")):"")}}}function li(l){this.g=this.o=this.j="",this.u=null,this.m=this.h="",this.l=!1;let m;l instanceof li?(this.l=l.l,Zo(this,l.j),this.o=l.o,this.g=l.g,ea(this,l.u),this.h=l.h,ih(this,ky(l.i)),this.m=l.m):l&&(m=String(l).match(_y))?(this.l=!1,Zo(this,m[1]||"",!0),this.o=ta(m[2]||""),this.g=ta(m[3]||"",!0),ea(this,m[4]),this.h=ta(m[5]||"",!0),ih(this,m[6]||"",!0),this.m=ta(m[7]||"")):(this.l=!1,this.i=new ra(null,this.l))}li.prototype.toString=function(){const l=[];var m=this.j;m&&l.push(na(m,by,!0),":");var y=this.g;return(y||m=="file")&&(l.push("//"),(m=this.o)&&l.push(na(m,by,!0),"@"),l.push(An(y).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),y=this.u,y!=null&&l.push(":",String(y))),(y=this.h)&&(this.g&&y.charAt(0)!="/"&&l.push("/"),l.push(na(y,y.charAt(0)=="/"?FT:VT,!0))),(y=this.i.toString())&&l.push("?",y),(y=this.m)&&l.push("#",na(y,zT)),l.join("")},li.prototype.resolve=function(l){const m=fr(this);let y=!!l.j;y?Zo(m,l.j):y=!!l.o,y?m.o=l.o:y=!!l.g,y?m.g=l.g:y=l.u!=null;var I=l.h;if(y)ea(m,l.u);else if(y=!!l.h){if(I.charAt(0)!="/")if(this.g&&!this.h)I="/"+I;else{var M=m.h.lastIndexOf("/");M!=-1&&(I=m.h.slice(0,M+1)+I)}if(M=I,M==".."||M==".")I="";else if(M.indexOf("./")!=-1||M.indexOf("/.")!=-1){I=M.lastIndexOf("/",0)==0,M=M.split("/");const U=[];for(let ne=0;ne1||U.length==1&&U[0]!="")&&U.pop(),I&&ne==M.length&&U.push("")):(U.push(Ve),I=!0)}I=U.join("/")}else I=M}return y?m.h=I:y=l.i.toString()!=="",y?ih(m,ky(l.i)):y=!!l.m,y&&(m.m=l.m),m};function fr(l){return new li(l)}function Zo(l,m,y){l.j=y?ta(m,!0):m,l.j&&(l.j=l.j.replace(/:$/,""))}function ea(l,m){if(m){if(m=Number(m),isNaN(m)||m<0)throw Error("Bad port number "+m);l.u=m}else l.u=null}function ih(l,m,y){m instanceof ra?(l.i=m,BT(l.i,l.l)):(y||(m=na(m,UT)),l.i=new ra(m,l.l))}function lt(l,m,y){l.i.set(m,y)}function ql(l){return lt(l,"zx",Math.floor(Math.random()*2147483648).toString(36)+Math.abs(Math.floor(Math.random()*2147483648)^Date.now()).toString(36)),l}function ta(l,m){return l?m?decodeURI(l.replace(/%25/g,"%2525")):decodeURIComponent(l):""}function na(l,m,y){return typeof l=="string"?(l=encodeURI(l).replace(m,MT),y&&(l=l.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),l):null}function MT(l){return l=l.charCodeAt(0),"%"+(l>>4&15).toString(16)+(l&15).toString(16)}var by=/[#\/\?@]/g,VT=/[#\?:]/g,FT=/[#\?]/g,UT=/[#\?@]/g,zT=/#/g;function ra(l,m){this.h=this.g=null,this.i=l||null,this.j=!!m}function os(l){l.g||(l.g=new Map,l.h=0,l.i&<(l.i,function(m,y){l.add(decodeURIComponent(m.replace(/\+/g," ")),y)}))}t=ra.prototype,t.add=function(l,m){os(this),this.i=null,l=Bs(this,l);let y=this.g.get(l);return y||this.g.set(l,y=[]),y.push(m),this.h+=1,this};function Ey(l,m){os(l),m=Bs(l,m),l.g.has(m)&&(l.i=null,l.h-=l.g.get(m).length,l.g.delete(m))}function Iy(l,m){return os(l),m=Bs(l,m),l.g.has(m)}t.forEach=function(l,m){os(this),this.g.forEach(function(y,I){y.forEach(function(M){l.call(m,M,I,this)},this)},this)};function Ty(l,m){os(l);let y=[];if(typeof m=="string")Iy(l,m)&&(y=y.concat(l.g.get(Bs(l,m))));else for(l=Array.from(l.g.values()),m=0;m0?String(l[0]):m):m};function Sy(l,m,y){Ey(l,m),y.length>0&&(l.i=null,l.g.set(Bs(l,m),g(y)),l.h+=y.length)}t.toString=function(){if(this.i)return this.i;if(!this.g)return"";const l=[],m=Array.from(this.g.keys());for(let I=0;I{I.abort(),ui(y,"TestPingServer: timeout",!1,m)},1e4);fetch(l,{signal:I.signal}).then(U=>{clearTimeout(M),U.ok?ui(y,"TestPingServer: ok",!0,m):ui(y,"TestPingServer: server error",!1,m)}).catch(()=>{clearTimeout(M),ui(y,"TestPingServer: error",!1,m)})}function ui(l,m,y,I,M){try{M&&(M.onload=null,M.onerror=null,M.onabort=null,M.ontimeout=null),I(y)}catch{}}function qT(){this.g=new J}function sh(l){this.i=l.Sb||null,this.h=l.ab||!1}h(sh,je),sh.prototype.g=function(){return new Wl(this.i,this.h)};function Wl(l,m){we.call(this),this.H=l,this.o=m,this.m=void 0,this.status=this.readyState=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.A=new Headers,this.h=null,this.F="GET",this.D="",this.g=!1,this.B=this.j=this.l=null,this.v=new AbortController}h(Wl,we),t=Wl.prototype,t.open=function(l,m){if(this.readyState!=0)throw this.abort(),Error("Error reopening a connection");this.F=l,this.D=m,this.readyState=1,sa(this)},t.send=function(l){if(this.readyState!=1)throw this.abort(),Error("need to call open() first. ");if(this.v.signal.aborted)throw this.abort(),Error("Request was aborted.");this.g=!0;const m={headers:this.A,method:this.F,credentials:this.m,cache:void 0,signal:this.v.signal};l&&(m.body=l),(this.H||o).fetch(new Request(this.D,m)).then(this.Pa.bind(this),this.ga.bind(this))},t.abort=function(){this.response=this.responseText="",this.A=new Headers,this.status=0,this.v.abort(),this.j&&this.j.cancel("Request was aborted.").catch(()=>{}),this.readyState>=1&&this.g&&this.readyState!=4&&(this.g=!1,ia(this)),this.readyState=0},t.Pa=function(l){if(this.g&&(this.l=l,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=l.headers,this.readyState=2,sa(this)),this.g&&(this.readyState=3,sa(this),this.g)))if(this.responseType==="arraybuffer")l.arrayBuffer().then(this.Na.bind(this),this.ga.bind(this));else if(typeof o.ReadableStream<"u"&&"body"in l){if(this.j=l.body.getReader(),this.o){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.B=new TextDecoder;Cy(this)}else l.text().then(this.Oa.bind(this),this.ga.bind(this))};function Cy(l){l.j.read().then(l.Ma.bind(l)).catch(l.ga.bind(l))}t.Ma=function(l){if(this.g){if(this.o&&l.value)this.response.push(l.value);else if(!this.o){var m=l.value?l.value:new Uint8Array(0);(m=this.B.decode(m,{stream:!l.done}))&&(this.response=this.responseText+=m)}l.done?ia(this):sa(this),this.readyState==3&&Cy(this)}},t.Oa=function(l){this.g&&(this.response=this.responseText=l,ia(this))},t.Na=function(l){this.g&&(this.response=l,ia(this))},t.ga=function(){this.g&&ia(this)};function ia(l){l.readyState=4,l.l=null,l.j=null,l.B=null,sa(l)}t.setRequestHeader=function(l,m){this.A.append(l,m)},t.getResponseHeader=function(l){return this.h&&this.h.get(l.toLowerCase())||""},t.getAllResponseHeaders=function(){if(!this.h)return"";const l=[],m=this.h.entries();for(var y=m.next();!y.done;)y=y.value,l.push(y[0]+": "+y[1]),y=m.next();return l.join(`\r +`)};function sa(l){l.onreadystatechange&&l.onreadystatechange.call(l)}Object.defineProperty(Wl.prototype,"withCredentials",{get:function(){return this.m==="include"},set:function(l){this.m=l?"include":"same-origin"}});function Ny(l){let m="";return oe(l,function(y,I){m+=I,m+=":",m+=y,m+=`\r +`}),m}function oh(l,m,y){e:{for(I in y){var I=!1;break e}I=!0}I||(y=Ny(y),typeof l=="string"?y!=null&&An(y):lt(l,m,y))}function bt(l){we.call(this),this.headers=new Map,this.L=l||null,this.h=!1,this.g=null,this.D="",this.o=0,this.l="",this.j=this.B=this.v=this.A=!1,this.m=null,this.F="",this.H=!1}h(bt,we);var WT=/^https?$/i,GT=["POST","PUT"];t=bt.prototype,t.Fa=function(l){this.H=l},t.ea=function(l,m,y,I){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+l);m=m?m.toUpperCase():"GET",this.D=l,this.l="",this.o=0,this.A=!1,this.h=!0,this.g=this.L?this.L.g():Me.g(),this.g.onreadystatechange=p(c(this.Ca,this));try{this.B=!0,this.g.open(m,String(l),!0),this.B=!1}catch(U){Ay(this,U);return}if(l=y||"",y=new Map(this.headers),I)if(Object.getPrototypeOf(I)===Object.prototype)for(var M in I)y.set(M,I[M]);else if(typeof I.keys=="function"&&typeof I.get=="function")for(const U of I.keys())y.set(U,I.get(U));else throw Error("Unknown input type for opt_headers: "+String(I));I=Array.from(y.keys()).find(U=>U.toLowerCase()=="content-type"),M=o.FormData&&l instanceof o.FormData,!(Array.prototype.indexOf.call(GT,m,void 0)>=0)||I||M||y.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(const[U,ne]of y)this.g.setRequestHeader(U,ne);this.F&&(this.g.responseType=this.F),"withCredentials"in this.g&&this.g.withCredentials!==this.H&&(this.g.withCredentials=this.H);try{this.m&&(clearTimeout(this.m),this.m=null),this.v=!0,this.g.send(l),this.v=!1}catch(U){Ay(this,U)}};function Ay(l,m){l.h=!1,l.g&&(l.j=!0,l.g.abort(),l.j=!1),l.l=m,l.o=5,Py(l),Gl(l)}function Py(l){l.A||(l.A=!0,Qe(l,"complete"),Qe(l,"error"))}t.abort=function(l){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.o=l||7,Qe(this,"complete"),Qe(this,"abort"),Gl(this))},t.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),Gl(this,!0)),bt.Z.N.call(this)},t.Ca=function(){this.u||(this.B||this.v||this.j?Ry(this):this.Xa())},t.Xa=function(){Ry(this)};function Ry(l){if(l.h&&typeof s<"u"){if(l.v&&ci(l)==4)setTimeout(l.Ca.bind(l),0);else if(Qe(l,"readystatechange"),ci(l)==4){l.h=!1;try{const U=l.ca();e:switch(U){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var m=!0;break e;default:m=!1}var y;if(!(y=m)){var I;if(I=U===0){let ne=String(l.D).match(_y)[1]||null;!ne&&o.self&&o.self.location&&(ne=o.self.location.protocol.slice(0,-1)),I=!WT.test(ne?ne.toLowerCase():"")}y=I}if(y)Qe(l,"complete"),Qe(l,"success");else{l.o=6;try{var M=ci(l)>2?l.g.statusText:""}catch{M=""}l.l=M+" ["+l.ca()+"]",Py(l)}}finally{Gl(l)}}}}function Gl(l,m){if(l.g){l.m&&(clearTimeout(l.m),l.m=null);const y=l.g;l.g=null,m||Qe(l,"ready");try{y.onreadystatechange=null}catch{}}}t.isActive=function(){return!!this.g};function ci(l){return l.g?l.g.readyState:0}t.ca=function(){try{return ci(this)>2?this.g.status:-1}catch{return-1}},t.la=function(){try{return this.g?this.g.responseText:""}catch{return""}},t.La=function(l){if(this.g){var m=this.g.responseText;return l&&m.indexOf(l)==0&&(m=m.substring(l.length)),K(m)}};function Dy(l){try{if(!l.g)return null;if("response"in l.g)return l.g.response;switch(l.F){case"":case"text":return l.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in l.g)return l.g.mozResponseArrayBuffer}return null}catch{return null}}function KT(l){const m={};l=(l.g&&ci(l)>=2&&l.g.getAllResponseHeaders()||"").split(`\r +`);for(let I=0;I0&&(this.ia=l.longPollingTimeout),this.ta=void 0,this.T=0,this.P=!1,this.ja=this.B=null}t=jy.prototype,t.ka=8,t.I=1,t.connect=function(l,m,y,I){xt(0),this.W=l,this.H=m||{},y&&I!==void 0&&(this.H.OSID=y,this.H.OAID=I),this.F=this.X,this.J=$y(this,null,this.W),Ql(this)};function ah(l){if(Oy(l),l.I==3){var m=l.V++,y=fr(l.J);if(lt(y,"SID",l.M),lt(y,"RID",m),lt(y,"TYPE","terminate"),aa(l,y),m=new ai(l,l.j,m),m.M=2,m.A=ql(fr(y)),y=!1,o.navigator&&o.navigator.sendBeacon)try{y=o.navigator.sendBeacon(m.A.toString(),"")}catch{}!y&&o.Image&&(new Image().src=m.A,y=!0),y||(m.g=Hy(m.j,null),m.g.ea(m.A)),m.F=Date.now(),Hl(m)}By(l)}function Kl(l){l.g&&(uh(l),l.g.cancel(),l.g=null)}function Oy(l){Kl(l),l.v&&(o.clearTimeout(l.v),l.v=null),Yl(l),l.h.cancel(),l.m&&(typeof l.m=="number"&&o.clearTimeout(l.m),l.m=null)}function Ql(l){if(!yy(l.h)&&!l.m){l.m=!0;var m=l.Ea;L||w(),D||(L(),D=!0),b.add(m,l),l.D=0}}function QT(l,m){return vy(l.h)>=l.h.j-(l.m?1:0)?!1:l.m?(l.i=m.G.concat(l.i),!0):l.I==1||l.I==2||l.D>=(l.Sa?0:l.Ta)?!1:(l.m=_e(c(l.Ea,l,m),zy(l,l.D)),l.D++,!0)}t.Ea=function(l){if(this.m)if(this.m=null,this.I==1){if(!l){this.V=Math.floor(Math.random()*1e5),l=this.V++;const M=new ai(this,this.j,l);let U=this.o;if(this.U&&(U?(U=ge(U),R(U,this.U)):U=this.U),this.u!==null||this.R||(M.J=U,U=null),this.S)e:{for(var m=0,y=0;y4096){m=y;break e}if(m===4096||y===this.i.length-1){m=y+1;break e}}m=1e3}else m=1e3;m=My(this,M,m),y=fr(this.J),lt(y,"RID",l),lt(y,"CVER",22),this.G&<(y,"X-HTTP-Session-Id",this.G),aa(this,y),U&&(this.R?m="headers="+An(Ny(U))+"&"+m:this.u&&oh(y,this.u,U)),rh(this.h,M),this.Ra&<(y,"TYPE","init"),this.S?(lt(y,"$req",m),lt(y,"SID","null"),M.U=!0,Zd(M,y,null)):Zd(M,y,m),this.I=2}}else this.I==3&&(l?Ly(this,l):this.i.length==0||yy(this.h)||Ly(this))};function Ly(l,m){var y;m?y=m.l:y=l.V++;const I=fr(l.J);lt(I,"SID",l.M),lt(I,"RID",y),lt(I,"AID",l.K),aa(l,I),l.u&&l.o&&oh(I,l.u,l.o),y=new ai(l,l.j,y,l.D+1),l.u===null&&(y.J=l.o),m&&(l.i=m.G.concat(l.i)),m=My(l,y,1e3),y.H=Math.round(l.va*.5)+Math.round(l.va*.5*Math.random()),rh(l.h,y),Zd(y,I,m)}function aa(l,m){l.H&&oe(l.H,function(y,I){lt(m,I,y)}),l.l&&oe({},function(y,I){lt(m,I,y)})}function My(l,m,y){y=Math.min(l.i.length,y);const I=l.l?c(l.l.Ka,l.l,l):null;e:{var M=l.i;let Ve=-1;for(;;){const Ot=["count="+y];Ve==-1?y>0?(Ve=M[0].g,Ot.push("ofs="+Ve)):Ve=0:Ot.push("ofs="+Ve);let rt=!0;for(let Ut=0;Ut=3?!1:(l.Y++,l.v=_e(c(l.Da,l),zy(l,l.A)),l.A++,!0)}t.Da=function(){if(this.v=null,Fy(this),this.aa&&!(this.P||this.g==null||this.T<=0)){var l=4*this.T;this.j.info("BP detection timer enabled: "+l),this.B=_e(c(this.Wa,this),l)}},t.Wa=function(){this.B&&(this.B=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.F=!1,this.P=!0,xt(10),Kl(this),Fy(this))};function uh(l){l.B!=null&&(o.clearTimeout(l.B),l.B=null)}function Fy(l){l.g=new ai(l,l.j,"rpc",l.Y),l.u===null&&(l.g.J=l.o),l.g.P=0;var m=fr(l.na);lt(m,"RID","rpc"),lt(m,"SID",l.M),lt(m,"AID",l.K),lt(m,"CI",l.F?"0":"1"),!l.F&&l.ia&<(m,"TO",l.ia),lt(m,"TYPE","xmlhttp"),aa(l,m),l.u&&l.o&&oh(m,l.u,l.o),l.O&&(l.g.H=l.O);var y=l.g;l=l.ba,y.M=1,y.A=ql(fr(m)),y.u=null,y.R=!0,fy(y,l)}t.Va=function(){this.C!=null&&(this.C=null,Kl(this),lh(this),xt(19))};function Yl(l){l.C!=null&&(o.clearTimeout(l.C),l.C=null)}function Uy(l,m){var y=null;if(l.g==m){Yl(l),uh(l),l.g=null;var I=2}else if(nh(l.h,m))y=m.G,xy(l.h,m),I=1;else return;if(l.I!=0){if(m.o)if(I==1){y=m.u?m.u.length:0,m=Date.now()-m.F;var M=l.D;I=pe(),Qe(I,new Or(I,y)),Ql(l)}else Vy(l);else if(M=m.m,M==3||M==0&&m.X>0||!(I==1&&QT(l,m)||I==2&&lh(l)))switch(y&&y.length>0&&(m=l.h,m.i=m.i.concat(y)),M){case 1:as(l,5);break;case 4:as(l,10);break;case 3:as(l,6);break;default:as(l,2)}}}function zy(l,m){let y=l.Qa+Math.floor(Math.random()*l.Za);return l.isActive()||(y*=2),y*m}function as(l,m){if(l.j.info("Error code "+m),m==2){var y=c(l.bb,l),I=l.Ua;const M=!I;I=new li(I||"//www.google.com/images/cleardot.gif"),o.location&&o.location.protocol=="http"||Zo(I,"https"),ql(I),M?$T(I.toString(),y):HT(I.toString(),y)}else xt(2);l.I=0,l.l&&l.l.pa(m),By(l),Oy(l)}t.bb=function(l){l?(this.j.info("Successfully pinged google.com"),xt(2)):(this.j.info("Failed to ping google.com"),xt(1))};function By(l){if(l.I=0,l.ja=[],l.l){const m=wy(l.h);(m.length!=0||l.i.length!=0)&&(_(l.ja,m),_(l.ja,l.i),l.h.i.length=0,g(l.i),l.i.length=0),l.l.oa()}}function $y(l,m,y){var I=y instanceof li?fr(y):new li(y);if(I.g!="")m&&(I.g=m+"."+I.g),ea(I,I.u);else{var M=o.location;I=M.protocol,m=m?m+"."+M.hostname:M.hostname,M=+M.port;const U=new li(null);I&&Zo(U,I),m&&(U.g=m),M&&ea(U,M),y&&(U.h=y),I=U}return y=l.G,m=l.wa,y&&m&<(I,y,m),lt(I,"VER",l.ka),aa(l,I),I}function Hy(l,m,y){if(m&&!l.L)throw Error("Can't create secondary domain capable XhrIo object.");return m=l.Aa&&!l.ma?new bt(new sh({ab:y})):new bt(l.ma),m.Fa(l.L),m}t.isActive=function(){return!!this.l&&this.l.isActive(this)};function qy(){}t=qy.prototype,t.ra=function(){},t.qa=function(){},t.pa=function(){},t.oa=function(){},t.isActive=function(){return!0},t.Ka=function(){};function Xl(){}Xl.prototype.g=function(l,m){return new Pn(l,m)};function Pn(l,m){we.call(this),this.g=new jy(m),this.l=l,this.h=m&&m.messageUrlParams||null,l=m&&m.messageHeaders||null,m&&m.clientProtocolHeaderRequired&&(l?l["X-Client-Protocol"]="webchannel":l={"X-Client-Protocol":"webchannel"}),this.g.o=l,l=m&&m.initMessageHeaders||null,m&&m.messageContentType&&(l?l["X-WebChannel-Content-Type"]=m.messageContentType:l={"X-WebChannel-Content-Type":m.messageContentType}),m&&m.sa&&(l?l["X-WebChannel-Client-Profile"]=m.sa:l={"X-WebChannel-Client-Profile":m.sa}),this.g.U=l,(l=m&&m.Qb)&&!C(l)&&(this.g.u=l),this.A=m&&m.supportsCrossDomainXhr||!1,this.v=m&&m.sendRawJson||!1,(m=m&&m.httpSessionIdParam)&&!C(m)&&(this.g.G=m,l=this.h,l!==null&&m in l&&(l=this.h,m in l&&delete l[m])),this.j=new $s(this)}h(Pn,we),Pn.prototype.m=function(){this.g.l=this.j,this.A&&(this.g.L=!0),this.g.connect(this.l,this.h||void 0)},Pn.prototype.close=function(){ah(this.g)},Pn.prototype.o=function(l){var m=this.g;if(typeof l=="string"){var y={};y.__data__=l,l=y}else this.v&&(y={},y.__data__=B(l),l=y);m.i.push(new OT(m.Ya++,l)),m.I==3&&Ql(m)},Pn.prototype.N=function(){this.g.l=null,delete this.j,ah(this.g),delete this.g,Pn.Z.N.call(this)};function Wy(l){H.call(this),l.__headers__&&(this.headers=l.__headers__,this.statusCode=l.__status__,delete l.__headers__,delete l.__status__);var m=l.__sm__;if(m){e:{for(const y in m){l=y;break e}l=void 0}(this.i=l)&&(l=this.i,m=m!==null&&l in m?m[l]:void 0),this.data=m}else this.data=l}h(Wy,H);function Gy(){Q.call(this),this.status=1}h(Gy,Q);function $s(l){this.g=l}h($s,qy),$s.prototype.ra=function(){Qe(this.g,"a")},$s.prototype.qa=function(l){Qe(this.g,new Wy(l))},$s.prototype.pa=function(l){Qe(this.g,new Gy)},$s.prototype.oa=function(){Qe(this.g,"b")},Xl.prototype.createWebChannel=Xl.prototype.g,Pn.prototype.send=Pn.prototype.o,Pn.prototype.open=Pn.prototype.m,Pn.prototype.close=Pn.prototype.close,Pb=function(){return new Xl},Ab=function(){return pe()},Nb=de,hp={jb:0,mb:1,nb:2,Hb:3,Mb:4,Jb:5,Kb:6,Ib:7,Gb:8,Lb:9,PROXY:10,NOPROXY:11,Eb:12,Ab:13,Bb:14,zb:15,Cb:16,Db:17,fb:18,eb:19,gb:20},Bn.NO_ERROR=0,Bn.TIMEOUT=8,Bn.HTTP_ERROR=6,Bu=Bn,Kt.COMPLETE="complete",Cb=Kt,Ue.EventType=De,De.OPEN="a",De.CLOSE="b",De.ERROR="c",De.MESSAGE="d",we.prototype.listen=we.prototype.J,Sa=Ue,bt.prototype.listenOnce=bt.prototype.K,bt.prototype.getLastError=bt.prototype.Ha,bt.prototype.getLastErrorCode=bt.prototype.ya,bt.prototype.getStatus=bt.prototype.ca,bt.prototype.getResponseJson=bt.prototype.La,bt.prototype.getResponseText=bt.prototype.la,bt.prototype.send=bt.prototype.ea,bt.prototype.setWithCredentials=bt.prototype.Fa,kb=bt}).apply(typeof vu<"u"?vu:typeof self<"u"?self:typeof window<"u"?window:{});const bv="@firebase/firestore",Ev="4.9.2";/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class on{constructor(e){this.uid=e}isAuthenticated(){return this.uid!=null}toKey(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}isEqual(e){return e.uid===this.uid}}on.UNAUTHENTICATED=new on(null),on.GOOGLE_CREDENTIALS=new on("google-credentials-uid"),on.FIRST_PARTY=new on("first-party-uid"),on.MOCK_USER=new on("mock-user");/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */let Bo="12.3.0";/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Ns=new Gm("@firebase/firestore");function Ws(){return Ns.logLevel}function ue(t,...e){if(Ns.logLevel<=Be.DEBUG){const n=e.map(Ym);Ns.debug(`Firestore (${Bo}): ${t}`,...n)}}function ei(t,...e){if(Ns.logLevel<=Be.ERROR){const n=e.map(Ym);Ns.error(`Firestore (${Bo}): ${t}`,...n)}}function Ao(t,...e){if(Ns.logLevel<=Be.WARN){const n=e.map(Ym);Ns.warn(`Firestore (${Bo}): ${t}`,...n)}}function Ym(t){if(typeof t=="string")return t;try{/** +* @license +* Copyright 2020 Google LLC +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/return function(n){return JSON.stringify(n)}(t)}catch{return t}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Ee(t,e,n){let r="Unexpected state";typeof e=="string"?r=e:n=e,Rb(t,r,n)}function Rb(t,e,n){let r=`FIRESTORE (${Bo}) INTERNAL ASSERTION FAILED: ${e} (ID: ${t.toString(16)})`;if(n!==void 0)try{r+=" CONTEXT: "+JSON.stringify(n)}catch{r+=" CONTEXT: "+n}throw ei(r),new Error(r)}function Ze(t,e,n,r){let i="Unexpected state";typeof n=="string"?i=n:r=n,t||Rb(e,i,r)}function Re(t,e){return t}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const W={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENTED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"};class ae extends Dr{constructor(e,n){super(e,n),this.code=e,this.message=n,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class qr{constructor(){this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Db{constructor(e,n){this.user=n,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}}class AN{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,n){e.enqueueRetryable(()=>n(on.UNAUTHENTICATED))}shutdown(){}}class PN{constructor(e){this.token=e,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(e,n){this.changeListener=n,e.enqueueRetryable(()=>n(this.token.user))}shutdown(){this.changeListener=null}}class RN{constructor(e){this.t=e,this.currentUser=on.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,n){Ze(this.o===void 0,42304);let r=this.i;const i=u=>this.i!==r?(r=this.i,n(u)):Promise.resolve();let s=new qr;this.o=()=>{this.i++,this.currentUser=this.u(),s.resolve(),s=new qr,e.enqueueRetryable(()=>i(this.currentUser))};const o=()=>{const u=s;e.enqueueRetryable(async()=>{await u.promise,await i(this.currentUser)})},a=u=>{ue("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=u,this.o&&(this.auth.addAuthTokenListener(this.o),o())};this.t.onInit(u=>a(u)),setTimeout(()=>{if(!this.auth){const u=this.t.getImmediate({optional:!0});u?a(u):(ue("FirebaseAuthCredentialsProvider","Auth not yet detected"),s.resolve(),s=new qr)}},0),o()}getToken(){const e=this.i,n=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(n).then(r=>this.i!==e?(ue("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):r?(Ze(typeof r.accessToken=="string",31837,{l:r}),new Db(r.accessToken,this.currentUser)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.o&&this.auth.removeAuthTokenListener(this.o),this.o=void 0}u(){const e=this.auth&&this.auth.getUid();return Ze(e===null||typeof e=="string",2055,{h:e}),new on(e)}}class DN{constructor(e,n,r){this.P=e,this.T=n,this.I=r,this.type="FirstParty",this.user=on.FIRST_PARTY,this.A=new Map}R(){return this.I?this.I():null}get headers(){this.A.set("X-Goog-AuthUser",this.P);const e=this.R();return e&&this.A.set("Authorization",e),this.T&&this.A.set("X-Goog-Iam-Authorization-Token",this.T),this.A}}class jN{constructor(e,n,r){this.P=e,this.T=n,this.I=r}getToken(){return Promise.resolve(new DN(this.P,this.T,this.I))}start(e,n){e.enqueueRetryable(()=>n(on.FIRST_PARTY))}shutdown(){}invalidateToken(){}}class Iv{constructor(e){this.value=e,this.type="AppCheck",this.headers=new Map,e&&e.length>0&&this.headers.set("x-firebase-appcheck",this.value)}}class ON{constructor(e,n){this.V=n,this.forceRefresh=!1,this.appCheck=null,this.m=null,this.p=null,wn(e)&&e.settings.appCheckToken&&(this.p=e.settings.appCheckToken)}start(e,n){Ze(this.o===void 0,3512);const r=s=>{s.error!=null&&ue("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${s.error.message}`);const o=s.token!==this.m;return this.m=s.token,ue("FirebaseAppCheckTokenProvider",`Received ${o?"new":"existing"} token.`),o?n(s.token):Promise.resolve()};this.o=s=>{e.enqueueRetryable(()=>r(s))};const i=s=>{ue("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=s,this.o&&this.appCheck.addTokenListener(this.o)};this.V.onInit(s=>i(s)),setTimeout(()=>{if(!this.appCheck){const s=this.V.getImmediate({optional:!0});s?i(s):ue("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}},0)}getToken(){if(this.p)return Promise.resolve(new Iv(this.p));const e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then(n=>n?(Ze(typeof n.token=="string",44558,{tokenResult:n}),this.m=n.token,new Iv(n.token)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.o&&this.appCheck.removeTokenListener(this.o),this.o=void 0}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function LN(t){const e=typeof self<"u"&&(self.crypto||self.msCrypto),n=new Uint8Array(t);if(e&&typeof e.getRandomValues=="function")e.getRandomValues(n);else for(let r=0;re?1:0}function fp(t,e){const n=Math.min(t.length,e.length);for(let r=0;r=MN&&e<=VN}function Po(t,e,n){return t.length===e.length&&t.every((r,i)=>n(r,e[i]))}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Tv="__name__";class xr{constructor(e,n,r){n===void 0?n=0:n>e.length&&Ee(637,{offset:n,range:e.length}),r===void 0?r=e.length-n:r>e.length-n&&Ee(1746,{length:r,range:e.length-n}),this.segments=e,this.offset=n,this.len=r}get length(){return this.len}isEqual(e){return xr.comparator(this,e)===0}child(e){const n=this.segments.slice(this.offset,this.limit());return e instanceof xr?e.forEach(r=>{n.push(r)}):n.push(e),this.construct(n)}limit(){return this.offset+this.length}popFirst(e){return e=e===void 0?1:e,this.construct(this.segments,this.offset+e,this.length-e)}popLast(){return this.construct(this.segments,this.offset,this.length-1)}firstSegment(){return this.segments[this.offset]}lastSegment(){return this.get(this.length-1)}get(e){return this.segments[this.offset+e]}isEmpty(){return this.length===0}isPrefixOf(e){if(e.length=0)throw new ae(W.INVALID_ARGUMENT,`Invalid segment (${r}). Paths must not contain // in them.`);n.push(...r.split("/").filter(i=>i.length>0))}return new st(n)}static emptyPath(){return new st([])}}const FN=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class Xt extends xr{construct(e,n,r){return new Xt(e,n,r)}static isValidIdentifier(e){return FN.test(e)}canonicalString(){return this.toArray().map(e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),Xt.isValidIdentifier(e)||(e="`"+e+"`"),e)).join(".")}toString(){return this.canonicalString()}isKeyField(){return this.length===1&&this.get(0)===Tv}static keyField(){return new Xt([Tv])}static fromServerFormat(e){const n=[];let r="",i=0;const s=()=>{if(r.length===0)throw new ae(W.INVALID_ARGUMENT,`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);n.push(r),r=""};let o=!1;for(;i=2&&this.path.get(this.path.length-2)===e}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(e){return e!==null&&st.comparator(this.path,e.path)===0}toString(){return this.path.toString()}static comparator(e,n){return st.comparator(e.path,n.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new xe(new st(e.slice()))}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function jb(t,e,n){if(!n)throw new ae(W.INVALID_ARGUMENT,`Function ${t}() cannot be called with an empty ${e}.`)}function UN(t,e,n,r){if(e===!0&&r===!0)throw new ae(W.INVALID_ARGUMENT,`${t} and ${n} cannot be used together.`)}function Sv(t){if(!xe.isDocumentKey(t))throw new ae(W.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`)}function kv(t){if(xe.isDocumentKey(t))throw new ae(W.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`)}function Ob(t){return typeof t=="object"&&t!==null&&(Object.getPrototypeOf(t)===Object.prototype||Object.getPrototypeOf(t)===null)}function xd(t){if(t===void 0)return"undefined";if(t===null)return"null";if(typeof t=="string")return t.length>20&&(t=`${t.substring(0,20)}...`),JSON.stringify(t);if(typeof t=="number"||typeof t=="boolean")return""+t;if(typeof t=="object"){if(t instanceof Array)return"an array";{const e=function(r){return r.constructor?r.constructor.name:null}(t);return e?`a custom ${e} object`:"an object"}}return typeof t=="function"?"a function":Ee(12329,{type:typeof t})}function Sn(t,e){if("_delegate"in t&&(t=t._delegate),!(t instanceof e)){if(e.name===t.constructor.name)throw new ae(W.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const n=xd(t);throw new ae(W.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${n}`)}}return t}/** + * @license + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Rt(t,e){const n={typeString:t};return e&&(n.value=e),n}function Rl(t,e){if(!Ob(t))throw new ae(W.INVALID_ARGUMENT,"JSON must be an object");let n;for(const r in e)if(e[r]){const i=e[r].typeString,s="value"in e[r]?{value:e[r].value}:void 0;if(!(r in t)){n=`JSON missing required field: '${r}'`;break}const o=t[r];if(i&&typeof o!==i){n=`JSON field '${r}' must be a ${i}.`;break}if(s!==void 0&&o!==s.value){n=`Expected '${r}' field to equal '${s.value}'`;break}}if(n)throw new ae(W.INVALID_ARGUMENT,n);return!0}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Cv=-62135596800,Nv=1e6;class Je{static now(){return Je.fromMillis(Date.now())}static fromDate(e){return Je.fromMillis(e.getTime())}static fromMillis(e){const n=Math.floor(e/1e3),r=Math.floor((e-1e3*n)*Nv);return new Je(n,r)}constructor(e,n){if(this.seconds=e,this.nanoseconds=n,n<0)throw new ae(W.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+n);if(n>=1e9)throw new ae(W.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+n);if(e=253402300800)throw new ae(W.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/Nv}_compareTo(e){return this.seconds===e.seconds?$e(this.nanoseconds,e.nanoseconds):$e(this.seconds,e.seconds)}isEqual(e){return e.seconds===this.seconds&&e.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{type:Je._jsonSchemaVersion,seconds:this.seconds,nanoseconds:this.nanoseconds}}static fromJSON(e){if(Rl(e,Je._jsonSchema))return new Je(e.seconds,e.nanoseconds)}valueOf(){const e=this.seconds-Cv;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}Je._jsonSchemaVersion="firestore/timestamp/1.0",Je._jsonSchema={type:Rt("string",Je._jsonSchemaVersion),seconds:Rt("number"),nanoseconds:Rt("number")};/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Ne{static fromTimestamp(e){return new Ne(e)}static min(){return new Ne(new Je(0,0))}static max(){return new Ne(new Je(253402300799,999999999))}constructor(e){this.timestamp=e}compareTo(e){return this.timestamp._compareTo(e.timestamp)}isEqual(e){return this.timestamp.isEqual(e.timestamp)}toMicroseconds(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}toString(){return"SnapshotVersion("+this.timestamp.toString()+")"}toTimestamp(){return this.timestamp}}/** + * @license + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const ml=-1;function zN(t,e){const n=t.toTimestamp().seconds,r=t.toTimestamp().nanoseconds+1,i=Ne.fromTimestamp(r===1e9?new Je(n+1,0):new Je(n,r));return new $i(i,xe.empty(),e)}function BN(t){return new $i(t.readTime,t.key,ml)}class $i{constructor(e,n,r){this.readTime=e,this.documentKey=n,this.largestBatchId=r}static min(){return new $i(Ne.min(),xe.empty(),ml)}static max(){return new $i(Ne.max(),xe.empty(),ml)}}function $N(t,e){let n=t.readTime.compareTo(e.readTime);return n!==0?n:(n=xe.comparator(t.documentKey,e.documentKey),n!==0?n:$e(t.largestBatchId,e.largestBatchId))}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const HN="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.";class qN{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach(e=>e())}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function $o(t){if(t.code!==W.FAILED_PRECONDITION||t.message!==HN)throw t;ue("LocalStore","Unexpectedly lost primary lease")}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class G{constructor(e){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,e(n=>{this.isDone=!0,this.result=n,this.nextCallback&&this.nextCallback(n)},n=>{this.isDone=!0,this.error=n,this.catchCallback&&this.catchCallback(n)})}catch(e){return this.next(void 0,e)}next(e,n){return this.callbackAttached&&Ee(59440),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(n,this.error):this.wrapSuccess(e,this.result):new G((r,i)=>{this.nextCallback=s=>{this.wrapSuccess(e,s).next(r,i)},this.catchCallback=s=>{this.wrapFailure(n,s).next(r,i)}})}toPromise(){return new Promise((e,n)=>{this.next(e,n)})}wrapUserFunction(e){try{const n=e();return n instanceof G?n:G.resolve(n)}catch(n){return G.reject(n)}}wrapSuccess(e,n){return e?this.wrapUserFunction(()=>e(n)):G.resolve(n)}wrapFailure(e,n){return e?this.wrapUserFunction(()=>e(n)):G.reject(n)}static resolve(e){return new G((n,r)=>{n(e)})}static reject(e){return new G((n,r)=>{r(e)})}static waitFor(e){return new G((n,r)=>{let i=0,s=0,o=!1;e.forEach(a=>{++i,a.next(()=>{++s,o&&s===i&&n()},u=>r(u))}),o=!0,s===i&&n()})}static or(e){let n=G.resolve(!1);for(const r of e)n=n.next(i=>i?G.resolve(i):r());return n}static forEach(e,n){const r=[];return e.forEach((i,s)=>{r.push(n.call(this,i,s))}),this.waitFor(r)}static mapArray(e,n){return new G((r,i)=>{const s=e.length,o=new Array(s);let a=0;for(let u=0;u{o[c]=f,++a,a===s&&r(o)},f=>i(f))}})}static doWhile(e,n){return new G((r,i)=>{const s=()=>{e()===!0?n().next(()=>{s()},i):r()};s()})}}function WN(t){const e=t.match(/Android ([\d.]+)/i),n=e?e[1].split(".").slice(0,2).join("."):"-1";return Number(n)}function Ho(t){return t.name==="IndexedDbTransactionError"}/** + * @license + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class wd{constructor(e,n){this.previousValue=e,n&&(n.sequenceNumberHandler=r=>this.ae(r),this.ue=r=>n.writeSequenceNumber(r))}ae(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){const e=++this.previousValue;return this.ue&&this.ue(e),e}}wd.ce=-1;/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Jm=-1;function _d(t){return t==null}function Nc(t){return t===0&&1/t==-1/0}function GN(t){return typeof t=="number"&&Number.isInteger(t)&&!Nc(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Lb="";function KN(t){let e="";for(let n=0;n0&&(e=Av(e)),e=QN(t.get(n),e);return Av(e)}function QN(t,e){let n=e;const r=t.length;for(let i=0;i0&&(n=n.right)}return null}indexOf(e){let n=0,r=this.root;for(;!r.isEmpty();){const i=this.comparator(e,r.key);if(i===0)return n+r.left.size;i<0?r=r.left:(n+=r.left.size+1,r=r.right)}return-1}isEmpty(){return this.root.isEmpty()}get size(){return this.root.size}minKey(){return this.root.minKey()}maxKey(){return this.root.maxKey()}inorderTraversal(e){return this.root.inorderTraversal(e)}forEach(e){this.inorderTraversal((n,r)=>(e(n,r),!1))}toString(){const e=[];return this.inorderTraversal((n,r)=>(e.push(`${n}:${r}`),!1)),`{${e.join(", ")}}`}reverseTraversal(e){return this.root.reverseTraversal(e)}getIterator(){return new xu(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new xu(this.root,e,this.comparator,!1)}getReverseIterator(){return new xu(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new xu(this.root,e,this.comparator,!0)}}class xu{constructor(e,n,r,i){this.isReverse=i,this.nodeStack=[];let s=1;for(;!e.isEmpty();)if(s=n?r(e.key,n):1,n&&i&&(s*=-1),s<0)e=this.isReverse?e.left:e.right;else{if(s===0){this.nodeStack.push(e);break}this.nodeStack.push(e),e=this.isReverse?e.right:e.left}}getNext(){let e=this.nodeStack.pop();const n={key:e.key,value:e.value};if(this.isReverse)for(e=e.left;!e.isEmpty();)this.nodeStack.push(e),e=e.right;else for(e=e.right;!e.isEmpty();)this.nodeStack.push(e),e=e.left;return n}hasNext(){return this.nodeStack.length>0}peek(){if(this.nodeStack.length===0)return null;const e=this.nodeStack[this.nodeStack.length-1];return{key:e.key,value:e.value}}}class Yt{constructor(e,n,r,i,s){this.key=e,this.value=n,this.color=r??Yt.RED,this.left=i??Yt.EMPTY,this.right=s??Yt.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,n,r,i,s){return new Yt(e??this.key,n??this.value,r??this.color,i??this.left,s??this.right)}isEmpty(){return!1}inorderTraversal(e){return this.left.inorderTraversal(e)||e(this.key,this.value)||this.right.inorderTraversal(e)}reverseTraversal(e){return this.right.reverseTraversal(e)||e(this.key,this.value)||this.left.reverseTraversal(e)}min(){return this.left.isEmpty()?this:this.left.min()}minKey(){return this.min().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(e,n,r){let i=this;const s=r(e,i.key);return i=s<0?i.copy(null,null,null,i.left.insert(e,n,r),null):s===0?i.copy(null,n,null,null,null):i.copy(null,null,null,null,i.right.insert(e,n,r)),i.fixUp()}removeMin(){if(this.left.isEmpty())return Yt.EMPTY;let e=this;return e.left.isRed()||e.left.left.isRed()||(e=e.moveRedLeft()),e=e.copy(null,null,null,e.left.removeMin(),null),e.fixUp()}remove(e,n){let r,i=this;if(n(e,i.key)<0)i.left.isEmpty()||i.left.isRed()||i.left.left.isRed()||(i=i.moveRedLeft()),i=i.copy(null,null,null,i.left.remove(e,n),null);else{if(i.left.isRed()&&(i=i.rotateRight()),i.right.isEmpty()||i.right.isRed()||i.right.left.isRed()||(i=i.moveRedRight()),n(e,i.key)===0){if(i.right.isEmpty())return Yt.EMPTY;r=i.right.min(),i=i.copy(r.key,r.value,null,null,i.right.removeMin())}i=i.copy(null,null,null,null,i.right.remove(e,n))}return i.fixUp()}isRed(){return this.color}fixUp(){let e=this;return e.right.isRed()&&!e.left.isRed()&&(e=e.rotateLeft()),e.left.isRed()&&e.left.left.isRed()&&(e=e.rotateRight()),e.left.isRed()&&e.right.isRed()&&(e=e.colorFlip()),e}moveRedLeft(){let e=this.colorFlip();return e.right.left.isRed()&&(e=e.copy(null,null,null,null,e.right.rotateRight()),e=e.rotateLeft(),e=e.colorFlip()),e}moveRedRight(){let e=this.colorFlip();return e.left.left.isRed()&&(e=e.rotateRight(),e=e.colorFlip()),e}rotateLeft(){const e=this.copy(null,null,Yt.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){const e=this.copy(null,null,Yt.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)}colorFlip(){const e=this.left.copy(null,null,!this.left.color,null,null),n=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,n)}checkMaxDepth(){const e=this.check();return Math.pow(2,e)<=this.size+1}check(){if(this.isRed()&&this.left.isRed())throw Ee(43730,{key:this.key,value:this.value});if(this.right.isRed())throw Ee(14113,{key:this.key,value:this.value});const e=this.left.check();if(e!==this.right.check())throw Ee(27949);return e+(this.isRed()?0:1)}}Yt.EMPTY=null,Yt.RED=!0,Yt.BLACK=!1;Yt.EMPTY=new class{constructor(){this.size=0}get key(){throw Ee(57766)}get value(){throw Ee(16141)}get color(){throw Ee(16727)}get left(){throw Ee(29726)}get right(){throw Ee(36894)}copy(e,n,r,i,s){return this}insert(e,n,r){return new Yt(e,n)}remove(e,n){return this}isEmpty(){return!0}inorderTraversal(e){return!1}reverseTraversal(e){return!1}minKey(){return null}maxKey(){return null}isRed(){return!1}checkMaxDepth(){return!0}check(){return 0}};/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Vt{constructor(e){this.comparator=e,this.data=new yt(this.comparator)}has(e){return this.data.get(e)!==null}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(e){return this.data.indexOf(e)}forEach(e){this.data.inorderTraversal((n,r)=>(e(n),!1))}forEachInRange(e,n){const r=this.data.getIteratorFrom(e[0]);for(;r.hasNext();){const i=r.getNext();if(this.comparator(i.key,e[1])>=0)return;n(i.key)}}forEachWhile(e,n){let r;for(r=n!==void 0?this.data.getIteratorFrom(n):this.data.getIterator();r.hasNext();)if(!e(r.getNext().key))return}firstAfterOrEqual(e){const n=this.data.getIteratorFrom(e);return n.hasNext()?n.getNext().key:null}getIterator(){return new Rv(this.data.getIterator())}getIteratorFrom(e){return new Rv(this.data.getIteratorFrom(e))}add(e){return this.copy(this.data.remove(e).insert(e,!0))}delete(e){return this.has(e)?this.copy(this.data.remove(e)):this}isEmpty(){return this.data.isEmpty()}unionWith(e){let n=this;return n.size{n=n.add(r)}),n}isEqual(e){if(!(e instanceof Vt)||this.size!==e.size)return!1;const n=this.data.getIterator(),r=e.data.getIterator();for(;n.hasNext();){const i=n.getNext().key,s=r.getNext().key;if(this.comparator(i,s)!==0)return!1}return!0}toArray(){const e=[];return this.forEach(n=>{e.push(n)}),e}toString(){const e=[];return this.forEach(n=>e.push(n)),"SortedSet("+e.toString()+")"}copy(e){const n=new Vt(this.comparator);return n.data=e,n}}class Rv{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class On{constructor(e){this.fields=e,e.sort(Xt.comparator)}static empty(){return new On([])}unionWith(e){let n=new Vt(Xt.comparator);for(const r of this.fields)n=n.add(r);for(const r of e)n=n.add(r);return new On(n.toArray())}covers(e){for(const n of this.fields)if(n.isPrefixOf(e))return!0;return!1}isEqual(e){return Po(this.fields,e.fields,(n,r)=>n.isEqual(r))}}/** + * @license + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Vb extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class en{constructor(e){this.binaryString=e}static fromBase64String(e){const n=function(i){try{return atob(i)}catch(s){throw typeof DOMException<"u"&&s instanceof DOMException?new Vb("Invalid base64 string: "+s):s}}(e);return new en(n)}static fromUint8Array(e){const n=function(i){let s="";for(let o=0;oeAr(n,e))!==void 0}function Ro(t,e){if(t===e)return 0;const n=Wi(t),r=Wi(e);if(n!==r)return $e(n,r);switch(n){case 0:case 9007199254740991:return 0;case 1:return $e(t.booleanValue,e.booleanValue);case 2:return function(s,o){const a=Tt(s.integerValue||s.doubleValue),u=Tt(o.integerValue||o.doubleValue);return au?1:a===u?0:isNaN(a)?isNaN(u)?0:-1:1}(t,e);case 3:return Dv(t.timestampValue,e.timestampValue);case 4:return Dv(gl(t),gl(e));case 5:return fp(t.stringValue,e.stringValue);case 6:return function(s,o){const a=qi(s),u=qi(o);return a.compareTo(u)}(t.bytesValue,e.bytesValue);case 7:return function(s,o){const a=s.split("/"),u=o.split("/");for(let c=0;ci+$u(s),0)}(t.arrayValue);case 10:case 11:return function(r){let i=0;return Ji(r.fields,(s,o)=>{i+=s.length+$u(o)}),i}(t.mapValue);default:throw Ee(13486,{value:t})}}function Ov(t,e){return{referenceValue:`projects/${t.projectId}/databases/${t.database}/documents/${e.path.canonicalString()}`}}function mp(t){return!!t&&"integerValue"in t}function eg(t){return!!t&&"arrayValue"in t}function Lv(t){return!!t&&"nullValue"in t}function Mv(t){return!!t&&"doubleValue"in t&&isNaN(Number(t.doubleValue))}function Hu(t){return!!t&&"mapValue"in t}function ZN(t){var n,r;return((r=(((n=t==null?void 0:t.mapValue)==null?void 0:n.fields)||{})[$b])==null?void 0:r.stringValue)===Hb}function Ua(t){if(t.geoPointValue)return{geoPointValue:{...t.geoPointValue}};if(t.timestampValue&&typeof t.timestampValue=="object")return{timestampValue:{...t.timestampValue}};if(t.mapValue){const e={mapValue:{fields:{}}};return Ji(t.mapValue.fields,(n,r)=>e.mapValue.fields[n]=Ua(r)),e}if(t.arrayValue){const e={arrayValue:{values:[]}};for(let n=0;n<(t.arrayValue.values||[]).length;++n)e.arrayValue.values[n]=Ua(t.arrayValue.values[n]);return e}return{...t}}function eA(t){return(((t.mapValue||{}).fields||{}).__type__||{}).stringValue===JN}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class _n{constructor(e){this.value=e}static empty(){return new _n({mapValue:{}})}field(e){if(e.isEmpty())return this.value;{let n=this.value;for(let r=0;r{if(!n.isImmediateParentOf(a)){const u=this.getFieldsMap(n);this.applyChanges(u,r,i),r={},i=[],n=a.popLast()}o?r[a.lastSegment()]=Ua(o):i.push(a.lastSegment())});const s=this.getFieldsMap(n);this.applyChanges(s,r,i)}delete(e){const n=this.field(e.popLast());Hu(n)&&n.mapValue.fields&&delete n.mapValue.fields[e.lastSegment()]}isEqual(e){return Ar(this.value,e.value)}getFieldsMap(e){let n=this.value;n.mapValue.fields||(n.mapValue={fields:{}});for(let r=0;re[i]=s);for(const i of r)delete e[i]}clone(){return new _n(Ua(this.value))}}function qb(t){const e=[];return Ji(t.fields,(n,r)=>{const i=new Xt([n]);if(Hu(r)){const s=qb(r.mapValue).fields;if(s.length===0)e.push(i);else for(const o of s)e.push(i.child(o))}else e.push(i)}),new On(e)}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class ln{constructor(e,n,r,i,s,o,a){this.key=e,this.documentType=n,this.version=r,this.readTime=i,this.createTime=s,this.data=o,this.documentState=a}static newInvalidDocument(e){return new ln(e,0,Ne.min(),Ne.min(),Ne.min(),_n.empty(),0)}static newFoundDocument(e,n,r,i){return new ln(e,1,n,Ne.min(),r,i,0)}static newNoDocument(e,n){return new ln(e,2,n,Ne.min(),Ne.min(),_n.empty(),0)}static newUnknownDocument(e,n){return new ln(e,3,n,Ne.min(),Ne.min(),_n.empty(),2)}convertToFoundDocument(e,n){return!this.createTime.isEqual(Ne.min())||this.documentType!==2&&this.documentType!==0||(this.createTime=e),this.version=e,this.documentType=1,this.data=n,this.documentState=0,this}convertToNoDocument(e){return this.version=e,this.documentType=2,this.data=_n.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=_n.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=Ne.min(),this}setReadTime(e){return this.readTime=e,this}get hasLocalMutations(){return this.documentState===1}get hasCommittedMutations(){return this.documentState===2}get hasPendingWrites(){return this.hasLocalMutations||this.hasCommittedMutations}isValidDocument(){return this.documentType!==0}isFoundDocument(){return this.documentType===1}isNoDocument(){return this.documentType===2}isUnknownDocument(){return this.documentType===3}isEqual(e){return e instanceof ln&&this.key.isEqual(e.key)&&this.version.isEqual(e.version)&&this.documentType===e.documentType&&this.documentState===e.documentState&&this.data.isEqual(e.data)}mutableCopy(){return new ln(this.key,this.documentType,this.version,this.readTime,this.createTime,this.data.clone(),this.documentState)}toString(){return`Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {createTime: ${this.createTime}}), {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`}}/** + * @license + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Rc{constructor(e,n){this.position=e,this.inclusive=n}}function Vv(t,e,n){let r=0;for(let i=0;i":return e>0;case">=":return e>=0;default:return Ee(47266,{operator:this.op})}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}}class dr extends Wb{constructor(e,n){super(),this.filters=e,this.op=n,this.Pe=null}static create(e,n){return new dr(e,n)}matches(e){return Gb(this)?this.filters.find(n=>!n.matches(e))===void 0:this.filters.find(n=>n.matches(e))!==void 0}getFlattenedFilters(){return this.Pe!==null||(this.Pe=this.filters.reduce((e,n)=>e.concat(n.getFlattenedFilters()),[])),this.Pe}getFilters(){return Object.assign([],this.filters)}}function Gb(t){return t.op==="and"}function Kb(t){return nA(t)&&Gb(t)}function nA(t){for(const e of t.filters)if(e instanceof dr)return!1;return!0}function gp(t){if(t instanceof Pt)return t.field.canonicalString()+t.op.toString()+Do(t.value);if(Kb(t))return t.filters.map(e=>gp(e)).join(",");{const e=t.filters.map(n=>gp(n)).join(",");return`${t.op}(${e})`}}function Qb(t,e){return t instanceof Pt?function(r,i){return i instanceof Pt&&r.op===i.op&&r.field.isEqual(i.field)&&Ar(r.value,i.value)}(t,e):t instanceof dr?function(r,i){return i instanceof dr&&r.op===i.op&&r.filters.length===i.filters.length?r.filters.reduce((s,o,a)=>s&&Qb(o,i.filters[a]),!0):!1}(t,e):void Ee(19439)}function Yb(t){return t instanceof Pt?function(n){return`${n.field.canonicalString()} ${n.op} ${Do(n.value)}`}(t):t instanceof dr?function(n){return n.op.toString()+" {"+n.getFilters().map(Yb).join(" ,")+"}"}(t):"Filter"}class rA extends Pt{constructor(e,n,r){super(e,n,r),this.key=xe.fromName(r.referenceValue)}matches(e){const n=xe.comparator(e.key,this.key);return this.matchesComparison(n)}}class iA extends Pt{constructor(e,n){super(e,"in",n),this.keys=Xb("in",n)}matches(e){return this.keys.some(n=>n.isEqual(e.key))}}class sA extends Pt{constructor(e,n){super(e,"not-in",n),this.keys=Xb("not-in",n)}matches(e){return!this.keys.some(n=>n.isEqual(e.key))}}function Xb(t,e){var n;return(((n=e.arrayValue)==null?void 0:n.values)||[]).map(r=>xe.fromName(r.referenceValue))}class oA extends Pt{constructor(e,n){super(e,"array-contains",n)}matches(e){const n=e.data.field(this.field);return eg(n)&&vl(n.arrayValue,this.value)}}class aA extends Pt{constructor(e,n){super(e,"in",n)}matches(e){const n=e.data.field(this.field);return n!==null&&vl(this.value.arrayValue,n)}}class lA extends Pt{constructor(e,n){super(e,"not-in",n)}matches(e){if(vl(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const n=e.data.field(this.field);return n!==null&&n.nullValue===void 0&&!vl(this.value.arrayValue,n)}}class uA extends Pt{constructor(e,n){super(e,"array-contains-any",n)}matches(e){const n=e.data.field(this.field);return!(!eg(n)||!n.arrayValue.values)&&n.arrayValue.values.some(r=>vl(this.value.arrayValue,r))}}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class cA{constructor(e,n=null,r=[],i=[],s=null,o=null,a=null){this.path=e,this.collectionGroup=n,this.orderBy=r,this.filters=i,this.limit=s,this.startAt=o,this.endAt=a,this.Te=null}}function Uv(t,e=null,n=[],r=[],i=null,s=null,o=null){return new cA(t,e,n,r,i,s,o)}function tg(t){const e=Re(t);if(e.Te===null){let n=e.path.canonicalString();e.collectionGroup!==null&&(n+="|cg:"+e.collectionGroup),n+="|f:",n+=e.filters.map(r=>gp(r)).join(","),n+="|ob:",n+=e.orderBy.map(r=>function(s){return s.field.canonicalString()+s.dir}(r)).join(","),_d(e.limit)||(n+="|l:",n+=e.limit),e.startAt&&(n+="|lb:",n+=e.startAt.inclusive?"b:":"a:",n+=e.startAt.position.map(r=>Do(r)).join(",")),e.endAt&&(n+="|ub:",n+=e.endAt.inclusive?"a:":"b:",n+=e.endAt.position.map(r=>Do(r)).join(",")),e.Te=n}return e.Te}function ng(t,e){if(t.limit!==e.limit||t.orderBy.length!==e.orderBy.length)return!1;for(let n=0;n0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc";(function(o){let a=new Vt(Xt.comparator);return o.filters.forEach(u=>{u.getFlattenedFilters().forEach(c=>{c.isInequality()&&(a=a.add(c.field))})}),a})(e).forEach(s=>{n.has(s.canonicalString())||s.isKeyField()||e.Ie.push(new xl(s,r))}),n.has(Xt.keyField().canonicalString())||e.Ie.push(new xl(Xt.keyField(),r))}return e.Ie}function Tr(t){const e=Re(t);return e.Ee||(e.Ee=hA(e,za(t))),e.Ee}function hA(t,e){if(t.limitType==="F")return Uv(t.path,t.collectionGroup,e,t.filters,t.limit,t.startAt,t.endAt);{e=e.map(i=>{const s=i.dir==="desc"?"asc":"desc";return new xl(i.field,s)});const n=t.endAt?new Rc(t.endAt.position,t.endAt.inclusive):null,r=t.startAt?new Rc(t.startAt.position,t.startAt.inclusive):null;return Uv(t.path,t.collectionGroup,e,t.filters,t.limit,n,r)}}function vp(t,e){const n=t.filters.concat([e]);return new qo(t.path,t.collectionGroup,t.explicitOrderBy.slice(),n,t.limit,t.limitType,t.startAt,t.endAt)}function xp(t,e,n){return new qo(t.path,t.collectionGroup,t.explicitOrderBy.slice(),t.filters.slice(),e,n,t.startAt,t.endAt)}function Id(t,e){return ng(Tr(t),Tr(e))&&t.limitType===e.limitType}function Zb(t){return`${tg(Tr(t))}|lt:${t.limitType}`}function Gs(t){return`Query(target=${function(n){let r=n.path.canonicalString();return n.collectionGroup!==null&&(r+=" collectionGroup="+n.collectionGroup),n.filters.length>0&&(r+=`, filters: [${n.filters.map(i=>Yb(i)).join(", ")}]`),_d(n.limit)||(r+=", limit: "+n.limit),n.orderBy.length>0&&(r+=`, orderBy: [${n.orderBy.map(i=>function(o){return`${o.field.canonicalString()} (${o.dir})`}(i)).join(", ")}]`),n.startAt&&(r+=", startAt: ",r+=n.startAt.inclusive?"b:":"a:",r+=n.startAt.position.map(i=>Do(i)).join(",")),n.endAt&&(r+=", endAt: ",r+=n.endAt.inclusive?"a:":"b:",r+=n.endAt.position.map(i=>Do(i)).join(",")),`Target(${r})`}(Tr(t))}; limitType=${t.limitType})`}function Td(t,e){return e.isFoundDocument()&&function(r,i){const s=i.key.path;return r.collectionGroup!==null?i.key.hasCollectionId(r.collectionGroup)&&r.path.isPrefixOf(s):xe.isDocumentKey(r.path)?r.path.isEqual(s):r.path.isImmediateParentOf(s)}(t,e)&&function(r,i){for(const s of za(r))if(!s.field.isKeyField()&&i.data.field(s.field)===null)return!1;return!0}(t,e)&&function(r,i){for(const s of r.filters)if(!s.matches(i))return!1;return!0}(t,e)&&function(r,i){return!(r.startAt&&!function(o,a,u){const c=Vv(o,a,u);return o.inclusive?c<=0:c<0}(r.startAt,za(r),i)||r.endAt&&!function(o,a,u){const c=Vv(o,a,u);return o.inclusive?c>=0:c>0}(r.endAt,za(r),i))}(t,e)}function fA(t){return t.collectionGroup||(t.path.length%2==1?t.path.lastSegment():t.path.get(t.path.length-2))}function eE(t){return(e,n)=>{let r=!1;for(const i of za(t)){const s=pA(i,e,n);if(s!==0)return s;r=r||i.field.isKeyField()}return 0}}function pA(t,e,n){const r=t.field.isKeyField()?xe.comparator(e.key,n.key):function(s,o,a){const u=o.data.field(s),c=a.data.field(s);return u!==null&&c!==null?Ro(u,c):Ee(42886)}(t.field,e,n);switch(t.dir){case"asc":return r;case"desc":return-1*r;default:return Ee(19790,{direction:t.dir})}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Vs{constructor(e,n){this.mapKeyFn=e,this.equalsFn=n,this.inner={},this.innerSize=0}get(e){const n=this.mapKeyFn(e),r=this.inner[n];if(r!==void 0){for(const[i,s]of r)if(this.equalsFn(i,e))return s}}has(e){return this.get(e)!==void 0}set(e,n){const r=this.mapKeyFn(e),i=this.inner[r];if(i===void 0)return this.inner[r]=[[e,n]],void this.innerSize++;for(let s=0;s{for(const[i,s]of r)e(i,s)})}isEmpty(){return Mb(this.inner)}size(){return this.innerSize}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const mA=new yt(xe.comparator);function ti(){return mA}const tE=new yt(xe.comparator);function ka(...t){let e=tE;for(const n of t)e=e.insert(n.key,n);return e}function nE(t){let e=tE;return t.forEach((n,r)=>e=e.insert(n,r.overlayedDocument)),e}function gs(){return Ba()}function rE(){return Ba()}function Ba(){return new Vs(t=>t.toString(),(t,e)=>t.isEqual(e))}const gA=new yt(xe.comparator),yA=new Vt(xe.comparator);function He(...t){let e=yA;for(const n of t)e=e.add(n);return e}const vA=new Vt($e);function xA(){return vA}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function rg(t,e){if(t.useProto3Json){if(isNaN(e))return{doubleValue:"NaN"};if(e===1/0)return{doubleValue:"Infinity"};if(e===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:Nc(e)?"-0":e}}function iE(t){return{integerValue:""+t}}function sE(t,e){return GN(e)?iE(e):rg(t,e)}/** + * @license + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Sd{constructor(){this._=void 0}}function wA(t,e,n){return t instanceof Dc?function(i,s){const o={fields:{[Ub]:{stringValue:Fb},[Bb]:{timestampValue:{seconds:i.seconds,nanos:i.nanoseconds}}}};return s&&Zm(s)&&(s=bd(s)),s&&(o.fields[zb]=s),{mapValue:o}}(n,e):t instanceof jo?aE(t,e):t instanceof Oo?lE(t,e):function(i,s){const o=oE(i,s),a=Bv(o)+Bv(i.Ae);return mp(o)&&mp(i.Ae)?iE(a):rg(i.serializer,a)}(t,e)}function _A(t,e,n){return t instanceof jo?aE(t,e):t instanceof Oo?lE(t,e):n}function oE(t,e){return t instanceof wl?function(r){return mp(r)||function(s){return!!s&&"doubleValue"in s}(r)}(e)?e:{integerValue:0}:null}class Dc extends Sd{}class jo extends Sd{constructor(e){super(),this.elements=e}}function aE(t,e){const n=uE(e);for(const r of t.elements)n.some(i=>Ar(i,r))||n.push(r);return{arrayValue:{values:n}}}class Oo extends Sd{constructor(e){super(),this.elements=e}}function lE(t,e){let n=uE(e);for(const r of t.elements)n=n.filter(i=>!Ar(i,r));return{arrayValue:{values:n}}}class wl extends Sd{constructor(e,n){super(),this.serializer=e,this.Ae=n}}function Bv(t){return Tt(t.integerValue||t.doubleValue)}function uE(t){return eg(t)&&t.arrayValue.values?t.arrayValue.values.slice():[]}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class ig{constructor(e,n){this.field=e,this.transform=n}}function bA(t,e){return t.field.isEqual(e.field)&&function(r,i){return r instanceof jo&&i instanceof jo||r instanceof Oo&&i instanceof Oo?Po(r.elements,i.elements,Ar):r instanceof wl&&i instanceof wl?Ar(r.Ae,i.Ae):r instanceof Dc&&i instanceof Dc}(t.transform,e.transform)}class EA{constructor(e,n){this.version=e,this.transformResults=n}}class Yn{constructor(e,n){this.updateTime=e,this.exists=n}static none(){return new Yn}static exists(e){return new Yn(void 0,e)}static updateTime(e){return new Yn(e)}get isNone(){return this.updateTime===void 0&&this.exists===void 0}isEqual(e){return this.exists===e.exists&&(this.updateTime?!!e.updateTime&&this.updateTime.isEqual(e.updateTime):!e.updateTime)}}function qu(t,e){return t.updateTime!==void 0?e.isFoundDocument()&&e.version.isEqual(t.updateTime):t.exists===void 0||t.exists===e.isFoundDocument()}class kd{}function cE(t,e){if(!t.hasLocalMutations||e&&e.fields.length===0)return null;if(e===null)return t.isNoDocument()?new sg(t.key,Yn.none()):new Dl(t.key,t.data,Yn.none());{const n=t.data,r=_n.empty();let i=new Vt(Xt.comparator);for(let s of e.fields)if(!i.has(s)){let o=n.field(s);o===null&&s.length>1&&(s=s.popLast(),o=n.field(s)),o===null?r.delete(s):r.set(s,o),i=i.add(s)}return new Zi(t.key,r,new On(i.toArray()),Yn.none())}}function IA(t,e,n){t instanceof Dl?function(i,s,o){const a=i.value.clone(),u=Hv(i.fieldTransforms,s,o.transformResults);a.setAll(u),s.convertToFoundDocument(o.version,a).setHasCommittedMutations()}(t,e,n):t instanceof Zi?function(i,s,o){if(!qu(i.precondition,s))return void s.convertToUnknownDocument(o.version);const a=Hv(i.fieldTransforms,s,o.transformResults),u=s.data;u.setAll(dE(i)),u.setAll(a),s.convertToFoundDocument(o.version,u).setHasCommittedMutations()}(t,e,n):function(i,s,o){s.convertToNoDocument(o.version).setHasCommittedMutations()}(0,e,n)}function $a(t,e,n,r){return t instanceof Dl?function(s,o,a,u){if(!qu(s.precondition,o))return a;const c=s.value.clone(),f=qv(s.fieldTransforms,u,o);return c.setAll(f),o.convertToFoundDocument(o.version,c).setHasLocalMutations(),null}(t,e,n,r):t instanceof Zi?function(s,o,a,u){if(!qu(s.precondition,o))return a;const c=qv(s.fieldTransforms,u,o),f=o.data;return f.setAll(dE(s)),f.setAll(c),o.convertToFoundDocument(o.version,f).setHasLocalMutations(),a===null?null:a.unionWith(s.fieldMask.fields).unionWith(s.fieldTransforms.map(h=>h.field))}(t,e,n,r):function(s,o,a){return qu(s.precondition,o)?(o.convertToNoDocument(o.version).setHasLocalMutations(),null):a}(t,e,n)}function TA(t,e){let n=null;for(const r of t.fieldTransforms){const i=e.data.field(r.field),s=oE(r.transform,i||null);s!=null&&(n===null&&(n=_n.empty()),n.set(r.field,s))}return n||null}function $v(t,e){return t.type===e.type&&!!t.key.isEqual(e.key)&&!!t.precondition.isEqual(e.precondition)&&!!function(r,i){return r===void 0&&i===void 0||!(!r||!i)&&Po(r,i,(s,o)=>bA(s,o))}(t.fieldTransforms,e.fieldTransforms)&&(t.type===0?t.value.isEqual(e.value):t.type!==1||t.data.isEqual(e.data)&&t.fieldMask.isEqual(e.fieldMask))}class Dl extends kd{constructor(e,n,r,i=[]){super(),this.key=e,this.value=n,this.precondition=r,this.fieldTransforms=i,this.type=0}getFieldMask(){return null}}class Zi extends kd{constructor(e,n,r,i,s=[]){super(),this.key=e,this.data=n,this.fieldMask=r,this.precondition=i,this.fieldTransforms=s,this.type=1}getFieldMask(){return this.fieldMask}}function dE(t){const e=new Map;return t.fieldMask.fields.forEach(n=>{if(!n.isEmpty()){const r=t.data.field(n);e.set(n,r)}}),e}function Hv(t,e,n){const r=new Map;Ze(t.length===n.length,32656,{Re:n.length,Ve:t.length});for(let i=0;i{const s=e.get(i.key),o=s.overlayedDocument;let a=this.applyToLocalView(o,s.mutatedFields);a=n.has(i.key)?null:a;const u=cE(o,a);u!==null&&r.set(i.key,u),o.isValidDocument()||o.convertToNoDocument(Ne.min())}),r}keys(){return this.mutations.reduce((e,n)=>e.add(n.key),He())}isEqual(e){return this.batchId===e.batchId&&Po(this.mutations,e.mutations,(n,r)=>$v(n,r))&&Po(this.baseMutations,e.baseMutations,(n,r)=>$v(n,r))}}class og{constructor(e,n,r,i){this.batch=e,this.commitVersion=n,this.mutationResults=r,this.docVersions=i}static from(e,n,r){Ze(e.mutations.length===r.length,58842,{me:e.mutations.length,fe:r.length});let i=function(){return gA}();const s=e.mutations;for(let o=0;o=8)throw new Ca(`Invalid padding: ${n}`);if(r<0)throw new Ca(`Invalid hash count: ${r}`);if(e.length>0&&this.hashCount===0)throw new Ca(`Invalid hash count: ${r}`);if(e.length===0&&n!==0)throw new Ca(`Invalid padding when bitmap length is 0: ${n}`);this.ge=8*e.length-n,this.pe=Vi.fromNumber(this.ge)}ye(e,n,r){let i=e.add(n.multiply(Vi.fromNumber(r)));return i.compare(RA)===1&&(i=new Vi([i.getBits(0),i.getBits(1)],0)),i.modulo(this.pe).toNumber()}we(e){return!!(this.bitmap[Math.floor(e/8)]&1<o.insert(a)),o}insert(e){if(this.ge===0)return;const n=Wv(e),[r,i]=Gv(n);for(let s=0;s0&&(this.Oe=!0,this.Me=e)}ke(){let e=He(),n=He(),r=He();return this.Fe.forEach((i,s)=>{switch(s){case 0:e=e.add(i);break;case 2:n=n.add(i);break;case 1:r=r.add(i);break;default:Ee(38017,{changeType:s})}}),new jl(this.Me,this.xe,e,n,r)}qe(){this.Oe=!1,this.Fe=Qv()}Qe(e,n){this.Oe=!0,this.Fe=this.Fe.insert(e,n)}$e(e){this.Oe=!0,this.Fe=this.Fe.remove(e)}Ue(){this.ve+=1}Ke(){this.ve-=1,Ze(this.ve>=0,3241,{ve:this.ve})}We(){this.Oe=!0,this.xe=!0}}class DA{constructor(e){this.Ge=e,this.ze=new Map,this.je=ti(),this.Je=_u(),this.He=_u(),this.Ye=new yt($e)}Ze(e){for(const n of e.be)e.De&&e.De.isFoundDocument()?this.Xe(n,e.De):this.et(n,e.key,e.De);for(const n of e.removedTargetIds)this.et(n,e.key,e.De)}tt(e){this.forEachTarget(e,n=>{const r=this.nt(n);switch(e.state){case 0:this.rt(n)&&r.Le(e.resumeToken);break;case 1:r.Ke(),r.Ne||r.qe(),r.Le(e.resumeToken);break;case 2:r.Ke(),r.Ne||this.removeTarget(n);break;case 3:this.rt(n)&&(r.We(),r.Le(e.resumeToken));break;case 4:this.rt(n)&&(this.it(n),r.Le(e.resumeToken));break;default:Ee(56790,{state:e.state})}})}forEachTarget(e,n){e.targetIds.length>0?e.targetIds.forEach(n):this.ze.forEach((r,i)=>{this.rt(i)&&n(i)})}st(e){const n=e.targetId,r=e.Ce.count,i=this.ot(n);if(i){const s=i.target;if(yp(s))if(r===0){const o=new xe(s.path);this.et(n,o,ln.newNoDocument(o,Ne.min()))}else Ze(r===1,20013,{expectedCount:r});else{const o=this._t(n);if(o!==r){const a=this.ut(e),u=a?this.ct(a,e,o):1;if(u!==0){this.it(n);const c=u===2?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.Ye=this.Ye.insert(n,c)}}}}}ut(e){const n=e.Ce.unchangedNames;if(!n||!n.bits)return null;const{bits:{bitmap:r="",padding:i=0},hashCount:s=0}=n;let o,a;try{o=qi(r).toUint8Array()}catch(u){if(u instanceof Vb)return Ao("Decoding the base64 bloom filter in existence filter failed ("+u.message+"); ignoring the bloom filter and falling back to full re-query."),null;throw u}try{a=new ag(o,i,s)}catch(u){return Ao(u instanceof Ca?"BloomFilter error: ":"Applying bloom filter failed: ",u),null}return a.ge===0?null:a}ct(e,n,r){return n.Ce.count===r-this.Pt(e,n.targetId)?0:2}Pt(e,n){const r=this.Ge.getRemoteKeysForTarget(n);let i=0;return r.forEach(s=>{const o=this.Ge.ht(),a=`projects/${o.projectId}/databases/${o.database}/documents/${s.path.canonicalString()}`;e.mightContain(a)||(this.et(n,s,null),i++)}),i}Tt(e){const n=new Map;this.ze.forEach((s,o)=>{const a=this.ot(o);if(a){if(s.current&&yp(a.target)){const u=new xe(a.target.path);this.It(u).has(o)||this.Et(o,u)||this.et(o,u,ln.newNoDocument(u,e))}s.Be&&(n.set(o,s.ke()),s.qe())}});let r=He();this.He.forEach((s,o)=>{let a=!0;o.forEachWhile(u=>{const c=this.ot(u);return!c||c.purpose==="TargetPurposeLimboResolution"||(a=!1,!1)}),a&&(r=r.add(s))}),this.je.forEach((s,o)=>o.setReadTime(e));const i=new Cd(e,n,this.Ye,this.je,r);return this.je=ti(),this.Je=_u(),this.He=_u(),this.Ye=new yt($e),i}Xe(e,n){if(!this.rt(e))return;const r=this.Et(e,n.key)?2:0;this.nt(e).Qe(n.key,r),this.je=this.je.insert(n.key,n),this.Je=this.Je.insert(n.key,this.It(n.key).add(e)),this.He=this.He.insert(n.key,this.dt(n.key).add(e))}et(e,n,r){if(!this.rt(e))return;const i=this.nt(e);this.Et(e,n)?i.Qe(n,1):i.$e(n),this.He=this.He.insert(n,this.dt(n).delete(e)),this.He=this.He.insert(n,this.dt(n).add(e)),r&&(this.je=this.je.insert(n,r))}removeTarget(e){this.ze.delete(e)}_t(e){const n=this.nt(e).ke();return this.Ge.getRemoteKeysForTarget(e).size+n.addedDocuments.size-n.removedDocuments.size}Ue(e){this.nt(e).Ue()}nt(e){let n=this.ze.get(e);return n||(n=new Kv,this.ze.set(e,n)),n}dt(e){let n=this.He.get(e);return n||(n=new Vt($e),this.He=this.He.insert(e,n)),n}It(e){let n=this.Je.get(e);return n||(n=new Vt($e),this.Je=this.Je.insert(e,n)),n}rt(e){const n=this.ot(e)!==null;return n||ue("WatchChangeAggregator","Detected inactive target",e),n}ot(e){const n=this.ze.get(e);return n&&n.Ne?null:this.Ge.At(e)}it(e){this.ze.set(e,new Kv),this.Ge.getRemoteKeysForTarget(e).forEach(n=>{this.et(e,n,null)})}Et(e,n){return this.Ge.getRemoteKeysForTarget(e).has(n)}}function _u(){return new yt(xe.comparator)}function Qv(){return new yt(xe.comparator)}const jA={asc:"ASCENDING",desc:"DESCENDING"},OA={"<":"LESS_THAN","<=":"LESS_THAN_OR_EQUAL",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","!=":"NOT_EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","not-in":"NOT_IN","array-contains-any":"ARRAY_CONTAINS_ANY"},LA={and:"AND",or:"OR"};class MA{constructor(e,n){this.databaseId=e,this.useProto3Json=n}}function wp(t,e){return t.useProto3Json||_d(e)?e:{value:e}}function jc(t,e){return t.useProto3Json?`${new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+e.nanoseconds).slice(-9)}Z`:{seconds:""+e.seconds,nanos:e.nanoseconds}}function mE(t,e){return t.useProto3Json?e.toBase64():e.toUint8Array()}function VA(t,e){return jc(t,e.toTimestamp())}function Sr(t){return Ze(!!t,49232),Ne.fromTimestamp(function(n){const r=Hi(n);return new Je(r.seconds,r.nanos)}(t))}function lg(t,e){return _p(t,e).canonicalString()}function _p(t,e){const n=function(i){return new st(["projects",i.projectId,"databases",i.database])}(t).child("documents");return e===void 0?n:n.child(e)}function gE(t){const e=st.fromString(t);return Ze(_E(e),10190,{key:e.toString()}),e}function bp(t,e){return lg(t.databaseId,e.path)}function $h(t,e){const n=gE(e);if(n.get(1)!==t.databaseId.projectId)throw new ae(W.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+n.get(1)+" vs "+t.databaseId.projectId);if(n.get(3)!==t.databaseId.database)throw new ae(W.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+t.databaseId.database);return new xe(vE(n))}function yE(t,e){return lg(t.databaseId,e)}function FA(t){const e=gE(t);return e.length===4?st.emptyPath():vE(e)}function Ep(t){return new st(["projects",t.databaseId.projectId,"databases",t.databaseId.database]).canonicalString()}function vE(t){return Ze(t.length>4&&t.get(4)==="documents",29091,{key:t.toString()}),t.popFirst(5)}function Yv(t,e,n){return{name:bp(t,e),fields:n.value.mapValue.fields}}function UA(t,e){let n;if("targetChange"in e){e.targetChange;const r=function(c){return c==="NO_CHANGE"?0:c==="ADD"?1:c==="REMOVE"?2:c==="CURRENT"?3:c==="RESET"?4:Ee(39313,{state:c})}(e.targetChange.targetChangeType||"NO_CHANGE"),i=e.targetChange.targetIds||[],s=function(c,f){return c.useProto3Json?(Ze(f===void 0||typeof f=="string",58123),en.fromBase64String(f||"")):(Ze(f===void 0||f instanceof Buffer||f instanceof Uint8Array,16193),en.fromUint8Array(f||new Uint8Array))}(t,e.targetChange.resumeToken),o=e.targetChange.cause,a=o&&function(c){const f=c.code===void 0?W.UNKNOWN:hE(c.code);return new ae(f,c.message||"")}(o);n=new pE(r,i,s,a||null)}else if("documentChange"in e){e.documentChange;const r=e.documentChange;r.document,r.document.name,r.document.updateTime;const i=$h(t,r.document.name),s=Sr(r.document.updateTime),o=r.document.createTime?Sr(r.document.createTime):Ne.min(),a=new _n({mapValue:{fields:r.document.fields}}),u=ln.newFoundDocument(i,s,o,a),c=r.targetIds||[],f=r.removedTargetIds||[];n=new Wu(c,f,u.key,u)}else if("documentDelete"in e){e.documentDelete;const r=e.documentDelete;r.document;const i=$h(t,r.document),s=r.readTime?Sr(r.readTime):Ne.min(),o=ln.newNoDocument(i,s),a=r.removedTargetIds||[];n=new Wu([],a,o.key,o)}else if("documentRemove"in e){e.documentRemove;const r=e.documentRemove;r.document;const i=$h(t,r.document),s=r.removedTargetIds||[];n=new Wu([],s,i,null)}else{if(!("filter"in e))return Ee(11601,{Rt:e});{e.filter;const r=e.filter;r.targetId;const{count:i=0,unchangedNames:s}=r,o=new NA(i,s),a=r.targetId;n=new fE(a,o)}}return n}function zA(t,e){let n;if(e instanceof Dl)n={update:Yv(t,e.key,e.value)};else if(e instanceof sg)n={delete:bp(t,e.key)};else if(e instanceof Zi)n={update:Yv(t,e.key,e.data),updateMask:YA(e.fieldMask)};else{if(!(e instanceof SA))return Ee(16599,{Vt:e.type});n={verify:bp(t,e.key)}}return e.fieldTransforms.length>0&&(n.updateTransforms=e.fieldTransforms.map(r=>function(s,o){const a=o.transform;if(a instanceof Dc)return{fieldPath:o.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(a instanceof jo)return{fieldPath:o.field.canonicalString(),appendMissingElements:{values:a.elements}};if(a instanceof Oo)return{fieldPath:o.field.canonicalString(),removeAllFromArray:{values:a.elements}};if(a instanceof wl)return{fieldPath:o.field.canonicalString(),increment:a.Ae};throw Ee(20930,{transform:o.transform})}(0,r))),e.precondition.isNone||(n.currentDocument=function(i,s){return s.updateTime!==void 0?{updateTime:VA(i,s.updateTime)}:s.exists!==void 0?{exists:s.exists}:Ee(27497)}(t,e.precondition)),n}function BA(t,e){return t&&t.length>0?(Ze(e!==void 0,14353),t.map(n=>function(i,s){let o=i.updateTime?Sr(i.updateTime):Sr(s);return o.isEqual(Ne.min())&&(o=Sr(s)),new EA(o,i.transformResults||[])}(n,e))):[]}function $A(t,e){return{documents:[yE(t,e.path)]}}function HA(t,e){const n={structuredQuery:{}},r=e.path;let i;e.collectionGroup!==null?(i=r,n.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(i=r.popLast(),n.structuredQuery.from=[{collectionId:r.lastSegment()}]),n.parent=yE(t,i);const s=function(c){if(c.length!==0)return wE(dr.create(c,"and"))}(e.filters);s&&(n.structuredQuery.where=s);const o=function(c){if(c.length!==0)return c.map(f=>function(p){return{field:Ks(p.field),direction:GA(p.dir)}}(f))}(e.orderBy);o&&(n.structuredQuery.orderBy=o);const a=wp(t,e.limit);return a!==null&&(n.structuredQuery.limit=a),e.startAt&&(n.structuredQuery.startAt=function(c){return{before:c.inclusive,values:c.position}}(e.startAt)),e.endAt&&(n.structuredQuery.endAt=function(c){return{before:!c.inclusive,values:c.position}}(e.endAt)),{ft:n,parent:i}}function qA(t){let e=FA(t.parent);const n=t.structuredQuery,r=n.from?n.from.length:0;let i=null;if(r>0){Ze(r===1,65062);const f=n.from[0];f.allDescendants?i=f.collectionId:e=e.child(f.collectionId)}let s=[];n.where&&(s=function(h){const p=xE(h);return p instanceof dr&&Kb(p)?p.getFilters():[p]}(n.where));let o=[];n.orderBy&&(o=function(h){return h.map(p=>function(_){return new xl(Qs(_.field),function(P){switch(P){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(_.direction))}(p))}(n.orderBy));let a=null;n.limit&&(a=function(h){let p;return p=typeof h=="object"?h.value:h,_d(p)?null:p}(n.limit));let u=null;n.startAt&&(u=function(h){const p=!!h.before,g=h.values||[];return new Rc(g,p)}(n.startAt));let c=null;return n.endAt&&(c=function(h){const p=!h.before,g=h.values||[];return new Rc(g,p)}(n.endAt)),dA(e,i,o,s,a,"F",u,c)}function WA(t,e){const n=function(i){switch(i){case"TargetPurposeListen":return null;case"TargetPurposeExistenceFilterMismatch":return"existence-filter-mismatch";case"TargetPurposeExistenceFilterMismatchBloom":return"existence-filter-mismatch-bloom";case"TargetPurposeLimboResolution":return"limbo-document";default:return Ee(28987,{purpose:i})}}(e.purpose);return n==null?null:{"goog-listen-tags":n}}function xE(t){return t.unaryFilter!==void 0?function(n){switch(n.unaryFilter.op){case"IS_NAN":const r=Qs(n.unaryFilter.field);return Pt.create(r,"==",{doubleValue:NaN});case"IS_NULL":const i=Qs(n.unaryFilter.field);return Pt.create(i,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const s=Qs(n.unaryFilter.field);return Pt.create(s,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const o=Qs(n.unaryFilter.field);return Pt.create(o,"!=",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":return Ee(61313);default:return Ee(60726)}}(t):t.fieldFilter!==void 0?function(n){return Pt.create(Qs(n.fieldFilter.field),function(i){switch(i){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";case"OPERATOR_UNSPECIFIED":return Ee(58110);default:return Ee(50506)}}(n.fieldFilter.op),n.fieldFilter.value)}(t):t.compositeFilter!==void 0?function(n){return dr.create(n.compositeFilter.filters.map(r=>xE(r)),function(i){switch(i){case"AND":return"and";case"OR":return"or";default:return Ee(1026)}}(n.compositeFilter.op))}(t):Ee(30097,{filter:t})}function GA(t){return jA[t]}function KA(t){return OA[t]}function QA(t){return LA[t]}function Ks(t){return{fieldPath:t.canonicalString()}}function Qs(t){return Xt.fromServerFormat(t.fieldPath)}function wE(t){return t instanceof Pt?function(n){if(n.op==="=="){if(Mv(n.value))return{unaryFilter:{field:Ks(n.field),op:"IS_NAN"}};if(Lv(n.value))return{unaryFilter:{field:Ks(n.field),op:"IS_NULL"}}}else if(n.op==="!="){if(Mv(n.value))return{unaryFilter:{field:Ks(n.field),op:"IS_NOT_NAN"}};if(Lv(n.value))return{unaryFilter:{field:Ks(n.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:Ks(n.field),op:KA(n.op),value:n.value}}}(t):t instanceof dr?function(n){const r=n.getFilters().map(i=>wE(i));return r.length===1?r[0]:{compositeFilter:{op:QA(n.op),filters:r}}}(t):Ee(54877,{filter:t})}function YA(t){const e=[];return t.fields.forEach(n=>e.push(n.canonicalString())),{fieldPaths:e}}function _E(t){return t.length>=4&&t.get(0)==="projects"&&t.get(2)==="databases"}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Si{constructor(e,n,r,i,s=Ne.min(),o=Ne.min(),a=en.EMPTY_BYTE_STRING,u=null){this.target=e,this.targetId=n,this.purpose=r,this.sequenceNumber=i,this.snapshotVersion=s,this.lastLimboFreeSnapshotVersion=o,this.resumeToken=a,this.expectedCount=u}withSequenceNumber(e){return new Si(this.target,this.targetId,this.purpose,e,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(e,n){return new Si(this.target,this.targetId,this.purpose,this.sequenceNumber,n,this.lastLimboFreeSnapshotVersion,e,null)}withExpectedCount(e){return new Si(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,e)}withLastLimboFreeSnapshotVersion(e){return new Si(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,e,this.resumeToken,this.expectedCount)}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class XA{constructor(e){this.yt=e}}function JA(t){const e=qA({parent:t.parent,structuredQuery:t.structuredQuery});return t.limitType==="LAST"?xp(e,e.limit,"L"):e}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class ZA{constructor(){this.Cn=new eP}addToCollectionParentIndex(e,n){return this.Cn.add(n),G.resolve()}getCollectionParents(e,n){return G.resolve(this.Cn.getEntries(n))}addFieldIndex(e,n){return G.resolve()}deleteFieldIndex(e,n){return G.resolve()}deleteAllFieldIndexes(e){return G.resolve()}createTargetIndexes(e,n){return G.resolve()}getDocumentsMatchingTarget(e,n){return G.resolve(null)}getIndexType(e,n){return G.resolve(0)}getFieldIndexes(e,n){return G.resolve([])}getNextCollectionGroupToUpdate(e){return G.resolve(null)}getMinOffset(e,n){return G.resolve($i.min())}getMinOffsetFromCollectionGroup(e,n){return G.resolve($i.min())}updateCollectionGroup(e,n,r){return G.resolve()}updateIndexEntries(e,n){return G.resolve()}}class eP{constructor(){this.index={}}add(e){const n=e.lastSegment(),r=e.popLast(),i=this.index[n]||new Vt(st.comparator),s=!i.has(r);return this.index[n]=i.add(r),s}has(e){const n=e.lastSegment(),r=e.popLast(),i=this.index[n];return i&&i.has(r)}getEntries(e){return(this.index[e]||new Vt(st.comparator)).toArray()}}/** + * @license + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Xv={didRun:!1,sequenceNumbersCollected:0,targetsRemoved:0,documentsRemoved:0},bE=41943040;class vn{static withCacheSize(e){return new vn(e,vn.DEFAULT_COLLECTION_PERCENTILE,vn.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}constructor(e,n,r){this.cacheSizeCollectionThreshold=e,this.percentileToCollect=n,this.maximumSequenceNumbersToCollect=r}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */vn.DEFAULT_COLLECTION_PERCENTILE=10,vn.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,vn.DEFAULT=new vn(bE,vn.DEFAULT_COLLECTION_PERCENTILE,vn.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),vn.DISABLED=new vn(-1,0,0);/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Lo{constructor(e){this.ar=e}next(){return this.ar+=2,this.ar}static ur(){return new Lo(0)}static cr(){return new Lo(-1)}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Jv="LruGarbageCollector",tP=1048576;function Zv([t,e],[n,r]){const i=$e(t,n);return i===0?$e(e,r):i}class nP{constructor(e){this.Ir=e,this.buffer=new Vt(Zv),this.Er=0}dr(){return++this.Er}Ar(e){const n=[e,this.dr()];if(this.buffer.size{this.Rr=null;try{await this.localStore.collectGarbage(this.garbageCollector)}catch(n){Ho(n)?ue(Jv,"Ignoring IndexedDB error during garbage collection: ",n):await $o(n)}await this.Vr(3e5)})}}class iP{constructor(e,n){this.mr=e,this.params=n}calculateTargetCount(e,n){return this.mr.gr(e).next(r=>Math.floor(n/100*r))}nthSequenceNumber(e,n){if(n===0)return G.resolve(wd.ce);const r=new nP(n);return this.mr.forEachTarget(e,i=>r.Ar(i.sequenceNumber)).next(()=>this.mr.pr(e,i=>r.Ar(i))).next(()=>r.maxValue)}removeTargets(e,n,r){return this.mr.removeTargets(e,n,r)}removeOrphanedDocuments(e,n){return this.mr.removeOrphanedDocuments(e,n)}collect(e,n){return this.params.cacheSizeCollectionThreshold===-1?(ue("LruGarbageCollector","Garbage collection skipped; disabled"),G.resolve(Xv)):this.getCacheSize(e).next(r=>r(h>this.params.maximumSequenceNumbersToCollect?(ue("LruGarbageCollector",`Capping sequence numbers to collect down to the maximum of ${this.params.maximumSequenceNumbersToCollect} from ${h}`),i=this.params.maximumSequenceNumbersToCollect):i=h,o=Date.now(),this.nthSequenceNumber(e,i))).next(h=>(r=h,a=Date.now(),this.removeTargets(e,r,n))).next(h=>(s=h,u=Date.now(),this.removeOrphanedDocuments(e,r))).next(h=>(c=Date.now(),Ws()<=Be.DEBUG&&ue("LruGarbageCollector",`LRU Garbage Collection + Counted targets in ${o-f}ms + Determined least recently used ${i} in `+(a-o)+`ms + Removed ${s} targets in `+(u-a)+`ms + Removed ${h} documents in `+(c-u)+`ms +Total Duration: ${c-f}ms`),G.resolve({didRun:!0,sequenceNumbersCollected:i,targetsRemoved:s,documentsRemoved:h})))}}function sP(t,e){return new iP(t,e)}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class oP{constructor(){this.changes=new Vs(e=>e.toString(),(e,n)=>e.isEqual(n)),this.changesApplied=!1}addEntry(e){this.assertNotApplied(),this.changes.set(e.key,e)}removeEntry(e,n){this.assertNotApplied(),this.changes.set(e,ln.newInvalidDocument(e).setReadTime(n))}getEntry(e,n){this.assertNotApplied();const r=this.changes.get(n);return r!==void 0?G.resolve(r):this.getFromCache(e,n)}getEntries(e,n){return this.getAllFromCache(e,n)}apply(e){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(e)}assertNotApplied(){}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *//** + * @license + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class aP{constructor(e,n){this.overlayedDocument=e,this.mutatedFields=n}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class lP{constructor(e,n,r,i){this.remoteDocumentCache=e,this.mutationQueue=n,this.documentOverlayCache=r,this.indexManager=i}getDocument(e,n){let r=null;return this.documentOverlayCache.getOverlay(e,n).next(i=>(r=i,this.remoteDocumentCache.getEntry(e,n))).next(i=>(r!==null&&$a(r.mutation,i,On.empty(),Je.now()),i))}getDocuments(e,n){return this.remoteDocumentCache.getEntries(e,n).next(r=>this.getLocalViewOfDocuments(e,r,He()).next(()=>r))}getLocalViewOfDocuments(e,n,r=He()){const i=gs();return this.populateOverlays(e,i,n).next(()=>this.computeViews(e,n,i,r).next(s=>{let o=ka();return s.forEach((a,u)=>{o=o.insert(a,u.overlayedDocument)}),o}))}getOverlayedDocuments(e,n){const r=gs();return this.populateOverlays(e,r,n).next(()=>this.computeViews(e,n,r,He()))}populateOverlays(e,n,r){const i=[];return r.forEach(s=>{n.has(s)||i.push(s)}),this.documentOverlayCache.getOverlays(e,i).next(s=>{s.forEach((o,a)=>{n.set(o,a)})})}computeViews(e,n,r,i){let s=ti();const o=Ba(),a=function(){return Ba()}();return n.forEach((u,c)=>{const f=r.get(c.key);i.has(c.key)&&(f===void 0||f.mutation instanceof Zi)?s=s.insert(c.key,c):f!==void 0?(o.set(c.key,f.mutation.getFieldMask()),$a(f.mutation,c,f.mutation.getFieldMask(),Je.now())):o.set(c.key,On.empty())}),this.recalculateAndSaveOverlays(e,s).next(u=>(u.forEach((c,f)=>o.set(c,f)),n.forEach((c,f)=>a.set(c,new aP(f,o.get(c)??null))),a))}recalculateAndSaveOverlays(e,n){const r=Ba();let i=new yt((o,a)=>o-a),s=He();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,n).next(o=>{for(const a of o)a.keys().forEach(u=>{const c=n.get(u);if(c===null)return;let f=r.get(u)||On.empty();f=a.applyToLocalView(c,f),r.set(u,f);const h=(i.get(a.batchId)||He()).add(u);i=i.insert(a.batchId,h)})}).next(()=>{const o=[],a=i.getReverseIterator();for(;a.hasNext();){const u=a.getNext(),c=u.key,f=u.value,h=rE();f.forEach(p=>{if(!s.has(p)){const g=cE(n.get(p),r.get(p));g!==null&&h.set(p,g),s=s.add(p)}}),o.push(this.documentOverlayCache.saveOverlays(e,c,h))}return G.waitFor(o)}).next(()=>r)}recalculateAndSaveOverlaysForDocumentKeys(e,n){return this.remoteDocumentCache.getEntries(e,n).next(r=>this.recalculateAndSaveOverlays(e,r))}getDocumentsMatchingQuery(e,n,r,i){return function(o){return xe.isDocumentKey(o.path)&&o.collectionGroup===null&&o.filters.length===0}(n)?this.getDocumentsMatchingDocumentQuery(e,n.path):Jb(n)?this.getDocumentsMatchingCollectionGroupQuery(e,n,r,i):this.getDocumentsMatchingCollectionQuery(e,n,r,i)}getNextDocuments(e,n,r,i){return this.remoteDocumentCache.getAllFromCollectionGroup(e,n,r,i).next(s=>{const o=i-s.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,n,r.largestBatchId,i-s.size):G.resolve(gs());let a=ml,u=s;return o.next(c=>G.forEach(c,(f,h)=>(a{u=u.insert(f,p)}))).next(()=>this.populateOverlays(e,c,s)).next(()=>this.computeViews(e,u,c,He())).next(f=>({batchId:a,changes:nE(f)})))})}getDocumentsMatchingDocumentQuery(e,n){return this.getDocument(e,new xe(n)).next(r=>{let i=ka();return r.isFoundDocument()&&(i=i.insert(r.key,r)),i})}getDocumentsMatchingCollectionGroupQuery(e,n,r,i){const s=n.collectionGroup;let o=ka();return this.indexManager.getCollectionParents(e,s).next(a=>G.forEach(a,u=>{const c=function(h,p){return new qo(p,null,h.explicitOrderBy.slice(),h.filters.slice(),h.limit,h.limitType,h.startAt,h.endAt)}(n,u.child(s));return this.getDocumentsMatchingCollectionQuery(e,c,r,i).next(f=>{f.forEach((h,p)=>{o=o.insert(h,p)})})}).next(()=>o))}getDocumentsMatchingCollectionQuery(e,n,r,i){let s;return this.documentOverlayCache.getOverlaysForCollection(e,n.path,r.largestBatchId).next(o=>(s=o,this.remoteDocumentCache.getDocumentsMatchingQuery(e,n,r,s,i))).next(o=>{s.forEach((u,c)=>{const f=c.getKey();o.get(f)===null&&(o=o.insert(f,ln.newInvalidDocument(f)))});let a=ka();return o.forEach((u,c)=>{const f=s.get(u);f!==void 0&&$a(f.mutation,c,On.empty(),Je.now()),Td(n,c)&&(a=a.insert(u,c))}),a})}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class uP{constructor(e){this.serializer=e,this.Lr=new Map,this.kr=new Map}getBundleMetadata(e,n){return G.resolve(this.Lr.get(n))}saveBundleMetadata(e,n){return this.Lr.set(n.id,function(i){return{id:i.id,version:i.version,createTime:Sr(i.createTime)}}(n)),G.resolve()}getNamedQuery(e,n){return G.resolve(this.kr.get(n))}saveNamedQuery(e,n){return this.kr.set(n.name,function(i){return{name:i.name,query:JA(i.bundledQuery),readTime:Sr(i.readTime)}}(n)),G.resolve()}}/** + * @license + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class cP{constructor(){this.overlays=new yt(xe.comparator),this.qr=new Map}getOverlay(e,n){return G.resolve(this.overlays.get(n))}getOverlays(e,n){const r=gs();return G.forEach(n,i=>this.getOverlay(e,i).next(s=>{s!==null&&r.set(i,s)})).next(()=>r)}saveOverlays(e,n,r){return r.forEach((i,s)=>{this.St(e,n,s)}),G.resolve()}removeOverlaysForBatchId(e,n,r){const i=this.qr.get(r);return i!==void 0&&(i.forEach(s=>this.overlays=this.overlays.remove(s)),this.qr.delete(r)),G.resolve()}getOverlaysForCollection(e,n,r){const i=gs(),s=n.length+1,o=new xe(n.child("")),a=this.overlays.getIteratorFrom(o);for(;a.hasNext();){const u=a.getNext().value,c=u.getKey();if(!n.isPrefixOf(c.path))break;c.path.length===s&&u.largestBatchId>r&&i.set(u.getKey(),u)}return G.resolve(i)}getOverlaysForCollectionGroup(e,n,r,i){let s=new yt((c,f)=>c-f);const o=this.overlays.getIterator();for(;o.hasNext();){const c=o.getNext().value;if(c.getKey().getCollectionGroup()===n&&c.largestBatchId>r){let f=s.get(c.largestBatchId);f===null&&(f=gs(),s=s.insert(c.largestBatchId,f)),f.set(c.getKey(),c)}}const a=gs(),u=s.getIterator();for(;u.hasNext()&&(u.getNext().value.forEach((c,f)=>a.set(c,f)),!(a.size()>=i)););return G.resolve(a)}St(e,n,r){const i=this.overlays.get(r.key);if(i!==null){const o=this.qr.get(i.largestBatchId).delete(r.key);this.qr.set(i.largestBatchId,o)}this.overlays=this.overlays.insert(r.key,new CA(n,r));let s=this.qr.get(n);s===void 0&&(s=He(),this.qr.set(n,s)),this.qr.set(n,s.add(r.key))}}/** + * @license + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class dP{constructor(){this.sessionToken=en.EMPTY_BYTE_STRING}getSessionToken(e){return G.resolve(this.sessionToken)}setSessionToken(e,n){return this.sessionToken=n,G.resolve()}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class ug{constructor(){this.Qr=new Vt(zt.$r),this.Ur=new Vt(zt.Kr)}isEmpty(){return this.Qr.isEmpty()}addReference(e,n){const r=new zt(e,n);this.Qr=this.Qr.add(r),this.Ur=this.Ur.add(r)}Wr(e,n){e.forEach(r=>this.addReference(r,n))}removeReference(e,n){this.Gr(new zt(e,n))}zr(e,n){e.forEach(r=>this.removeReference(r,n))}jr(e){const n=new xe(new st([])),r=new zt(n,e),i=new zt(n,e+1),s=[];return this.Ur.forEachInRange([r,i],o=>{this.Gr(o),s.push(o.key)}),s}Jr(){this.Qr.forEach(e=>this.Gr(e))}Gr(e){this.Qr=this.Qr.delete(e),this.Ur=this.Ur.delete(e)}Hr(e){const n=new xe(new st([])),r=new zt(n,e),i=new zt(n,e+1);let s=He();return this.Ur.forEachInRange([r,i],o=>{s=s.add(o.key)}),s}containsKey(e){const n=new zt(e,0),r=this.Qr.firstAfterOrEqual(n);return r!==null&&e.isEqual(r.key)}}class zt{constructor(e,n){this.key=e,this.Yr=n}static $r(e,n){return xe.comparator(e.key,n.key)||$e(e.Yr,n.Yr)}static Kr(e,n){return $e(e.Yr,n.Yr)||xe.comparator(e.key,n.key)}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class hP{constructor(e,n){this.indexManager=e,this.referenceDelegate=n,this.mutationQueue=[],this.tr=1,this.Zr=new Vt(zt.$r)}checkEmpty(e){return G.resolve(this.mutationQueue.length===0)}addMutationBatch(e,n,r,i){const s=this.tr;this.tr++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const o=new kA(s,n,r,i);this.mutationQueue.push(o);for(const a of i)this.Zr=this.Zr.add(new zt(a.key,s)),this.indexManager.addToCollectionParentIndex(e,a.key.path.popLast());return G.resolve(o)}lookupMutationBatch(e,n){return G.resolve(this.Xr(n))}getNextMutationBatchAfterBatchId(e,n){const r=n+1,i=this.ei(r),s=i<0?0:i;return G.resolve(this.mutationQueue.length>s?this.mutationQueue[s]:null)}getHighestUnacknowledgedBatchId(){return G.resolve(this.mutationQueue.length===0?Jm:this.tr-1)}getAllMutationBatches(e){return G.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,n){const r=new zt(n,0),i=new zt(n,Number.POSITIVE_INFINITY),s=[];return this.Zr.forEachInRange([r,i],o=>{const a=this.Xr(o.Yr);s.push(a)}),G.resolve(s)}getAllMutationBatchesAffectingDocumentKeys(e,n){let r=new Vt($e);return n.forEach(i=>{const s=new zt(i,0),o=new zt(i,Number.POSITIVE_INFINITY);this.Zr.forEachInRange([s,o],a=>{r=r.add(a.Yr)})}),G.resolve(this.ti(r))}getAllMutationBatchesAffectingQuery(e,n){const r=n.path,i=r.length+1;let s=r;xe.isDocumentKey(s)||(s=s.child(""));const o=new zt(new xe(s),0);let a=new Vt($e);return this.Zr.forEachWhile(u=>{const c=u.key.path;return!!r.isPrefixOf(c)&&(c.length===i&&(a=a.add(u.Yr)),!0)},o),G.resolve(this.ti(a))}ti(e){const n=[];return e.forEach(r=>{const i=this.Xr(r);i!==null&&n.push(i)}),n}removeMutationBatch(e,n){Ze(this.ni(n.batchId,"removed")===0,55003),this.mutationQueue.shift();let r=this.Zr;return G.forEach(n.mutations,i=>{const s=new zt(i.key,n.batchId);return r=r.delete(s),this.referenceDelegate.markPotentiallyOrphaned(e,i.key)}).next(()=>{this.Zr=r})}ir(e){}containsKey(e,n){const r=new zt(n,0),i=this.Zr.firstAfterOrEqual(r);return G.resolve(n.isEqual(i&&i.key))}performConsistencyCheck(e){return this.mutationQueue.length,G.resolve()}ni(e,n){return this.ei(e)}ei(e){return this.mutationQueue.length===0?0:e-this.mutationQueue[0].batchId}Xr(e){const n=this.ei(e);return n<0||n>=this.mutationQueue.length?null:this.mutationQueue[n]}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class fP{constructor(e){this.ri=e,this.docs=function(){return new yt(xe.comparator)}(),this.size=0}setIndexManager(e){this.indexManager=e}addEntry(e,n){const r=n.key,i=this.docs.get(r),s=i?i.size:0,o=this.ri(n);return this.docs=this.docs.insert(r,{document:n.mutableCopy(),size:o}),this.size+=o-s,this.indexManager.addToCollectionParentIndex(e,r.path.popLast())}removeEntry(e){const n=this.docs.get(e);n&&(this.docs=this.docs.remove(e),this.size-=n.size)}getEntry(e,n){const r=this.docs.get(n);return G.resolve(r?r.document.mutableCopy():ln.newInvalidDocument(n))}getEntries(e,n){let r=ti();return n.forEach(i=>{const s=this.docs.get(i);r=r.insert(i,s?s.document.mutableCopy():ln.newInvalidDocument(i))}),G.resolve(r)}getDocumentsMatchingQuery(e,n,r,i){let s=ti();const o=n.path,a=new xe(o.child("__id-9223372036854775808__")),u=this.docs.getIteratorFrom(a);for(;u.hasNext();){const{key:c,value:{document:f}}=u.getNext();if(!o.isPrefixOf(c.path))break;c.path.length>o.length+1||$N(BN(f),r)<=0||(i.has(f.key)||Td(n,f))&&(s=s.insert(f.key,f.mutableCopy()))}return G.resolve(s)}getAllFromCollectionGroup(e,n,r,i){Ee(9500)}ii(e,n){return G.forEach(this.docs,r=>n(r))}newChangeBuffer(e){return new pP(this)}getSize(e){return G.resolve(this.size)}}class pP extends oP{constructor(e){super(),this.Nr=e}applyChanges(e){const n=[];return this.changes.forEach((r,i)=>{i.isValidDocument()?n.push(this.Nr.addEntry(e,i)):this.Nr.removeEntry(r)}),G.waitFor(n)}getFromCache(e,n){return this.Nr.getEntry(e,n)}getAllFromCache(e,n){return this.Nr.getEntries(e,n)}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class mP{constructor(e){this.persistence=e,this.si=new Vs(n=>tg(n),ng),this.lastRemoteSnapshotVersion=Ne.min(),this.highestTargetId=0,this.oi=0,this._i=new ug,this.targetCount=0,this.ai=Lo.ur()}forEachTarget(e,n){return this.si.forEach((r,i)=>n(i)),G.resolve()}getLastRemoteSnapshotVersion(e){return G.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return G.resolve(this.oi)}allocateTargetId(e){return this.highestTargetId=this.ai.next(),G.resolve(this.highestTargetId)}setTargetsMetadata(e,n,r){return r&&(this.lastRemoteSnapshotVersion=r),n>this.oi&&(this.oi=n),G.resolve()}Pr(e){this.si.set(e.target,e);const n=e.targetId;n>this.highestTargetId&&(this.ai=new Lo(n),this.highestTargetId=n),e.sequenceNumber>this.oi&&(this.oi=e.sequenceNumber)}addTargetData(e,n){return this.Pr(n),this.targetCount+=1,G.resolve()}updateTargetData(e,n){return this.Pr(n),G.resolve()}removeTargetData(e,n){return this.si.delete(n.target),this._i.jr(n.targetId),this.targetCount-=1,G.resolve()}removeTargets(e,n,r){let i=0;const s=[];return this.si.forEach((o,a)=>{a.sequenceNumber<=n&&r.get(a.targetId)===null&&(this.si.delete(o),s.push(this.removeMatchingKeysForTargetId(e,a.targetId)),i++)}),G.waitFor(s).next(()=>i)}getTargetCount(e){return G.resolve(this.targetCount)}getTargetData(e,n){const r=this.si.get(n)||null;return G.resolve(r)}addMatchingKeys(e,n,r){return this._i.Wr(n,r),G.resolve()}removeMatchingKeys(e,n,r){this._i.zr(n,r);const i=this.persistence.referenceDelegate,s=[];return i&&n.forEach(o=>{s.push(i.markPotentiallyOrphaned(e,o))}),G.waitFor(s)}removeMatchingKeysForTargetId(e,n){return this._i.jr(n),G.resolve()}getMatchingKeysForTargetId(e,n){const r=this._i.Hr(n);return G.resolve(r)}containsKey(e,n){return G.resolve(this._i.containsKey(n))}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class EE{constructor(e,n){this.ui={},this.overlays={},this.ci=new wd(0),this.li=!1,this.li=!0,this.hi=new dP,this.referenceDelegate=e(this),this.Pi=new mP(this),this.indexManager=new ZA,this.remoteDocumentCache=function(i){return new fP(i)}(r=>this.referenceDelegate.Ti(r)),this.serializer=new XA(n),this.Ii=new uP(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.li=!1,Promise.resolve()}get started(){return this.li}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let n=this.overlays[e.toKey()];return n||(n=new cP,this.overlays[e.toKey()]=n),n}getMutationQueue(e,n){let r=this.ui[e.toKey()];return r||(r=new hP(n,this.referenceDelegate),this.ui[e.toKey()]=r),r}getGlobalsCache(){return this.hi}getTargetCache(){return this.Pi}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.Ii}runTransaction(e,n,r){ue("MemoryPersistence","Starting transaction:",e);const i=new gP(this.ci.next());return this.referenceDelegate.Ei(),r(i).next(s=>this.referenceDelegate.di(i).next(()=>s)).toPromise().then(s=>(i.raiseOnCommittedEvent(),s))}Ai(e,n){return G.or(Object.values(this.ui).map(r=>()=>r.containsKey(e,n)))}}class gP extends qN{constructor(e){super(),this.currentSequenceNumber=e}}class cg{constructor(e){this.persistence=e,this.Ri=new ug,this.Vi=null}static mi(e){return new cg(e)}get fi(){if(this.Vi)return this.Vi;throw Ee(60996)}addReference(e,n,r){return this.Ri.addReference(r,n),this.fi.delete(r.toString()),G.resolve()}removeReference(e,n,r){return this.Ri.removeReference(r,n),this.fi.add(r.toString()),G.resolve()}markPotentiallyOrphaned(e,n){return this.fi.add(n.toString()),G.resolve()}removeTarget(e,n){this.Ri.jr(n.targetId).forEach(i=>this.fi.add(i.toString()));const r=this.persistence.getTargetCache();return r.getMatchingKeysForTargetId(e,n.targetId).next(i=>{i.forEach(s=>this.fi.add(s.toString()))}).next(()=>r.removeTargetData(e,n))}Ei(){this.Vi=new Set}di(e){const n=this.persistence.getRemoteDocumentCache().newChangeBuffer();return G.forEach(this.fi,r=>{const i=xe.fromPath(r);return this.gi(e,i).next(s=>{s||n.removeEntry(i,Ne.min())})}).next(()=>(this.Vi=null,n.apply(e)))}updateLimboDocument(e,n){return this.gi(e,n).next(r=>{r?this.fi.delete(n.toString()):this.fi.add(n.toString())})}Ti(e){return 0}gi(e,n){return G.or([()=>G.resolve(this.Ri.containsKey(n)),()=>this.persistence.getTargetCache().containsKey(e,n),()=>this.persistence.Ai(e,n)])}}class Oc{constructor(e,n){this.persistence=e,this.pi=new Vs(r=>KN(r.path),(r,i)=>r.isEqual(i)),this.garbageCollector=sP(this,n)}static mi(e,n){return new Oc(e,n)}Ei(){}di(e){return G.resolve()}forEachTarget(e,n){return this.persistence.getTargetCache().forEachTarget(e,n)}gr(e){const n=this.wr(e);return this.persistence.getTargetCache().getTargetCount(e).next(r=>n.next(i=>r+i))}wr(e){let n=0;return this.pr(e,r=>{n++}).next(()=>n)}pr(e,n){return G.forEach(this.pi,(r,i)=>this.br(e,r,i).next(s=>s?G.resolve():n(i)))}removeTargets(e,n,r){return this.persistence.getTargetCache().removeTargets(e,n,r)}removeOrphanedDocuments(e,n){let r=0;const i=this.persistence.getRemoteDocumentCache(),s=i.newChangeBuffer();return i.ii(e,o=>this.br(e,o,n).next(a=>{a||(r++,s.removeEntry(o,Ne.min()))})).next(()=>s.apply(e)).next(()=>r)}markPotentiallyOrphaned(e,n){return this.pi.set(n,e.currentSequenceNumber),G.resolve()}removeTarget(e,n){const r=n.withSequenceNumber(e.currentSequenceNumber);return this.persistence.getTargetCache().updateTargetData(e,r)}addReference(e,n,r){return this.pi.set(r,e.currentSequenceNumber),G.resolve()}removeReference(e,n,r){return this.pi.set(r,e.currentSequenceNumber),G.resolve()}updateLimboDocument(e,n){return this.pi.set(n,e.currentSequenceNumber),G.resolve()}Ti(e){let n=e.key.toString().length;return e.isFoundDocument()&&(n+=$u(e.data.value)),n}br(e,n,r){return G.or([()=>this.persistence.Ai(e,n),()=>this.persistence.getTargetCache().containsKey(e,n),()=>{const i=this.pi.get(n);return G.resolve(i!==void 0&&i>r)}])}getCacheSize(e){return this.persistence.getRemoteDocumentCache().getSize(e)}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class dg{constructor(e,n,r,i){this.targetId=e,this.fromCache=n,this.Es=r,this.ds=i}static As(e,n){let r=He(),i=He();for(const s of n.docChanges)switch(s.type){case 0:r=r.add(s.doc.key);break;case 1:i=i.add(s.doc.key)}return new dg(e,n.fromCache,r,i)}}/** + * @license + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class yP{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class vP{constructor(){this.Rs=!1,this.Vs=!1,this.fs=100,this.gs=function(){return cC()?8:WN(cn())>0?6:4}()}initialize(e,n){this.ps=e,this.indexManager=n,this.Rs=!0}getDocumentsMatchingQuery(e,n,r,i){const s={result:null};return this.ys(e,n).next(o=>{s.result=o}).next(()=>{if(!s.result)return this.ws(e,n,i,r).next(o=>{s.result=o})}).next(()=>{if(s.result)return;const o=new yP;return this.Ss(e,n,o).next(a=>{if(s.result=a,this.Vs)return this.bs(e,n,o,a.size)})}).next(()=>s.result)}bs(e,n,r,i){return r.documentReadCountthis.gs*i?(Ws()<=Be.DEBUG&&ue("QueryEngine","The SDK decides to create cache indexes for query:",Gs(n),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(e,Tr(n))):G.resolve())}ys(e,n){if(zv(n))return G.resolve(null);let r=Tr(n);return this.indexManager.getIndexType(e,r).next(i=>i===0?null:(n.limit!==null&&i===1&&(n=xp(n,null,"F"),r=Tr(n)),this.indexManager.getDocumentsMatchingTarget(e,r).next(s=>{const o=He(...s);return this.ps.getDocuments(e,o).next(a=>this.indexManager.getMinOffset(e,r).next(u=>{const c=this.Ds(n,a);return this.Cs(n,c,o,u.readTime)?this.ys(e,xp(n,null,"F")):this.vs(e,c,n,u)}))})))}ws(e,n,r,i){return zv(n)||i.isEqual(Ne.min())?G.resolve(null):this.ps.getDocuments(e,r).next(s=>{const o=this.Ds(n,s);return this.Cs(n,o,r,i)?G.resolve(null):(Ws()<=Be.DEBUG&&ue("QueryEngine","Re-using previous result from %s to execute query: %s",i.toString(),Gs(n)),this.vs(e,o,n,zN(i,ml)).next(a=>a))})}Ds(e,n){let r=new Vt(eE(e));return n.forEach((i,s)=>{Td(e,s)&&(r=r.add(s))}),r}Cs(e,n,r,i){if(e.limit===null)return!1;if(r.size!==n.size)return!0;const s=e.limitType==="F"?n.last():n.first();return!!s&&(s.hasPendingWrites||s.version.compareTo(i)>0)}Ss(e,n,r){return Ws()<=Be.DEBUG&&ue("QueryEngine","Using full collection scan to execute query:",Gs(n)),this.ps.getDocumentsMatchingQuery(e,n,$i.min(),r)}vs(e,n,r,i){return this.ps.getDocumentsMatchingQuery(e,r,i).next(s=>(n.forEach(o=>{s=s.insert(o.key,o)}),s))}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const hg="LocalStore",xP=3e8;class wP{constructor(e,n,r,i){this.persistence=e,this.Fs=n,this.serializer=i,this.Ms=new yt($e),this.xs=new Vs(s=>tg(s),ng),this.Os=new Map,this.Ns=e.getRemoteDocumentCache(),this.Pi=e.getTargetCache(),this.Ii=e.getBundleCache(),this.Bs(r)}Bs(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new lP(this.Ns,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.Ns.setIndexManager(this.indexManager),this.Fs.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction("Collect garbage","readwrite-primary",n=>e.collect(n,this.Ms))}}function _P(t,e,n,r){return new wP(t,e,n,r)}async function IE(t,e){const n=Re(t);return await n.persistence.runTransaction("Handle user change","readonly",r=>{let i;return n.mutationQueue.getAllMutationBatches(r).next(s=>(i=s,n.Bs(e),n.mutationQueue.getAllMutationBatches(r))).next(s=>{const o=[],a=[];let u=He();for(const c of i){o.push(c.batchId);for(const f of c.mutations)u=u.add(f.key)}for(const c of s){a.push(c.batchId);for(const f of c.mutations)u=u.add(f.key)}return n.localDocuments.getDocuments(r,u).next(c=>({Ls:c,removedBatchIds:o,addedBatchIds:a}))})})}function bP(t,e){const n=Re(t);return n.persistence.runTransaction("Acknowledge batch","readwrite-primary",r=>{const i=e.batch.keys(),s=n.Ns.newChangeBuffer({trackRemovals:!0});return function(a,u,c,f){const h=c.batch,p=h.keys();let g=G.resolve();return p.forEach(_=>{g=g.next(()=>f.getEntry(u,_)).next(S=>{const P=c.docVersions.get(_);Ze(P!==null,48541),S.version.compareTo(P)<0&&(h.applyToRemoteDocument(S,c),S.isValidDocument()&&(S.setReadTime(c.commitVersion),f.addEntry(S)))})}),g.next(()=>a.mutationQueue.removeMutationBatch(u,h))}(n,r,e,s).next(()=>s.apply(r)).next(()=>n.mutationQueue.performConsistencyCheck(r)).next(()=>n.documentOverlayCache.removeOverlaysForBatchId(r,i,e.batch.batchId)).next(()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(r,function(a){let u=He();for(let c=0;c0&&(u=u.add(a.batch.mutations[c].key));return u}(e))).next(()=>n.localDocuments.getDocuments(r,i))})}function TE(t){const e=Re(t);return e.persistence.runTransaction("Get last remote snapshot version","readonly",n=>e.Pi.getLastRemoteSnapshotVersion(n))}function EP(t,e){const n=Re(t),r=e.snapshotVersion;let i=n.Ms;return n.persistence.runTransaction("Apply remote event","readwrite-primary",s=>{const o=n.Ns.newChangeBuffer({trackRemovals:!0});i=n.Ms;const a=[];e.targetChanges.forEach((f,h)=>{const p=i.get(h);if(!p)return;a.push(n.Pi.removeMatchingKeys(s,f.removedDocuments,h).next(()=>n.Pi.addMatchingKeys(s,f.addedDocuments,h)));let g=p.withSequenceNumber(s.currentSequenceNumber);e.targetMismatches.get(h)!==null?g=g.withResumeToken(en.EMPTY_BYTE_STRING,Ne.min()).withLastLimboFreeSnapshotVersion(Ne.min()):f.resumeToken.approximateByteSize()>0&&(g=g.withResumeToken(f.resumeToken,r)),i=i.insert(h,g),function(S,P,v){return S.resumeToken.approximateByteSize()===0||P.snapshotVersion.toMicroseconds()-S.snapshotVersion.toMicroseconds()>=xP?!0:v.addedDocuments.size+v.modifiedDocuments.size+v.removedDocuments.size>0}(p,g,f)&&a.push(n.Pi.updateTargetData(s,g))});let u=ti(),c=He();if(e.documentUpdates.forEach(f=>{e.resolvedLimboDocuments.has(f)&&a.push(n.persistence.referenceDelegate.updateLimboDocument(s,f))}),a.push(IP(s,o,e.documentUpdates).next(f=>{u=f.ks,c=f.qs})),!r.isEqual(Ne.min())){const f=n.Pi.getLastRemoteSnapshotVersion(s).next(h=>n.Pi.setTargetsMetadata(s,s.currentSequenceNumber,r));a.push(f)}return G.waitFor(a).next(()=>o.apply(s)).next(()=>n.localDocuments.getLocalViewOfDocuments(s,u,c)).next(()=>u)}).then(s=>(n.Ms=i,s))}function IP(t,e,n){let r=He(),i=He();return n.forEach(s=>r=r.add(s)),e.getEntries(t,r).next(s=>{let o=ti();return n.forEach((a,u)=>{const c=s.get(a);u.isFoundDocument()!==c.isFoundDocument()&&(i=i.add(a)),u.isNoDocument()&&u.version.isEqual(Ne.min())?(e.removeEntry(a,u.readTime),o=o.insert(a,u)):!c.isValidDocument()||u.version.compareTo(c.version)>0||u.version.compareTo(c.version)===0&&c.hasPendingWrites?(e.addEntry(u),o=o.insert(a,u)):ue(hg,"Ignoring outdated watch update for ",a,". Current version:",c.version," Watch version:",u.version)}),{ks:o,qs:i}})}function TP(t,e){const n=Re(t);return n.persistence.runTransaction("Get next mutation batch","readonly",r=>(e===void 0&&(e=Jm),n.mutationQueue.getNextMutationBatchAfterBatchId(r,e)))}function SP(t,e){const n=Re(t);return n.persistence.runTransaction("Allocate target","readwrite",r=>{let i;return n.Pi.getTargetData(r,e).next(s=>s?(i=s,G.resolve(i)):n.Pi.allocateTargetId(r).next(o=>(i=new Si(e,o,"TargetPurposeListen",r.currentSequenceNumber),n.Pi.addTargetData(r,i).next(()=>i))))}).then(r=>{const i=n.Ms.get(r.targetId);return(i===null||r.snapshotVersion.compareTo(i.snapshotVersion)>0)&&(n.Ms=n.Ms.insert(r.targetId,r),n.xs.set(e,r.targetId)),r})}async function Ip(t,e,n){const r=Re(t),i=r.Ms.get(e),s=n?"readwrite":"readwrite-primary";try{n||await r.persistence.runTransaction("Release target",s,o=>r.persistence.referenceDelegate.removeTarget(o,i))}catch(o){if(!Ho(o))throw o;ue(hg,`Failed to update sequence numbers for target ${e}: ${o}`)}r.Ms=r.Ms.remove(e),r.xs.delete(i.target)}function ex(t,e,n){const r=Re(t);let i=Ne.min(),s=He();return r.persistence.runTransaction("Execute query","readwrite",o=>function(u,c,f){const h=Re(u),p=h.xs.get(f);return p!==void 0?G.resolve(h.Ms.get(p)):h.Pi.getTargetData(c,f)}(r,o,Tr(e)).next(a=>{if(a)return i=a.lastLimboFreeSnapshotVersion,r.Pi.getMatchingKeysForTargetId(o,a.targetId).next(u=>{s=u})}).next(()=>r.Fs.getDocumentsMatchingQuery(o,e,n?i:Ne.min(),n?s:He())).next(a=>(kP(r,fA(e),a),{documents:a,Qs:s})))}function kP(t,e,n){let r=t.Os.get(e)||Ne.min();n.forEach((i,s)=>{s.readTime.compareTo(r)>0&&(r=s.readTime)}),t.Os.set(e,r)}class tx{constructor(){this.activeTargetIds=xA()}zs(e){this.activeTargetIds=this.activeTargetIds.add(e)}js(e){this.activeTargetIds=this.activeTargetIds.delete(e)}Gs(){const e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)}}class CP{constructor(){this.Mo=new tx,this.xo={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,n,r){}addLocalQueryTarget(e,n=!0){return n&&this.Mo.zs(e),this.xo[e]||"not-current"}updateQueryState(e,n,r){this.xo[e]=n}removeLocalQueryTarget(e){this.Mo.js(e)}isLocalQueryTarget(e){return this.Mo.activeTargetIds.has(e)}clearQueryState(e){delete this.xo[e]}getAllActiveQueryTargets(){return this.Mo.activeTargetIds}isActiveQueryTarget(e){return this.Mo.activeTargetIds.has(e)}start(){return this.Mo=new tx,Promise.resolve()}handleUserChange(e,n,r){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class NP{Oo(e){}shutdown(){}}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const nx="ConnectivityMonitor";class rx{constructor(){this.No=()=>this.Bo(),this.Lo=()=>this.ko(),this.qo=[],this.Qo()}Oo(e){this.qo.push(e)}shutdown(){window.removeEventListener("online",this.No),window.removeEventListener("offline",this.Lo)}Qo(){window.addEventListener("online",this.No),window.addEventListener("offline",this.Lo)}Bo(){ue(nx,"Network connectivity changed: AVAILABLE");for(const e of this.qo)e(0)}ko(){ue(nx,"Network connectivity changed: UNAVAILABLE");for(const e of this.qo)e(1)}static v(){return typeof window<"u"&&window.addEventListener!==void 0&&window.removeEventListener!==void 0}}/** + * @license + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */let bu=null;function Tp(){return bu===null?bu=function(){return 268435456+Math.round(2147483648*Math.random())}():bu++,"0x"+bu.toString(16)}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Hh="RestConnection",AP={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery"};class PP{get $o(){return!1}constructor(e){this.databaseInfo=e,this.databaseId=e.databaseId;const n=e.ssl?"https":"http",r=encodeURIComponent(this.databaseId.projectId),i=encodeURIComponent(this.databaseId.database);this.Uo=n+"://"+e.host,this.Ko=`projects/${r}/databases/${i}`,this.Wo=this.databaseId.database===Ac?`project_id=${r}`:`project_id=${r}&database_id=${i}`}Go(e,n,r,i,s){const o=Tp(),a=this.zo(e,n.toUriEncodedString());ue(Hh,`Sending RPC '${e}' ${o}:`,a,r);const u={"google-cloud-resource-prefix":this.Ko,"x-goog-request-params":this.Wo};this.jo(u,i,s);const{host:c}=new URL(a),f=Ls(c);return this.Jo(e,a,u,r,f).then(h=>(ue(Hh,`Received RPC '${e}' ${o}: `,h),h),h=>{throw Ao(Hh,`RPC '${e}' ${o} failed with error: `,h,"url: ",a,"request:",r),h})}Ho(e,n,r,i,s,o){return this.Go(e,n,r,i,s)}jo(e,n,r){e["X-Goog-Api-Client"]=function(){return"gl-js/ fire/"+Bo}(),e["Content-Type"]="text/plain",this.databaseInfo.appId&&(e["X-Firebase-GMPID"]=this.databaseInfo.appId),n&&n.headers.forEach((i,s)=>e[s]=i),r&&r.headers.forEach((i,s)=>e[s]=i)}zo(e,n){const r=AP[e];return`${this.Uo}/v1/${n}:${r}`}terminate(){}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class RP{constructor(e){this.Yo=e.Yo,this.Zo=e.Zo}Xo(e){this.e_=e}t_(e){this.n_=e}r_(e){this.i_=e}onMessage(e){this.s_=e}close(){this.Zo()}send(e){this.Yo(e)}o_(){this.e_()}__(){this.n_()}a_(e){this.i_(e)}u_(e){this.s_(e)}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const sn="WebChannelConnection";class DP extends PP{constructor(e){super(e),this.c_=[],this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}Jo(e,n,r,i,s){const o=Tp();return new Promise((a,u)=>{const c=new kb;c.setWithCredentials(!0),c.listenOnce(Cb.COMPLETE,()=>{try{switch(c.getLastErrorCode()){case Bu.NO_ERROR:const h=c.getResponseJson();ue(sn,`XHR for RPC '${e}' ${o} received:`,JSON.stringify(h)),a(h);break;case Bu.TIMEOUT:ue(sn,`RPC '${e}' ${o} timed out`),u(new ae(W.DEADLINE_EXCEEDED,"Request time out"));break;case Bu.HTTP_ERROR:const p=c.getStatus();if(ue(sn,`RPC '${e}' ${o} failed with status:`,p,"response text:",c.getResponseText()),p>0){let g=c.getResponseJson();Array.isArray(g)&&(g=g[0]);const _=g==null?void 0:g.error;if(_&&_.status&&_.message){const S=function(v){const x=v.toLowerCase().replace(/_/g,"-");return Object.values(W).indexOf(x)>=0?x:W.UNKNOWN}(_.status);u(new ae(S,_.message))}else u(new ae(W.UNKNOWN,"Server responded with status "+c.getStatus()))}else u(new ae(W.UNAVAILABLE,"Connection failed."));break;default:Ee(9055,{l_:e,streamId:o,h_:c.getLastErrorCode(),P_:c.getLastError()})}}finally{ue(sn,`RPC '${e}' ${o} completed.`)}});const f=JSON.stringify(i);ue(sn,`RPC '${e}' ${o} sending request:`,i),c.send(n,"POST",f,r,15)})}T_(e,n,r){const i=Tp(),s=[this.Uo,"/","google.firestore.v1.Firestore","/",e,"/channel"],o=Pb(),a=Ab(),u={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:`projects/${this.databaseId.projectId}/databases/${this.databaseId.database}`},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling},c=this.longPollingOptions.timeoutSeconds;c!==void 0&&(u.longPollingTimeout=Math.round(1e3*c)),this.useFetchStreams&&(u.useFetchStreams=!0),this.jo(u.initMessageHeaders,n,r),u.encodeInitMessageHeaders=!0;const f=s.join("");ue(sn,`Creating RPC '${e}' stream ${i}: ${f}`,u);const h=o.createWebChannel(f,u);this.I_(h);let p=!1,g=!1;const _=new RP({Yo:P=>{g?ue(sn,`Not sending because RPC '${e}' stream ${i} is closed:`,P):(p||(ue(sn,`Opening RPC '${e}' stream ${i} transport.`),h.open(),p=!0),ue(sn,`RPC '${e}' stream ${i} sending:`,P),h.send(P))},Zo:()=>h.close()}),S=(P,v,x)=>{P.listen(v,E=>{try{x(E)}catch(O){setTimeout(()=>{throw O},0)}})};return S(h,Sa.EventType.OPEN,()=>{g||(ue(sn,`RPC '${e}' stream ${i} transport opened.`),_.o_())}),S(h,Sa.EventType.CLOSE,()=>{g||(g=!0,ue(sn,`RPC '${e}' stream ${i} transport closed`),_.a_(),this.E_(h))}),S(h,Sa.EventType.ERROR,P=>{g||(g=!0,Ao(sn,`RPC '${e}' stream ${i} transport errored. Name:`,P.name,"Message:",P.message),_.a_(new ae(W.UNAVAILABLE,"The operation could not be completed")))}),S(h,Sa.EventType.MESSAGE,P=>{var v;if(!g){const x=P.data[0];Ze(!!x,16349);const E=x,O=(E==null?void 0:E.error)||((v=E[0])==null?void 0:v.error);if(O){ue(sn,`RPC '${e}' stream ${i} received error:`,O);const L=O.status;let D=function(T){const A=kt[T];if(A!==void 0)return hE(A)}(L),b=O.message;D===void 0&&(D=W.INTERNAL,b="Unknown error status: "+L+" with message "+O.message),g=!0,_.a_(new ae(D,b)),h.close()}else ue(sn,`RPC '${e}' stream ${i} received:`,x),_.u_(x)}}),S(a,Nb.STAT_EVENT,P=>{P.stat===hp.PROXY?ue(sn,`RPC '${e}' stream ${i} detected buffering proxy`):P.stat===hp.NOPROXY&&ue(sn,`RPC '${e}' stream ${i} detected no buffering proxy`)}),setTimeout(()=>{_.__()},0),_}terminate(){this.c_.forEach(e=>e.close()),this.c_=[]}I_(e){this.c_.push(e)}E_(e){this.c_=this.c_.filter(n=>n===e)}}function qh(){return typeof document<"u"?document:null}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Nd(t){return new MA(t,!0)}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class SE{constructor(e,n,r=1e3,i=1.5,s=6e4){this.Mi=e,this.timerId=n,this.d_=r,this.A_=i,this.R_=s,this.V_=0,this.m_=null,this.f_=Date.now(),this.reset()}reset(){this.V_=0}g_(){this.V_=this.R_}p_(e){this.cancel();const n=Math.floor(this.V_+this.y_()),r=Math.max(0,Date.now()-this.f_),i=Math.max(0,n-r);i>0&&ue("ExponentialBackoff",`Backing off for ${i} ms (base delay: ${this.V_} ms, delay with jitter: ${n} ms, last attempt: ${r} ms ago)`),this.m_=this.Mi.enqueueAfterDelay(this.timerId,i,()=>(this.f_=Date.now(),e())),this.V_*=this.A_,this.V_this.R_&&(this.V_=this.R_)}w_(){this.m_!==null&&(this.m_.skipDelay(),this.m_=null)}cancel(){this.m_!==null&&(this.m_.cancel(),this.m_=null)}y_(){return(Math.random()-.5)*this.V_}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const ix="PersistentStream";class kE{constructor(e,n,r,i,s,o,a,u){this.Mi=e,this.S_=r,this.b_=i,this.connection=s,this.authCredentialsProvider=o,this.appCheckCredentialsProvider=a,this.listener=u,this.state=0,this.D_=0,this.C_=null,this.v_=null,this.stream=null,this.F_=0,this.M_=new SE(e,n)}x_(){return this.state===1||this.state===5||this.O_()}O_(){return this.state===2||this.state===3}start(){this.F_=0,this.state!==4?this.auth():this.N_()}async stop(){this.x_()&&await this.close(0)}B_(){this.state=0,this.M_.reset()}L_(){this.O_()&&this.C_===null&&(this.C_=this.Mi.enqueueAfterDelay(this.S_,6e4,()=>this.k_()))}q_(e){this.Q_(),this.stream.send(e)}async k_(){if(this.O_())return this.close(0)}Q_(){this.C_&&(this.C_.cancel(),this.C_=null)}U_(){this.v_&&(this.v_.cancel(),this.v_=null)}async close(e,n){this.Q_(),this.U_(),this.M_.cancel(),this.D_++,e!==4?this.M_.reset():n&&n.code===W.RESOURCE_EXHAUSTED?(ei(n.toString()),ei("Using maximum backoff delay to prevent overloading the backend."),this.M_.g_()):n&&n.code===W.UNAUTHENTICATED&&this.state!==3&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),this.stream!==null&&(this.K_(),this.stream.close(),this.stream=null),this.state=e,await this.listener.r_(n)}K_(){}auth(){this.state=1;const e=this.W_(this.D_),n=this.D_;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then(([r,i])=>{this.D_===n&&this.G_(r,i)},r=>{e(()=>{const i=new ae(W.UNKNOWN,"Fetching auth token failed: "+r.message);return this.z_(i)})})}G_(e,n){const r=this.W_(this.D_);this.stream=this.j_(e,n),this.stream.Xo(()=>{r(()=>this.listener.Xo())}),this.stream.t_(()=>{r(()=>(this.state=2,this.v_=this.Mi.enqueueAfterDelay(this.b_,1e4,()=>(this.O_()&&(this.state=3),Promise.resolve())),this.listener.t_()))}),this.stream.r_(i=>{r(()=>this.z_(i))}),this.stream.onMessage(i=>{r(()=>++this.F_==1?this.J_(i):this.onNext(i))})}N_(){this.state=5,this.M_.p_(async()=>{this.state=0,this.start()})}z_(e){return ue(ix,`close with error: ${e}`),this.stream=null,this.close(4,e)}W_(e){return n=>{this.Mi.enqueueAndForget(()=>this.D_===e?n():(ue(ix,"stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve()))}}}class jP extends kE{constructor(e,n,r,i,s,o){super(e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",n,r,i,o),this.serializer=s}j_(e,n){return this.connection.T_("Listen",e,n)}J_(e){return this.onNext(e)}onNext(e){this.M_.reset();const n=UA(this.serializer,e),r=function(s){if(!("targetChange"in s))return Ne.min();const o=s.targetChange;return o.targetIds&&o.targetIds.length?Ne.min():o.readTime?Sr(o.readTime):Ne.min()}(e);return this.listener.H_(n,r)}Y_(e){const n={};n.database=Ep(this.serializer),n.addTarget=function(s,o){let a;const u=o.target;if(a=yp(u)?{documents:$A(s,u)}:{query:HA(s,u).ft},a.targetId=o.targetId,o.resumeToken.approximateByteSize()>0){a.resumeToken=mE(s,o.resumeToken);const c=wp(s,o.expectedCount);c!==null&&(a.expectedCount=c)}else if(o.snapshotVersion.compareTo(Ne.min())>0){a.readTime=jc(s,o.snapshotVersion.toTimestamp());const c=wp(s,o.expectedCount);c!==null&&(a.expectedCount=c)}return a}(this.serializer,e);const r=WA(this.serializer,e);r&&(n.labels=r),this.q_(n)}Z_(e){const n={};n.database=Ep(this.serializer),n.removeTarget=e,this.q_(n)}}class OP extends kE{constructor(e,n,r,i,s,o){super(e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",n,r,i,o),this.serializer=s}get X_(){return this.F_>0}start(){this.lastStreamToken=void 0,super.start()}K_(){this.X_&&this.ea([])}j_(e,n){return this.connection.T_("Write",e,n)}J_(e){return Ze(!!e.streamToken,31322),this.lastStreamToken=e.streamToken,Ze(!e.writeResults||e.writeResults.length===0,55816),this.listener.ta()}onNext(e){Ze(!!e.streamToken,12678),this.lastStreamToken=e.streamToken,this.M_.reset();const n=BA(e.writeResults,e.commitTime),r=Sr(e.commitTime);return this.listener.na(r,n)}ra(){const e={};e.database=Ep(this.serializer),this.q_(e)}ea(e){const n={streamToken:this.lastStreamToken,writes:e.map(r=>zA(this.serializer,r))};this.q_(n)}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class LP{}class MP extends LP{constructor(e,n,r,i){super(),this.authCredentials=e,this.appCheckCredentials=n,this.connection=r,this.serializer=i,this.ia=!1}sa(){if(this.ia)throw new ae(W.FAILED_PRECONDITION,"The client has already been terminated.")}Go(e,n,r,i){return this.sa(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([s,o])=>this.connection.Go(e,_p(n,r),i,s,o)).catch(s=>{throw s.name==="FirebaseError"?(s.code===W.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),s):new ae(W.UNKNOWN,s.toString())})}Ho(e,n,r,i,s){return this.sa(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([o,a])=>this.connection.Ho(e,_p(n,r),i,o,a,s)).catch(o=>{throw o.name==="FirebaseError"?(o.code===W.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),o):new ae(W.UNKNOWN,o.toString())})}terminate(){this.ia=!0,this.connection.terminate()}}class VP{constructor(e,n){this.asyncQueue=e,this.onlineStateHandler=n,this.state="Unknown",this.oa=0,this._a=null,this.aa=!0}ua(){this.oa===0&&(this.ca("Unknown"),this._a=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,()=>(this._a=null,this.la("Backend didn't respond within 10 seconds."),this.ca("Offline"),Promise.resolve())))}ha(e){this.state==="Online"?this.ca("Unknown"):(this.oa++,this.oa>=1&&(this.Pa(),this.la(`Connection failed 1 times. Most recent error: ${e.toString()}`),this.ca("Offline")))}set(e){this.Pa(),this.oa=0,e==="Online"&&(this.aa=!1),this.ca(e)}ca(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}la(e){const n=`Could not reach Cloud Firestore backend. ${e} +This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.`;this.aa?(ei(n),this.aa=!1):ue("OnlineStateTracker",n)}Pa(){this._a!==null&&(this._a.cancel(),this._a=null)}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const As="RemoteStore";class FP{constructor(e,n,r,i,s){this.localStore=e,this.datastore=n,this.asyncQueue=r,this.remoteSyncer={},this.Ta=[],this.Ia=new Map,this.Ea=new Set,this.da=[],this.Aa=s,this.Aa.Oo(o=>{r.enqueueAndForget(async()=>{Fs(this)&&(ue(As,"Restarting streams for network reachability change."),await async function(u){const c=Re(u);c.Ea.add(4),await Ol(c),c.Ra.set("Unknown"),c.Ea.delete(4),await Ad(c)}(this))})}),this.Ra=new VP(r,i)}}async function Ad(t){if(Fs(t))for(const e of t.da)await e(!0)}async function Ol(t){for(const e of t.da)await e(!1)}function CE(t,e){const n=Re(t);n.Ia.has(e.targetId)||(n.Ia.set(e.targetId,e),gg(n)?mg(n):Wo(n).O_()&&pg(n,e))}function fg(t,e){const n=Re(t),r=Wo(n);n.Ia.delete(e),r.O_()&&NE(n,e),n.Ia.size===0&&(r.O_()?r.L_():Fs(n)&&n.Ra.set("Unknown"))}function pg(t,e){if(t.Va.Ue(e.targetId),e.resumeToken.approximateByteSize()>0||e.snapshotVersion.compareTo(Ne.min())>0){const n=t.remoteSyncer.getRemoteKeysForTarget(e.targetId).size;e=e.withExpectedCount(n)}Wo(t).Y_(e)}function NE(t,e){t.Va.Ue(e),Wo(t).Z_(e)}function mg(t){t.Va=new DA({getRemoteKeysForTarget:e=>t.remoteSyncer.getRemoteKeysForTarget(e),At:e=>t.Ia.get(e)||null,ht:()=>t.datastore.serializer.databaseId}),Wo(t).start(),t.Ra.ua()}function gg(t){return Fs(t)&&!Wo(t).x_()&&t.Ia.size>0}function Fs(t){return Re(t).Ea.size===0}function AE(t){t.Va=void 0}async function UP(t){t.Ra.set("Online")}async function zP(t){t.Ia.forEach((e,n)=>{pg(t,e)})}async function BP(t,e){AE(t),gg(t)?(t.Ra.ha(e),mg(t)):t.Ra.set("Unknown")}async function $P(t,e,n){if(t.Ra.set("Online"),e instanceof pE&&e.state===2&&e.cause)try{await async function(i,s){const o=s.cause;for(const a of s.targetIds)i.Ia.has(a)&&(await i.remoteSyncer.rejectListen(a,o),i.Ia.delete(a),i.Va.removeTarget(a))}(t,e)}catch(r){ue(As,"Failed to remove targets %s: %s ",e.targetIds.join(","),r),await Lc(t,r)}else if(e instanceof Wu?t.Va.Ze(e):e instanceof fE?t.Va.st(e):t.Va.tt(e),!n.isEqual(Ne.min()))try{const r=await TE(t.localStore);n.compareTo(r)>=0&&await function(s,o){const a=s.Va.Tt(o);return a.targetChanges.forEach((u,c)=>{if(u.resumeToken.approximateByteSize()>0){const f=s.Ia.get(c);f&&s.Ia.set(c,f.withResumeToken(u.resumeToken,o))}}),a.targetMismatches.forEach((u,c)=>{const f=s.Ia.get(u);if(!f)return;s.Ia.set(u,f.withResumeToken(en.EMPTY_BYTE_STRING,f.snapshotVersion)),NE(s,u);const h=new Si(f.target,u,c,f.sequenceNumber);pg(s,h)}),s.remoteSyncer.applyRemoteEvent(a)}(t,n)}catch(r){ue(As,"Failed to raise snapshot:",r),await Lc(t,r)}}async function Lc(t,e,n){if(!Ho(e))throw e;t.Ea.add(1),await Ol(t),t.Ra.set("Offline"),n||(n=()=>TE(t.localStore)),t.asyncQueue.enqueueRetryable(async()=>{ue(As,"Retrying IndexedDB access"),await n(),t.Ea.delete(1),await Ad(t)})}function PE(t,e){return e().catch(n=>Lc(t,n,e))}async function Pd(t){const e=Re(t),n=Gi(e);let r=e.Ta.length>0?e.Ta[e.Ta.length-1].batchId:Jm;for(;HP(e);)try{const i=await TP(e.localStore,r);if(i===null){e.Ta.length===0&&n.L_();break}r=i.batchId,qP(e,i)}catch(i){await Lc(e,i)}RE(e)&&DE(e)}function HP(t){return Fs(t)&&t.Ta.length<10}function qP(t,e){t.Ta.push(e);const n=Gi(t);n.O_()&&n.X_&&n.ea(e.mutations)}function RE(t){return Fs(t)&&!Gi(t).x_()&&t.Ta.length>0}function DE(t){Gi(t).start()}async function WP(t){Gi(t).ra()}async function GP(t){const e=Gi(t);for(const n of t.Ta)e.ea(n.mutations)}async function KP(t,e,n){const r=t.Ta.shift(),i=og.from(r,e,n);await PE(t,()=>t.remoteSyncer.applySuccessfulWrite(i)),await Pd(t)}async function QP(t,e){e&&Gi(t).X_&&await async function(r,i){if(function(o){return AA(o)&&o!==W.ABORTED}(i.code)){const s=r.Ta.shift();Gi(r).B_(),await PE(r,()=>r.remoteSyncer.rejectFailedWrite(s.batchId,i)),await Pd(r)}}(t,e),RE(t)&&DE(t)}async function sx(t,e){const n=Re(t);n.asyncQueue.verifyOperationInProgress(),ue(As,"RemoteStore received new credentials");const r=Fs(n);n.Ea.add(3),await Ol(n),r&&n.Ra.set("Unknown"),await n.remoteSyncer.handleCredentialChange(e),n.Ea.delete(3),await Ad(n)}async function YP(t,e){const n=Re(t);e?(n.Ea.delete(2),await Ad(n)):e||(n.Ea.add(2),await Ol(n),n.Ra.set("Unknown"))}function Wo(t){return t.ma||(t.ma=function(n,r,i){const s=Re(n);return s.sa(),new jP(r,s.connection,s.authCredentials,s.appCheckCredentials,s.serializer,i)}(t.datastore,t.asyncQueue,{Xo:UP.bind(null,t),t_:zP.bind(null,t),r_:BP.bind(null,t),H_:$P.bind(null,t)}),t.da.push(async e=>{e?(t.ma.B_(),gg(t)?mg(t):t.Ra.set("Unknown")):(await t.ma.stop(),AE(t))})),t.ma}function Gi(t){return t.fa||(t.fa=function(n,r,i){const s=Re(n);return s.sa(),new OP(r,s.connection,s.authCredentials,s.appCheckCredentials,s.serializer,i)}(t.datastore,t.asyncQueue,{Xo:()=>Promise.resolve(),t_:WP.bind(null,t),r_:QP.bind(null,t),ta:GP.bind(null,t),na:KP.bind(null,t)}),t.da.push(async e=>{e?(t.fa.B_(),await Pd(t)):(await t.fa.stop(),t.Ta.length>0&&(ue(As,`Stopping write stream with ${t.Ta.length} pending writes`),t.Ta=[]))})),t.fa}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class yg{constructor(e,n,r,i,s){this.asyncQueue=e,this.timerId=n,this.targetTimeMs=r,this.op=i,this.removalCallback=s,this.deferred=new qr,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch(o=>{})}get promise(){return this.deferred.promise}static createAndSchedule(e,n,r,i,s){const o=Date.now()+r,a=new yg(e,n,o,i,s);return a.start(r),a}start(e){this.timerHandle=setTimeout(()=>this.handleDelayElapsed(),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){this.timerHandle!==null&&(this.clearTimeout(),this.deferred.reject(new ae(W.CANCELLED,"Operation cancelled"+(e?": "+e:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget(()=>this.timerHandle!==null?(this.clearTimeout(),this.op().then(e=>this.deferred.resolve(e))):Promise.resolve())}clearTimeout(){this.timerHandle!==null&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}}function vg(t,e){if(ei("AsyncQueue",`${e}: ${t}`),Ho(t))return new ae(W.UNAVAILABLE,`${e}: ${t}`);throw t}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class go{static emptySet(e){return new go(e.comparator)}constructor(e){this.comparator=e?(n,r)=>e(n,r)||xe.comparator(n.key,r.key):(n,r)=>xe.comparator(n.key,r.key),this.keyedMap=ka(),this.sortedSet=new yt(this.comparator)}has(e){return this.keyedMap.get(e)!=null}get(e){return this.keyedMap.get(e)}first(){return this.sortedSet.minKey()}last(){return this.sortedSet.maxKey()}isEmpty(){return this.sortedSet.isEmpty()}indexOf(e){const n=this.keyedMap.get(e);return n?this.sortedSet.indexOf(n):-1}get size(){return this.sortedSet.size}forEach(e){this.sortedSet.inorderTraversal((n,r)=>(e(n),!1))}add(e){const n=this.delete(e.key);return n.copy(n.keyedMap.insert(e.key,e),n.sortedSet.insert(e,null))}delete(e){const n=this.get(e);return n?this.copy(this.keyedMap.remove(e),this.sortedSet.remove(n)):this}isEqual(e){if(!(e instanceof go)||this.size!==e.size)return!1;const n=this.sortedSet.getIterator(),r=e.sortedSet.getIterator();for(;n.hasNext();){const i=n.getNext().key,s=r.getNext().key;if(!i.isEqual(s))return!1}return!0}toString(){const e=[];return this.forEach(n=>{e.push(n.toString())}),e.length===0?"DocumentSet ()":`DocumentSet ( + `+e.join(` +`)+` +)`}copy(e,n){const r=new go;return r.comparator=this.comparator,r.keyedMap=e,r.sortedSet=n,r}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class ox{constructor(){this.ga=new yt(xe.comparator)}track(e){const n=e.doc.key,r=this.ga.get(n);r?e.type!==0&&r.type===3?this.ga=this.ga.insert(n,e):e.type===3&&r.type!==1?this.ga=this.ga.insert(n,{type:r.type,doc:e.doc}):e.type===2&&r.type===2?this.ga=this.ga.insert(n,{type:2,doc:e.doc}):e.type===2&&r.type===0?this.ga=this.ga.insert(n,{type:0,doc:e.doc}):e.type===1&&r.type===0?this.ga=this.ga.remove(n):e.type===1&&r.type===2?this.ga=this.ga.insert(n,{type:1,doc:r.doc}):e.type===0&&r.type===1?this.ga=this.ga.insert(n,{type:2,doc:e.doc}):Ee(63341,{Rt:e,pa:r}):this.ga=this.ga.insert(n,e)}ya(){const e=[];return this.ga.inorderTraversal((n,r)=>{e.push(r)}),e}}class Mo{constructor(e,n,r,i,s,o,a,u,c){this.query=e,this.docs=n,this.oldDocs=r,this.docChanges=i,this.mutatedKeys=s,this.fromCache=o,this.syncStateChanged=a,this.excludesMetadataChanges=u,this.hasCachedResults=c}static fromInitialDocuments(e,n,r,i,s){const o=[];return n.forEach(a=>{o.push({type:0,doc:a})}),new Mo(e,n,go.emptySet(n),o,r,i,!0,!1,s)}get hasPendingWrites(){return!this.mutatedKeys.isEmpty()}isEqual(e){if(!(this.fromCache===e.fromCache&&this.hasCachedResults===e.hasCachedResults&&this.syncStateChanged===e.syncStateChanged&&this.mutatedKeys.isEqual(e.mutatedKeys)&&Id(this.query,e.query)&&this.docs.isEqual(e.docs)&&this.oldDocs.isEqual(e.oldDocs)))return!1;const n=this.docChanges,r=e.docChanges;if(n.length!==r.length)return!1;for(let i=0;ie.Da())}}class JP{constructor(){this.queries=ax(),this.onlineState="Unknown",this.Ca=new Set}terminate(){(function(n,r){const i=Re(n),s=i.queries;i.queries=ax(),s.forEach((o,a)=>{for(const u of a.Sa)u.onError(r)})})(this,new ae(W.ABORTED,"Firestore shutting down"))}}function ax(){return new Vs(t=>Zb(t),Id)}async function xg(t,e){const n=Re(t);let r=3;const i=e.query;let s=n.queries.get(i);s?!s.ba()&&e.Da()&&(r=2):(s=new XP,r=e.Da()?0:1);try{switch(r){case 0:s.wa=await n.onListen(i,!0);break;case 1:s.wa=await n.onListen(i,!1);break;case 2:await n.onFirstRemoteStoreListen(i)}}catch(o){const a=vg(o,`Initialization of query '${Gs(e.query)}' failed`);return void e.onError(a)}n.queries.set(i,s),s.Sa.push(e),e.va(n.onlineState),s.wa&&e.Fa(s.wa)&&_g(n)}async function wg(t,e){const n=Re(t),r=e.query;let i=3;const s=n.queries.get(r);if(s){const o=s.Sa.indexOf(e);o>=0&&(s.Sa.splice(o,1),s.Sa.length===0?i=e.Da()?0:1:!s.ba()&&e.Da()&&(i=2))}switch(i){case 0:return n.queries.delete(r),n.onUnlisten(r,!0);case 1:return n.queries.delete(r),n.onUnlisten(r,!1);case 2:return n.onLastRemoteStoreUnlisten(r);default:return}}function ZP(t,e){const n=Re(t);let r=!1;for(const i of e){const s=i.query,o=n.queries.get(s);if(o){for(const a of o.Sa)a.Fa(i)&&(r=!0);o.wa=i}}r&&_g(n)}function eR(t,e,n){const r=Re(t),i=r.queries.get(e);if(i)for(const s of i.Sa)s.onError(n);r.queries.delete(e)}function _g(t){t.Ca.forEach(e=>{e.next()})}var Sp,lx;(lx=Sp||(Sp={})).Ma="default",lx.Cache="cache";class bg{constructor(e,n,r){this.query=e,this.xa=n,this.Oa=!1,this.Na=null,this.onlineState="Unknown",this.options=r||{}}Fa(e){if(!this.options.includeMetadataChanges){const r=[];for(const i of e.docChanges)i.type!==3&&r.push(i);e=new Mo(e.query,e.docs,e.oldDocs,r,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let n=!1;return this.Oa?this.Ba(e)&&(this.xa.next(e),n=!0):this.La(e,this.onlineState)&&(this.ka(e),n=!0),this.Na=e,n}onError(e){this.xa.error(e)}va(e){this.onlineState=e;let n=!1;return this.Na&&!this.Oa&&this.La(this.Na,e)&&(this.ka(this.Na),n=!0),n}La(e,n){if(!e.fromCache||!this.Da())return!0;const r=n!=="Offline";return(!this.options.qa||!r)&&(!e.docs.isEmpty()||e.hasCachedResults||n==="Offline")}Ba(e){if(e.docChanges.length>0)return!0;const n=this.Na&&this.Na.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!n)&&this.options.includeMetadataChanges===!0}ka(e){e=Mo.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.Oa=!0,this.xa.next(e)}Da(){return this.options.source!==Sp.Cache}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class jE{constructor(e){this.key=e}}class OE{constructor(e){this.key=e}}class tR{constructor(e,n){this.query=e,this.Ya=n,this.Za=null,this.hasCachedResults=!1,this.current=!1,this.Xa=He(),this.mutatedKeys=He(),this.eu=eE(e),this.tu=new go(this.eu)}get nu(){return this.Ya}ru(e,n){const r=n?n.iu:new ox,i=n?n.tu:this.tu;let s=n?n.mutatedKeys:this.mutatedKeys,o=i,a=!1;const u=this.query.limitType==="F"&&i.size===this.query.limit?i.last():null,c=this.query.limitType==="L"&&i.size===this.query.limit?i.first():null;if(e.inorderTraversal((f,h)=>{const p=i.get(f),g=Td(this.query,h)?h:null,_=!!p&&this.mutatedKeys.has(p.key),S=!!g&&(g.hasLocalMutations||this.mutatedKeys.has(g.key)&&g.hasCommittedMutations);let P=!1;p&&g?p.data.isEqual(g.data)?_!==S&&(r.track({type:3,doc:g}),P=!0):this.su(p,g)||(r.track({type:2,doc:g}),P=!0,(u&&this.eu(g,u)>0||c&&this.eu(g,c)<0)&&(a=!0)):!p&&g?(r.track({type:0,doc:g}),P=!0):p&&!g&&(r.track({type:1,doc:p}),P=!0,(u||c)&&(a=!0)),P&&(g?(o=o.add(g),s=S?s.add(f):s.delete(f)):(o=o.delete(f),s=s.delete(f)))}),this.query.limit!==null)for(;o.size>this.query.limit;){const f=this.query.limitType==="F"?o.last():o.first();o=o.delete(f.key),s=s.delete(f.key),r.track({type:1,doc:f})}return{tu:o,iu:r,Cs:a,mutatedKeys:s}}su(e,n){return e.hasLocalMutations&&n.hasCommittedMutations&&!n.hasLocalMutations}applyChanges(e,n,r,i){const s=this.tu;this.tu=e.tu,this.mutatedKeys=e.mutatedKeys;const o=e.iu.ya();o.sort((f,h)=>function(g,_){const S=P=>{switch(P){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return Ee(20277,{Rt:P})}};return S(g)-S(_)}(f.type,h.type)||this.eu(f.doc,h.doc)),this.ou(r),i=i??!1;const a=n&&!i?this._u():[],u=this.Xa.size===0&&this.current&&!i?1:0,c=u!==this.Za;return this.Za=u,o.length!==0||c?{snapshot:new Mo(this.query,e.tu,s,o,e.mutatedKeys,u===0,c,!1,!!r&&r.resumeToken.approximateByteSize()>0),au:a}:{au:a}}va(e){return this.current&&e==="Offline"?(this.current=!1,this.applyChanges({tu:this.tu,iu:new ox,mutatedKeys:this.mutatedKeys,Cs:!1},!1)):{au:[]}}uu(e){return!this.Ya.has(e)&&!!this.tu.has(e)&&!this.tu.get(e).hasLocalMutations}ou(e){e&&(e.addedDocuments.forEach(n=>this.Ya=this.Ya.add(n)),e.modifiedDocuments.forEach(n=>{}),e.removedDocuments.forEach(n=>this.Ya=this.Ya.delete(n)),this.current=e.current)}_u(){if(!this.current)return[];const e=this.Xa;this.Xa=He(),this.tu.forEach(r=>{this.uu(r.key)&&(this.Xa=this.Xa.add(r.key))});const n=[];return e.forEach(r=>{this.Xa.has(r)||n.push(new OE(r))}),this.Xa.forEach(r=>{e.has(r)||n.push(new jE(r))}),n}cu(e){this.Ya=e.Qs,this.Xa=He();const n=this.ru(e.documents);return this.applyChanges(n,!0)}lu(){return Mo.fromInitialDocuments(this.query,this.tu,this.mutatedKeys,this.Za===0,this.hasCachedResults)}}const Eg="SyncEngine";class nR{constructor(e,n,r){this.query=e,this.targetId=n,this.view=r}}class rR{constructor(e){this.key=e,this.hu=!1}}class iR{constructor(e,n,r,i,s,o){this.localStore=e,this.remoteStore=n,this.eventManager=r,this.sharedClientState=i,this.currentUser=s,this.maxConcurrentLimboResolutions=o,this.Pu={},this.Tu=new Vs(a=>Zb(a),Id),this.Iu=new Map,this.Eu=new Set,this.du=new yt(xe.comparator),this.Au=new Map,this.Ru=new ug,this.Vu={},this.mu=new Map,this.fu=Lo.cr(),this.onlineState="Unknown",this.gu=void 0}get isPrimaryClient(){return this.gu===!0}}async function sR(t,e,n=!0){const r=zE(t);let i;const s=r.Tu.get(e);return s?(r.sharedClientState.addLocalQueryTarget(s.targetId),i=s.view.lu()):i=await LE(r,e,n,!0),i}async function oR(t,e){const n=zE(t);await LE(n,e,!0,!1)}async function LE(t,e,n,r){const i=await SP(t.localStore,Tr(e)),s=i.targetId,o=t.sharedClientState.addLocalQueryTarget(s,n);let a;return r&&(a=await aR(t,e,s,o==="current",i.resumeToken)),t.isPrimaryClient&&n&&CE(t.remoteStore,i),a}async function aR(t,e,n,r,i){t.pu=(h,p,g)=>async function(S,P,v,x){let E=P.view.ru(v);E.Cs&&(E=await ex(S.localStore,P.query,!1).then(({documents:b})=>P.view.ru(b,E)));const O=x&&x.targetChanges.get(P.targetId),L=x&&x.targetMismatches.get(P.targetId)!=null,D=P.view.applyChanges(E,S.isPrimaryClient,O,L);return cx(S,P.targetId,D.au),D.snapshot}(t,h,p,g);const s=await ex(t.localStore,e,!0),o=new tR(e,s.Qs),a=o.ru(s.documents),u=jl.createSynthesizedTargetChangeForCurrentChange(n,r&&t.onlineState!=="Offline",i),c=o.applyChanges(a,t.isPrimaryClient,u);cx(t,n,c.au);const f=new nR(e,n,o);return t.Tu.set(e,f),t.Iu.has(n)?t.Iu.get(n).push(e):t.Iu.set(n,[e]),c.snapshot}async function lR(t,e,n){const r=Re(t),i=r.Tu.get(e),s=r.Iu.get(i.targetId);if(s.length>1)return r.Iu.set(i.targetId,s.filter(o=>!Id(o,e))),void r.Tu.delete(e);r.isPrimaryClient?(r.sharedClientState.removeLocalQueryTarget(i.targetId),r.sharedClientState.isActiveQueryTarget(i.targetId)||await Ip(r.localStore,i.targetId,!1).then(()=>{r.sharedClientState.clearQueryState(i.targetId),n&&fg(r.remoteStore,i.targetId),kp(r,i.targetId)}).catch($o)):(kp(r,i.targetId),await Ip(r.localStore,i.targetId,!0))}async function uR(t,e){const n=Re(t),r=n.Tu.get(e),i=n.Iu.get(r.targetId);n.isPrimaryClient&&i.length===1&&(n.sharedClientState.removeLocalQueryTarget(r.targetId),fg(n.remoteStore,r.targetId))}async function cR(t,e,n){const r=yR(t);try{const i=await function(o,a){const u=Re(o),c=Je.now(),f=a.reduce((g,_)=>g.add(_.key),He());let h,p;return u.persistence.runTransaction("Locally write mutations","readwrite",g=>{let _=ti(),S=He();return u.Ns.getEntries(g,f).next(P=>{_=P,_.forEach((v,x)=>{x.isValidDocument()||(S=S.add(v))})}).next(()=>u.localDocuments.getOverlayedDocuments(g,_)).next(P=>{h=P;const v=[];for(const x of a){const E=TA(x,h.get(x.key).overlayedDocument);E!=null&&v.push(new Zi(x.key,E,qb(E.value.mapValue),Yn.exists(!0)))}return u.mutationQueue.addMutationBatch(g,c,v,a)}).next(P=>{p=P;const v=P.applyToLocalDocumentSet(h,S);return u.documentOverlayCache.saveOverlays(g,P.batchId,v)})}).then(()=>({batchId:p.batchId,changes:nE(h)}))}(r.localStore,e);r.sharedClientState.addPendingMutation(i.batchId),function(o,a,u){let c=o.Vu[o.currentUser.toKey()];c||(c=new yt($e)),c=c.insert(a,u),o.Vu[o.currentUser.toKey()]=c}(r,i.batchId,n),await Ll(r,i.changes),await Pd(r.remoteStore)}catch(i){const s=vg(i,"Failed to persist write");n.reject(s)}}async function ME(t,e){const n=Re(t);try{const r=await EP(n.localStore,e);e.targetChanges.forEach((i,s)=>{const o=n.Au.get(s);o&&(Ze(i.addedDocuments.size+i.modifiedDocuments.size+i.removedDocuments.size<=1,22616),i.addedDocuments.size>0?o.hu=!0:i.modifiedDocuments.size>0?Ze(o.hu,14607):i.removedDocuments.size>0&&(Ze(o.hu,42227),o.hu=!1))}),await Ll(n,r,e)}catch(r){await $o(r)}}function ux(t,e,n){const r=Re(t);if(r.isPrimaryClient&&n===0||!r.isPrimaryClient&&n===1){const i=[];r.Tu.forEach((s,o)=>{const a=o.view.va(e);a.snapshot&&i.push(a.snapshot)}),function(o,a){const u=Re(o);u.onlineState=a;let c=!1;u.queries.forEach((f,h)=>{for(const p of h.Sa)p.va(a)&&(c=!0)}),c&&_g(u)}(r.eventManager,e),i.length&&r.Pu.H_(i),r.onlineState=e,r.isPrimaryClient&&r.sharedClientState.setOnlineState(e)}}async function dR(t,e,n){const r=Re(t);r.sharedClientState.updateQueryState(e,"rejected",n);const i=r.Au.get(e),s=i&&i.key;if(s){let o=new yt(xe.comparator);o=o.insert(s,ln.newNoDocument(s,Ne.min()));const a=He().add(s),u=new Cd(Ne.min(),new Map,new yt($e),o,a);await ME(r,u),r.du=r.du.remove(s),r.Au.delete(e),Ig(r)}else await Ip(r.localStore,e,!1).then(()=>kp(r,e,n)).catch($o)}async function hR(t,e){const n=Re(t),r=e.batch.batchId;try{const i=await bP(n.localStore,e);FE(n,r,null),VE(n,r),n.sharedClientState.updateMutationState(r,"acknowledged"),await Ll(n,i)}catch(i){await $o(i)}}async function fR(t,e,n){const r=Re(t);try{const i=await function(o,a){const u=Re(o);return u.persistence.runTransaction("Reject batch","readwrite-primary",c=>{let f;return u.mutationQueue.lookupMutationBatch(c,a).next(h=>(Ze(h!==null,37113),f=h.keys(),u.mutationQueue.removeMutationBatch(c,h))).next(()=>u.mutationQueue.performConsistencyCheck(c)).next(()=>u.documentOverlayCache.removeOverlaysForBatchId(c,f,a)).next(()=>u.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(c,f)).next(()=>u.localDocuments.getDocuments(c,f))})}(r.localStore,e);FE(r,e,n),VE(r,e),r.sharedClientState.updateMutationState(e,"rejected",n),await Ll(r,i)}catch(i){await $o(i)}}function VE(t,e){(t.mu.get(e)||[]).forEach(n=>{n.resolve()}),t.mu.delete(e)}function FE(t,e,n){const r=Re(t);let i=r.Vu[r.currentUser.toKey()];if(i){const s=i.get(e);s&&(n?s.reject(n):s.resolve(),i=i.remove(e)),r.Vu[r.currentUser.toKey()]=i}}function kp(t,e,n=null){t.sharedClientState.removeLocalQueryTarget(e);for(const r of t.Iu.get(e))t.Tu.delete(r),n&&t.Pu.yu(r,n);t.Iu.delete(e),t.isPrimaryClient&&t.Ru.jr(e).forEach(r=>{t.Ru.containsKey(r)||UE(t,r)})}function UE(t,e){t.Eu.delete(e.path.canonicalString());const n=t.du.get(e);n!==null&&(fg(t.remoteStore,n),t.du=t.du.remove(e),t.Au.delete(n),Ig(t))}function cx(t,e,n){for(const r of n)r instanceof jE?(t.Ru.addReference(r.key,e),pR(t,r)):r instanceof OE?(ue(Eg,"Document no longer in limbo: "+r.key),t.Ru.removeReference(r.key,e),t.Ru.containsKey(r.key)||UE(t,r.key)):Ee(19791,{wu:r})}function pR(t,e){const n=e.key,r=n.path.canonicalString();t.du.get(n)||t.Eu.has(r)||(ue(Eg,"New document in limbo: "+n),t.Eu.add(r),Ig(t))}function Ig(t){for(;t.Eu.size>0&&t.du.size{o.push(r.pu(u,e,n).then(c=>{var f;if((c||n)&&r.isPrimaryClient){const h=c?!c.fromCache:(f=n==null?void 0:n.targetChanges.get(u.targetId))==null?void 0:f.current;r.sharedClientState.updateQueryState(u.targetId,h?"current":"not-current")}if(c){i.push(c);const h=dg.As(u.targetId,c);s.push(h)}}))}),await Promise.all(o),r.Pu.H_(i),await async function(u,c){const f=Re(u);try{await f.persistence.runTransaction("notifyLocalViewChanges","readwrite",h=>G.forEach(c,p=>G.forEach(p.Es,g=>f.persistence.referenceDelegate.addReference(h,p.targetId,g)).next(()=>G.forEach(p.ds,g=>f.persistence.referenceDelegate.removeReference(h,p.targetId,g)))))}catch(h){if(!Ho(h))throw h;ue(hg,"Failed to update sequence numbers: "+h)}for(const h of c){const p=h.targetId;if(!h.fromCache){const g=f.Ms.get(p),_=g.snapshotVersion,S=g.withLastLimboFreeSnapshotVersion(_);f.Ms=f.Ms.insert(p,S)}}}(r.localStore,s))}async function mR(t,e){const n=Re(t);if(!n.currentUser.isEqual(e)){ue(Eg,"User change. New user:",e.toKey());const r=await IE(n.localStore,e);n.currentUser=e,function(s,o){s.mu.forEach(a=>{a.forEach(u=>{u.reject(new ae(W.CANCELLED,o))})}),s.mu.clear()}(n,"'waitForPendingWrites' promise is rejected due to a user change."),n.sharedClientState.handleUserChange(e,r.removedBatchIds,r.addedBatchIds),await Ll(n,r.Ls)}}function gR(t,e){const n=Re(t),r=n.Au.get(e);if(r&&r.hu)return He().add(r.key);{let i=He();const s=n.Iu.get(e);if(!s)return i;for(const o of s){const a=n.Tu.get(o);i=i.unionWith(a.view.nu)}return i}}function zE(t){const e=Re(t);return e.remoteStore.remoteSyncer.applyRemoteEvent=ME.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=gR.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=dR.bind(null,e),e.Pu.H_=ZP.bind(null,e.eventManager),e.Pu.yu=eR.bind(null,e.eventManager),e}function yR(t){const e=Re(t);return e.remoteStore.remoteSyncer.applySuccessfulWrite=hR.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=fR.bind(null,e),e}class Mc{constructor(){this.kind="memory",this.synchronizeTabs=!1}async initialize(e){this.serializer=Nd(e.databaseInfo.databaseId),this.sharedClientState=this.Du(e),this.persistence=this.Cu(e),await this.persistence.start(),this.localStore=this.vu(e),this.gcScheduler=this.Fu(e,this.localStore),this.indexBackfillerScheduler=this.Mu(e,this.localStore)}Fu(e,n){return null}Mu(e,n){return null}vu(e){return _P(this.persistence,new vP,e.initialUser,this.serializer)}Cu(e){return new EE(cg.mi,this.serializer)}Du(e){return new CP}async terminate(){var e,n;(e=this.gcScheduler)==null||e.stop(),(n=this.indexBackfillerScheduler)==null||n.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}}Mc.provider={build:()=>new Mc};class vR extends Mc{constructor(e){super(),this.cacheSizeBytes=e}Fu(e,n){Ze(this.persistence.referenceDelegate instanceof Oc,46915);const r=this.persistence.referenceDelegate.garbageCollector;return new rP(r,e.asyncQueue,n)}Cu(e){const n=this.cacheSizeBytes!==void 0?vn.withCacheSize(this.cacheSizeBytes):vn.DEFAULT;return new EE(r=>Oc.mi(r,n),this.serializer)}}class Cp{async initialize(e,n){this.localStore||(this.localStore=e.localStore,this.sharedClientState=e.sharedClientState,this.datastore=this.createDatastore(n),this.remoteStore=this.createRemoteStore(n),this.eventManager=this.createEventManager(n),this.syncEngine=this.createSyncEngine(n,!e.synchronizeTabs),this.sharedClientState.onlineStateHandler=r=>ux(this.syncEngine,r,1),this.remoteStore.remoteSyncer.handleCredentialChange=mR.bind(null,this.syncEngine),await YP(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return function(){return new JP}()}createDatastore(e){const n=Nd(e.databaseInfo.databaseId),r=function(s){return new DP(s)}(e.databaseInfo);return function(s,o,a,u){return new MP(s,o,a,u)}(e.authCredentials,e.appCheckCredentials,r,n)}createRemoteStore(e){return function(r,i,s,o,a){return new FP(r,i,s,o,a)}(this.localStore,this.datastore,e.asyncQueue,n=>ux(this.syncEngine,n,0),function(){return rx.v()?new rx:new NP}())}createSyncEngine(e,n){return function(i,s,o,a,u,c,f){const h=new iR(i,s,o,a,u,c);return f&&(h.gu=!0),h}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,n)}async terminate(){var e,n;await async function(i){const s=Re(i);ue(As,"RemoteStore shutting down."),s.Ea.add(5),await Ol(s),s.Aa.shutdown(),s.Ra.set("Unknown")}(this.remoteStore),(e=this.datastore)==null||e.terminate(),(n=this.eventManager)==null||n.terminate()}}Cp.provider={build:()=>new Cp};/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *//** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Tg{constructor(e){this.observer=e,this.muted=!1}next(e){this.muted||this.observer.next&&this.Ou(this.observer.next,e)}error(e){this.muted||(this.observer.error?this.Ou(this.observer.error,e):ei("Uncaught Error in snapshot listener:",e.toString()))}Nu(){this.muted=!0}Ou(e,n){setTimeout(()=>{this.muted||e(n)},0)}}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Ki="FirestoreClient";class xR{constructor(e,n,r,i,s){this.authCredentials=e,this.appCheckCredentials=n,this.asyncQueue=r,this.databaseInfo=i,this.user=on.UNAUTHENTICATED,this.clientId=Xm.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=s,this.authCredentials.start(r,async o=>{ue(Ki,"Received user=",o.uid),await this.authCredentialListener(o),this.user=o}),this.appCheckCredentials.start(r,o=>(ue(Ki,"Received new app check token=",o),this.appCheckCredentialListener(o,this.user)))}get configuration(){return{asyncQueue:this.asyncQueue,databaseInfo:this.databaseInfo,clientId:this.clientId,authCredentials:this.authCredentials,appCheckCredentials:this.appCheckCredentials,initialUser:this.user,maxConcurrentLimboResolutions:100}}setCredentialChangeListener(e){this.authCredentialListener=e}setAppCheckTokenChangeListener(e){this.appCheckCredentialListener=e}terminate(){this.asyncQueue.enterRestrictedMode();const e=new qr;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted(async()=>{try{this._onlineComponents&&await this._onlineComponents.terminate(),this._offlineComponents&&await this._offlineComponents.terminate(),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),e.resolve()}catch(n){const r=vg(n,"Failed to shutdown persistence");e.reject(r)}}),e.promise}}async function Wh(t,e){t.asyncQueue.verifyOperationInProgress(),ue(Ki,"Initializing OfflineComponentProvider");const n=t.configuration;await e.initialize(n);let r=n.initialUser;t.setCredentialChangeListener(async i=>{r.isEqual(i)||(await IE(e.localStore,i),r=i)}),e.persistence.setDatabaseDeletedListener(()=>t.terminate()),t._offlineComponents=e}async function dx(t,e){t.asyncQueue.verifyOperationInProgress();const n=await wR(t);ue(Ki,"Initializing OnlineComponentProvider"),await e.initialize(n,t.configuration),t.setCredentialChangeListener(r=>sx(e.remoteStore,r)),t.setAppCheckTokenChangeListener((r,i)=>sx(e.remoteStore,i)),t._onlineComponents=e}async function wR(t){if(!t._offlineComponents)if(t._uninitializedComponentsProvider){ue(Ki,"Using user provided OfflineComponentProvider");try{await Wh(t,t._uninitializedComponentsProvider._offline)}catch(e){const n=e;if(!function(i){return i.name==="FirebaseError"?i.code===W.FAILED_PRECONDITION||i.code===W.UNIMPLEMENTED:!(typeof DOMException<"u"&&i instanceof DOMException)||i.code===22||i.code===20||i.code===11}(n))throw n;Ao("Error using user provided cache. Falling back to memory cache: "+n),await Wh(t,new Mc)}}else ue(Ki,"Using default OfflineComponentProvider"),await Wh(t,new vR(void 0));return t._offlineComponents}async function BE(t){return t._onlineComponents||(t._uninitializedComponentsProvider?(ue(Ki,"Using user provided OnlineComponentProvider"),await dx(t,t._uninitializedComponentsProvider._online)):(ue(Ki,"Using default OnlineComponentProvider"),await dx(t,new Cp))),t._onlineComponents}function _R(t){return BE(t).then(e=>e.syncEngine)}async function Vc(t){const e=await BE(t),n=e.eventManager;return n.onListen=sR.bind(null,e.syncEngine),n.onUnlisten=lR.bind(null,e.syncEngine),n.onFirstRemoteStoreListen=oR.bind(null,e.syncEngine),n.onLastRemoteStoreUnlisten=uR.bind(null,e.syncEngine),n}function bR(t,e,n={}){const r=new qr;return t.asyncQueue.enqueueAndForget(async()=>function(s,o,a,u,c){const f=new Tg({next:p=>{f.Nu(),o.enqueueAndForget(()=>wg(s,h));const g=p.docs.has(a);!g&&p.fromCache?c.reject(new ae(W.UNAVAILABLE,"Failed to get document because the client is offline.")):g&&p.fromCache&&u&&u.source==="server"?c.reject(new ae(W.UNAVAILABLE,'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')):c.resolve(p)},error:p=>c.reject(p)}),h=new bg(Ed(a.path),f,{includeMetadataChanges:!0,qa:!0});return xg(s,h)}(await Vc(t),t.asyncQueue,e,n,r)),r.promise}function ER(t,e,n={}){const r=new qr;return t.asyncQueue.enqueueAndForget(async()=>function(s,o,a,u,c){const f=new Tg({next:p=>{f.Nu(),o.enqueueAndForget(()=>wg(s,h)),p.fromCache&&u.source==="server"?c.reject(new ae(W.UNAVAILABLE,'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')):c.resolve(p)},error:p=>c.reject(p)}),h=new bg(a,f,{includeMetadataChanges:!0,qa:!0});return xg(s,h)}(await Vc(t),t.asyncQueue,e,n,r)),r.promise}/** + * @license + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function $E(t){const e={};return t.timeoutSeconds!==void 0&&(e.timeoutSeconds=t.timeoutSeconds),e}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const hx=new Map;/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const HE="firestore.googleapis.com",fx=!0;class px{constructor(e){if(e.host===void 0){if(e.ssl!==void 0)throw new ae(W.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host=HE,this.ssl=fx}else this.host=e.host,this.ssl=e.ssl??fx;if(this.isUsingEmulator=e.emulatorOptions!==void 0,this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,this.localCache=e.localCache,e.cacheSizeBytes===void 0)this.cacheSizeBytes=bE;else{if(e.cacheSizeBytes!==-1&&e.cacheSizeBytes30)throw new ae(W.INVALID_ARGUMENT,`invalid long polling timeout: ${r.timeoutSeconds} (maximum allowed value is 30)`)}}(this.experimentalLongPollingOptions),this.useFetchStreams=!!e.useFetchStreams}isEqual(e){return this.host===e.host&&this.ssl===e.ssl&&this.credentials===e.credentials&&this.cacheSizeBytes===e.cacheSizeBytes&&this.experimentalForceLongPolling===e.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===e.experimentalAutoDetectLongPolling&&function(r,i){return r.timeoutSeconds===i.timeoutSeconds}(this.experimentalLongPollingOptions,e.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}}class Rd{constructor(e,n,r,i){this._authCredentials=e,this._appCheckCredentials=n,this._databaseId=r,this._app=i,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new px({}),this._settingsFrozen=!1,this._emulatorOptions={},this._terminateTask="notTerminated"}get app(){if(!this._app)throw new ae(W.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}get _initialized(){return this._settingsFrozen}get _terminated(){return this._terminateTask!=="notTerminated"}_setSettings(e){if(this._settingsFrozen)throw new ae(W.FAILED_PRECONDITION,"Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");this._settings=new px(e),this._emulatorOptions=e.emulatorOptions||{},e.credentials!==void 0&&(this._authCredentials=function(r){if(!r)return new AN;switch(r.type){case"firstParty":return new jN(r.sessionIndex||"0",r.iamToken||null,r.authTokenFactory||null);case"provider":return r.client;default:throw new ae(W.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}}(e.credentials))}_getSettings(){return this._settings}_getEmulatorOptions(){return this._emulatorOptions}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return this._terminateTask==="notTerminated"&&(this._terminateTask=this._terminate()),this._terminateTask}async _restart(){this._terminateTask==="notTerminated"?await this._terminate():this._terminateTask="notTerminated"}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(n){const r=hx.get(n);r&&(ue("ComponentProvider","Removing Datastore"),hx.delete(n),r.terminate())}(this),Promise.resolve()}}function IR(t,e,n,r={}){var c;t=Sn(t,Rd);const i=Ls(e),s=t._getSettings(),o={...s,emulatorOptions:t._getEmulatorOptions()},a=`${e}:${n}`;i&&(qm(`https://${a}`),Wm("Firestore",!0)),s.host!==HE&&s.host!==a&&Ao("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used.");const u={...s,host:a,ssl:i,emulatorOptions:r};if(!Jr(u,o)&&(t._setSettings(u),r.mockUserToken)){let f,h;if(typeof r.mockUserToken=="string")f=r.mockUserToken,h=on.MOCK_USER;else{f=wb(r.mockUserToken,(c=t._app)==null?void 0:c.options.projectId);const p=r.mockUserToken.sub||r.mockUserToken.user_id;if(!p)throw new ae(W.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");h=new on(p)}t._authCredentials=new PN(new Db(f,h))}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class es{constructor(e,n,r){this.converter=n,this._query=r,this.type="query",this.firestore=e}withConverter(e){return new es(this.firestore,e,this._query)}}class It{constructor(e,n,r){this.converter=n,this._key=r,this.type="document",this.firestore=e}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new Fi(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new It(this.firestore,e,this._key)}toJSON(){return{type:It._jsonSchemaVersion,referencePath:this._key.toString()}}static fromJSON(e,n,r){if(Rl(n,It._jsonSchema))return new It(e,r||null,new xe(st.fromString(n.referencePath)))}}It._jsonSchemaVersion="firestore/documentReference/1.0",It._jsonSchema={type:Rt("string",It._jsonSchemaVersion),referencePath:Rt("string")};class Fi extends es{constructor(e,n,r){super(e,n,Ed(r)),this._path=r,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const e=this._path.popLast();return e.isEmpty()?null:new It(this.firestore,null,new xe(e))}withConverter(e){return new Fi(this.firestore,e,this._path)}}function Xn(t,e,...n){if(t=Ft(t),jb("collection","path",e),t instanceof Rd){const r=st.fromString(e,...n);return kv(r),new Fi(t,null,r)}{if(!(t instanceof It||t instanceof Fi))throw new ae(W.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(st.fromString(e,...n));return kv(r),new Fi(t.firestore,null,r)}}function vt(t,e,...n){if(t=Ft(t),arguments.length===1&&(e=Xm.newId()),jb("doc","path",e),t instanceof Rd){const r=st.fromString(e,...n);return Sv(r),new It(t,null,new xe(r))}{if(!(t instanceof It||t instanceof Fi))throw new ae(W.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(st.fromString(e,...n));return Sv(r),new It(t.firestore,t instanceof Fi?t.converter:null,new xe(r))}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const mx="AsyncQueue";class gx{constructor(e=Promise.resolve()){this.Xu=[],this.ec=!1,this.tc=[],this.nc=null,this.rc=!1,this.sc=!1,this.oc=[],this.M_=new SE(this,"async_queue_retry"),this._c=()=>{const r=qh();r&&ue(mx,"Visibility state changed to "+r.visibilityState),this.M_.w_()},this.ac=e;const n=qh();n&&typeof n.addEventListener=="function"&&n.addEventListener("visibilitychange",this._c)}get isShuttingDown(){return this.ec}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.uc(),this.cc(e)}enterRestrictedMode(e){if(!this.ec){this.ec=!0,this.sc=e||!1;const n=qh();n&&typeof n.removeEventListener=="function"&&n.removeEventListener("visibilitychange",this._c)}}enqueue(e){if(this.uc(),this.ec)return new Promise(()=>{});const n=new qr;return this.cc(()=>this.ec&&this.sc?Promise.resolve():(e().then(n.resolve,n.reject),n.promise)).then(()=>n.promise)}enqueueRetryable(e){this.enqueueAndForget(()=>(this.Xu.push(e),this.lc()))}async lc(){if(this.Xu.length!==0){try{await this.Xu[0](),this.Xu.shift(),this.M_.reset()}catch(e){if(!Ho(e))throw e;ue(mx,"Operation failed with retryable error: "+e)}this.Xu.length>0&&this.M_.p_(()=>this.lc())}}cc(e){const n=this.ac.then(()=>(this.rc=!0,e().catch(r=>{throw this.nc=r,this.rc=!1,ei("INTERNAL UNHANDLED ERROR: ",yx(r)),r}).then(r=>(this.rc=!1,r))));return this.ac=n,n}enqueueAfterDelay(e,n,r){this.uc(),this.oc.indexOf(e)>-1&&(n=0);const i=yg.createAndSchedule(this,e,n,r,s=>this.hc(s));return this.tc.push(i),i}uc(){this.nc&&Ee(47125,{Pc:yx(this.nc)})}verifyOperationInProgress(){}async Tc(){let e;do e=this.ac,await e;while(e!==this.ac)}Ic(e){for(const n of this.tc)if(n.timerId===e)return!0;return!1}Ec(e){return this.Tc().then(()=>{this.tc.sort((n,r)=>n.targetTimeMs-r.targetTimeMs);for(const n of this.tc)if(n.skipDelay(),e!=="all"&&n.timerId===e)break;return this.Tc()})}dc(e){this.oc.push(e)}hc(e){const n=this.tc.indexOf(e);this.tc.splice(n,1)}}function yx(t){let e=t.message||"";return t.stack&&(e=t.stack.includes(t.message)?t.stack:t.message+` +`+t.stack),e}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function vx(t){return function(n,r){if(typeof n!="object"||n===null)return!1;const i=n;for(const s of r)if(s in i&&typeof i[s]=="function")return!0;return!1}(t,["next","error","complete"])}class ni extends Rd{constructor(e,n,r,i){super(e,n,r,i),this.type="firestore",this._queue=new gx,this._persistenceKey=(i==null?void 0:i.name)||"[DEFAULT]"}async _terminate(){if(this._firestoreClient){const e=this._firestoreClient.terminate();this._queue=new gx(e),this._firestoreClient=void 0,await e}}}function TR(t,e){const n=typeof t=="object"?t:Qm(),r=typeof t=="string"?t:Ac,i=vd(n,"firestore").getImmediate({identifier:r});if(!i._initialized){const s=yb("firestore");s&&IR(i,...s)}return i}function Dd(t){if(t._terminated)throw new ae(W.FAILED_PRECONDITION,"The client has already been terminated.");return t._firestoreClient||SR(t),t._firestoreClient}function SR(t){var r,i,s;const e=t._freezeSettings(),n=function(a,u,c,f){return new XN(a,u,c,f.host,f.ssl,f.experimentalForceLongPolling,f.experimentalAutoDetectLongPolling,$E(f.experimentalLongPollingOptions),f.useFetchStreams,f.isUsingEmulator)}(t._databaseId,((r=t._app)==null?void 0:r.options.appId)||"",t._persistenceKey,e);t._componentsProvider||(i=e.localCache)!=null&&i._offlineComponentProvider&&((s=e.localCache)!=null&&s._onlineComponentProvider)&&(t._componentsProvider={_offline:e.localCache._offlineComponentProvider,_online:e.localCache._onlineComponentProvider}),t._firestoreClient=new xR(t._authCredentials,t._appCheckCredentials,t._queue,n,t._componentsProvider&&function(a){const u=a==null?void 0:a._online.build();return{_offline:a==null?void 0:a._offline.build(u),_online:u}}(t._componentsProvider))}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Wn{constructor(e){this._byteString=e}static fromBase64String(e){try{return new Wn(en.fromBase64String(e))}catch(n){throw new ae(W.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+n)}}static fromUint8Array(e){return new Wn(en.fromUint8Array(e))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return"Bytes(base64: "+this.toBase64()+")"}isEqual(e){return this._byteString.isEqual(e._byteString)}toJSON(){return{type:Wn._jsonSchemaVersion,bytes:this.toBase64()}}static fromJSON(e){if(Rl(e,Wn._jsonSchema))return Wn.fromBase64String(e.bytes)}}Wn._jsonSchemaVersion="firestore/bytes/1.0",Wn._jsonSchema={type:Rt("string",Wn._jsonSchemaVersion),bytes:Rt("string")};/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class jd{constructor(...e){for(let n=0;n90)throw new ae(W.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(n)||n<-180||n>180)throw new ae(W.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+n);this._lat=e,this._long=n}get latitude(){return this._lat}get longitude(){return this._long}isEqual(e){return this._lat===e._lat&&this._long===e._long}_compareTo(e){return $e(this._lat,e._lat)||$e(this._long,e._long)}toJSON(){return{latitude:this._lat,longitude:this._long,type:kr._jsonSchemaVersion}}static fromJSON(e){if(Rl(e,kr._jsonSchema))return new kr(e.latitude,e.longitude)}}kr._jsonSchemaVersion="firestore/geoPoint/1.0",kr._jsonSchema={type:Rt("string",kr._jsonSchemaVersion),latitude:Rt("number"),longitude:Rt("number")};/** + * @license + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Cr{constructor(e){this._values=(e||[]).map(n=>n)}toArray(){return this._values.map(e=>e)}isEqual(e){return function(r,i){if(r.length!==i.length)return!1;for(let s=0;stypeof n=="number"))return new Cr(e.vectorValues);throw new ae(W.INVALID_ARGUMENT,"Expected 'vectorValues' field to be a number array")}}}Cr._jsonSchemaVersion="firestore/vectorValue/1.0",Cr._jsonSchema={type:Rt("string",Cr._jsonSchemaVersion),vectorValues:Rt("object")};/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const kR=/^__.*__$/;class CR{constructor(e,n,r){this.data=e,this.fieldMask=n,this.fieldTransforms=r}toMutation(e,n){return this.fieldMask!==null?new Zi(e,this.data,this.fieldMask,n,this.fieldTransforms):new Dl(e,this.data,n,this.fieldTransforms)}}class qE{constructor(e,n,r){this.data=e,this.fieldMask=n,this.fieldTransforms=r}toMutation(e,n){return new Zi(e,this.data,this.fieldMask,n,this.fieldTransforms)}}function WE(t){switch(t){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw Ee(40011,{Ac:t})}}class Od{constructor(e,n,r,i,s,o){this.settings=e,this.databaseId=n,this.serializer=r,this.ignoreUndefinedProperties=i,s===void 0&&this.Rc(),this.fieldTransforms=s||[],this.fieldMask=o||[]}get path(){return this.settings.path}get Ac(){return this.settings.Ac}Vc(e){return new Od({...this.settings,...e},this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}mc(e){var i;const n=(i=this.path)==null?void 0:i.child(e),r=this.Vc({path:n,fc:!1});return r.gc(e),r}yc(e){var i;const n=(i=this.path)==null?void 0:i.child(e),r=this.Vc({path:n,fc:!1});return r.Rc(),r}wc(e){return this.Vc({path:void 0,fc:!0})}Sc(e){return Fc(e,this.settings.methodName,this.settings.bc||!1,this.path,this.settings.Dc)}contains(e){return this.fieldMask.find(n=>e.isPrefixOf(n))!==void 0||this.fieldTransforms.find(n=>e.isPrefixOf(n.field))!==void 0}Rc(){if(this.path)for(let e=0;eu.covers(h.field))}else u=null,c=o.fieldTransforms;return new CR(new _n(a),u,c)}class Md extends Go{_toFieldTransform(e){if(e.Ac!==2)throw e.Ac===1?e.Sc(`${this._methodName}() can only appear at the top level of your update data`):e.Sc(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);return e.fieldMask.push(e.path),null}isEqual(e){return e instanceof Md}}function KE(t,e,n){return new Od({Ac:3,Dc:e.settings.Dc,methodName:t._methodName,fc:n},e.databaseId,e.serializer,e.ignoreUndefinedProperties)}class Sg extends Go{constructor(e,n){super(e),this.vc=n}_toFieldTransform(e){const n=KE(this,e,!0),r=this.vc.map(s=>Us(s,n)),i=new jo(r);return new ig(e.path,i)}isEqual(e){return e instanceof Sg&&Jr(this.vc,e.vc)}}class kg extends Go{constructor(e,n){super(e),this.vc=n}_toFieldTransform(e){const n=KE(this,e,!0),r=this.vc.map(s=>Us(s,n)),i=new Oo(r);return new ig(e.path,i)}isEqual(e){return e instanceof kg&&Jr(this.vc,e.vc)}}class Cg extends Go{constructor(e,n){super(e),this.Fc=n}_toFieldTransform(e){const n=new wl(e.serializer,sE(e.serializer,this.Fc));return new ig(e.path,n)}isEqual(e){return e instanceof Cg&&this.Fc===e.Fc}}function AR(t,e,n,r){const i=t.Cc(1,e,n);Ng("Data must be an object, but it was:",i,r);const s=[],o=_n.empty();Ji(r,(u,c)=>{const f=Ag(e,u,n);c=Ft(c);const h=i.yc(f);if(c instanceof Md)s.push(f);else{const p=Us(c,h);p!=null&&(s.push(f),o.set(f,p))}});const a=new On(s);return new qE(o,a,i.fieldTransforms)}function PR(t,e,n,r,i,s){const o=t.Cc(1,e,n),a=[Np(e,r,n)],u=[i];if(s.length%2!=0)throw new ae(W.INVALID_ARGUMENT,`Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);for(let p=0;p=0;--p)if(!XE(c,a[p])){const g=a[p];let _=u[p];_=Ft(_);const S=o.yc(g);if(_ instanceof Md)c.push(g);else{const P=Us(_,S);P!=null&&(c.push(g),f.set(g,P))}}const h=new On(c);return new qE(f,h,o.fieldTransforms)}function RR(t,e,n,r=!1){return Us(n,t.Cc(r?4:3,e))}function Us(t,e){if(YE(t=Ft(t)))return Ng("Unsupported field value:",e,t),QE(t,e);if(t instanceof Go)return function(r,i){if(!WE(i.Ac))throw i.Sc(`${r._methodName}() can only be used with update() and set()`);if(!i.path)throw i.Sc(`${r._methodName}() is not currently supported inside arrays`);const s=r._toFieldTransform(i);s&&i.fieldTransforms.push(s)}(t,e),null;if(t===void 0&&e.ignoreUndefinedProperties)return null;if(e.path&&e.fieldMask.push(e.path),t instanceof Array){if(e.settings.fc&&e.Ac!==4)throw e.Sc("Nested arrays are not supported");return function(r,i){const s=[];let o=0;for(const a of r){let u=Us(a,i.wc(o));u==null&&(u={nullValue:"NULL_VALUE"}),s.push(u),o++}return{arrayValue:{values:s}}}(t,e)}return function(r,i){if((r=Ft(r))===null)return{nullValue:"NULL_VALUE"};if(typeof r=="number")return sE(i.serializer,r);if(typeof r=="boolean")return{booleanValue:r};if(typeof r=="string")return{stringValue:r};if(r instanceof Date){const s=Je.fromDate(r);return{timestampValue:jc(i.serializer,s)}}if(r instanceof Je){const s=new Je(r.seconds,1e3*Math.floor(r.nanoseconds/1e3));return{timestampValue:jc(i.serializer,s)}}if(r instanceof kr)return{geoPointValue:{latitude:r.latitude,longitude:r.longitude}};if(r instanceof Wn)return{bytesValue:mE(i.serializer,r._byteString)};if(r instanceof It){const s=i.databaseId,o=r.firestore._databaseId;if(!o.isEqual(s))throw i.Sc(`Document reference is for database ${o.projectId}/${o.database} but should be for database ${s.projectId}/${s.database}`);return{referenceValue:lg(r.firestore._databaseId||i.databaseId,r._key.path)}}if(r instanceof Cr)return function(o,a){return{mapValue:{fields:{[$b]:{stringValue:Hb},[Pc]:{arrayValue:{values:o.toArray().map(c=>{if(typeof c!="number")throw a.Sc("VectorValues must only contain numeric values.");return rg(a.serializer,c)})}}}}}}(r,i);throw i.Sc(`Unsupported field value: ${xd(r)}`)}(t,e)}function QE(t,e){const n={};return Mb(t)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):Ji(t,(r,i)=>{const s=Us(i,e.mc(r));s!=null&&(n[r]=s)}),{mapValue:{fields:n}}}function YE(t){return!(typeof t!="object"||t===null||t instanceof Array||t instanceof Date||t instanceof Je||t instanceof kr||t instanceof Wn||t instanceof It||t instanceof Go||t instanceof Cr)}function Ng(t,e,n){if(!YE(n)||!Ob(n)){const r=xd(n);throw r==="an object"?e.Sc(t+" a custom object"):e.Sc(t+" "+r)}}function Np(t,e,n){if((e=Ft(e))instanceof jd)return e._internalPath;if(typeof e=="string")return Ag(t,e);throw Fc("Field path arguments must be of type string or ",t,!1,void 0,n)}const DR=new RegExp("[~\\*/\\[\\]]");function Ag(t,e,n){if(e.search(DR)>=0)throw Fc(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,t,!1,void 0,n);try{return new jd(...e.split("."))._internalPath}catch{throw Fc(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,t,!1,void 0,n)}}function Fc(t,e,n,r,i){const s=r&&!r.isEmpty(),o=i!==void 0;let a=`Function ${e}() called with invalid data`;n&&(a+=" (via `toFirestore()`)"),a+=". ";let u="";return(s||o)&&(u+=" (found",s&&(u+=` in field ${r}`),o&&(u+=` in document ${i}`),u+=")"),new ae(W.INVALID_ARGUMENT,a+t+u)}function XE(t,e){return t.some(n=>n.isEqual(e))}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class JE{constructor(e,n,r,i,s){this._firestore=e,this._userDataWriter=n,this._key=r,this._document=i,this._converter=s}get id(){return this._key.path.lastSegment()}get ref(){return new It(this._firestore,this._converter,this._key)}exists(){return this._document!==null}data(){if(this._document){if(this._converter){const e=new jR(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(e)}return this._userDataWriter.convertValue(this._document.data.value)}}get(e){if(this._document){const n=this._document.data.field(Vd("DocumentSnapshot.get",e));if(n!==null)return this._userDataWriter.convertValue(n)}}}class jR extends JE{data(){return super.data()}}function Vd(t,e){return typeof e=="string"?Ag(t,e):e instanceof jd?e._internalPath:e._delegate._internalPath}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function ZE(t){if(t.limitType==="L"&&t.explicitOrderBy.length===0)throw new ae(W.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class Pg{}class eI extends Pg{}function Ps(t,e,...n){let r=[];e instanceof Pg&&r.push(e),r=r.concat(n),function(s){const o=s.filter(u=>u instanceof Rg).length,a=s.filter(u=>u instanceof Fd).length;if(o>1||o>0&&a>0)throw new ae(W.INVALID_ARGUMENT,"InvalidQuery. When using composite filters, you cannot use more than one filter at the top level. Consider nesting the multiple filters within an `and(...)` statement. For example: change `query(query, where(...), or(...))` to `query(query, and(where(...), or(...)))`.")}(r);for(const i of r)t=i._apply(t);return t}class Fd extends eI{constructor(e,n,r){super(),this._field=e,this._op=n,this._value=r,this.type="where"}static _create(e,n,r){return new Fd(e,n,r)}_apply(e){const n=this._parse(e);return tI(e._query,n),new es(e.firestore,e.converter,vp(e._query,n))}_parse(e){const n=Ld(e.firestore);return function(s,o,a,u,c,f,h){let p;if(c.isKeyField()){if(f==="array-contains"||f==="array-contains-any")throw new ae(W.INVALID_ARGUMENT,`Invalid Query. You can't perform '${f}' queries on documentId().`);if(f==="in"||f==="not-in"){wx(h,f);const _=[];for(const S of h)_.push(xx(u,s,S));p={arrayValue:{values:_}}}else p=xx(u,s,h)}else f!=="in"&&f!=="not-in"&&f!=="array-contains-any"||wx(h,f),p=RR(a,o,h,f==="in"||f==="not-in");return Pt.create(c,f,p)}(e._query,"where",n,e.firestore._databaseId,this._field,this._op,this._value)}}function Ko(t,e,n){const r=e,i=Vd("where",t);return Fd._create(i,r,n)}class Rg extends Pg{constructor(e,n){super(),this.type=e,this._queryConstraints=n}static _create(e,n){return new Rg(e,n)}_parse(e){const n=this._queryConstraints.map(r=>r._parse(e)).filter(r=>r.getFilters().length>0);return n.length===1?n[0]:dr.create(n,this._getOperator())}_apply(e){const n=this._parse(e);return n.getFilters().length===0?e:(function(i,s){let o=i;const a=s.getFlattenedFilters();for(const u of a)tI(o,u),o=vp(o,u)}(e._query,n),new es(e.firestore,e.converter,vp(e._query,n)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return this.type==="and"?"and":"or"}}class Dg extends eI{constructor(e,n){super(),this._field=e,this._direction=n,this.type="orderBy"}static _create(e,n){return new Dg(e,n)}_apply(e){const n=function(i,s,o){if(i.startAt!==null)throw new ae(W.INVALID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(i.endAt!==null)throw new ae(W.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");return new xl(s,o)}(e._query,this._field,this._direction);return new es(e.firestore,e.converter,function(i,s){const o=i.explicitOrderBy.concat([s]);return new qo(i.path,i.collectionGroup,o,i.filters.slice(),i.limit,i.limitType,i.startAt,i.endAt)}(e._query,n))}}function OR(t,e="asc"){const n=e,r=Vd("orderBy",t);return Dg._create(r,n)}function xx(t,e,n){if(typeof(n=Ft(n))=="string"){if(n==="")throw new ae(W.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!Jb(e)&&n.indexOf("/")!==-1)throw new ae(W.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);const r=e.path.child(st.fromString(n));if(!xe.isDocumentKey(r))throw new ae(W.INVALID_ARGUMENT,`Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${r}' is not because it has an odd number of segments (${r.length}).`);return Ov(t,new xe(r))}if(n instanceof It)return Ov(t,n._key);throw new ae(W.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${xd(n)}.`)}function wx(t,e){if(!Array.isArray(t)||t.length===0)throw new ae(W.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`)}function tI(t,e){const n=function(i,s){for(const o of i)for(const a of o.getFlattenedFilters())if(s.indexOf(a.op)>=0)return a.op;return null}(t.filters,function(i){switch(i){case"!=":return["!=","not-in"];case"array-contains-any":case"in":return["not-in"];case"not-in":return["array-contains-any","in","not-in","!="];default:return[]}}(e.op));if(n!==null)throw n===e.op?new ae(W.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}' filter.`):new ae(W.INVALID_ARGUMENT,`Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`)}class LR{convertValue(e,n="none"){switch(Wi(e)){case 0:return null;case 1:return e.booleanValue;case 2:return Tt(e.integerValue||e.doubleValue);case 3:return this.convertTimestamp(e.timestampValue);case 4:return this.convertServerTimestamp(e,n);case 5:return e.stringValue;case 6:return this.convertBytes(qi(e.bytesValue));case 7:return this.convertReference(e.referenceValue);case 8:return this.convertGeoPoint(e.geoPointValue);case 9:return this.convertArray(e.arrayValue,n);case 11:return this.convertObject(e.mapValue,n);case 10:return this.convertVectorValue(e.mapValue);default:throw Ee(62114,{value:e})}}convertObject(e,n){return this.convertObjectMap(e.fields,n)}convertObjectMap(e,n="none"){const r={};return Ji(e,(i,s)=>{r[i]=this.convertValue(s,n)}),r}convertVectorValue(e){var r,i,s;const n=(s=(i=(r=e.fields)==null?void 0:r[Pc].arrayValue)==null?void 0:i.values)==null?void 0:s.map(o=>Tt(o.doubleValue));return new Cr(n)}convertGeoPoint(e){return new kr(Tt(e.latitude),Tt(e.longitude))}convertArray(e,n){return(e.values||[]).map(r=>this.convertValue(r,n))}convertServerTimestamp(e,n){switch(n){case"previous":const r=bd(e);return r==null?null:this.convertValue(r,n);case"estimate":return this.convertTimestamp(gl(e));default:return null}}convertTimestamp(e){const n=Hi(e);return new Je(n.seconds,n.nanos)}convertDocumentKey(e,n){const r=st.fromString(e);Ze(_E(r),9688,{name:e});const i=new yl(r.get(1),r.get(3)),s=new xe(r.popFirst(5));return i.isEqual(n)||ei(`Document ${s} contains a document reference within a different database (${i.projectId}/${i.database}) which is not supported. It will be treated as a reference in the current database (${n.projectId}/${n.database}) instead.`),s}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function nI(t,e,n){let r;return r=t?t.toFirestore(e):e,r}class Na{constructor(e,n){this.hasPendingWrites=e,this.fromCache=n}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}class ws extends JE{constructor(e,n,r,i,s,o){super(e,n,r,i,o),this._firestore=e,this._firestoreImpl=e,this.metadata=s}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){const n=new Gu(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(n,e)}return this._userDataWriter.convertValue(this._document.data.value,e.serverTimestamps)}}get(e,n={}){if(this._document){const r=this._document.data.field(Vd("DocumentSnapshot.get",e));if(r!==null)return this._userDataWriter.convertValue(r,n.serverTimestamps)}}toJSON(){if(this.metadata.hasPendingWrites)throw new ae(W.FAILED_PRECONDITION,"DocumentSnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const e=this._document,n={};return n.type=ws._jsonSchemaVersion,n.bundle="",n.bundleSource="DocumentSnapshot",n.bundleName=this._key.toString(),!e||!e.isValidDocument()||!e.isFoundDocument()?n:(this._userDataWriter.convertObjectMap(e.data.value.mapValue.fields,"previous"),n.bundle=(this._firestore,this.ref.path,"NOT SUPPORTED"),n)}}ws._jsonSchemaVersion="firestore/documentSnapshot/1.0",ws._jsonSchema={type:Rt("string",ws._jsonSchemaVersion),bundleSource:Rt("string","DocumentSnapshot"),bundleName:Rt("string"),bundle:Rt("string")};class Gu extends ws{data(e={}){return super.data(e)}}class _s{constructor(e,n,r,i){this._firestore=e,this._userDataWriter=n,this._snapshot=i,this.metadata=new Na(i.hasPendingWrites,i.fromCache),this.query=r}get docs(){const e=[];return this.forEach(n=>e.push(n)),e}get size(){return this._snapshot.docs.size}get empty(){return this.size===0}forEach(e,n){this._snapshot.docs.forEach(r=>{e.call(n,new Gu(this._firestore,this._userDataWriter,r.key,r,new Na(this._snapshot.mutatedKeys.has(r.key),this._snapshot.fromCache),this.query.converter))})}docChanges(e={}){const n=!!e.includeMetadataChanges;if(n&&this._snapshot.excludesMetadataChanges)throw new ae(W.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===n||(this._cachedChanges=function(i,s){if(i._snapshot.oldDocs.isEmpty()){let o=0;return i._snapshot.docChanges.map(a=>{const u=new Gu(i._firestore,i._userDataWriter,a.doc.key,a.doc,new Na(i._snapshot.mutatedKeys.has(a.doc.key),i._snapshot.fromCache),i.query.converter);return a.doc,{type:"added",doc:u,oldIndex:-1,newIndex:o++}})}{let o=i._snapshot.oldDocs;return i._snapshot.docChanges.filter(a=>s||a.type!==3).map(a=>{const u=new Gu(i._firestore,i._userDataWriter,a.doc.key,a.doc,new Na(i._snapshot.mutatedKeys.has(a.doc.key),i._snapshot.fromCache),i.query.converter);let c=-1,f=-1;return a.type!==0&&(c=o.indexOf(a.doc.key),o=o.delete(a.doc.key)),a.type!==1&&(o=o.add(a.doc),f=o.indexOf(a.doc.key)),{type:MR(a.type),doc:u,oldIndex:c,newIndex:f}})}}(this,n),this._cachedChangesIncludeMetadataChanges=n),this._cachedChanges}toJSON(){if(this.metadata.hasPendingWrites)throw new ae(W.FAILED_PRECONDITION,"QuerySnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const e={};e.type=_s._jsonSchemaVersion,e.bundleSource="QuerySnapshot",e.bundleName=Xm.newId(),this._firestore._databaseId.database,this._firestore._databaseId.projectId;const n=[],r=[],i=[];return this.docs.forEach(s=>{s._document!==null&&(n.push(s._document),r.push(this._userDataWriter.convertObjectMap(s._document.data.value.mapValue.fields,"previous")),i.push(s.ref.path))}),e.bundle=(this._firestore,this.query._query,e.bundleName,"NOT SUPPORTED"),e}}function MR(t){switch(t){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return Ee(61501,{type:t})}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function hr(t){t=Sn(t,It);const e=Sn(t.firestore,ni);return bR(Dd(e),t._key).then(n=>rI(e,t,n))}_s._jsonSchemaVersion="firestore/querySnapshot/1.0",_s._jsonSchema={type:Rt("string",_s._jsonSchemaVersion),bundleSource:Rt("string","QuerySnapshot"),bundleName:Rt("string"),bundle:Rt("string")};class jg extends LR{constructor(e){super(),this.firestore=e}convertBytes(e){return new Wn(e)}convertReference(e){const n=this.convertDocumentKey(e,this.firestore._databaseId);return new It(this.firestore,null,n)}}function Wr(t){t=Sn(t,es);const e=Sn(t.firestore,ni),n=Dd(e),r=new jg(e);return ZE(t._query),ER(n,t._query).then(i=>new _s(e,r,t,i))}function Og(t,e,n){t=Sn(t,It);const r=Sn(t.firestore,ni),i=nI(t.converter,e);return Ud(r,[GE(Ld(r),"setDoc",t._key,i,t.converter!==null,n).toMutation(t._key,Yn.none())])}function si(t,e,n,...r){t=Sn(t,It);const i=Sn(t.firestore,ni),s=Ld(i);let o;return o=typeof(e=Ft(e))=="string"||e instanceof jd?PR(s,"updateDoc",t._key,e,n,r):AR(s,"updateDoc",t._key,e),Ud(i,[o.toMutation(t._key,Yn.exists(!0))])}function Ap(t){return Ud(Sn(t.firestore,ni),[new sg(t._key,Yn.none())])}function Lg(t,e){const n=Sn(t.firestore,ni),r=vt(t),i=nI(t.converter,e);return Ud(n,[GE(Ld(t.firestore),"addDoc",r._key,i,t.converter!==null,{}).toMutation(r._key,Yn.exists(!1))]).then(()=>r)}function Mg(t,...e){var u,c,f;t=Ft(t);let n={includeMetadataChanges:!1,source:"default"},r=0;typeof e[r]!="object"||vx(e[r])||(n=e[r++]);const i={includeMetadataChanges:n.includeMetadataChanges,source:n.source};if(vx(e[r])){const h=e[r];e[r]=(u=h.next)==null?void 0:u.bind(h),e[r+1]=(c=h.error)==null?void 0:c.bind(h),e[r+2]=(f=h.complete)==null?void 0:f.bind(h)}let s,o,a;if(t instanceof It)o=Sn(t.firestore,ni),a=Ed(t._key.path),s={next:h=>{e[r]&&e[r](rI(o,t,h))},error:e[r+1],complete:e[r+2]};else{const h=Sn(t,es);o=Sn(h.firestore,ni),a=h._query;const p=new jg(o);s={next:g=>{e[r]&&e[r](new _s(o,p,h,g))},error:e[r+1],complete:e[r+2]},ZE(t._query)}return function(p,g,_,S){const P=new Tg(S),v=new bg(g,P,_);return p.asyncQueue.enqueueAndForget(async()=>xg(await Vc(p),v)),()=>{P.Nu(),p.asyncQueue.enqueueAndForget(async()=>wg(await Vc(p),v))}}(Dd(o),a,i,s)}function Ud(t,e){return function(r,i){const s=new qr;return r.asyncQueue.enqueueAndForget(async()=>cR(await _R(r),i,s)),s.promise}(Dd(t),e)}function rI(t,e,n){const r=n.docs.get(e._key),i=new jg(t);return new ws(t,i,e._key,r,new Na(n.hasPendingWrites,n.fromCache),e.converter)}function VR(...t){return new Sg("arrayUnion",t)}function FR(...t){return new kg("arrayRemove",t)}function UR(t){return new Cg("increment",t)}(function(e,n=!0){(function(i){Bo=i})(Ms),Cs(new Bi("firestore",(r,{instanceIdentifier:i,options:s})=>{const o=r.getProvider("app").getImmediate(),a=new ni(new RN(r.getProvider("auth-internal")),new ON(o,r.getProvider("app-check-internal")),function(c,f){if(!Object.prototype.hasOwnProperty.apply(c.options,["projectId"]))throw new ae(W.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new yl(c.options.projectId,f)}(o,i),o);return s={useFetchStreams:n,...s},a._setSettings(s),a},"PUBLIC").setMultipleInstances(!0)),Ir(bv,Ev,e),Ir(bv,Ev,"esm2020")})();/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const iI="firebasestorage.googleapis.com",zR="storageBucket",BR=2*60*1e3,$R=10*60*1e3;/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class jr extends Dr{constructor(e,n,r=0){super(Gh(e),`Firebase Storage: ${n} (${Gh(e)})`),this.status_=r,this.customData={serverResponse:null},this._baseMessage=this.message,Object.setPrototypeOf(this,jr.prototype)}get status(){return this.status_}set status(e){this.status_=e}_codeEquals(e){return Gh(e)===this.code}get serverResponse(){return this.customData.serverResponse}set serverResponse(e){this.customData.serverResponse=e,this.customData.serverResponse?this.message=`${this._baseMessage} +${this.customData.serverResponse}`:this.message=this._baseMessage}}var Pr;(function(t){t.UNKNOWN="unknown",t.OBJECT_NOT_FOUND="object-not-found",t.BUCKET_NOT_FOUND="bucket-not-found",t.PROJECT_NOT_FOUND="project-not-found",t.QUOTA_EXCEEDED="quota-exceeded",t.UNAUTHENTICATED="unauthenticated",t.UNAUTHORIZED="unauthorized",t.UNAUTHORIZED_APP="unauthorized-app",t.RETRY_LIMIT_EXCEEDED="retry-limit-exceeded",t.INVALID_CHECKSUM="invalid-checksum",t.CANCELED="canceled",t.INVALID_EVENT_NAME="invalid-event-name",t.INVALID_URL="invalid-url",t.INVALID_DEFAULT_BUCKET="invalid-default-bucket",t.NO_DEFAULT_BUCKET="no-default-bucket",t.CANNOT_SLICE_BLOB="cannot-slice-blob",t.SERVER_FILE_WRONG_SIZE="server-file-wrong-size",t.NO_DOWNLOAD_URL="no-download-url",t.INVALID_ARGUMENT="invalid-argument",t.INVALID_ARGUMENT_COUNT="invalid-argument-count",t.APP_DELETED="app-deleted",t.INVALID_ROOT_OPERATION="invalid-root-operation",t.INVALID_FORMAT="invalid-format",t.INTERNAL_ERROR="internal-error",t.UNSUPPORTED_ENVIRONMENT="unsupported-environment"})(Pr||(Pr={}));function Gh(t){return"storage/"+t}function HR(){const t="An unknown error occurred, please check the error payload for server response.";return new jr(Pr.UNKNOWN,t)}function qR(){return new jr(Pr.RETRY_LIMIT_EXCEEDED,"Max retry time for operation exceeded, please try again.")}function WR(){return new jr(Pr.CANCELED,"User canceled the upload/download.")}function GR(t){return new jr(Pr.INVALID_URL,"Invalid URL '"+t+"'.")}function KR(t){return new jr(Pr.INVALID_DEFAULT_BUCKET,"Invalid default bucket '"+t+"'.")}function _x(t){return new jr(Pr.INVALID_ARGUMENT,t)}function sI(){return new jr(Pr.APP_DELETED,"The Firebase app was deleted.")}function QR(t){return new jr(Pr.INVALID_ROOT_OPERATION,"The operation '"+t+"' cannot be performed on a root reference, create a non-root reference using child, such as .child('file.png').")}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class sr{constructor(e,n){this.bucket=e,this.path_=n}get path(){return this.path_}get isRoot(){return this.path.length===0}fullServerUrl(){const e=encodeURIComponent;return"/b/"+e(this.bucket)+"/o/"+e(this.path)}bucketOnlyServerUrl(){return"/b/"+encodeURIComponent(this.bucket)+"/o"}static makeFromBucketSpec(e,n){let r;try{r=sr.makeFromUrl(e,n)}catch{return new sr(e,"")}if(r.path==="")return r;throw KR(e)}static makeFromUrl(e,n){let r=null;const i="([A-Za-z0-9.\\-_]+)";function s(O){O.path.charAt(O.path.length-1)==="/"&&(O.path_=O.path_.slice(0,-1))}const o="(/(.*))?$",a=new RegExp("^gs://"+i+o,"i"),u={bucket:1,path:3};function c(O){O.path_=decodeURIComponent(O.path)}const f="v[A-Za-z0-9_]+",h=n.replace(/[.]/g,"\\."),p="(/([^?#]*).*)?$",g=new RegExp(`^https?://${h}/${f}/b/${i}/o${p}`,"i"),_={bucket:1,path:3},S=n===iI?"(?:storage.googleapis.com|storage.cloud.google.com)":n,P="([^?#]*)",v=new RegExp(`^https?://${S}/${i}/${P}`,"i"),E=[{regex:a,indices:u,postModify:s},{regex:g,indices:_,postModify:c},{regex:v,indices:{bucket:1,path:2},postModify:c}];for(let O=0;O{i=null,t(g,u())},P)}function p(){s&&clearTimeout(s)}function g(P,...v){if(c){p();return}if(P){p(),f.call(null,P,...v);return}if(u()||o){p(),f.call(null,P,...v);return}r<64&&(r*=2);let E;a===1?(a=2,E=0):E=(r+Math.random())*1e3,h(E)}let _=!1;function S(P){_||(_=!0,p(),!c&&(i!==null?(P||(a=2),clearTimeout(i),h(0)):P||(a=1)))}return h(0),s=setTimeout(()=>{o=!0,S(!0)},n),S}function JR(t){t(!1)}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function ZR(t){return t!==void 0}function bx(t,e,n,r){if(rn)throw _x(`Invalid value for '${t}'. Expected ${n} or less.`)}function e4(t){const e=encodeURIComponent;let n="?";for(const r in t)if(t.hasOwnProperty(r)){const i=e(r)+"="+e(t[r]);n=n+i+"&"}return n=n.slice(0,-1),n}var Uc;(function(t){t[t.NO_ERROR=0]="NO_ERROR",t[t.NETWORK_ERROR=1]="NETWORK_ERROR",t[t.ABORT=2]="ABORT"})(Uc||(Uc={}));/** + * @license + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function t4(t,e){const n=t>=500&&t<600,i=[408,429].indexOf(t)!==-1,s=e.indexOf(t)!==-1;return n||i||s}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class n4{constructor(e,n,r,i,s,o,a,u,c,f,h,p=!0,g=!1){this.url_=e,this.method_=n,this.headers_=r,this.body_=i,this.successCodes_=s,this.additionalRetryCodes_=o,this.callback_=a,this.errorCallback_=u,this.timeout_=c,this.progressCallback_=f,this.connectionFactory_=h,this.retry=p,this.isUsingEmulator=g,this.pendingConnection_=null,this.backoffId_=null,this.canceled_=!1,this.appDelete_=!1,this.promise_=new Promise((_,S)=>{this.resolve_=_,this.reject_=S,this.start_()})}start_(){const e=(r,i)=>{if(i){r(!1,new Eu(!1,null,!0));return}const s=this.connectionFactory_();this.pendingConnection_=s;const o=a=>{const u=a.loaded,c=a.lengthComputable?a.total:-1;this.progressCallback_!==null&&this.progressCallback_(u,c)};this.progressCallback_!==null&&s.addUploadProgressListener(o),s.send(this.url_,this.method_,this.isUsingEmulator,this.body_,this.headers_).then(()=>{this.progressCallback_!==null&&s.removeUploadProgressListener(o),this.pendingConnection_=null;const a=s.getErrorCode()===Uc.NO_ERROR,u=s.getStatus();if(!a||t4(u,this.additionalRetryCodes_)&&this.retry){const f=s.getErrorCode()===Uc.ABORT;r(!1,new Eu(!1,null,f));return}const c=this.successCodes_.indexOf(u)!==-1;r(!0,new Eu(c,s))})},n=(r,i)=>{const s=this.resolve_,o=this.reject_,a=i.connection;if(i.wasSuccessCode)try{const u=this.callback_(a,a.getResponse());ZR(u)?s(u):s()}catch(u){o(u)}else if(a!==null){const u=HR();u.serverResponse=a.getErrorText(),this.errorCallback_?o(this.errorCallback_(a,u)):o(u)}else if(i.canceled){const u=this.appDelete_?sI():WR();o(u)}else{const u=qR();o(u)}};this.canceled_?n(!1,new Eu(!1,null,!0)):this.backoffId_=XR(e,n,this.timeout_)}getPromise(){return this.promise_}cancel(e){this.canceled_=!0,this.appDelete_=e||!1,this.backoffId_!==null&&JR(this.backoffId_),this.pendingConnection_!==null&&this.pendingConnection_.abort()}}class Eu{constructor(e,n,r){this.wasSuccessCode=e,this.connection=n,this.canceled=!!r}}function r4(t,e){e!==null&&e.length>0&&(t.Authorization="Firebase "+e)}function i4(t,e){t["X-Firebase-Storage-Version"]="webjs/"+(e??"AppManager")}function s4(t,e){e&&(t["X-Firebase-GMPID"]=e)}function o4(t,e){e!==null&&(t["X-Firebase-AppCheck"]=e)}function a4(t,e,n,r,i,s,o=!0,a=!1){const u=e4(t.urlParams),c=t.url+u,f=Object.assign({},t.headers);return s4(f,e),r4(f,n),i4(f,s),o4(f,r),new n4(c,t.method,f,t.body,t.successCodes,t.additionalRetryCodes,t.handler,t.errorHandler,t.timeout,t.progressCallback,i,o,a)}/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function l4(t){if(t.length===0)return null;const e=t.lastIndexOf("/");return e===-1?"":t.slice(0,e)}function u4(t){const e=t.lastIndexOf("/",t.length-2);return e===-1?t:t.slice(e+1)}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class zc{constructor(e,n){this._service=e,n instanceof sr?this._location=n:this._location=sr.makeFromUrl(n,e.host)}toString(){return"gs://"+this._location.bucket+"/"+this._location.path}_newRef(e,n){return new zc(e,n)}get root(){const e=new sr(this._location.bucket,"");return this._newRef(this._service,e)}get bucket(){return this._location.bucket}get fullPath(){return this._location.path}get name(){return u4(this._location.path)}get storage(){return this._service}get parent(){const e=l4(this._location.path);if(e===null)return null;const n=new sr(this._location.bucket,e);return new zc(this._service,n)}_throwIfRoot(e){if(this._location.path==="")throw QR(e)}}function Ex(t,e){const n=e==null?void 0:e[zR];return n==null?null:sr.makeFromBucketSpec(n,t)}function c4(t,e,n,r={}){t.host=`${e}:${n}`;const i=Ls(e);i&&(qm(`https://${t.host}/b`),Wm("Storage",!0)),t._isUsingEmulator=!0,t._protocol=i?"https":"http";const{mockUserToken:s}=r;s&&(t._overrideAuthToken=typeof s=="string"?s:wb(s,t.app.options.projectId))}class d4{constructor(e,n,r,i,s,o=!1){this.app=e,this._authProvider=n,this._appCheckProvider=r,this._url=i,this._firebaseVersion=s,this._isUsingEmulator=o,this._bucket=null,this._host=iI,this._protocol="https",this._appId=null,this._deleted=!1,this._maxOperationRetryTime=BR,this._maxUploadRetryTime=$R,this._requests=new Set,i!=null?this._bucket=sr.makeFromBucketSpec(i,this._host):this._bucket=Ex(this._host,this.app.options)}get host(){return this._host}set host(e){this._host=e,this._url!=null?this._bucket=sr.makeFromBucketSpec(this._url,e):this._bucket=Ex(e,this.app.options)}get maxUploadRetryTime(){return this._maxUploadRetryTime}set maxUploadRetryTime(e){bx("time",0,Number.POSITIVE_INFINITY,e),this._maxUploadRetryTime=e}get maxOperationRetryTime(){return this._maxOperationRetryTime}set maxOperationRetryTime(e){bx("time",0,Number.POSITIVE_INFINITY,e),this._maxOperationRetryTime=e}async _getAuthToken(){if(this._overrideAuthToken)return this._overrideAuthToken;const e=this._authProvider.getImmediate({optional:!0});if(e){const n=await e.getToken();if(n!==null)return n.accessToken}return null}async _getAppCheckToken(){if(wn(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const e=this._appCheckProvider.getImmediate({optional:!0});return e?(await e.getToken()).token:null}_delete(){return this._deleted||(this._deleted=!0,this._requests.forEach(e=>e.cancel()),this._requests.clear()),Promise.resolve()}_makeStorageReference(e){return new zc(this,e)}_makeRequest(e,n,r,i,s=!0){if(this._deleted)return new YR(sI());{const o=a4(e,this._appId,r,i,n,this._firebaseVersion,s,this._isUsingEmulator);return this._requests.add(o),o.getPromise().then(()=>this._requests.delete(o),()=>this._requests.delete(o)),o}}async makeRequestWithTokens(e,n){const[r,i]=await Promise.all([this._getAuthToken(),this._getAppCheckToken()]);return this._makeRequest(e,n,r,i).getPromise()}}const Ix="@firebase/storage",Tx="0.14.0";/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const oI="storage";function h4(t=Qm(),e){t=Ft(t);const r=vd(t,oI).getImmediate({identifier:e}),i=yb("storage");return i&&f4(r,...i),r}function f4(t,e,n,r={}){c4(t,e,n,r)}function p4(t,{instanceIdentifier:e}){const n=t.getProvider("app").getImmediate(),r=t.getProvider("auth-internal"),i=t.getProvider("app-check-internal");return new d4(n,r,i,e,Ms)}function m4(){Cs(new Bi(oI,p4,"PUBLIC").setMultipleInstances(!0)),Ir(Ix,Tx,""),Ir(Ix,Tx,"esm2020")}m4();function aI(){return{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}}const g4=aI,lI=new Al("auth","Firebase",aI());/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Bc=new Gm("@firebase/auth");function y4(t,...e){Bc.logLevel<=Be.WARN&&Bc.warn(`Auth (${Ms}): ${t}`,...e)}function Ku(t,...e){Bc.logLevel<=Be.ERROR&&Bc.error(`Auth (${Ms}): ${t}`,...e)}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function er(t,...e){throw Fg(t,...e)}function ur(t,...e){return Fg(t,...e)}function Vg(t,e,n){const r={...g4(),[e]:n};return new Al("auth","Firebase",r).create(e,{appName:t.name})}function Gr(t){return Vg(t,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function v4(t,e,n){const r=n;if(!(e instanceof r))throw r.name!==e.constructor.name&&er(t,"argument-error"),Vg(t,"argument-error",`Type of ${e.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`)}function Fg(t,...e){if(typeof t!="string"){const n=e[0],r=[...e.slice(1)];return r[0]&&(r[0].appName=t.name),t._errorFactory.create(n,...r)}return lI.create(t,...e)}function be(t,e,...n){if(!t)throw Fg(e,...n)}function Br(t){const e="INTERNAL ASSERTION FAILED: "+t;throw Ku(e),new Error(e)}function ri(t,e){t||Br(e)}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Pp(){var t;return typeof self<"u"&&((t=self.location)==null?void 0:t.href)||""}function x4(){return Sx()==="http:"||Sx()==="https:"}function Sx(){var t;return typeof self<"u"&&((t=self.location)==null?void 0:t.protocol)||null}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function w4(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(x4()||aC()||"connection"in navigator)?navigator.onLine:!0}function _4(){if(typeof navigator>"u")return null;const t=navigator;return t.languages&&t.languages[0]||t.language||null}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Ml{constructor(e,n){this.shortDelay=e,this.longDelay=n,ri(n>e,"Short delay should be less than long delay!"),this.isMobile=iC()||lC()}get(){return w4()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Ug(t,e){ri(t.emulator,"Emulator should always be set here");const{url:n}=t.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class uI{static initialize(e,n,r){this.fetchImpl=e,n&&(this.headersImpl=n),r&&(this.responseImpl=r)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;Br("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;Br("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;Br("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const b4={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const E4=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],I4=new Ml(3e4,6e4);function ts(t,e){return t.tenantId&&!e.tenantId?{...e,tenantId:t.tenantId}:e}async function ns(t,e,n,r,i={}){return cI(t,i,async()=>{let s={},o={};r&&(e==="GET"?o=r:s={body:JSON.stringify(r)});const a=Pl({key:t.config.apiKey,...o}).slice(1),u=await t._getAdditionalHeaders();u["Content-Type"]="application/json",t.languageCode&&(u["X-Firebase-Locale"]=t.languageCode);const c={method:e,headers:u,...s};return oC()||(c.referrerPolicy="no-referrer"),t.emulatorConfig&&Ls(t.emulatorConfig.host)&&(c.credentials="include"),uI.fetch()(await dI(t,t.config.apiHost,n,a),c)})}async function cI(t,e,n){t._canInitEmulator=!1;const r={...b4,...e};try{const i=new S4(t),s=await Promise.race([n(),i.promise]);i.clearNetworkTimeout();const o=await s.json();if("needConfirmation"in o)throw Iu(t,"account-exists-with-different-credential",o);if(s.ok&&!("errorMessage"in o))return o;{const a=s.ok?o.errorMessage:o.error.message,[u,c]=a.split(" : ");if(u==="FEDERATED_USER_ID_ALREADY_LINKED")throw Iu(t,"credential-already-in-use",o);if(u==="EMAIL_EXISTS")throw Iu(t,"email-already-in-use",o);if(u==="USER_DISABLED")throw Iu(t,"user-disabled",o);const f=r[u]||u.toLowerCase().replace(/[_\s]+/g,"-");if(c)throw Vg(t,f,c);er(t,f)}}catch(i){if(i instanceof Dr)throw i;er(t,"network-request-failed",{message:String(i)})}}async function Vl(t,e,n,r,i={}){const s=await ns(t,e,n,r,i);return"mfaPendingCredential"in s&&er(t,"multi-factor-auth-required",{_serverResponse:s}),s}async function dI(t,e,n,r){const i=`${e}${n}?${r}`,s=t,o=s.config.emulator?Ug(t.config,i):`${t.config.apiScheme}://${i}`;return E4.includes(n)&&(await s._persistenceManagerAvailable,s._getPersistenceType()==="COOKIE")?s._getPersistence()._getFinalTarget(o).toString():o}function T4(t){switch(t){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}class S4{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((n,r)=>{this.timer=setTimeout(()=>r(ur(this.auth,"network-request-failed")),I4.get())})}}function Iu(t,e,n){const r={appName:t.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const i=ur(t,e,r);return i.customData._tokenResponse=n,i}function kx(t){return t!==void 0&&t.enterprise!==void 0}class k4{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],e.recaptchaKey===void 0)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||this.recaptchaEnforcementState.length===0)return null;for(const n of this.recaptchaEnforcementState)if(n.provider&&n.provider===e)return T4(n.enforcementState);return null}isProviderEnabled(e){return this.getProviderEnforcementState(e)==="ENFORCE"||this.getProviderEnforcementState(e)==="AUDIT"}isAnyProviderEnabled(){return this.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")||this.isProviderEnabled("PHONE_PROVIDER")}}async function C4(t,e){return ns(t,"GET","/v2/recaptchaConfig",ts(t,e))}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function N4(t,e){return ns(t,"POST","/v1/accounts:delete",e)}async function $c(t,e){return ns(t,"POST","/v1/accounts:lookup",e)}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Ha(t){if(t)try{const e=new Date(Number(t));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function A4(t,e=!1){const n=Ft(t),r=await n.getIdToken(e),i=zg(r);be(i&&i.exp&&i.auth_time&&i.iat,n.auth,"internal-error");const s=typeof i.firebase=="object"?i.firebase:void 0,o=s==null?void 0:s.sign_in_provider;return{claims:i,token:r,authTime:Ha(Kh(i.auth_time)),issuedAtTime:Ha(Kh(i.iat)),expirationTime:Ha(Kh(i.exp)),signInProvider:o||null,signInSecondFactor:(s==null?void 0:s.sign_in_second_factor)||null}}function Kh(t){return Number(t)*1e3}function zg(t){const[e,n,r]=t.split(".");if(e===void 0||n===void 0||r===void 0)return Ku("JWT malformed, contained fewer than 3 sections"),null;try{const i=mb(n);return i?JSON.parse(i):(Ku("Failed to decode base64 JWT payload"),null)}catch(i){return Ku("Caught error parsing JWT payload as JSON",i==null?void 0:i.toString()),null}}function Cx(t){const e=zg(t);return be(e,"internal-error"),be(typeof e.exp<"u","internal-error"),be(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function _l(t,e,n=!1){if(n)return e;try{return await e}catch(r){throw r instanceof Dr&&P4(r)&&t.auth.currentUser===t&&await t.auth.signOut(),r}}function P4({code:t}){return t==="auth/user-disabled"||t==="auth/user-token-expired"}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class R4{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(e){if(e){const n=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),n}else{this.errorBackoff=3e4;const r=(this.user.stsTokenManager.expirationTime??0)-Date.now()-3e5;return Math.max(0,r)}}schedule(e=!1){if(!this.isRunning)return;const n=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},n)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){(e==null?void 0:e.code)==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Rp{constructor(e,n){this.createdAt=e,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=Ha(this.lastLoginAt),this.creationTime=Ha(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function Hc(t){var h;const e=t.auth,n=await t.getIdToken(),r=await _l(t,$c(e,{idToken:n}));be(r==null?void 0:r.users.length,e,"internal-error");const i=r.users[0];t._notifyReloadListener(i);const s=(h=i.providerUserInfo)!=null&&h.length?hI(i.providerUserInfo):[],o=j4(t.providerData,s),a=t.isAnonymous,u=!(t.email&&i.passwordHash)&&!(o!=null&&o.length),c=a?u:!1,f={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:o,metadata:new Rp(i.createdAt,i.lastLoginAt),isAnonymous:c};Object.assign(t,f)}async function D4(t){const e=Ft(t);await Hc(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function j4(t,e){return[...t.filter(r=>!e.some(i=>i.providerId===r.providerId)),...e]}function hI(t){return t.map(({providerId:e,...n})=>({providerId:e,uid:n.rawId||"",displayName:n.displayName||null,email:n.email||null,phoneNumber:n.phoneNumber||null,photoURL:n.photoUrl||null}))}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function O4(t,e){const n=await cI(t,{},async()=>{const r=Pl({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:i,apiKey:s}=t.config,o=await dI(t,i,"/v1/token",`key=${s}`),a=await t._getAdditionalHeaders();a["Content-Type"]="application/x-www-form-urlencoded";const u={method:"POST",headers:a,body:r};return t.emulatorConfig&&Ls(t.emulatorConfig.host)&&(u.credentials="include"),uI.fetch()(o,u)});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function L4(t,e){return ns(t,"POST","/v2/accounts:revokeToken",ts(t,e))}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class yo{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){be(e.idToken,"internal-error"),be(typeof e.idToken<"u","internal-error"),be(typeof e.refreshToken<"u","internal-error");const n="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):Cx(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,n)}updateFromIdToken(e){be(e.length!==0,"internal-error");const n=Cx(e);this.updateTokensAndExpiration(e,null,n)}async getToken(e,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(be(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(e,n){const{accessToken:r,refreshToken:i,expiresIn:s}=await O4(e,n);this.updateTokensAndExpiration(r,i,Number(s))}updateTokensAndExpiration(e,n,r){this.refreshToken=n||null,this.accessToken=e||null,this.expirationTime=Date.now()+r*1e3}static fromJSON(e,n){const{refreshToken:r,accessToken:i,expirationTime:s}=n,o=new yo;return r&&(be(typeof r=="string","internal-error",{appName:e}),o.refreshToken=r),i&&(be(typeof i=="string","internal-error",{appName:e}),o.accessToken=i),s&&(be(typeof s=="number","internal-error",{appName:e}),o.expirationTime=s),o}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new yo,this.toJSON())}_performRefresh(){return Br("not implemented")}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function pi(t,e){be(typeof t=="string"||typeof t>"u","internal-error",{appName:e})}class or{constructor({uid:e,auth:n,stsTokenManager:r,...i}){this.providerId="firebase",this.proactiveRefresh=new R4(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=n,this.stsTokenManager=r,this.accessToken=r.accessToken,this.displayName=i.displayName||null,this.email=i.email||null,this.emailVerified=i.emailVerified||!1,this.phoneNumber=i.phoneNumber||null,this.photoURL=i.photoURL||null,this.isAnonymous=i.isAnonymous||!1,this.tenantId=i.tenantId||null,this.providerData=i.providerData?[...i.providerData]:[],this.metadata=new Rp(i.createdAt||void 0,i.lastLoginAt||void 0)}async getIdToken(e){const n=await _l(this,this.stsTokenManager.getToken(this.auth,e));return be(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(e){return A4(this,e)}reload(){return D4(this)}_assign(e){this!==e&&(be(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(n=>({...n})),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){const n=new or({...this,auth:e,stsTokenManager:this.stsTokenManager._clone()});return n.metadata._copy(this.metadata),n}_onReload(e){be(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,n=!1){let r=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),r=!0),n&&await Hc(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(wn(this.auth.app))return Promise.reject(Gr(this.auth));const e=await this.getIdToken();return await _l(this,N4(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return{uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>({...e})),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId,...this.metadata.toJSON(),apiKey:this.auth.config.apiKey,appName:this.auth.name}}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,n){const r=n.displayName??void 0,i=n.email??void 0,s=n.phoneNumber??void 0,o=n.photoURL??void 0,a=n.tenantId??void 0,u=n._redirectEventId??void 0,c=n.createdAt??void 0,f=n.lastLoginAt??void 0,{uid:h,emailVerified:p,isAnonymous:g,providerData:_,stsTokenManager:S}=n;be(h&&S,e,"internal-error");const P=yo.fromJSON(this.name,S);be(typeof h=="string",e,"internal-error"),pi(r,e.name),pi(i,e.name),be(typeof p=="boolean",e,"internal-error"),be(typeof g=="boolean",e,"internal-error"),pi(s,e.name),pi(o,e.name),pi(a,e.name),pi(u,e.name),pi(c,e.name),pi(f,e.name);const v=new or({uid:h,auth:e,email:i,emailVerified:p,displayName:r,isAnonymous:g,photoURL:o,phoneNumber:s,tenantId:a,stsTokenManager:P,createdAt:c,lastLoginAt:f});return _&&Array.isArray(_)&&(v.providerData=_.map(x=>({...x}))),u&&(v._redirectEventId=u),v}static async _fromIdTokenResponse(e,n,r=!1){const i=new yo;i.updateFromServerResponse(n);const s=new or({uid:n.localId,auth:e,stsTokenManager:i,isAnonymous:r});return await Hc(s),s}static async _fromGetAccountInfoResponse(e,n,r){const i=n.users[0];be(i.localId!==void 0,"internal-error");const s=i.providerUserInfo!==void 0?hI(i.providerUserInfo):[],o=!(i.email&&i.passwordHash)&&!(s!=null&&s.length),a=new yo;a.updateFromIdToken(r);const u=new or({uid:i.localId,auth:e,stsTokenManager:a,isAnonymous:o}),c={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:s,metadata:new Rp(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash)&&!(s!=null&&s.length)};return Object.assign(u,c),u}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Nx=new Map;function $r(t){ri(t instanceof Function,"Expected a class definition");let e=Nx.get(t);return e?(ri(e instanceof t,"Instance stored in cache mismatched with class"),e):(e=new t,Nx.set(t,e),e)}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class fI{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,n){this.storage[e]=n}async _get(e){const n=this.storage[e];return n===void 0?null:n}async _remove(e){delete this.storage[e]}_addListener(e,n){}_removeListener(e,n){}}fI.type="NONE";const Ax=fI;/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Qu(t,e,n){return`firebase:${t}:${e}:${n}`}class vo{constructor(e,n,r){this.persistence=e,this.auth=n,this.userKey=r;const{config:i,name:s}=this.auth;this.fullUserKey=Qu(this.userKey,i.apiKey,s),this.fullPersistenceKey=Qu("persistence",i.apiKey,s),this.boundEventHandler=n._onStorageEvent.bind(n),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){const e=await this.persistence._get(this.fullUserKey);if(!e)return null;if(typeof e=="string"){const n=await $c(this.auth,{idToken:e}).catch(()=>{});return n?or._fromGetAccountInfoResponse(this.auth,n,e):null}return or._fromJSON(this.auth,e)}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;const n=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,n)return this.setCurrentUser(n)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,n,r="authUser"){if(!n.length)return new vo($r(Ax),e,r);const i=(await Promise.all(n.map(async c=>{if(await c._isAvailable())return c}))).filter(c=>c);let s=i[0]||$r(Ax);const o=Qu(r,e.config.apiKey,e.name);let a=null;for(const c of n)try{const f=await c._get(o);if(f){let h;if(typeof f=="string"){const p=await $c(e,{idToken:f}).catch(()=>{});if(!p)break;h=await or._fromGetAccountInfoResponse(e,p,f)}else h=or._fromJSON(e,f);c!==s&&(a=h),s=c;break}}catch{}const u=i.filter(c=>c._shouldAllowMigration);return!s._shouldAllowMigration||!u.length?new vo(s,e,r):(s=u[0],a&&await s._set(o,a.toJSON()),await Promise.all(n.map(async c=>{if(c!==s)try{await c._remove(o)}catch{}})),new vo(s,e,r))}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Px(t){const e=t.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(yI(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(pI(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(xI(e))return"Blackberry";if(wI(e))return"Webos";if(mI(e))return"Safari";if((e.includes("chrome/")||gI(e))&&!e.includes("edge/"))return"Chrome";if(vI(e))return"Android";{const n=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,r=t.match(n);if((r==null?void 0:r.length)===2)return r[1]}return"Other"}function pI(t=cn()){return/firefox\//i.test(t)}function mI(t=cn()){const e=t.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function gI(t=cn()){return/crios\//i.test(t)}function yI(t=cn()){return/iemobile/i.test(t)}function vI(t=cn()){return/android/i.test(t)}function xI(t=cn()){return/blackberry/i.test(t)}function wI(t=cn()){return/webos/i.test(t)}function Bg(t=cn()){return/iphone|ipad|ipod/i.test(t)||/macintosh/i.test(t)&&/mobile/i.test(t)}function M4(t=cn()){var e;return Bg(t)&&!!((e=window.navigator)!=null&&e.standalone)}function V4(){return uC()&&document.documentMode===10}function _I(t=cn()){return Bg(t)||vI(t)||wI(t)||xI(t)||/windows phone/i.test(t)||yI(t)}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function bI(t,e=[]){let n;switch(t){case"Browser":n=Px(cn());break;case"Worker":n=`${Px(cn())}-${t}`;break;default:n=t}const r=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${Ms}/${r}`}/** + * @license + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class F4{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,n){const r=s=>new Promise((o,a)=>{try{const u=e(s);o(u)}catch(u){a(u)}});r.onAbort=n,this.queue.push(r);const i=this.queue.length-1;return()=>{this.queue[i]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;const n=[];try{for(const r of this.queue)await r(e),r.onAbort&&n.push(r.onAbort)}catch(r){n.reverse();for(const i of n)try{i()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:r==null?void 0:r.message})}}}/** + * @license + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function U4(t,e={}){return ns(t,"GET","/v2/passwordPolicy",ts(t,e))}/** + * @license + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const z4=6;class B4{constructor(e){var r;const n=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=n.minPasswordLength??z4,n.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=n.maxPasswordLength),n.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=n.containsLowercaseCharacter),n.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=n.containsUppercaseCharacter),n.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=n.containsNumericCharacter),n.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=n.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=((r=e.allowedNonAlphanumericCharacters)==null?void 0:r.join(""))??"",this.forceUpgradeOnSignin=e.forceUpgradeOnSignin??!1,this.schemaVersion=e.schemaVersion}validatePassword(e){const n={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,n),this.validatePasswordCharacterOptions(e,n),n.isValid&&(n.isValid=n.meetsMinPasswordLength??!0),n.isValid&&(n.isValid=n.meetsMaxPasswordLength??!0),n.isValid&&(n.isValid=n.containsLowercaseLetter??!0),n.isValid&&(n.isValid=n.containsUppercaseLetter??!0),n.isValid&&(n.isValid=n.containsNumericCharacter??!0),n.isValid&&(n.isValid=n.containsNonAlphanumericCharacter??!0),n}validatePasswordLengthOptions(e,n){const r=this.customStrengthOptions.minPasswordLength,i=this.customStrengthOptions.maxPasswordLength;r&&(n.meetsMinPasswordLength=e.length>=r),i&&(n.meetsMaxPasswordLength=e.length<=i)}validatePasswordCharacterOptions(e,n){this.updatePasswordCharacterOptionsStatuses(n,!1,!1,!1,!1);let r;for(let i=0;i="a"&&r<="z",r>="A"&&r<="Z",r>="0"&&r<="9",this.allowedNonAlphanumericCharacters.includes(r))}updatePasswordCharacterOptionsStatuses(e,n,r,i,s){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=n)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=r)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=i)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=s))}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class $4{constructor(e,n,r,i){this.app=e,this.heartbeatServiceProvider=n,this.appCheckServiceProvider=r,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new Rx(this),this.idTokenSubscription=new Rx(this),this.beforeStateQueue=new F4(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=lI,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this._resolvePersistenceManagerAvailable=void 0,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=i.sdkClientVersion,this._persistenceManagerAvailable=new Promise(s=>this._resolvePersistenceManagerAvailable=s)}_initializeWithPersistence(e,n){return n&&(this._popupRedirectResolver=$r(n)),this._initializationPromise=this.queue(async()=>{var r,i,s;if(!this._deleted&&(this.persistenceManager=await vo.create(this,e),(r=this._resolvePersistenceManagerAvailable)==null||r.call(this),!this._deleted)){if((i=this._popupRedirectResolver)!=null&&i._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(n),this.lastNotifiedUid=((s=this.currentUser)==null?void 0:s.uid)||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const e=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!e)){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUserFromIdToken(e){try{const n=await $c(this,{idToken:e}),r=await or._fromGetAccountInfoResponse(this,n,e);await this.directlySetCurrentUser(r)}catch(n){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",n),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){var s;if(wn(this.app)){const o=this.app.settings.authIdToken;return o?new Promise(a=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(o).then(a,a))}):this.directlySetCurrentUser(null)}const n=await this.assertedPersistence.getCurrentUser();let r=n,i=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const o=(s=this.redirectUser)==null?void 0:s._redirectEventId,a=r==null?void 0:r._redirectEventId,u=await this.tryRedirectSignIn(e);(!o||o===a)&&(u!=null&&u.user)&&(r=u.user,i=!0)}if(!r)return this.directlySetCurrentUser(null);if(!r._redirectEventId){if(i)try{await this.beforeStateQueue.runMiddleware(r)}catch(o){r=n,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(o))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return be(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===r._redirectEventId?this.directlySetCurrentUser(r):this.reloadAndSetCurrentUserOrClear(r)}async tryRedirectSignIn(e){let n=null;try{n=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return n}async reloadAndSetCurrentUserOrClear(e){try{await Hc(e)}catch(n){if((n==null?void 0:n.code)!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=_4()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(wn(this.app))return Promise.reject(Gr(this));const n=e?Ft(e):null;return n&&be(n.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(n&&n._clone(this))}async _updateCurrentUser(e,n=!1){if(!this._deleted)return e&&be(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),n||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return wn(this.app)?Promise.reject(Gr(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return wn(this.app)?Promise.reject(Gr(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence($r(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();const n=this._getPasswordPolicyInternal();return n.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):n.validatePassword(e)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){const e=await U4(this),n=new B4(e);this.tenantId===null?this._projectPasswordPolicy=n:this._tenantPasswordPolicies[this.tenantId]=n}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(e){this._errorFactory=new Al("auth","Firebase",e())}onAuthStateChanged(e,n,r){return this.registerStateListener(this.authStateSubscription,e,n,r)}beforeAuthStateChanged(e,n){return this.beforeStateQueue.pushCallback(e,n)}onIdTokenChanged(e,n,r){return this.registerStateListener(this.idTokenSubscription,e,n,r)}authStateReady(){return new Promise((e,n)=>{if(this.currentUser)e();else{const r=this.onAuthStateChanged(()=>{r(),e()},n)}})}async revokeAccessToken(e){if(this.currentUser){const n=await this.currentUser.getIdToken(),r={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:n};this.tenantId!=null&&(r.tenantId=this.tenantId),await L4(this,r)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:(e=this._currentUser)==null?void 0:e.toJSON()}}async _setRedirectUser(e,n){const r=await this.getOrInitRedirectPersistenceManager(n);return e===null?r.removeCurrentUser():r.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){const n=e&&$r(e)||this._popupRedirectResolver;be(n,this,"argument-error"),this.redirectPersistenceManager=await vo.create(this,[$r(n._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var n,r;return this._isInitialized&&await this.queue(async()=>{}),((n=this._currentUser)==null?void 0:n._redirectEventId)===e?this._currentUser:((r=this.redirectUser)==null?void 0:r._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var n;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const e=((n=this.currentUser)==null?void 0:n.uid)??null;this.lastNotifiedUid!==e&&(this.lastNotifiedUid=e,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,n,r,i){if(this._deleted)return()=>{};const s=typeof n=="function"?n:n.next.bind(n);let o=!1;const a=this._isInitialized?Promise.resolve():this._initializationPromise;if(be(a,this,"internal-error"),a.then(()=>{o||s(this.currentUser)}),typeof n=="function"){const u=e.addObserver(n,r,i);return()=>{o=!0,u()}}else{const u=e.addObserver(n);return()=>{o=!0,u()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return be(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=bI(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var i;const e={"X-Client-Version":this.clientVersion};this.app.options.appId&&(e["X-Firebase-gmpid"]=this.app.options.appId);const n=await((i=this.heartbeatServiceProvider.getImmediate({optional:!0}))==null?void 0:i.getHeartbeatsHeader());n&&(e["X-Firebase-Client"]=n);const r=await this._getAppCheckToken();return r&&(e["X-Firebase-AppCheck"]=r),e}async _getAppCheckToken(){var n;if(wn(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const e=await((n=this.appCheckServiceProvider.getImmediate({optional:!0}))==null?void 0:n.getToken());return e!=null&&e.error&&y4(`Error while retrieving App Check token: ${e.error}`),e==null?void 0:e.token}}function rs(t){return Ft(t)}class Rx{constructor(e){this.auth=e,this.observer=null,this.addObserver=yC(n=>this.observer=n)}get next(){return be(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */let zd={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function H4(t){zd=t}function EI(t){return zd.loadJS(t)}function q4(){return zd.recaptchaEnterpriseScript}function W4(){return zd.gapiScript}function G4(t){return`__${t}${Math.floor(Math.random()*1e6)}`}class K4{constructor(){this.enterprise=new Q4}ready(e){e()}execute(e,n){return Promise.resolve("token")}render(e,n){return""}}class Q4{ready(e){e()}execute(e,n){return Promise.resolve("token")}render(e,n){return""}}const Y4="recaptcha-enterprise",II="NO_RECAPTCHA";class X4{constructor(e){this.type=Y4,this.auth=rs(e)}async verify(e="verify",n=!1){async function r(s){if(!n){if(s.tenantId==null&&s._agentRecaptchaConfig!=null)return s._agentRecaptchaConfig.siteKey;if(s.tenantId!=null&&s._tenantRecaptchaConfigs[s.tenantId]!==void 0)return s._tenantRecaptchaConfigs[s.tenantId].siteKey}return new Promise(async(o,a)=>{C4(s,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(u=>{if(u.recaptchaKey===void 0)a(new Error("recaptcha Enterprise site key undefined"));else{const c=new k4(u);return s.tenantId==null?s._agentRecaptchaConfig=c:s._tenantRecaptchaConfigs[s.tenantId]=c,o(c.siteKey)}}).catch(u=>{a(u)})})}function i(s,o,a){const u=window.grecaptcha;kx(u)?u.enterprise.ready(()=>{u.enterprise.execute(s,{action:e}).then(c=>{o(c)}).catch(()=>{o(II)})}):a(Error("No reCAPTCHA enterprise script loaded."))}return this.auth.settings.appVerificationDisabledForTesting?new K4().execute("siteKey",{action:"verify"}):new Promise((s,o)=>{r(this.auth).then(a=>{if(!n&&kx(window.grecaptcha))i(a,s,o);else{if(typeof window>"u"){o(new Error("RecaptchaVerifier is only supported in browser"));return}let u=q4();u.length!==0&&(u+=a),EI(u).then(()=>{i(a,s,o)}).catch(c=>{o(c)})}}).catch(a=>{o(a)})})}}async function Dx(t,e,n,r=!1,i=!1){const s=new X4(t);let o;if(i)o=II;else try{o=await s.verify(n)}catch{o=await s.verify(n,!0)}const a={...e};if(n==="mfaSmsEnrollment"||n==="mfaSmsSignIn"){if("phoneEnrollmentInfo"in a){const u=a.phoneEnrollmentInfo.phoneNumber,c=a.phoneEnrollmentInfo.recaptchaToken;Object.assign(a,{phoneEnrollmentInfo:{phoneNumber:u,recaptchaToken:c,captchaResponse:o,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}else if("phoneSignInInfo"in a){const u=a.phoneSignInInfo.recaptchaToken;Object.assign(a,{phoneSignInInfo:{recaptchaToken:u,captchaResponse:o,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}return a}return r?Object.assign(a,{captchaResp:o}):Object.assign(a,{captchaResponse:o}),Object.assign(a,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(a,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),a}async function Dp(t,e,n,r,i){var s;if((s=t._getRecaptchaConfig())!=null&&s.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){const o=await Dx(t,e,n,n==="getOobCode");return r(t,o)}else return r(t,e).catch(async o=>{if(o.code==="auth/missing-recaptcha-token"){console.log(`${n} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);const a=await Dx(t,e,n,n==="getOobCode");return r(t,a)}else return Promise.reject(o)})}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function J4(t,e){const n=vd(t,"auth");if(n.isInitialized()){const i=n.getImmediate(),s=n.getOptions();if(Jr(s,e??{}))return i;er(i,"already-initialized")}return n.initialize({options:e})}function Z4(t,e){const n=(e==null?void 0:e.persistence)||[],r=(Array.isArray(n)?n:[n]).map($r);e!=null&&e.errorMap&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(r,e==null?void 0:e.popupRedirectResolver)}function eD(t,e,n){const r=rs(t);be(/^https?:\/\//.test(e),r,"invalid-emulator-scheme");const i=!1,s=TI(e),{host:o,port:a}=tD(e),u=a===null?"":`:${a}`,c={url:`${s}//${o}${u}/`},f=Object.freeze({host:o,port:a,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:i})});if(!r._canInitEmulator){be(r.config.emulator&&r.emulatorConfig,r,"emulator-config-failed"),be(Jr(c,r.config.emulator)&&Jr(f,r.emulatorConfig),r,"emulator-config-failed");return}r.config.emulator=c,r.emulatorConfig=f,r.settings.appVerificationDisabledForTesting=!0,Ls(o)?(qm(`${s}//${o}${u}`),Wm("Auth",!0)):nD()}function TI(t){const e=t.indexOf(":");return e<0?"":t.substr(0,e+1)}function tD(t){const e=TI(t),n=/(\/\/)?([^?#/]+)/.exec(t.substr(e.length));if(!n)return{host:"",port:null};const r=n[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(r);if(i){const s=i[1];return{host:s,port:jx(r.substr(s.length+1))}}else{const[s,o]=r.split(":");return{host:s,port:jx(o)}}}function jx(t){if(!t)return null;const e=Number(t);return isNaN(e)?null:e}function nD(){function t(){const e=document.createElement("p"),n=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",n.position="fixed",n.width="100%",n.backgroundColor="#ffffff",n.border=".1em solid #000000",n.color="#b50000",n.bottom="0px",n.left="0px",n.margin="0px",n.zIndex="10000",n.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",t):t())}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class $g{constructor(e,n){this.providerId=e,this.signInMethod=n}toJSON(){return Br("not implemented")}_getIdTokenResponse(e){return Br("not implemented")}_linkToIdToken(e,n){return Br("not implemented")}_getReauthenticationResolver(e){return Br("not implemented")}}async function rD(t,e){return ns(t,"POST","/v1/accounts:signUp",e)}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function iD(t,e){return Vl(t,"POST","/v1/accounts:signInWithPassword",ts(t,e))}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function sD(t,e){return Vl(t,"POST","/v1/accounts:signInWithEmailLink",ts(t,e))}async function oD(t,e){return Vl(t,"POST","/v1/accounts:signInWithEmailLink",ts(t,e))}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class bl extends $g{constructor(e,n,r,i=null){super("password",r),this._email=e,this._password=n,this._tenantId=i}static _fromEmailAndPassword(e,n){return new bl(e,n,"password")}static _fromEmailAndCode(e,n,r=null){return new bl(e,n,"emailLink",r)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){const n=typeof e=="string"?JSON.parse(e):e;if(n!=null&&n.email&&(n!=null&&n.password)){if(n.signInMethod==="password")return this._fromEmailAndPassword(n.email,n.password);if(n.signInMethod==="emailLink")return this._fromEmailAndCode(n.email,n.password,n.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":const n={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return Dp(e,n,"signInWithPassword",iD);case"emailLink":return sD(e,{email:this._email,oobCode:this._password});default:er(e,"internal-error")}}async _linkToIdToken(e,n){switch(this.signInMethod){case"password":const r={idToken:n,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return Dp(e,r,"signUpPassword",rD);case"emailLink":return oD(e,{idToken:n,email:this._email,oobCode:this._password});default:er(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function xo(t,e){return Vl(t,"POST","/v1/accounts:signInWithIdp",ts(t,e))}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const aD="http://localhost";class Rs extends $g{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const n=new Rs(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(n.idToken=e.idToken),e.accessToken&&(n.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(n.nonce=e.nonce),e.pendingToken&&(n.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(n.accessToken=e.oauthToken,n.secret=e.oauthTokenSecret):er("argument-error"),n}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){const n=typeof e=="string"?JSON.parse(e):e,{providerId:r,signInMethod:i,...s}=n;if(!r||!i)return null;const o=new Rs(r,i);return o.idToken=s.idToken||void 0,o.accessToken=s.accessToken||void 0,o.secret=s.secret,o.nonce=s.nonce,o.pendingToken=s.pendingToken||null,o}_getIdTokenResponse(e){const n=this.buildRequest();return xo(e,n)}_linkToIdToken(e,n){const r=this.buildRequest();return r.idToken=n,xo(e,r)}_getReauthenticationResolver(e){const n=this.buildRequest();return n.autoCreate=!1,xo(e,n)}buildRequest(){const e={requestUri:aD,returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{const n={};this.idToken&&(n.id_token=this.idToken),this.accessToken&&(n.access_token=this.accessToken),this.secret&&(n.oauth_token_secret=this.secret),n.providerId=this.providerId,this.nonce&&!this.pendingToken&&(n.nonce=this.nonce),e.postBody=Pl(n)}return e}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function lD(t){switch(t){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}function uD(t){const e=Ia(Ta(t)).link,n=e?Ia(Ta(e)).deep_link_id:null,r=Ia(Ta(t)).deep_link_id;return(r?Ia(Ta(r)).link:null)||r||n||e||t}class Hg{constructor(e){const n=Ia(Ta(e)),r=n.apiKey??null,i=n.oobCode??null,s=lD(n.mode??null);be(r&&i&&s,"argument-error"),this.apiKey=r,this.operation=s,this.code=i,this.continueUrl=n.continueUrl??null,this.languageCode=n.lang??null,this.tenantId=n.tenantId??null}static parseLink(e){const n=uD(e);try{return new Hg(n)}catch{return null}}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Qo{constructor(){this.providerId=Qo.PROVIDER_ID}static credential(e,n){return bl._fromEmailAndPassword(e,n)}static credentialWithLink(e,n){const r=Hg.parseLink(n);return be(r,"argument-error"),bl._fromEmailAndCode(e,r.code,r.tenantId)}}Qo.PROVIDER_ID="password";Qo.EMAIL_PASSWORD_SIGN_IN_METHOD="password";Qo.EMAIL_LINK_SIGN_IN_METHOD="emailLink";/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class qg{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Fl extends qg{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class _i extends Fl{constructor(){super("facebook.com")}static credential(e){return Rs._fromParams({providerId:_i.PROVIDER_ID,signInMethod:_i.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return _i.credentialFromTaggedObject(e)}static credentialFromError(e){return _i.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return _i.credential(e.oauthAccessToken)}catch{return null}}}_i.FACEBOOK_SIGN_IN_METHOD="facebook.com";_i.PROVIDER_ID="facebook.com";/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Vr extends Fl{constructor(){super("google.com"),this.addScope("profile")}static credential(e,n){return Rs._fromParams({providerId:Vr.PROVIDER_ID,signInMethod:Vr.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:n})}static credentialFromResult(e){return Vr.credentialFromTaggedObject(e)}static credentialFromError(e){return Vr.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:n,oauthAccessToken:r}=e;if(!n&&!r)return null;try{return Vr.credential(n,r)}catch{return null}}}Vr.GOOGLE_SIGN_IN_METHOD="google.com";Vr.PROVIDER_ID="google.com";/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class bi extends Fl{constructor(){super("github.com")}static credential(e){return Rs._fromParams({providerId:bi.PROVIDER_ID,signInMethod:bi.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return bi.credentialFromTaggedObject(e)}static credentialFromError(e){return bi.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return bi.credential(e.oauthAccessToken)}catch{return null}}}bi.GITHUB_SIGN_IN_METHOD="github.com";bi.PROVIDER_ID="github.com";/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Ei extends Fl{constructor(){super("twitter.com")}static credential(e,n){return Rs._fromParams({providerId:Ei.PROVIDER_ID,signInMethod:Ei.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:n})}static credentialFromResult(e){return Ei.credentialFromTaggedObject(e)}static credentialFromError(e){return Ei.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthAccessToken:n,oauthTokenSecret:r}=e;if(!n||!r)return null;try{return Ei.credential(n,r)}catch{return null}}}Ei.TWITTER_SIGN_IN_METHOD="twitter.com";Ei.PROVIDER_ID="twitter.com";/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function cD(t,e){return Vl(t,"POST","/v1/accounts:signUp",ts(t,e))}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Ds{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,n,r,i=!1){const s=await or._fromIdTokenResponse(e,r,i),o=Ox(r);return new Ds({user:s,providerId:o,_tokenResponse:r,operationType:n})}static async _forOperation(e,n,r){await e._updateTokensIfNecessary(r,!0);const i=Ox(r);return new Ds({user:e,providerId:i,_tokenResponse:r,operationType:n})}}function Ox(t){return t.providerId?t.providerId:"phoneNumber"in t?"phone":null}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class qc extends Dr{constructor(e,n,r,i){super(n.code,n.message),this.operationType=r,this.user=i,Object.setPrototypeOf(this,qc.prototype),this.customData={appName:e.name,tenantId:e.tenantId??void 0,_serverResponse:n.customData._serverResponse,operationType:r}}static _fromErrorAndOperation(e,n,r,i){return new qc(e,n,r,i)}}function SI(t,e,n,r){return(e==="reauthenticate"?n._getReauthenticationResolver(t):n._getIdTokenResponse(t)).catch(s=>{throw s.code==="auth/multi-factor-auth-required"?qc._fromErrorAndOperation(t,s,e,r):s})}async function dD(t,e,n=!1){const r=await _l(t,e._linkToIdToken(t.auth,await t.getIdToken()),n);return Ds._forOperation(t,"link",r)}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function hD(t,e,n=!1){const{auth:r}=t;if(wn(r.app))return Promise.reject(Gr(r));const i="reauthenticate";try{const s=await _l(t,SI(r,i,e,t),n);be(s.idToken,r,"internal-error");const o=zg(s.idToken);be(o,r,"internal-error");const{sub:a}=o;return be(t.uid===a,r,"user-mismatch"),Ds._forOperation(t,i,s)}catch(s){throw(s==null?void 0:s.code)==="auth/user-not-found"&&er(r,"user-mismatch"),s}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function kI(t,e,n=!1){if(wn(t.app))return Promise.reject(Gr(t));const r="signIn",i=await SI(t,r,e),s=await Ds._fromIdTokenResponse(t,r,i);return n||await t._updateCurrentUser(s.user),s}async function fD(t,e){return kI(rs(t),e)}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function CI(t){const e=rs(t);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}async function pD(t,e,n){if(wn(t.app))return Promise.reject(Gr(t));const r=rs(t),o=await Dp(r,{returnSecureToken:!0,email:e,password:n,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",cD).catch(u=>{throw u.code==="auth/password-does-not-meet-requirements"&&CI(t),u}),a=await Ds._fromIdTokenResponse(r,"signIn",o);return await r._updateCurrentUser(a.user),a}function mD(t,e,n){return wn(t.app)?Promise.reject(Gr(t)):fD(Ft(t),Qo.credential(e,n)).catch(async r=>{throw r.code==="auth/password-does-not-meet-requirements"&&CI(t),r})}function gD(t,e,n,r){return Ft(t).onIdTokenChanged(e,n,r)}function yD(t,e,n){return Ft(t).beforeAuthStateChanged(e,n)}function Tu(t){return Ft(t).signOut()}const Wc="__sak";/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class NI{constructor(e,n){this.storageRetriever=e,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(Wc,"1"),this.storage.removeItem(Wc),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,n){return this.storage.setItem(e,JSON.stringify(n)),Promise.resolve()}_get(e){const n=this.storage.getItem(e);return Promise.resolve(n?JSON.parse(n):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const vD=1e3,xD=10;class AI extends NI{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,n)=>this.onStorageEvent(e,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=_I(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(const n of Object.keys(this.listeners)){const r=this.storage.getItem(n),i=this.localCache[n];r!==i&&e(n,i,r)}}onStorageEvent(e,n=!1){if(!e.key){this.forAllChangedKeys((o,a,u)=>{this.notifyListeners(o,u)});return}const r=e.key;n?this.detachListener():this.stopPolling();const i=()=>{const o=this.storage.getItem(r);!n&&this.localCache[r]===o||this.notifyListeners(r,o)},s=this.storage.getItem(r);V4()&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(i,xD):i()}notifyListeners(e,n){this.localCache[e]=n;const r=this.listeners[e];if(r)for(const i of Array.from(r))i(n&&JSON.parse(n))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,n,r)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:n,newValue:r}),!0)})},vD)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,n){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(e,n){await super._set(e,n),this.localCache[e]=JSON.stringify(n)}async _get(e){const n=await super._get(e);return this.localCache[e]=JSON.stringify(n),n}async _remove(e){await super._remove(e),delete this.localCache[e]}}AI.type="LOCAL";const wD=AI;/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class PI extends NI{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,n){}_removeListener(e,n){}}PI.type="SESSION";const RI=PI;/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function _D(t){return Promise.all(t.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(n){return{fulfilled:!1,reason:n}}}))}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Bd{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){const n=this.receivers.find(i=>i.isListeningto(e));if(n)return n;const r=new Bd(e);return this.receivers.push(r),r}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const n=e,{eventId:r,eventType:i,data:s}=n.data,o=this.handlersMap[i];if(!(o!=null&&o.size))return;n.ports[0].postMessage({status:"ack",eventId:r,eventType:i});const a=Array.from(o).map(async c=>c(n.origin,s)),u=await _D(a);n.ports[0].postMessage({status:"done",eventId:r,eventType:i,response:u})}_subscribe(e,n){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(n)}_unsubscribe(e,n){this.handlersMap[e]&&n&&this.handlersMap[e].delete(n),(!n||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}Bd.receivers=[];/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Wg(t="",e=10){let n="";for(let r=0;r{const c=Wg("",20);i.port1.start();const f=setTimeout(()=>{u(new Error("unsupported_event"))},r);o={messageChannel:i,onMessage(h){const p=h;if(p.data.eventId===c)switch(p.data.status){case"ack":clearTimeout(f),s=setTimeout(()=>{u(new Error("timeout"))},3e3);break;case"done":clearTimeout(s),a(p.data.response);break;default:clearTimeout(f),clearTimeout(s),u(new Error("invalid_response"));break}}},this.handlers.add(o),i.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:c,data:n},[i.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Nr(){return window}function ED(t){Nr().location.href=t}/** + * @license + * Copyright 2020 Google LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function DI(){return typeof Nr().WorkerGlobalScope<"u"&&typeof Nr().importScripts=="function"}async function ID(){if(!(navigator!=null&&navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function TD(){var t;return((t=navigator==null?void 0:navigator.serviceWorker)==null?void 0:t.controller)||null}function SD(){return DI()?self:null}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const jI="firebaseLocalStorageDb",kD=1,Gc="firebaseLocalStorage",OI="fbase_key";class Ul{constructor(e){this.request=e}toPromise(){return new Promise((e,n)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{n(this.request.error)})})}}function $d(t,e){return t.transaction([Gc],e?"readwrite":"readonly").objectStore(Gc)}function CD(){const t=indexedDB.deleteDatabase(jI);return new Ul(t).toPromise()}function jp(){const t=indexedDB.open(jI,kD);return new Promise((e,n)=>{t.addEventListener("error",()=>{n(t.error)}),t.addEventListener("upgradeneeded",()=>{const r=t.result;try{r.createObjectStore(Gc,{keyPath:OI})}catch(i){n(i)}}),t.addEventListener("success",async()=>{const r=t.result;r.objectStoreNames.contains(Gc)?e(r):(r.close(),await CD(),e(await jp()))})})}async function Lx(t,e,n){const r=$d(t,!0).put({[OI]:e,value:n});return new Ul(r).toPromise()}async function ND(t,e){const n=$d(t,!1).get(e),r=await new Ul(n).toPromise();return r===void 0?null:r.value}function Mx(t,e){const n=$d(t,!0).delete(e);return new Ul(n).toPromise()}const AD=800,PD=3;class LI{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.db?this.db:(this.db=await jp(),this.db)}async _withRetries(e){let n=0;for(;;)try{const r=await this._openDb();return await e(r)}catch(r){if(n++>PD)throw r;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return DI()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Bd._getInstance(SD()),this.receiver._subscribe("keyChanged",async(e,n)=>({keyProcessed:(await this._poll()).includes(n.key)})),this.receiver._subscribe("ping",async(e,n)=>["keyChanged"])}async initializeSender(){var n,r;if(this.activeServiceWorker=await ID(),!this.activeServiceWorker)return;this.sender=new bD(this.activeServiceWorker);const e=await this.sender._send("ping",{},800);e&&(n=e[0])!=null&&n.fulfilled&&(r=e[0])!=null&&r.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||TD()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;const e=await jp();return await Lx(e,Wc,"1"),await Mx(e,Wc),!0}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,n){return this._withPendingWrite(async()=>(await this._withRetries(r=>Lx(r,e,n)),this.localCache[e]=n,this.notifyServiceWorker(e)))}async _get(e){const n=await this._withRetries(r=>ND(r,e));return this.localCache[e]=n,n}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(n=>Mx(n,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){const e=await this._withRetries(i=>{const s=$d(i,!1).getAll();return new Ul(s).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];const n=[],r=new Set;if(e.length!==0)for(const{fbase_key:i,value:s}of e)r.add(i),JSON.stringify(this.localCache[i])!==JSON.stringify(s)&&(this.notifyListeners(i,s),n.push(i));for(const i of Object.keys(this.localCache))this.localCache[i]&&!r.has(i)&&(this.notifyListeners(i,null),n.push(i));return n}notifyListeners(e,n){this.localCache[e]=n;const r=this.listeners[e];if(r)for(const i of Array.from(r))i(n)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),AD)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,n){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&this.stopPolling()}}LI.type="LOCAL";const RD=LI;new Ml(3e4,6e4);/** + * @license + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function MI(t,e){return e?$r(e):(be(t._popupRedirectResolver,t,"argument-error"),t._popupRedirectResolver)}/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class Gg extends $g{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return xo(e,this._buildIdpRequest())}_linkToIdToken(e,n){return xo(e,this._buildIdpRequest(n))}_getReauthenticationResolver(e){return xo(e,this._buildIdpRequest())}_buildIdpRequest(e){const n={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(n.idToken=e),n}}function DD(t){return kI(t.auth,new Gg(t),t.bypassAuthState)}function jD(t){const{auth:e,user:n}=t;return be(n,e,"internal-error"),hD(n,new Gg(t),t.bypassAuthState)}async function OD(t){const{auth:e,user:n}=t;return be(n,e,"internal-error"),dD(n,new Gg(t),t.bypassAuthState)}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class VI{constructor(e,n,r,i,s=!1){this.auth=e,this.resolver=r,this.user=i,this.bypassAuthState=s,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(n)?n:[n]}execute(){return new Promise(async(e,n)=>{this.pendingPromise={resolve:e,reject:n};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(r){this.reject(r)}})}async onAuthEvent(e){const{urlResponse:n,sessionId:r,postBody:i,tenantId:s,error:o,type:a}=e;if(o){this.reject(o);return}const u={auth:this.auth,requestUri:n,sessionId:r,tenantId:s||void 0,postBody:i||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(a)(u))}catch(c){this.reject(c)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return DD;case"linkViaPopup":case"linkViaRedirect":return OD;case"reauthViaPopup":case"reauthViaRedirect":return jD;default:er(this.auth,"internal-error")}}resolve(e){ri(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){ri(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const LD=new Ml(2e3,1e4);async function MD(t,e,n){if(wn(t.app))return Promise.reject(ur(t,"operation-not-supported-in-this-environment"));const r=rs(t);v4(t,e,qg);const i=MI(r,n);return new ys(r,"signInViaPopup",e,i).executeNotNull()}class ys extends VI{constructor(e,n,r,i,s){super(e,n,i,s),this.provider=r,this.authWindow=null,this.pollId=null,ys.currentPopupAction&&ys.currentPopupAction.cancel(),ys.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return be(e,this.auth,"internal-error"),e}async onExecution(){ri(this.filter.length===1,"Popup operations only handle one event");const e=Wg();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(n=>{this.reject(n)}),this.resolver._isIframeWebStorageSupported(this.auth,n=>{n||this.reject(ur(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return((e=this.authWindow)==null?void 0:e.associatedEvent)||null}cancel(){this.reject(ur(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,ys.currentPopupAction=null}pollUserCancellation(){const e=()=>{var n,r;if((r=(n=this.authWindow)==null?void 0:n.window)!=null&&r.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(ur(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,LD.get())};e()}}ys.currentPopupAction=null;/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const VD="pendingRedirect",Yu=new Map;class FD extends VI{constructor(e,n,r=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,r),this.eventId=null}async execute(){let e=Yu.get(this.auth._key());if(!e){try{const r=await UD(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(r)}catch(n){e=()=>Promise.reject(n)}Yu.set(this.auth._key(),e)}return this.bypassAuthState||Yu.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if(e.type==="signInViaRedirect")return super.onAuthEvent(e);if(e.type==="unknown"){this.resolve(null);return}if(e.eventId){const n=await this.auth._redirectUserForId(e.eventId);if(n)return this.user=n,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}}async function UD(t,e){const n=$D(e),r=BD(t);if(!await r._isAvailable())return!1;const i=await r._get(n)==="true";return await r._remove(n),i}function zD(t,e){Yu.set(t._key(),e)}function BD(t){return $r(t._redirectPersistence)}function $D(t){return Qu(VD,t.config.apiKey,t.name)}async function HD(t,e,n=!1){if(wn(t.app))return Promise.reject(Gr(t));const r=rs(t),i=MI(r,e),o=await new FD(r,i,n).execute();return o&&!n&&(delete o.user._redirectEventId,await r._persistUserIfCurrent(o.user),await r._setRedirectUser(null,e)),o}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const qD=10*60*1e3;class WD{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let n=!1;return this.consumers.forEach(r=>{this.isEventForConsumer(e,r)&&(n=!0,this.sendToConsumer(e,r),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!GD(e)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=e,n=!0)),n}sendToConsumer(e,n){var r;if(e.error&&!FI(e)){const i=((r=e.error.code)==null?void 0:r.split("auth/")[1])||"internal-error";n.onError(ur(this.auth,i))}else n.onAuthEvent(e)}isEventForConsumer(e,n){const r=n.eventId===null||!!e.eventId&&e.eventId===n.eventId;return n.filter.includes(e.type)&&r}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=qD&&this.cachedEventUids.clear(),this.cachedEventUids.has(Vx(e))}saveEventToCache(e){this.cachedEventUids.add(Vx(e)),this.lastProcessedEventTime=Date.now()}}function Vx(t){return[t.type,t.eventId,t.sessionId,t.tenantId].filter(e=>e).join("-")}function FI({type:t,error:e}){return t==="unknown"&&(e==null?void 0:e.code)==="auth/no-auth-event"}function GD(t){switch(t.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return FI(t);default:return!1}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */async function KD(t,e={}){return ns(t,"GET","/v1/projects",e)}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const QD=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,YD=/^https?/;async function XD(t){if(t.config.emulator)return;const{authorizedDomains:e}=await KD(t);for(const n of e)try{if(JD(n))return}catch{}er(t,"unauthorized-domain")}function JD(t){const e=Pp(),{protocol:n,hostname:r}=new URL(e);if(t.startsWith("chrome-extension://")){const o=new URL(t);return o.hostname===""&&r===""?n==="chrome-extension:"&&t.replace("chrome-extension://","")===e.replace("chrome-extension://",""):n==="chrome-extension:"&&o.hostname===r}if(!YD.test(n))return!1;if(QD.test(t))return r===t;const i=t.replace(/\./g,"\\.");return new RegExp("^(.+\\."+i+"|"+i+")$","i").test(r)}/** + * @license + * Copyright 2020 Google LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const ZD=new Ml(3e4,6e4);function Fx(){const t=Nr().___jsl;if(t!=null&&t.H){for(const e of Object.keys(t.H))if(t.H[e].r=t.H[e].r||[],t.H[e].L=t.H[e].L||[],t.H[e].r=[...t.H[e].L],t.CP)for(let n=0;n{var i,s,o;function r(){Fx(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Fx(),n(ur(t,"network-request-failed"))},timeout:ZD.get()})}if((s=(i=Nr().gapi)==null?void 0:i.iframes)!=null&&s.Iframe)e(gapi.iframes.getContext());else if((o=Nr().gapi)!=null&&o.load)r();else{const a=G4("iframefcb");return Nr()[a]=()=>{gapi.load?r():n(ur(t,"network-request-failed"))},EI(`${W4()}?onload=${a}`).catch(u=>n(u))}}).catch(e=>{throw Xu=null,e})}let Xu=null;function tj(t){return Xu=Xu||ej(t),Xu}/** + * @license + * Copyright 2020 Google LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const nj=new Ml(5e3,15e3),rj="__/auth/iframe",ij="emulator/auth/iframe",sj={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},oj=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function aj(t){const e=t.config;be(e.authDomain,t,"auth-domain-config-required");const n=e.emulator?Ug(e,ij):`https://${t.config.authDomain}/${rj}`,r={apiKey:e.apiKey,appName:t.name,v:Ms},i=oj.get(t.config.apiHost);i&&(r.eid=i);const s=t._getFrameworks();return s.length&&(r.fw=s.join(",")),`${n}?${Pl(r).slice(1)}`}async function lj(t){const e=await tj(t),n=Nr().gapi;return be(n,t,"internal-error"),e.open({where:document.body,url:aj(t),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:sj,dontclear:!0},r=>new Promise(async(i,s)=>{await r.restyle({setHideOnLeave:!1});const o=ur(t,"network-request-failed"),a=Nr().setTimeout(()=>{s(o)},nj.get());function u(){Nr().clearTimeout(a),i(r)}r.ping(u).then(u,()=>{s(o)})}))}/** + * @license + * Copyright 2020 Google LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const uj={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},cj=500,dj=600,hj="_blank",fj="http://localhost";class Ux{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function pj(t,e,n,r=cj,i=dj){const s=Math.max((window.screen.availHeight-i)/2,0).toString(),o=Math.max((window.screen.availWidth-r)/2,0).toString();let a="";const u={...uj,width:r.toString(),height:i.toString(),top:s,left:o},c=cn().toLowerCase();n&&(a=gI(c)?hj:n),pI(c)&&(e=e||fj,u.scrollbars="yes");const f=Object.entries(u).reduce((p,[g,_])=>`${p}${g}=${_},`,"");if(M4(c)&&a!=="_self")return mj(e||"",a),new Ux(null);const h=window.open(e||"",a,f);be(h,t,"popup-blocked");try{h.focus()}catch{}return new Ux(h)}function mj(t,e){const n=document.createElement("a");n.href=t,n.target=e;const r=document.createEvent("MouseEvent");r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(r)}/** + * @license + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const gj="__/auth/handler",yj="emulator/auth/handler",vj=encodeURIComponent("fac");async function zx(t,e,n,r,i,s){be(t.config.authDomain,t,"auth-domain-config-required"),be(t.config.apiKey,t,"invalid-api-key");const o={apiKey:t.config.apiKey,appName:t.name,authType:n,redirectUrl:r,v:Ms,eventId:i};if(e instanceof qg){e.setDefaultLanguage(t.languageCode),o.providerId=e.providerId||"",gC(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(const[f,h]of Object.entries({}))o[f]=h}if(e instanceof Fl){const f=e.getScopes().filter(h=>h!=="");f.length>0&&(o.scopes=f.join(","))}t.tenantId&&(o.tid=t.tenantId);const a=o;for(const f of Object.keys(a))a[f]===void 0&&delete a[f];const u=await t._getAppCheckToken(),c=u?`#${vj}=${encodeURIComponent(u)}`:"";return`${xj(t)}?${Pl(a).slice(1)}${c}`}function xj({config:t}){return t.emulator?Ug(t,yj):`https://${t.authDomain}/${gj}`}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Qh="webStorageSupport";class wj{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=RI,this._completeRedirectFn=HD,this._overrideRedirectResult=zD}async _openPopup(e,n,r,i){var o;ri((o=this.eventManagers[e._key()])==null?void 0:o.manager,"_initialize() not called before _openPopup()");const s=await zx(e,n,r,Pp(),i);return pj(e,s,Wg())}async _openRedirect(e,n,r,i){await this._originValidation(e);const s=await zx(e,n,r,Pp(),i);return ED(s),new Promise(()=>{})}_initialize(e){const n=e._key();if(this.eventManagers[n]){const{manager:i,promise:s}=this.eventManagers[n];return i?Promise.resolve(i):(ri(s,"If manager is not set, promise should be"),s)}const r=this.initAndGetManager(e);return this.eventManagers[n]={promise:r},r.catch(()=>{delete this.eventManagers[n]}),r}async initAndGetManager(e){const n=await lj(e),r=new WD(e);return n.register("authEvent",i=>(be(i==null?void 0:i.authEvent,e,"invalid-auth-event"),{status:r.onEvent(i.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:r},this.iframes[e._key()]=n,r}_isIframeWebStorageSupported(e,n){this.iframes[e._key()].send(Qh,{type:Qh},i=>{var o;const s=(o=i==null?void 0:i[0])==null?void 0:o[Qh];s!==void 0&&n(!!s),er(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const n=e._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=XD(e)),this.originValidationPromises[n]}get _shouldInitProactively(){return _I()||mI()||Bg()}}const _j=wj;var Bx="@firebase/auth",$x="1.11.1";/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */class bj{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),((e=this.auth.currentUser)==null?void 0:e.uid)||null}async getToken(e){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;const n=this.auth.onIdTokenChanged(r=>{e((r==null?void 0:r.stsTokenManager.accessToken)||null)});this.internalListeners.set(e,n),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();const n=this.internalListeners.get(e);n&&(this.internalListeners.delete(e),n(),this.updateProactiveRefresh())}assertAuthConfigured(){be(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */function Ej(t){switch(t){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function Ij(t){Cs(new Bi("auth",(e,{options:n})=>{const r=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),s=e.getProvider("app-check-internal"),{apiKey:o,authDomain:a}=r.options;be(o&&!o.includes(":"),"invalid-api-key",{appName:r.name});const u={apiKey:o,authDomain:a,clientPlatform:t,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:bI(t)},c=new $4(r,i,s,u);return Z4(c,n),c},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,n,r)=>{e.getProvider("auth-internal").initialize()})),Cs(new Bi("auth-internal",e=>{const n=rs(e.getProvider("auth").getImmediate());return(r=>new bj(r))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),Ir(Bx,$x,Ej(t)),Ir(Bx,$x,"esm2020")}/** + * @license + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */const Tj=5*60,Sj=xb("authIdTokenMaxAge")||Tj;let Hx=null;const kj=t=>async e=>{const n=e&&await e.getIdTokenResult(),r=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(r&&r>Sj)return;const i=n==null?void 0:n.token;Hx!==i&&(Hx=i,await fetch(t,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))};function Cj(t=Qm()){const e=vd(t,"auth");if(e.isInitialized())return e.getImmediate();const n=J4(t,{popupRedirectResolver:_j,persistence:[RD,wD,RI]}),r=xb("authTokenSyncURL");if(r&&typeof isSecureContext=="boolean"&&isSecureContext){const s=new URL(r,location.origin);if(location.origin===s.origin){const o=kj(s.toString());yD(n,o,()=>o(n.currentUser)),gD(n,a=>o(a))}}const i=gb("auth");return i&&eD(n,`http://${i}`),n}function Nj(){var t;return((t=document.getElementsByTagName("head"))==null?void 0:t[0])??document}H4({loadJS(t){return new Promise((e,n)=>{const r=document.createElement("script");r.setAttribute("src",t),r.onload=e,r.onerror=i=>{const s=ur("internal-error");s.customData=i,n(s)},r.type="text/javascript",r.charset="UTF-8",Nj().appendChild(r)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="});Ij("Browser");const Aj={apiKey:"AIzaSyAH3jvbe0_QLzIuuv5kTMK8246HNvohvfE",authDomain:"twistedbrody-9d163.firebaseapp.com",projectId:"twistedbrody-9d163",storageBucket:"twistedbrody-9d163.firebasestorage.app",messagingSenderId:"733213514129",appId:"1:733213514129:web:e9694684f5c3994ed06230",measurementId:"G-N8TQ7MY42W"},Kg=Eb(Aj),Ge=TR(Kg);h4(Kg);const mi=Cj(Kg),Pj=new Vr;function El(t){if(t!=null){if(Array.isArray(t)){const e=t.map(n=>El(n)).filter(n=>n!=null&&n!=="");return e.length>0?e:void 0}if(typeof t=="object"&&!(t instanceof Je)){const e={};for(const n in t)if(t.hasOwnProperty(n)){const r=El(t[n]);r!=null&&(e[n]=r)}return Object.keys(e).length>0?e:void 0}return t}}const zl={MANGA_PREFIX:"mangalib_detail_v2_"};function Hd(t,e){try{localStorage.setItem(t,JSON.stringify(e))}catch(n){console.warn(`Error saving ${t} to localStorage`,n)}}function Rj(t){try{localStorage.removeItem(t)}catch(e){console.warn(`Error removing ${t} from localStorage`,e)}}async function qd(){const t=Ps(Xn(Ge,"mangas"),OR("created_at","desc")),e=await Wr(t),r=(await Wr(Xn(Ge,"categories"))).docs.reduce((o,a)=>(o[a.id]={id:a.id,...a.data()},o),{}),i=await Promise.all(e.docs.map(async o=>{var a,u;try{const c=o.data();let f=new Date().toISOString();(a=c.created_at)!=null&&a.toDate?f=c.created_at.toDate().toISOString():c.created_at&&(f=new Date(c.created_at).toISOString());let h=f;(u=c.updated_at)!=null&&u.toDate&&(h=c.updated_at.toDate().toISOString());const p=Ps(Xn(Ge,"chapters"),Ko("manga_id","==",o.id)),_=(await Wr(p)).docs.map(v=>{var L,D;const x=v.data(),E=(L=x.created_at)!=null&&L.toDate?x.created_at.toDate().toISOString():new Date().toISOString(),O=(D=x.updated_at)!=null&&D.toDate?x.updated_at.toDate().toISOString():new Date().toISOString();return{id:v.id,manga_id:x.manga_id,number:x.number,title:x.title,pages:x.pages||[],page_formats:x.page_formats||[],original_pages:x.original_pages||[],created_at:E,updated_at:O}}).sort((v,x)=>v.number-x.number),P=(c.categories||[]).map(v=>r[v]).filter(v=>v!==void 0);return{id:o.id,...c,created_at:f,updated_at:h,categories:P,chapters:_}}catch(c){return console.error(`[DATA ERROR] Skipping corrupt manga ${o.id}:`,c),null}})),s=i.filter(o=>o!==null);return console.log(`[DATA] Loaded ${s.length} mangas (Skipped ${i.length-s.length} corrupt)`),s}const Vo=new Map;async function UI(t){var f,h;const e=vt(Ge,"mangas",t),n=await hr(e);if(!n.exists())return null;const r=n.data(),i=Ps(Xn(Ge,"chapters"),Ko("manga_id","==",t)),o=(await Wr(i)).docs.map(p=>{const g=p.data();return{id:p.id,manga_id:g.manga_id,number:g.number,title:g.title,pages:g.pages||[],page_formats:g.page_formats||[],original_pages:g.original_pages||[],created_at:g.created_at.toDate().toISOString(),updated_at:g.updated_at.toDate().toISOString()}}).sort((p,g)=>p.number-g.number),a=r.categories||[],u=[];for(const p of a){const g=vt(Ge,"categories",p),_=await hr(g);_.exists()&&u.push({id:_.id,..._.data(),created_at:((h=(f=_.data().created_at)==null?void 0:f.toDate)==null?void 0:h.call(f).toISOString())||new Date().toISOString()})}const c={id:n.id,...r,created_at:r.created_at.toDate().toISOString(),categories:u,chapters:o,updated_at:r.updated_at?r.updated_at.toDate().toISOString():r.created_at.toDate().toISOString()};return Vo.set(t,c),Hd(`${zl.MANGA_PREFIX}${t}`,c),c}function Dj(t,e){const n=vt(Ge,"mangas",t);return Mg(n,async r=>{if(!r.exists()){e(null);return}const i=r.data();let s=Vo.get(t),o=(s==null?void 0:s.chapters)||[],a=(s==null?void 0:s.categories)||[];if(!s){const c=Ps(Xn(Ge,"chapters"),Ko("manga_id","==",t));o=(await Wr(c)).docs.map(p=>({id:p.id,...p.data(),created_at:p.data().created_at.toDate().toISOString(),updated_at:p.data().updated_at.toDate().toISOString()})).sort((p,g)=>p.number-g.number);const h=i.categories||[];a=[];for(const p of h){const g=await hr(vt(Ge,"categories",p));g.exists()&&a.push({id:g.id,...g.data()})}}const u={id:r.id,...i,chapters:o,categories:a,created_at:i.created_at.toDate().toISOString(),updated_at:i.updated_at?i.updated_at.toDate().toISOString():i.created_at.toDate().toISOString()};Vo.set(t,u),Hd(`${zl.MANGA_PREFIX}${t}`,u),e(u)})}async function jj(t){const e=Je.now(),n={title:t.title,author:t.author,description:t.description||"",status:t.status||"En curso",categories:t.categoryIds||[],views:0,rating:0,created_at:e,updated_at:e};t.thumbnail_url&&(n.thumbnail_url=t.thumbnail_url),t.cover_url&&(n.cover_url=t.cover_url);const r=await Lg(Xn(Ge,"mangas"),n),i=new Date().toISOString(),s={id:r.id,title:t.title,author:t.author,description:t.description||"",status:t.status||"En curso",categories:t.categoryIds||[],chapters:[],views:0,rating:0,created_at:i,updated_at:i};return t.thumbnail_url&&(s.thumbnail_url=t.thumbnail_url),t.cover_url&&(s.cover_url=t.cover_url),Vo.set(s.id,s),Hd(`${zl.MANGA_PREFIX}${s.id}`,s),s}async function zI(){return(await Wr(Xn(Ge,"categories"))).docs.map(e=>({id:e.id,...e.data()}))}async function BI(t,e="genre"){const n=await Lg(Xn(Ge,"categories"),{name:t,type:e}),r=await hr(n);return{id:r.id,...r.data()}}async function $I(t){const e=vt(Ge,"categories",t);await Ap(e);const n=Ps(Xn(Ge,"mangas"),Ko("categories","array-contains",t)),i=(await Wr(n)).docs.map(s=>{const u=(s.data().categories||[]).filter(c=>c!==t);return si(vt(Ge,"mangas",s.id),{categories:u})});await Promise.all(i)}async function qx(t){const e=Je.now(),n=await Lg(Xn(Ge,"chapters"),{manga_id:t.manga_id,number:t.number,title:t.title,pages:t.pages,page_formats:t.page_formats||[],original_pages:t.original_pages||[],created_at:e,updated_at:e}),r=await hr(n),i=r.data();return{id:r.id,manga_id:i.manga_id,number:i.number,title:i.title,pages:i.pages||[],page_formats:i.page_formats||[],original_pages:i.original_pages||[],created_at:i.created_at.toDate().toISOString(),updated_at:i.updated_at.toDate().toISOString()}}async function Oj(){const e=(await qd()).map(n=>{const r=vt(Ge,"mangas",n.id);return si(r,{views:0})});await Promise.all(e)}async function Lj(t){const e=vt(Ge,"mangas",t);await si(e,{views:UR(1)})}async function HI(t,e){var _,S;const n=vt(Ge,"mangas",t),r=Je.now(),i={title:e.title,author:e.author,categories:e.categoryIds||[],updated_at:r};e.status&&(i.status=e.status),e.description!==void 0&&e.description!==null&&(i.description=e.description),e.thumbnail_url&&(i.thumbnail_url=e.thumbnail_url),e.cover_url&&(i.cover_url=e.cover_url);const s=El(i);await si(n,s);const o=await hr(n);if(!o.exists())throw new Error("Manga no encontrado");const a=o.data(),u=Ps(Xn(Ge,"chapters"),Ko("manga_id","==",t)),f=(await Wr(u)).docs.map(P=>{const v=P.data();return{id:P.id,manga_id:v.manga_id,number:v.number,title:v.title,pages:v.pages||[],page_formats:v.page_formats||[],original_pages:v.original_pages||[],created_at:v.created_at.toDate().toISOString(),updated_at:v.updated_at.toDate().toISOString()}}).sort((P,v)=>P.number-v.number),h=a.categories||[],p=[];for(const P of h){const v=vt(Ge,"categories",P),x=await hr(v);x.exists()&&p.push({id:x.id,...x.data(),created_at:((S=(_=x.data().created_at)==null?void 0:_.toDate)==null?void 0:S.call(_).toISOString())||new Date().toISOString()})}const g={id:o.id,...a,created_at:a.created_at.toDate().toISOString(),categories:p,chapters:f,updated_at:a.updated_at.toDate().toISOString()};return Vo.set(g.id,g),Hd(`${zl.MANGA_PREFIX}${g.id}`,g),g}async function Mj(t){const e=vt(Ge,"mangas",t),n=Ps(Xn(Ge,"chapters"),Ko("manga_id","==",t)),r=await Wr(n);for(const i of r.docs)await Ap(i.ref);await Ap(e),Vo.delete(t),Rj(`${zl.MANGA_PREFIX}${t}`)}async function Vj(t,e){const n=vt(Ge,"mangas",t),r=await hr(n);if(!r.exists())throw new Error("Manga no encontrado");const s={external_links:[...r.data().external_links||[],e]},o=El(s);await si(n,o)}async function Fj(t,e){const n=vt(Ge,"mangas",t),r=await hr(n);if(!r.exists())throw new Error("Manga no encontrado");const s={external_links:(r.data().external_links||[]).filter((a,u)=>u!==e)},o=El(s);await si(n,o)}async function Uj(t,e,n,r){const s=(await qd()).filter(o=>o.id!==t).map(o=>{var S,P;let a=0;const u=((S=o.categories)==null?void 0:S.map(v=>v.id))||[],c=e.filter(v=>u.includes(v));a+=c.length*10;const f=n.toLowerCase().split(/\s+/).filter(v=>v.length>2),h=o.title.toLowerCase().split(/\s+/).filter(v=>v.length>2),p=f.filter(v=>h.includes(v));a+=p.length*5;const g=((P=o.author)==null?void 0:P.toLowerCase().split(/\s+/).filter(v=>v.length>2))||[],_=f.filter(v=>g.includes(v));return a+=_.length*3,{manga:o,score:a}}).filter(o=>o.score>0).sort((o,a)=>{const u=o.manga.title.toLowerCase(),c=a.manga.title.toLowerCase();return u.localeCompare(c)}).map(o=>o.manga);return r?s.slice(0,r):s}function zj(t){if(typeof document>"u")return;let e=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",e.appendChild(n),n.styleSheet?n.styleSheet.cssText=t:n.appendChild(document.createTextNode(t))}const Bj=t=>{switch(t){case"success":return qj;case"info":return Gj;case"warning":return Wj;case"error":return Kj;default:return null}},$j=Array(12).fill(0),Hj=({visible:t,className:e})=>re.createElement("div",{className:["sonner-loading-wrapper",e].filter(Boolean).join(" "),"data-visible":t},re.createElement("div",{className:"sonner-spinner"},$j.map((n,r)=>re.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),qj=re.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},re.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),Wj=re.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},re.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),Gj=re.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},re.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),Kj=re.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},re.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),Qj=re.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},re.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),re.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),Yj=()=>{const[t,e]=re.useState(document.hidden);return re.useEffect(()=>{const n=()=>{e(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),t};let Op=1;class Xj{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{const n=this.subscribers.indexOf(e);this.subscribers.splice(n,1)}),this.publish=e=>{this.subscribers.forEach(n=>n(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var n;const{message:r,...i}=e,s=typeof(e==null?void 0:e.id)=="number"||((n=e.id)==null?void 0:n.length)>0?e.id:Op++,o=this.toasts.find(u=>u.id===s),a=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(s)&&this.dismissedToasts.delete(s),o?this.toasts=this.toasts.map(u=>u.id===s?(this.publish({...u,...e,id:s,title:r}),{...u,...e,id:s,dismissible:a,title:r}):u):this.addToast({title:r,...i,dismissible:a,id:s}),s},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(n=>n({id:e,dismiss:!0})))):this.toasts.forEach(n=>{this.subscribers.forEach(r=>r({id:n.id,dismiss:!0}))}),e),this.message=(e,n)=>this.create({...n,message:e}),this.error=(e,n)=>this.create({...n,message:e,type:"error"}),this.success=(e,n)=>this.create({...n,type:"success",message:e}),this.info=(e,n)=>this.create({...n,type:"info",message:e}),this.warning=(e,n)=>this.create({...n,type:"warning",message:e}),this.loading=(e,n)=>this.create({...n,type:"loading",message:e}),this.promise=(e,n)=>{if(!n)return;let r;n.loading!==void 0&&(r=this.create({...n,promise:e,type:"loading",message:n.loading,description:typeof n.description!="function"?n.description:void 0}));const i=Promise.resolve(e instanceof Function?e():e);let s=r!==void 0,o;const a=i.then(async c=>{if(o=["resolve",c],re.isValidElement(c))s=!1,this.create({id:r,type:"default",message:c});else if(Zj(c)&&!c.ok){s=!1;const h=typeof n.error=="function"?await n.error(`HTTP error! status: ${c.status}`):n.error,p=typeof n.description=="function"?await n.description(`HTTP error! status: ${c.status}`):n.description,_=typeof h=="object"&&!re.isValidElement(h)?h:{message:h};this.create({id:r,type:"error",description:p,..._})}else if(c instanceof Error){s=!1;const h=typeof n.error=="function"?await n.error(c):n.error,p=typeof n.description=="function"?await n.description(c):n.description,_=typeof h=="object"&&!re.isValidElement(h)?h:{message:h};this.create({id:r,type:"error",description:p,..._})}else if(n.success!==void 0){s=!1;const h=typeof n.success=="function"?await n.success(c):n.success,p=typeof n.description=="function"?await n.description(c):n.description,_=typeof h=="object"&&!re.isValidElement(h)?h:{message:h};this.create({id:r,type:"success",description:p,..._})}}).catch(async c=>{if(o=["reject",c],n.error!==void 0){s=!1;const f=typeof n.error=="function"?await n.error(c):n.error,h=typeof n.description=="function"?await n.description(c):n.description,g=typeof f=="object"&&!re.isValidElement(f)?f:{message:f};this.create({id:r,type:"error",description:h,...g})}}).finally(()=>{s&&(this.dismiss(r),r=void 0),n.finally==null||n.finally.call(n)}),u=()=>new Promise((c,f)=>a.then(()=>o[0]==="reject"?f(o[1]):c(o[1])).catch(f));return typeof r!="string"&&typeof r!="number"?{unwrap:u}:Object.assign(r,{unwrap:u})},this.custom=(e,n)=>{const r=(n==null?void 0:n.id)||Op++;return this.create({jsx:e(r),id:r,...n}),r},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const yn=new Xj,Jj=(t,e)=>{const n=(e==null?void 0:e.id)||Op++;return yn.addToast({title:t,...e,id:n}),n},Zj=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",e3=Jj,t3=()=>yn.toasts,n3=()=>yn.getActiveToasts(),Ct=Object.assign(e3,{success:yn.success,info:yn.info,warning:yn.warning,error:yn.error,custom:yn.custom,message:yn.message,promise:yn.promise,dismiss:yn.dismiss,loading:yn.loading},{getHistory:t3,getToasts:n3});zj("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function Su(t){return t.label!==void 0}const r3=3,i3="24px",s3="16px",Wx=4e3,o3=356,a3=14,l3=45,u3=200;function gr(...t){return t.filter(Boolean).join(" ")}function c3(t){const[e,n]=t.split("-"),r=[];return e&&r.push(e),n&&r.push(n),r}const d3=t=>{var e,n,r,i,s,o,a,u,c;const{invert:f,toast:h,unstyled:p,interacting:g,setHeights:_,visibleToasts:S,heights:P,index:v,toasts:x,expanded:E,removeToast:O,defaultRichColors:L,closeButton:D,style:b,cancelButtonStyle:w,actionButtonStyle:T,className:A="",descriptionClassName:N="",duration:j,position:C,gap:se,expandByDefault:he,classNames:le,icons:me,closeButtonAriaLabel:q="Close toast"}=t,[oe,k]=re.useState(null),[ge,ye]=re.useState(null),[R,$]=re.useState(!1),[Z,ie]=re.useState(!1),[Te,fe]=re.useState(!1),[Fe,ee]=re.useState(!1),[Ce,tt]=re.useState(!1),[Dt,jt]=re.useState(0),[te,ve]=re.useState(0),Ae=re.useRef(h.duration||j||Wx),Le=re.useRef(null),we=re.useRef(null),Qe=v===0,Ht=v+1<=S,Xe=h.type,ht=h.dismissible!==!1,tn=h.className||"",qt=h.descriptionClassName||"",z=re.useMemo(()=>P.findIndex(_e=>_e.toastId===h.id)||0,[P,h.id]),V=re.useMemo(()=>{var _e;return(_e=h.closeButton)!=null?_e:D},[h.closeButton,D]),B=re.useMemo(()=>h.duration||j||Wx,[h.duration,j]),K=re.useRef(0),J=re.useRef(0),je=re.useRef(0),Ue=re.useRef(null),[De,H]=C.split("-"),Q=re.useMemo(()=>P.reduce((_e,Pe,wt)=>wt>=z?_e:_e+Pe.height,0),[P,z]),de=Yj(),Ie=h.invert||f,pe=Xe==="loading";J.current=re.useMemo(()=>z*se+Q,[z,Q]),re.useEffect(()=>{Ae.current=B},[B]),re.useEffect(()=>{$(!0)},[]),re.useEffect(()=>{const _e=we.current;if(_e){const Pe=_e.getBoundingClientRect().height;return ve(Pe),_(wt=>[{toastId:h.id,height:Pe,position:h.position},...wt]),()=>_(wt=>wt.filter(Wt=>Wt.toastId!==h.id))}},[_,h.id]),re.useLayoutEffect(()=>{if(!R)return;const _e=we.current,Pe=_e.style.height;_e.style.height="auto";const wt=_e.getBoundingClientRect().height;_e.style.height=Pe,ve(wt),_(Wt=>Wt.find(_t=>_t.toastId===h.id)?Wt.map(_t=>_t.toastId===h.id?{..._t,height:wt}:_t):[{toastId:h.id,height:wt,position:h.position},...Wt])},[R,h.title,h.description,_,h.id,h.jsx,h.action,h.cancel]);const qe=re.useCallback(()=>{ie(!0),jt(J.current),_(_e=>_e.filter(Pe=>Pe.toastId!==h.id)),setTimeout(()=>{O(h)},u3)},[h,O,_,J]);re.useEffect(()=>{if(h.promise&&Xe==="loading"||h.duration===1/0||h.type==="loading")return;let _e;return E||g||de?(()=>{if(je.current{Ae.current!==1/0&&(K.current=new Date().getTime(),_e=setTimeout(()=>{h.onAutoClose==null||h.onAutoClose.call(h,h),qe()},Ae.current))})(),()=>clearTimeout(_e)},[E,g,h,Xe,de,qe]),re.useEffect(()=>{h.delete&&(qe(),h.onDismiss==null||h.onDismiss.call(h,h))},[qe,h.delete]);function nt(){var _e;if(me!=null&&me.loading){var Pe;return re.createElement("div",{className:gr(le==null?void 0:le.loader,h==null||(Pe=h.classNames)==null?void 0:Pe.loader,"sonner-loader"),"data-visible":Xe==="loading"},me.loading)}return re.createElement(Hj,{className:gr(le==null?void 0:le.loader,h==null||(_e=h.classNames)==null?void 0:_e.loader),visible:Xe==="loading"})}const ft=h.icon||(me==null?void 0:me[Xe])||Bj(Xe);var xt,Or;return re.createElement("li",{tabIndex:0,ref:we,className:gr(A,tn,le==null?void 0:le.toast,h==null||(e=h.classNames)==null?void 0:e.toast,le==null?void 0:le.default,le==null?void 0:le[Xe],h==null||(n=h.classNames)==null?void 0:n[Xe]),"data-sonner-toast":"","data-rich-colors":(xt=h.richColors)!=null?xt:L,"data-styled":!(h.jsx||h.unstyled||p),"data-mounted":R,"data-promise":!!h.promise,"data-swiped":Ce,"data-removed":Z,"data-visible":Ht,"data-y-position":De,"data-x-position":H,"data-index":v,"data-front":Qe,"data-swiping":Te,"data-dismissible":ht,"data-type":Xe,"data-invert":Ie,"data-swipe-out":Fe,"data-swipe-direction":ge,"data-expanded":!!(E||he&&R),"data-testid":h.testId,style:{"--index":v,"--toasts-before":v,"--z-index":x.length-v,"--offset":`${Z?Dt:J.current}px`,"--initial-height":he?"auto":`${te}px`,...b,...h.style},onDragEnd:()=>{fe(!1),k(null),Ue.current=null},onPointerDown:_e=>{_e.button!==2&&(pe||!ht||(Le.current=new Date,jt(J.current),_e.target.setPointerCapture(_e.pointerId),_e.target.tagName!=="BUTTON"&&(fe(!0),Ue.current={x:_e.clientX,y:_e.clientY})))},onPointerUp:()=>{var _e,Pe,wt;if(Fe||!ht)return;Ue.current=null;const Wt=Number(((_e=we.current)==null?void 0:_e.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Nn=Number(((Pe=we.current)==null?void 0:Pe.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),_t=new Date().getTime()-((wt=Le.current)==null?void 0:wt.getTime()),Gt=oe==="x"?Wt:Nn,Bn=Math.abs(Gt)/_t;if(Math.abs(Gt)>=l3||Bn>.11){jt(J.current),h.onDismiss==null||h.onDismiss.call(h,h),ye(oe==="x"?Wt>0?"right":"left":Nn>0?"down":"up"),qe(),ee(!0);return}else{var Kt,Me;(Kt=we.current)==null||Kt.style.setProperty("--swipe-amount-x","0px"),(Me=we.current)==null||Me.style.setProperty("--swipe-amount-y","0px")}tt(!1),fe(!1),k(null)},onPointerMove:_e=>{var Pe,wt,Wt;if(!Ue.current||!ht||((Pe=window.getSelection())==null?void 0:Pe.toString().length)>0)return;const _t=_e.clientY-Ue.current.y,Gt=_e.clientX-Ue.current.x;var Bn;const Kt=(Bn=t.swipeDirections)!=null?Bn:c3(C);!oe&&(Math.abs(Gt)>1||Math.abs(_t)>1)&&k(Math.abs(Gt)>Math.abs(_t)?"x":"y");let Me={x:0,y:0};const oi=An=>1/(1.5+Math.abs(An)/20);if(oe==="y"){if(Kt.includes("top")||Kt.includes("bottom"))if(Kt.includes("top")&&_t<0||Kt.includes("bottom")&&_t>0)Me.y=_t;else{const An=_t*oi(_t);Me.y=Math.abs(An)0)Me.x=Gt;else{const An=Gt*oi(Gt);Me.x=Math.abs(An)0||Math.abs(Me.y)>0)&&tt(!0),(wt=we.current)==null||wt.style.setProperty("--swipe-amount-x",`${Me.x}px`),(Wt=we.current)==null||Wt.style.setProperty("--swipe-amount-y",`${Me.y}px`)}},V&&!h.jsx&&Xe!=="loading"?re.createElement("button",{"aria-label":q,"data-disabled":pe,"data-close-button":!0,onClick:pe||!ht?()=>{}:()=>{qe(),h.onDismiss==null||h.onDismiss.call(h,h)},className:gr(le==null?void 0:le.closeButton,h==null||(r=h.classNames)==null?void 0:r.closeButton)},(Or=me==null?void 0:me.close)!=null?Or:Qj):null,(Xe||h.icon||h.promise)&&h.icon!==null&&((me==null?void 0:me[Xe])!==null||h.icon)?re.createElement("div",{"data-icon":"",className:gr(le==null?void 0:le.icon,h==null||(i=h.classNames)==null?void 0:i.icon)},h.promise||h.type==="loading"&&!h.icon?h.icon||nt():null,h.type!=="loading"?ft:null):null,re.createElement("div",{"data-content":"",className:gr(le==null?void 0:le.content,h==null||(s=h.classNames)==null?void 0:s.content)},re.createElement("div",{"data-title":"",className:gr(le==null?void 0:le.title,h==null||(o=h.classNames)==null?void 0:o.title)},h.jsx?h.jsx:typeof h.title=="function"?h.title():h.title),h.description?re.createElement("div",{"data-description":"",className:gr(N,qt,le==null?void 0:le.description,h==null||(a=h.classNames)==null?void 0:a.description)},typeof h.description=="function"?h.description():h.description):null),re.isValidElement(h.cancel)?h.cancel:h.cancel&&Su(h.cancel)?re.createElement("button",{"data-button":!0,"data-cancel":!0,style:h.cancelButtonStyle||w,onClick:_e=>{Su(h.cancel)&&ht&&(h.cancel.onClick==null||h.cancel.onClick.call(h.cancel,_e),qe())},className:gr(le==null?void 0:le.cancelButton,h==null||(u=h.classNames)==null?void 0:u.cancelButton)},h.cancel.label):null,re.isValidElement(h.action)?h.action:h.action&&Su(h.action)?re.createElement("button",{"data-button":!0,"data-action":!0,style:h.actionButtonStyle||T,onClick:_e=>{Su(h.action)&&(h.action.onClick==null||h.action.onClick.call(h.action,_e),!_e.defaultPrevented&&qe())},className:gr(le==null?void 0:le.actionButton,h==null||(c=h.classNames)==null?void 0:c.actionButton)},h.action.label):null)};function Gx(){if(typeof window>"u"||typeof document>"u")return"ltr";const t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}function h3(t,e){const n={};return[t,e].forEach((r,i)=>{const s=i===1,o=s?"--mobile-offset":"--offset",a=s?s3:i3;function u(c){["top","right","bottom","left"].forEach(f=>{n[`${o}-${f}`]=typeof c=="number"?`${c}px`:c})}typeof r=="number"||typeof r=="string"?u(r):typeof r=="object"?["top","right","bottom","left"].forEach(c=>{r[c]===void 0?n[`${o}-${c}`]=a:n[`${o}-${c}`]=typeof r[c]=="number"?`${r[c]}px`:r[c]}):u(a)}),n}const f3=re.forwardRef(function(e,n){const{id:r,invert:i,position:s="bottom-right",hotkey:o=["altKey","KeyT"],expand:a,closeButton:u,className:c,offset:f,mobileOffset:h,theme:p="light",richColors:g,duration:_,style:S,visibleToasts:P=r3,toastOptions:v,dir:x=Gx(),gap:E=a3,icons:O,containerAriaLabel:L="Notifications"}=e,[D,b]=re.useState([]),w=re.useMemo(()=>r?D.filter(R=>R.toasterId===r):D.filter(R=>!R.toasterId),[D,r]),T=re.useMemo(()=>Array.from(new Set([s].concat(w.filter(R=>R.position).map(R=>R.position)))),[w,s]),[A,N]=re.useState([]),[j,C]=re.useState(!1),[se,he]=re.useState(!1),[le,me]=re.useState(p!=="system"?p:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),q=re.useRef(null),oe=o.join("+").replace(/Key/g,"").replace(/Digit/g,""),k=re.useRef(null),ge=re.useRef(!1),ye=re.useCallback(R=>{b($=>{var Z;return(Z=$.find(ie=>ie.id===R.id))!=null&&Z.delete||yn.dismiss(R.id),$.filter(({id:ie})=>ie!==R.id)})},[]);return re.useEffect(()=>yn.subscribe(R=>{if(R.dismiss){requestAnimationFrame(()=>{b($=>$.map(Z=>Z.id===R.id?{...Z,delete:!0}:Z))});return}setTimeout(()=>{_2.flushSync(()=>{b($=>{const Z=$.findIndex(ie=>ie.id===R.id);return Z!==-1?[...$.slice(0,Z),{...$[Z],...R},...$.slice(Z+1)]:[R,...$]})})})}),[D]),re.useEffect(()=>{if(p!=="system"){me(p);return}if(p==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?me("dark"):me("light")),typeof window>"u")return;const R=window.matchMedia("(prefers-color-scheme: dark)");try{R.addEventListener("change",({matches:$})=>{me($?"dark":"light")})}catch{R.addListener(({matches:Z})=>{try{me(Z?"dark":"light")}catch(ie){console.error(ie)}})}},[p]),re.useEffect(()=>{D.length<=1&&C(!1)},[D]),re.useEffect(()=>{const R=$=>{var Z;if(o.every(fe=>$[fe]||$.code===fe)){var Te;C(!0),(Te=q.current)==null||Te.focus()}$.code==="Escape"&&(document.activeElement===q.current||(Z=q.current)!=null&&Z.contains(document.activeElement))&&C(!1)};return document.addEventListener("keydown",R),()=>document.removeEventListener("keydown",R)},[o]),re.useEffect(()=>{if(q.current)return()=>{k.current&&(k.current.focus({preventScroll:!0}),k.current=null,ge.current=!1)}},[q.current]),re.createElement("section",{ref:n,"aria-label":`${L} ${oe}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},T.map((R,$)=>{var Z;const[ie,Te]=R.split("-");return w.length?re.createElement("ol",{key:R,dir:x==="auto"?Gx():x,tabIndex:-1,ref:q,className:c,"data-sonner-toaster":!0,"data-sonner-theme":le,"data-y-position":ie,"data-x-position":Te,style:{"--front-toast-height":`${((Z=A[0])==null?void 0:Z.height)||0}px`,"--width":`${o3}px`,"--gap":`${E}px`,...S,...h3(f,h)},onBlur:fe=>{ge.current&&!fe.currentTarget.contains(fe.relatedTarget)&&(ge.current=!1,k.current&&(k.current.focus({preventScroll:!0}),k.current=null))},onFocus:fe=>{fe.target instanceof HTMLElement&&fe.target.dataset.dismissible==="false"||ge.current||(ge.current=!0,k.current=fe.relatedTarget)},onMouseEnter:()=>C(!0),onMouseMove:()=>C(!0),onMouseLeave:()=>{se||C(!1)},onDragEnd:()=>C(!1),onPointerDown:fe=>{fe.target instanceof HTMLElement&&fe.target.dataset.dismissible==="false"||he(!0)},onPointerUp:()=>he(!1)},w.filter(fe=>!fe.position&&$===0||fe.position===R).map((fe,Fe)=>{var ee,Ce;return re.createElement(d3,{key:fe.id,icons:O,index:Fe,toast:fe,defaultRichColors:g,duration:(ee=v==null?void 0:v.duration)!=null?ee:_,className:v==null?void 0:v.className,descriptionClassName:v==null?void 0:v.descriptionClassName,invert:i,visibleToasts:P,closeButton:(Ce=v==null?void 0:v.closeButton)!=null?Ce:u,interacting:se,position:R,style:v==null?void 0:v.style,unstyled:v==null?void 0:v.unstyled,classNames:v==null?void 0:v.classNames,cancelButtonStyle:v==null?void 0:v.cancelButtonStyle,actionButtonStyle:v==null?void 0:v.actionButtonStyle,closeButtonAriaLabel:v==null?void 0:v.closeButtonAriaLabel,removeToast:ye,toasts:w.filter(tt=>tt.position==fe.position),heights:A.filter(tt=>tt.position==fe.position),setHeights:N,expandByDefault:a,gap:E,expanded:j,swipeDirections:e.swipeDirections})})):null}))});function ki({label:t,type:e,categories:n,selectedIds:r,onSelect:i,onRemove:s,onCreate:o,onDeleteCategory:a,colorClass:u,placeholder:c="Añadir..."}){const[f,h]=F.useState(""),[p,g]=F.useState(!1),_=F.useRef(null),S=F.useMemo(()=>n.filter(D=>D.type===e||!D.type&&e==="genre"),[n,e]),P=F.useMemo(()=>f.trim()?S.filter(D=>D.name.toLowerCase().includes(f.toLowerCase())):S,[S,f]);F.useEffect(()=>{const D=b=>{_.current&&!_.current.contains(b.target)&&g(!1)};return document.addEventListener("mousedown",D),()=>document.removeEventListener("mousedown",D)},[]);const v=D=>{D.key==="Enter"&&(D.preventDefault(),x())},x=()=>{if(!f.trim())return;const D=S.find(b=>b.name.toLowerCase()===f.trim().toLowerCase());D?r.includes(D.id)||i(D.id):o(f.trim()),h(""),g(!1)},E=(D,b)=>{D.stopPropagation(),Ct("¿Eliminar esta categoría permanentemente?",{description:"Esta acción no se puede deshacer.",action:{label:"Eliminar",onClick:()=>a(b)},cancel:{label:"Cancelar",onClick:()=>{}},duration:5e3})},L=u.includes("blue")?{bg:"bg-blue-500/20",text:"text-blue-300",border:"border-blue-500/30"}:u.includes("green")?{bg:"bg-green-500/20",text:"text-green-300",border:"border-green-500/30"}:u.includes("purple")?{bg:"bg-purple-500/20",text:"text-purple-300",border:"border-purple-500/30"}:u.includes("pink")?{bg:"bg-pink-500/20",text:"text-pink-300",border:"border-pink-500/30"}:{bg:"bg-gray-500/20",text:"text-gray-300",border:"border-gray-500/30"};return d.jsxs("div",{className:"space-y-3 mb-6",ref:_,children:[d.jsx("label",{className:`text-xs uppercase font-bold tracking-wider ${u}`,children:t}),d.jsxs("div",{className:"relative",children:[d.jsxs("div",{className:"flex gap-2",children:[d.jsxs("div",{className:"relative flex-1",children:[d.jsx("input",{type:"text",value:f,onChange:D=>{h(D.target.value),g(!0)},onFocus:()=>g(!0),onKeyDown:v,placeholder:c,className:"w-full bg-[#1a1a1a] border border-gray-600/50 rounded-lg px-4 py-2 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-[#bb86fc] transition-all"}),f&&d.jsx("button",{onClick:()=>h(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-500 hover:text-white",children:d.jsx(Vn,{className:"w-3 h-3"})})]}),d.jsx("button",{onClick:x,disabled:!f.trim(),className:"bg-[#bb86fc]/20 hover:bg-[#bb86fc]/30 text-[#bb86fc] px-3 rounded-lg transition-all",children:d.jsx(fl,{className:"w-5 h-5"})})]}),p&&(P.length>0||f)&&d.jsx("div",{className:"absolute top-full left-0 right-0 mt-1 bg-[#1a1a1a] border border-gray-700/50 rounded-lg shadow-xl z-50 max-h-60 overflow-y-auto w-full custom-scrollbar",children:P.length>0?P.map(D=>{const b=r.includes(D.id);return d.jsxs("div",{className:"flex items-center justify-between px-4 py-2 hover:bg-white/5 cursor-pointer group",onClick:()=>{b||(i(D.id),h(""),g(!1))},children:[d.jsx("span",{className:`text-sm ${b?"text-[#bb86fc]":"text-gray-300"}`,children:D.name}),d.jsxs("div",{className:"flex items-center gap-2",children:[b&&d.jsx(fd,{className:"w-4 h-4 text-[#bb86fc]"}),d.jsx("button",{onClick:w=>E(w,D.id),className:"opacity-0 group-hover:opacity-100 p-1 hover:bg-red-500/20 text-gray-500 hover:text-red-400 rounded transition-all",title:"Eliminar permanentemente",children:d.jsx(zr,{className:"w-3.5 h-3.5"})})]})]},D.id)}):d.jsxs("div",{className:"px-4 py-3 text-center",children:[d.jsx("p",{className:"text-gray-400 text-xs mb-2",children:"No encontrado."}),d.jsxs("button",{onClick:x,className:"text-xs text-[#bb86fc] hover:underline font-semibold",children:['Crear "',f,'"']})]})})]}),d.jsx("div",{className:"flex gap-2 flex-wrap",children:r.map(D=>{const b=n.find(w=>w.id===D);return!b||b.type!==e&&!(e==="genre"&&!b.type)?null:d.jsxs("span",{className:`px-3 py-1 ${L.bg} ${L.text} text-xs rounded-full border ${L.border} flex items-center gap-2`,children:[b.name,d.jsx("button",{onClick:()=>s(D),className:"hover:text-white",children:d.jsx(Vn,{className:"w-3 h-3"})})]},D)})})]})}function bs({size:t=40,borderWidth:e=2,className:n=""}){return d.jsx("div",{className:`flex items-center justify-center ${n}`,children:d.jsx("div",{className:"relative",style:{width:`${t}px`,height:`${t}px`},children:d.jsx("div",{className:"rounded-full animate-spin",style:{width:`${t}px`,height:`${t}px`,borderWidth:`${e}px`,borderStyle:"solid",borderColor:"rgba(187, 134, 252, 0.3)",borderTopColor:"#bb86fc",animation:"spin 1.2s linear infinite",boxShadow:"0 0 20px rgba(139, 92, 246, 0.2)"}})})})}function p3({isOpen:t,onClose:e,onMangaCreated:n,editingManga:r,onDelete:i}){const[s,o]=F.useState({title:"",name:"",description:"",selectedCategories:[]}),[a,u]=F.useState(null),[c,f]=F.useState(!1),[h,p]=F.useState(null),[g,_]=F.useState([]),[S,P]=F.useState(!1),[v,x]=F.useState([]),[E,O]=F.useState(!1),[L,D]=F.useState(null),[b,w]=F.useState(0),[T,A]=F.useState(!1),[N,j]=F.useState(0),[C,se]=F.useState(0),[he,le]=F.useState(0),[me,q]=F.useState(0),[oe,k]=F.useState(0),[ge,ye]=F.useState(!1),[R,$]=F.useState(null),[Z,ie]=F.useState(null),[Te,fe]=F.useState(!1),[Fe,ee]=F.useState(hb()),Ce=!!r;F.useEffect(()=>{var V,B;if(t&&(tt(),r)){o({title:r.title,name:r.author,description:r.description||"",selectedCategories:((V=r.categories)==null?void 0:V.map(J=>typeof J=="string"?J:J.id))||[]}),r.thumbnail_url&&p(r.thumbnail_url);const K=(B=r.chapters)==null?void 0:B[0];if(K!=null&&K.pages&&K.pages.length>0){const J=K.pages,je=K.original_pages||[],Ue=J.map((De,H)=>{var Q;return{thumbnail:De,original:je[H]||De,webpDisplay:De,webpCover:De,originalFormat:((Q=K.page_formats)==null?void 0:Q[H])||"jpg",originalBase64:"",originalUnmodified:""}});x(Ue)}}},[t,r]);async function tt(){try{const V=await zI();_(V)}catch(V){console.error("Error loading categories:",V)}}const Dt=async V=>{const{name:B,value:K}=V.target;o(J=>({...J,[B]:K}))},jt=V=>{o(B=>({...B,selectedCategories:B.selectedCategories.filter(K=>K!==V)}))},te=async(V,B)=>{if(V.trim()){if(B==="tag"){const K=V.split(" ").map(J=>J.trim()).filter(J=>J.length>0);for(const J of K)await ve(J,B);return}await ve(V,B)}},ve=async(V,B)=>{try{const K=g.find(J=>J.name.toLowerCase()===V.trim().toLowerCase()&&J.type===B);if(K)o(J=>J.selectedCategories.includes(K.id)?J:{...J,selectedCategories:[...J.selectedCategories,K.id]});else{const J=await BI(V.trim(),B);_(je=>je.find(Ue=>Ue.id===J.id)?je:[...je,J]),o(je=>je.selectedCategories.includes(J.id)?je:{...je,selectedCategories:[...je.selectedCategories,J.id]})}}catch(K){console.error("Error creating category:",K)}},Ae=async V=>{try{await $I(V),_(B=>B.filter(K=>K.id!==V)),o(B=>({...B,selectedCategories:B.selectedCategories.filter(K=>K!==V)}))}catch(B){console.error("Error deleting category:",B),alert("Error al eliminar la categoría")}},Le=async V=>{var K;const B=(K=V.target.files)==null?void 0:K[0];if(B){f(!0);try{const J=await lv(B);u(J),p(J.originalUnmodified)}catch(J){console.error("Error processing image:",J),alert("Error al procesar la imagen. Intenta con otro archivo.")}finally{f(!1)}}},we=async V=>{const B=V.target.files;if(!(!B||B.length===0)){O(!0),le(0),q(0),k(B.length);try{const K=Array.from(B);let J=0;const je=10,Ue=[];let De=0;const H=async()=>{if(De>=K.length)return;const pe=De++,qe=K[pe];try{const nt=await lv(qe,pe+1,K.length);Ue[pe]=nt}catch(nt){console.error(`Error processing image ${qe.name}:`,nt),Ue[pe]=null}finally{J++,le(Math.round(J/K.length*100)),q(J),await H()}},Q=[];for(let pe=0;pepe!==null);x(pe=>[...pe,...Ie])}catch(K){console.error("Error processing pages:",K),alert("Error al procesar algunas imágenes.")}finally{O(!1),le(0),q(0),k(0),V.target.value=""}}},Qe=V=>{x(B=>B.filter((K,J)=>J!==V))},Ht=V=>{D(V)},Xe=(V,B)=>{if(V.preventDefault(),L===null||L===B)return;const K=[...v],J=K[L];K.splice(L,1),K.splice(B,0,J),x(K),D(B)},ht=()=>{D(null)},tn=async()=>{var V,B,K,J,je;if(!s.title||!s.title.trim()){alert("El título es requerido");return}P(!0);try{let Ue=[...s.selectedCategories],De=(r==null?void 0:r.thumbnail_url)||void 0,H=(r==null?void 0:r.cover_url)||void 0;if(Z)De=Z.thumbnail,H=Z.original;else if(a)try{A(!0),se(2),j(1),w(0);const Q=await Sc(a.thumbnail,`${s.title}_thumb`);w(50),j(2);const de=await Sc(a.originalUnmodified,`${s.title}_cover`);w(100),De=Q.data.url,H=de.data.url}catch(Q){console.error("Error uploading cover images:",Q),Q.message==="API_BURNED"?alert("⚠️ API QUEMADA: La API de ImgBB ha alcanzado su límite. Por favor, usa otra API o intenta más tarde."):Q.message==="API_INVALID_KEY"?alert("❌ Clave API inválida: La clave API que estás usando no es válida."):alert("Error al subir la portada. Continuar sin portada.")}finally{A(!1),w(0)}if(Ce&&r){const Q={title:s.title.trim(),author:((V=s.name)==null?void 0:V.trim())||"",description:((B=s.description)==null?void 0:B.trim())||"",categoryIds:Ue};if(De&&(Q.thumbnail_url=De),H&&(Q.cover_url=H),await HI(r.id,Q),v.length>0){const de=v.some(Ie=>Ie.originalBase64!=="");if(v.length>0)try{A(!0);const Ie=v.filter(Me=>Me.originalBase64!=="");se(Ie.length*2),j(0),w(0);const pe=Ie.map(Me=>Me.webpDisplay),qe=Ie.map(Me=>Me.originalUnmodified),nt=Ie.map(Me=>Me.originalFormat),ft=await yu(pe,`${s.title}_updated_webp`,(Me,oi)=>{j(Me),w(Math.round(Me/(Ie.length*2)*100))}),xt=await yu(qe,`${s.title}_updated_original`,(Me,oi)=>{j(Ie.length+Me),w(Math.round((Ie.length+Me)/(Ie.length*2)*100))}),Or=ft.map(Me=>Me.data.url),_e=xt.map(Me=>Me.data.url),Pe=v.filter(Me=>Me.originalBase64===""),wt=Pe.map(Me=>Me.webpDisplay),Wt=Pe.map(Me=>Me.original),Nn=Pe.map(Me=>Me.originalFormat),_t=[...wt,...Or],Gt=[...Wt,..._e],Bn=[...Nn,...nt];A(!1),w(0);const Kt=(K=r.chapters)==null?void 0:K[0];Kt?await si(vt(Ge,"chapters",Kt.id),{pages:_t,page_formats:Bn,original_pages:Gt,updated_at:Je.now()}):await qx({manga_id:r.id,number:1,title:"Páginas",pages:_t,page_formats:Bn,original_pages:Gt})}catch(Ie){console.error("Error updating chapter:",Ie),Ie.message==="API_BURNED"?alert("⚠️ API QUEMADA: La API de ImgBB ha alcanzado su límite. Por favor, usa otra API o intenta más tarde."):Ie.message==="API_INVALID_KEY"?alert("❌ Clave API inválida: La clave API que estás usando no es válida."):alert("Error al actualizar las páginas.")}}n(r.id)}else{const Q={title:s.title.trim(),author:((J=s.name)==null?void 0:J.trim())||"",categoryIds:Ue};(je=s.description)!=null&&je.trim()&&(Q.description=s.description.trim()),De&&(Q.thumbnail_url=De),H&&(Q.cover_url=H);const de=await jj(Q);if(!de.id)throw new Error("No se pudo obtener el ID del manga creado");const Ie=de.id;if(v.length>0)try{A(!0),se(v.length*2),j(0),w(0);const pe=v.map(Pe=>Pe.webpDisplay),qe=v.map(Pe=>Pe.originalUnmodified),nt=v.map(Pe=>Pe.originalFormat),ft=await yu(pe,`${s.title}_ch1_webp`,(Pe,wt)=>{j(Pe),w(Math.round(Pe/(v.length*2)*100))}),xt=await yu(qe,`${s.title}_ch1_original`,(Pe,wt)=>{j(v.length+Pe),w(Math.round((v.length+Pe)/(v.length*2)*100))}),Or=ft.map(Pe=>Pe.data.url),_e=xt.map(Pe=>Pe.data.url);A(!1),w(0),await qx({manga_id:Ie,number:1,title:"Páginas",pages:Or,page_formats:nt,original_pages:_e})}catch(pe){console.error("Error creating chapter:",pe),pe.message==="API_BURNED"?alert("⚠️ API QUEMADA: La API de ImgBB ha alcanzado su límite. Por favor, usa otra API o intenta más tarde."):pe.message==="API_INVALID_KEY"?alert("❌ Clave API inválida: La clave API que estás usando no es válida."):alert("Error al crear el capítulo. Por favor intenta de nuevo.")}n(Ie)}z()}catch(Ue){console.error("Error creating/updating manga:",Ue);let De="Error al guardar el manga. ";if(Ue.message)De+=Ue.message;else if(Ue.code)switch(Ue.code){case"permission-denied":De+="No tienes permisos para realizar esta operación.";break;case"unavailable":De+="El servicio no está disponible. Verifica tu conexión.";break;case"invalid-argument":De+="Algunos datos no son válidos. Revisa el formulario.";break;default:De+=`Código de error: ${Ue.code}`}else De+="Por favor intenta de nuevo.";alert(De)}finally{P(!1),A(!1),w(0)}},qt=V=>{const B=v[V];if(!B.originalBase64)ie({thumbnail:B.thumbnail,original:B.original}),u(null);else{const J={thumbnail:B.thumbnail,original:B.originalUnmodified,webpDisplay:B.originalUnmodified,webpCover:B.originalUnmodified,originalFormat:B.originalFormat,originalBase64:B.originalBase64,originalUnmodified:B.originalUnmodified};u(J),ie(null)}p(B.thumbnail),$(V),ye(!1)},z=()=>{o({title:"",name:"",description:"",selectedCategories:[]}),u(null),ie(null),p(null),x([]),w(0),A(!1),j(0),se(0),le(0),q(0),ye(!1),$(null),e()};return t?d.jsxs("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:[d.jsxs("div",{className:"bg-gradient-to-b from-[#1f1f1f] to-[#121212] rounded-2xl border border-gray-700/40 w-full max-w-2xl max-h-[90vh] overflow-y-auto shadow-2xl",children:[d.jsxs("div",{className:"sticky top-0 bg-gradient-to-b from-[#2a2a2a]/80 to-[#1f1f1f]/80 border-b border-gray-700/30 px-8 py-6 flex items-center justify-between z-10",children:[d.jsxs("div",{children:[d.jsxs("h2",{className:"text-2xl font-bold flex items-center gap-3",children:[d.jsx("div",{className:"p-2 bg-gradient-to-br from-[#bb86fc] to-[#9966dd] rounded-lg shadow-lg shadow-[#bb86fc]/30",children:d.jsx(hl,{className:"w-5 h-5 text-white"})}),Ce?"Editar Manga":"Crear Manga"]}),d.jsx("p",{className:"text-sm text-gray-400 mt-1.5",children:Ce?"Actualiza los detalles de tu obra":"Comparte tu historia con el mundo"})]}),d.jsx("button",{onClick:z,className:"text-gray-500 hover:text-white hover:bg-white/10 transition-all p-2 rounded-lg",children:d.jsx(Vn,{className:"w-6 h-6"})})]}),d.jsxs("div",{className:"p-8 space-y-5",children:[d.jsxs("div",{className:"bg-gradient-to-br from-[#242424] to-[#1a1a1a] rounded-xl p-6 border border-gray-700/40 shadow-lg hover:border-gray-700/60 transition-all",children:[d.jsxs("div",{className:"flex items-center gap-3 mb-5",children:[d.jsx("div",{className:"w-1 h-5 bg-gradient-to-b from-[#bb86fc] to-[#7744cc] rounded-full"}),d.jsx("h3",{className:"text-sm font-semibold text-white tracking-wide uppercase",children:"Información Principal"})]}),d.jsxs("div",{className:"space-y-3.5",children:[d.jsxs("div",{children:[d.jsxs("label",{className:"block text-xs font-semibold text-gray-200 mb-2",children:["Título del Manga ",d.jsx("span",{className:"text-red-400 font-bold",children:"*"})]}),d.jsx("input",{type:"text",name:"title",placeholder:"El nombre de tu obra maestra",value:s.title,onChange:Dt,onKeyPress:V=>V.key==="Enter"&&Ce&&!S&&tn(),className:"w-full bg-[#1a1a1a] border border-gray-600/50 rounded-lg px-4 py-3 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-[#bb86fc] focus:ring-2 focus:ring-[#bb86fc]/30 transition-all shadow-md hover:border-gray-600/70"})]}),d.jsxs("div",{children:[d.jsxs("label",{className:"block text-xs font-semibold text-gray-200 mb-2",children:["Autor ",d.jsx("span",{className:"text-gray-500 font-normal",children:"(opcional)"})]}),d.jsx("input",{type:"text",name:"name",placeholder:"Tu nombre o seudónimo",value:s.name,onChange:Dt,onKeyPress:V=>V.key==="Enter"&&Ce&&!S&&tn(),className:"w-full bg-[#1a1a1a] border border-gray-600/50 rounded-lg px-4 py-3 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-[#bb86fc] focus:ring-2 focus:ring-[#bb86fc]/30 transition-all shadow-md hover:border-gray-600/70"})]}),d.jsxs("div",{children:[d.jsxs("label",{className:"block text-xs font-semibold text-gray-200 mb-2",children:["Sinopsis ",d.jsx("span",{className:"text-gray-500 font-normal",children:"(opcional)"})]}),d.jsx("textarea",{name:"description",placeholder:"Cuéntanos de qué trata tu manga, qué lo hace especial...",value:s.description,onChange:Dt,onKeyDown:V=>V.key==="Enter"&&V.ctrlKey&&Ce&&!S&&tn(),rows:3,className:"w-full bg-[#1a1a1a] border border-gray-600/50 rounded-lg px-4 py-3 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-[#bb86fc] focus:ring-2 focus:ring-[#bb86fc]/30 transition-all shadow-md hover:border-gray-600/70 resize-none"})]})]})]}),d.jsxs("div",{className:"bg-gradient-to-br from-[#242424] to-[#1a1a1a] rounded-xl p-6 border border-gray-700/40 shadow-lg hover:border-gray-700/60 transition-all",children:[d.jsxs("div",{className:"flex items-center gap-3 mb-5",children:[d.jsx("div",{className:"w-1 h-5 bg-gradient-to-b from-[#bb86fc] to-[#7744cc] rounded-full"}),d.jsx("h3",{className:"text-sm font-semibold text-white tracking-wide uppercase",children:"Clasificación"})]}),d.jsx(ki,{label:"Personajes",type:"character",categories:g,selectedIds:s.selectedCategories,onSelect:V=>{s.selectedCategories.includes(V)||o(B=>({...B,selectedCategories:[...B.selectedCategories,V]}))},onRemove:jt,onCreate:V=>te(V,"character"),onDeleteCategory:Ae,colorClass:"text-blue-400",placeholder:"Añadir personaje..."}),d.jsx(ki,{label:"Series",type:"series",categories:g,selectedIds:s.selectedCategories,onSelect:V=>{s.selectedCategories.includes(V)||o(B=>({...B,selectedCategories:[...B.selectedCategories,V]}))},onRemove:jt,onCreate:V=>te(V,"series"),onDeleteCategory:Ae,colorClass:"text-green-400",placeholder:"Añadir serie..."}),d.jsx(ki,{label:"Géneros",type:"genre",categories:g,selectedIds:s.selectedCategories,onSelect:V=>{s.selectedCategories.includes(V)||o(B=>({...B,selectedCategories:[...B.selectedCategories,V]}))},onRemove:jt,onCreate:V=>te(V,"genre"),onDeleteCategory:Ae,colorClass:"text-purple-400",placeholder:"Añadir género..."}),d.jsx(ki,{label:"Etiquetas",type:"tag",categories:g,selectedIds:s.selectedCategories,onSelect:V=>{s.selectedCategories.includes(V)||o(B=>({...B,selectedCategories:[...B.selectedCategories,V]}))},onRemove:jt,onCreate:V=>te(V,"tag"),onDeleteCategory:Ae,colorClass:"text-pink-400",placeholder:"Añadir etiqueta..."})]}),d.jsxs("div",{className:"bg-gradient-to-br from-[#242424] to-[#1a1a1a] rounded-xl p-6 border border-gray-700/40 shadow-lg hover:border-gray-700/60 transition-all",children:[d.jsxs("div",{className:"flex items-center gap-3 mb-5",children:[d.jsx("div",{className:"w-1 h-5 bg-gradient-to-b from-[#bb86fc] to-[#7744cc] rounded-full"}),d.jsx("h3",{className:"text-sm font-semibold text-white tracking-wide uppercase",children:"Portada"}),d.jsx("span",{className:"text-xs text-gray-500 ml-auto",children:"Opcional"})]}),c&&d.jsxs("div",{className:"mb-4",children:[d.jsx("div",{className:"flex items-center justify-between mb-2",children:d.jsx("span",{className:"text-xs font-semibold text-[#bb86fc]",children:"Procesando portada..."})}),d.jsx("div",{className:"w-full bg-gray-700/40 rounded-full h-2 overflow-hidden border border-[#bb86fc]/30",children:d.jsx("div",{className:"bg-gradient-to-r from-[#bb86fc] to-[#9966dd] h-full transition-all duration-300 ease-out animate-pulse",style:{width:"100%"}})})]}),h&&!c&&d.jsxs("div",{className:"mb-4 relative group max-w-xs mx-auto",children:[d.jsx(Kn,{src:h,alt:"Preview",aspectRatio:"3/4",objectFit:"cover",loading:"eager",className:"rounded-xl border border-gray-600 shadow-2xl shadow-[#bb86fc]/20"}),d.jsx("div",{className:"absolute inset-0 rounded-xl bg-black/40 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center gap-2",children:d.jsx("button",{onClick:()=>{u(null),p(null),$(null)},className:"bg-red-600/80 hover:bg-red-600 text-white p-2 rounded-lg transition-all shadow-lg",children:d.jsx(zr,{className:"w-4 h-4"})})}),R!==null&&d.jsxs("div",{className:"absolute bottom-2 left-2 bg-green-600/90 text-white text-xs px-2.5 py-1 rounded-lg font-semibold",children:["Página ",R+1]})]}),d.jsxs("div",{className:"flex gap-3 mb-4",children:[d.jsxs("label",{className:"flex-1 border-2 border-dashed border-gray-600/50 rounded-xl p-6 cursor-pointer hover:border-[#bb86fc]/50 hover:bg-[#bb86fc]/5 transition-all block group",children:[d.jsxs("div",{className:"flex flex-col items-center gap-2",children:[d.jsx("div",{className:"w-12 h-12 bg-gradient-to-br from-[#bb86fc] to-[#9966dd] rounded-xl flex items-center justify-center shadow-lg shadow-[#bb86fc]/40 group-hover:scale-110 group-hover:shadow-[#bb86fc]/60 transition-all",children:c?d.jsx(bs,{size:24,borderWidth:2}):d.jsx(fl,{className:"w-6 h-6 text-white"})}),d.jsxs("div",{className:"text-center",children:[d.jsx("p",{className:"text-xs font-semibold text-white mb-0.5",children:c?"Procesando...":"Subir portada"}),d.jsx("p",{className:"text-xs text-gray-400",children:"Archivo"})]})]}),d.jsx("input",{type:"file",accept:"image/*",onChange:Le,disabled:c,className:"hidden"})]}),v.length>0&&d.jsxs("button",{onClick:()=>ye(!ge),className:"flex-1 border-2 border-dashed border-gray-600/50 rounded-xl p-6 hover:border-[#bb86fc]/50 hover:bg-[#bb86fc]/5 transition-all group flex flex-col items-center justify-center gap-2 bg-gradient-to-br from-[#1a1a1a] to-[#0f0f0f]",children:[d.jsx("div",{className:"w-12 h-12 bg-gradient-to-br from-[#9966dd] to-[#bb86fc] rounded-xl flex items-center justify-center shadow-lg shadow-[#bb86fc]/40 group-hover:scale-110 group-hover:shadow-[#bb86fc]/60 transition-all",children:d.jsx(sv,{className:"w-6 h-6 text-white"})}),d.jsxs("div",{className:"text-center",children:[d.jsx("p",{className:"text-xs font-semibold text-white mb-0.5",children:"Elegir página"}),d.jsxs("p",{className:"text-xs text-gray-400",children:[v.length," disponibles"]})]})]})]})]}),d.jsxs("div",{className:"bg-gradient-to-br from-[#242424] to-[#1a1a1a] rounded-xl p-6 border border-gray-700/40 shadow-lg hover:border-gray-700/60 transition-all",children:[d.jsxs("div",{className:"flex items-center gap-3 mb-5",children:[d.jsx("div",{className:"w-1 h-5 bg-gradient-to-b from-[#bb86fc] to-[#7744cc] rounded-full"}),d.jsx("h3",{className:"text-sm font-semibold text-white tracking-wide uppercase",children:"Páginas del Capítulo"}),d.jsx("span",{className:"text-xs text-gray-500 ml-auto",children:"Opcional"}),d.jsxs("button",{onClick:()=>fe(!0),className:"bg-[#1a1a1a] hover:bg-[#242424] border border-gray-600/50 hover:border-[#bb86fc]/50 text-gray-300 hover:text-[#bb86fc] p-2 rounded-lg transition-all flex items-center gap-1.5 text-xs font-medium",title:"Configurar tamaño de lote de subida",children:[d.jsx(ov,{className:"w-3.5 h-3.5"}),d.jsxs("span",{className:"hidden sm:inline",children:["Subida: ",Fe===0?"Sin límite":`${Fe} por lote`]})]})]}),E&&d.jsxs("div",{className:"mb-5",children:[d.jsxs("div",{className:"flex items-center justify-between mb-2",children:[d.jsxs("span",{className:"text-xs font-semibold text-[#bb86fc]",children:["Procesadas ",me," de ",oe]}),d.jsxs("span",{className:"text-xs font-bold text-[#bb86fc]",children:[he,"%"]})]}),d.jsx("div",{className:"w-full bg-gray-700/40 rounded-full h-2 overflow-hidden border border-[#bb86fc]/30",children:d.jsx("div",{className:"bg-gradient-to-r from-[#bb86fc] to-[#9966dd] h-full transition-all duration-300 ease-out",style:{width:`${he}%`}})})]}),v.length>0&&!E&&d.jsxs("div",{className:"mb-5",children:[d.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[d.jsx(iv,{className:"w-3.5 h-3.5 text-gray-500"}),d.jsxs("p",{className:"text-xs text-gray-400",children:[v.length," página",v.length!==1?"s":""," • Arrastra para reordenar"]})]}),d.jsx("div",{className:"grid grid-cols-4 gap-2",children:v.map((V,B)=>d.jsxs("div",{draggable:!0,onDragStart:()=>Ht(B),onDragOver:K=>Xe(K,B),onDragEnd:ht,style:{animationDelay:`${B*40}ms`},className:`relative group cursor-move opacity-0 animate-[fadeIn_0.7s_ease-out_forwards] ${L===B?"opacity-50 scale-95":"hover:scale-105"} transition-all duration-200`,children:[d.jsxs("div",{className:"relative overflow-hidden w-full aspect-[3/4] rounded-lg border border-gray-600/50 shadow-md bg-black",children:[d.jsx("div",{className:"absolute inset-0 flex items-center justify-center z-10 transition-opacity duration-300",children:d.jsx("div",{className:"rounded-full animate-spin",style:{width:"24px",height:"24px",borderWidth:"2px",borderStyle:"solid",borderColor:"rgba(187, 134, 252, 0.2)",borderTopColor:"#bb86fc",animation:"spin 0.6s linear infinite"}})}),d.jsx("img",{src:V.thumbnail,alt:`Página ${B+1}`,className:"w-full h-full object-cover transition-all duration-700 ease-out transform-gpu group-hover:scale-[1.08] group-hover:shadow-[#bb86fc]/30 opacity-0 scale-95",onLoad:K=>{var je;K.currentTarget.classList.remove("opacity-0","scale-95"),K.currentTarget.classList.add("opacity-100","scale-100");const J=(je=K.currentTarget.parentElement)==null?void 0:je.querySelector("div:nth-child(1)");J&&J.classList.add("opacity-0","pointer-events-none")}})]}),d.jsxs("div",{className:"absolute inset-0 bg-black/60 opacity-0 group-hover:opacity-100 transition-opacity rounded-lg flex items-center justify-center gap-2",children:[d.jsx(iv,{className:"w-4 h-4 text-white/70"}),d.jsx("button",{onClick:()=>Qe(B),className:"bg-red-600/80 hover:bg-red-600 text-white p-1.5 rounded-lg transition-all shadow-lg",children:d.jsx(zr,{className:"w-3.5 h-3.5"})})]}),d.jsx("div",{className:"absolute top-1.5 left-1.5 bg-black/80 text-white text-xs px-2 py-0.5 rounded-md font-semibold",children:B+1})]},B))})]}),d.jsxs("label",{className:"border-2 border-dashed border-gray-600/50 rounded-xl p-8 text-center cursor-pointer hover:border-[#bb86fc]/50 hover:bg-[#bb86fc]/5 transition-all block group",children:[d.jsx("div",{className:"w-14 h-14 bg-gradient-to-br from-[#bb86fc] to-[#9966dd] rounded-xl flex items-center justify-center mx-auto mb-2.5 shadow-lg shadow-[#bb86fc]/40 group-hover:scale-110 group-hover:shadow-[#bb86fc]/60 transition-all",children:E?d.jsx(bs,{size:24,borderWidth:2}):d.jsx(sv,{className:"w-7 h-7 text-white"})}),d.jsx("p",{className:"text-sm font-semibold text-white mb-1",children:E?`Procesando ${me}...`:v.length>0?"Agregar más páginas":"Sube tus páginas"}),d.jsx("p",{className:"text-xs text-gray-400 mb-2",children:"Arrastra o selecciona múltiples imágenes"}),d.jsx("p",{className:"text-xs text-gray-500",children:"Se optimizan automáticamente para mejor rendimiento"}),d.jsx("input",{type:"file",accept:"image/*",multiple:!0,onChange:we,disabled:E,className:"hidden"})]})]}),T&&d.jsxs("div",{className:"mb-6 bg-gradient-to-br from-[#242424] to-[#1a1a1a] rounded-xl p-5 border border-[#bb86fc]/30 shadow-xl",children:[d.jsxs("div",{className:"flex items-center justify-between mb-3",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(bs,{size:16,borderWidth:2}),d.jsxs("span",{className:"text-sm font-semibold text-white",children:["Subiendo imagen ",N," de ",C]})]}),d.jsxs("span",{className:"text-sm font-bold text-[#bb86fc]",children:[b,"%"]})]}),d.jsx("div",{className:"w-full bg-gray-700/40 rounded-full h-3 overflow-hidden border border-[#bb86fc]/40 shadow-inner",children:d.jsx("div",{className:"bg-gradient-to-r from-[#bb86fc] via-[#9966dd] to-[#bb86fc] h-full transition-all duration-500 ease-out relative overflow-hidden",style:{width:`${b}%`},children:d.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent animate-pulse"})})}),d.jsx("p",{className:"text-xs text-gray-400 mt-2 text-center",children:"Por favor no cierres esta ventana..."})]}),d.jsxs("div",{className:"flex gap-3 pt-6 border-t border-gray-700/50",children:[Ce&&i&&d.jsxs("button",{onClick:()=>{window.confirm("¿Estás seguro de que deseas eliminar este manga? Esta acción no se puede deshacer.")&&r&&(i(r.id),e())},className:"bg-red-500/10 border border-red-500/30 hover:bg-red-500/20 text-red-500 px-4 py-3 rounded-lg font-semibold text-sm transition-all flex items-center gap-2 mr-auto",children:[d.jsx(zr,{className:"w-4 h-4"}),"Eliminar"]}),d.jsx("button",{onClick:z,disabled:S||T,className:"flex-1 bg-[#1a1a1a] border border-gray-600/50 hover:border-gray-500 hover:bg-[#242424] text-white px-5 py-3 rounded-lg font-semibold text-sm transition-all shadow-md disabled:opacity-50 disabled:cursor-not-allowed",children:"Cancelar"}),d.jsx("button",{onClick:tn,className:"flex-1 bg-gradient-to-r from-[#bb86fc] to-[#9966dd] hover:from-[#9966dd] hover:to-[#7744cc] text-white px-5 py-3 rounded-lg font-semibold text-sm transition-all shadow-lg shadow-[#bb86fc]/40 hover:shadow-[#bb86fc]/60 disabled:opacity-50 disabled:cursor-not-allowed active:scale-95",disabled:c||S||T||!s.title.trim(),children:T?"Subiendo imágenes...":S?Ce?"Actualizando...":"Creando...":Ce?"Guardar Cambios":"Crear Manga"})]})]})]}),ge&&d.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:d.jsxs("div",{className:"bg-gradient-to-b from-[#1f1f1f] to-[#121212] rounded-2xl border border-gray-700/40 w-full max-w-2xl max-h-[80vh] shadow-2xl overflow-hidden flex flex-col",children:[d.jsxs("div",{className:"bg-gradient-to-b from-[#2a2a2a]/80 to-[#1f1f1f]/80 border-b border-gray-700/30 px-6 py-4 flex items-center justify-between flex-shrink-0",children:[d.jsxs("div",{children:[d.jsx("h2",{className:"text-xl font-bold text-white",children:"Selecciona portada"}),d.jsx("p",{className:"text-xs text-gray-400 mt-1",children:"Elige una página para usar como portada del manga"})]}),d.jsx("button",{onClick:()=>ye(!1),className:"text-gray-500 hover:text-white transition-colors p-1.5 rounded-lg hover:bg-white/10 flex-shrink-0",children:d.jsx(Vn,{className:"w-5 h-5"})})]}),d.jsx("div",{className:"overflow-y-auto flex-1 p-6",children:d.jsx("div",{className:"grid grid-cols-3 md:grid-cols-4 gap-3",children:v.map((V,B)=>d.jsxs("button",{onClick:()=>qt(B),className:`group relative aspect-[3/4] rounded-lg overflow-hidden transition-all duration-300 hover:scale-105 border-2 ${R===B?"border-green-500 shadow-lg shadow-green-500/40":"border-gray-600/50 hover:border-[#bb86fc]/50"}`,children:[d.jsxs("div",{className:"absolute inset-0 overflow-hidden bg-black flex items-center justify-center",children:[d.jsx("div",{className:"absolute inset-0 flex items-center justify-center z-10 transition-opacity duration-300",children:d.jsx("div",{className:"rounded-full animate-spin",style:{width:"20px",height:"20px",borderWidth:"2px",borderStyle:"solid",borderColor:"rgba(187, 134, 252, 0.2)",borderTopColor:"#bb86fc",animation:"spin 0.6s linear infinite"}})}),d.jsx("img",{src:V.thumbnail,alt:`Página ${B+1}`,className:"w-full h-full object-cover transition-all duration-700 ease-out transform-gpu group-hover:scale-[1.10] opacity-0 scale-95",onLoad:K=>{var je;K.currentTarget.classList.remove("opacity-0","scale-95"),K.currentTarget.classList.add("opacity-100","scale-100");const J=(je=K.currentTarget.parentElement)==null?void 0:je.querySelector("div:nth-child(1)");J&&J.classList.add("opacity-0","pointer-events-none")}})]}),d.jsx("div",{className:"absolute inset-0 bg-black/40 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center",children:d.jsx("div",{className:"bg-[#bb86fc]/90 text-white px-3 py-1.5 rounded-lg font-semibold text-sm",children:"Seleccionar"})}),d.jsx("div",{className:"absolute bottom-2 left-2 bg-black/80 text-white text-xs px-2 py-1 rounded-md font-semibold",children:B+1}),R===B&&d.jsxs("div",{className:"absolute top-2 right-2 bg-green-600/90 text-white px-2.5 py-1.5 rounded-lg flex items-center gap-1.5 font-semibold text-xs",children:[d.jsx("div",{className:"w-2 h-2 bg-white rounded-full"}),"Seleccionado"]})]},B))})}),d.jsxs("div",{className:"bg-gradient-to-b from-[#1f1f1f]/80 to-[#1a1a1a]/80 border-t border-gray-700/30 px-6 py-4 flex items-center justify-end gap-3 flex-shrink-0",children:[d.jsx("button",{onClick:()=>ye(!1),className:"bg-[#1a1a1a] border border-gray-600/50 hover:border-gray-500 hover:bg-[#242424] text-white px-4 py-2 rounded-lg font-semibold text-sm transition-all",children:"Cancelar"}),d.jsx("button",{onClick:()=>ye(!1),className:"bg-gradient-to-r from-[#bb86fc] to-[#9966dd] hover:from-[#9966dd] hover:to-[#7744cc] text-white px-4 py-2 rounded-lg font-semibold text-sm transition-all shadow-lg shadow-[#bb86fc]/40 hover:shadow-[#bb86fc]/60",children:"Confirmar"})]})]})}),Te&&d.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:d.jsxs("div",{className:"bg-gradient-to-b from-[#1f1f1f] to-[#121212] rounded-2xl border border-gray-700/40 w-full max-w-md shadow-2xl",children:[d.jsxs("div",{className:"bg-gradient-to-b from-[#2a2a2a]/80 to-[#1f1f1f]/80 border-b border-gray-700/30 px-6 py-4 flex items-center justify-between",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx("div",{className:"p-2 bg-gradient-to-br from-[#bb86fc] to-[#9966dd] rounded-lg shadow-lg shadow-[#bb86fc]/30",children:d.jsx(ov,{className:"w-5 h-5 text-white"})}),d.jsxs("div",{children:[d.jsx("h2",{className:"text-xl font-bold text-white",children:"Configurar Subida"}),d.jsx("p",{className:"text-xs text-gray-400 mt-0.5",children:"Tamaño de lote de imágenes"})]})]}),d.jsx("button",{onClick:()=>fe(!1),className:"text-gray-500 hover:text-white transition-colors p-1.5 rounded-lg hover:bg-white/10",children:d.jsx(Vn,{className:"w-5 h-5"})})]}),d.jsxs("div",{className:"p-6 space-y-4",children:[d.jsxs("div",{className:"bg-[#1a1a1a] border border-gray-700/40 rounded-lg p-4 mb-4",children:[d.jsx("h3",{className:"text-xs font-semibold text-gray-300 mb-2",children:"Opciones disponibles:"}),d.jsxs("ul",{className:"text-xs text-gray-400 space-y-1.5",children:[d.jsx("li",{children:"• 1 por lote: Más lento pero más estable"}),d.jsx("li",{children:"• 10 por lote: Balance entre velocidad y estabilidad (predeterminado)"}),d.jsx("li",{children:"• 50 por lote: Más rápido para muchas imágenes"}),d.jsx("li",{children:"• Sin límite: Sube todas las imágenes simultáneamente"})]})]}),d.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[d.jsx("button",{onClick:()=>{ee(1),gu(1)},className:`p-4 rounded-lg border-2 transition-all ${Fe===1?"border-[#bb86fc] bg-[#bb86fc]/10 shadow-lg shadow-[#bb86fc]/30":"border-gray-600/50 hover:border-gray-600 bg-[#1a1a1a]"}`,children:d.jsxs("div",{className:"text-center",children:[d.jsx("div",{className:"text-2xl font-bold text-white mb-1",children:"1"}),d.jsx("div",{className:"text-xs text-gray-400",children:"Por lote"})]})}),d.jsx("button",{onClick:()=>{ee(10),gu(10)},className:`p-4 rounded-lg border-2 transition-all ${Fe===10?"border-[#bb86fc] bg-[#bb86fc]/10 shadow-lg shadow-[#bb86fc]/30":"border-gray-600/50 hover:border-gray-600 bg-[#1a1a1a]"}`,children:d.jsxs("div",{className:"text-center",children:[d.jsx("div",{className:"text-2xl font-bold text-white mb-1",children:"10"}),d.jsx("div",{className:"text-xs text-gray-400",children:"Por lote"})]})}),d.jsx("button",{onClick:()=>{ee(50),gu(50)},className:`p-4 rounded-lg border-2 transition-all ${Fe===50?"border-[#bb86fc] bg-[#bb86fc]/10 shadow-lg shadow-[#bb86fc]/30":"border-gray-600/50 hover:border-gray-600 bg-[#1a1a1a]"}`,children:d.jsxs("div",{className:"text-center",children:[d.jsx("div",{className:"text-2xl font-bold text-white mb-1",children:"50"}),d.jsx("div",{className:"text-xs text-gray-400",children:"Por lote"})]})}),d.jsx("button",{onClick:()=>{ee(0),gu(999999)},className:`p-4 rounded-lg border-2 transition-all ${Fe===0||Fe>=999999?"border-[#bb86fc] bg-[#bb86fc]/10 shadow-lg shadow-[#bb86fc]/30":"border-gray-600/50 hover:border-gray-600 bg-[#1a1a1a]"}`,children:d.jsxs("div",{className:"text-center",children:[d.jsx("div",{className:"text-2xl font-bold text-white mb-1",children:"∞"}),d.jsx("div",{className:"text-xs text-gray-400",children:"Sin límite"})]})})]}),d.jsx("div",{className:"bg-green-500/10 border border-green-500/30 rounded-lg p-3",children:d.jsxs("p",{className:"text-green-400 text-xs font-semibold",children:["Configuración guardada: ",Fe===0||Fe>=999999?"Sin límite":`${Fe} imagen${Fe!==1?"es":""} por lote`]})}),d.jsx("button",{onClick:()=>fe(!1),className:"w-full bg-gradient-to-r from-[#bb86fc] to-[#9966dd] hover:from-[#9966dd] hover:to-[#7744cc] text-white px-4 py-3 rounded-lg font-semibold text-sm transition-all shadow-lg shadow-[#bb86fc]/40 hover:shadow-[#bb86fc]/60",children:"Cerrar"})]})]})})]}):null}const qI="settings",WI="announcement";async function Kx(t,e){const n=vt(Ge,qI,WI),r=new Date;let i=null;e&&(i=new Date(r.getTime()+e).toISOString());const s={text:t,updatedAt:r.toISOString(),expiresAt:i};await Og(n,s)}function m3(t){const e=vt(Ge,qI,WI);return Mg(e,n=>{n.exists()?t(n.data()):t(null)})}const Wd="general",Gd="admin_settings",qa=["gonzalosalvadorloyolahuarauya@gmail.com","loyolahuarauyagonzalosalvador@gmail.com","brody.loyola@gmail.com"];async function Yh(t){if(!t)return!1;if(qa.includes(t))return!0;try{const e=vt(Ge,Gd,Wd),n=await hr(e);return n.exists()?n.data().allowed_emails.includes(t):!1}catch(e){return console.error("Error checking admin status:",e),!1}}async function g3(){try{const t=vt(Ge,Gd,Wd),e=await hr(t);if(e.exists()){const n=e.data();return Array.from(new Set([...qa,...n.allowed_emails]))}return[...qa]}catch(t){return console.error("Error getting allowed emails:",t),[...qa]}}async function y3(t){const e=vt(Ge,Gd,Wd);try{await si(e,{allowed_emails:VR(t)})}catch(n){if(n.code==="not-found"||n.message.includes("No document to update"))await Og(e,{allowed_emails:[t]});else throw n}}async function v3(t){if(qa.includes(t))throw new Error("No puedes eliminar a un propietario.");const e=vt(Ge,Gd,Wd);await si(e,{allowed_emails:FR(t)})}function x3({isOpen:t,onClose:e,isAdmin:n,onAdminChange:r,isCategoryPlusEnabled:i,onCategoryPlusChange:s}){const[o,a]=F.useState(""),[u,c]=F.useState(!1),[f,h]=F.useState(!1),[p,g]=F.useState(""),[_,S]=F.useState(""),[P,v]=F.useState(""),[x,E]=F.useState([]),[O,L]=F.useState(""),[D,b]=F.useState(null),[w,T]=F.useState(""),[A,N]=F.useState(24),[j,C]=F.useState("hours"),[se,he]=F.useState(!1),[le,me]=F.useState(!1);F.useEffect(()=>{if(t){const ee=cb();ee?(a(ee),c(!0)):(a(""),c(!1)),g(""),S(""),v("");const Ce=mi.currentUser;Ce?(b(Ce.email),n&&q()):n&&r(!1)}},[t]);const q=async()=>{const ee=await g3();E(ee)},oe=()=>{if(!o.trim()){Ct.error("Por favor ingresa una API válida");return}B2(o.trim()),c(!0),Ct.success("API guardada exitosamente.")},k=()=>{$2(),a(""),c(!1),me(!1),Ct.success("API eliminada.")},ge=()=>{me(!0)},ye=async()=>{h(!0),g("");try{const Ce=(await MD(mi,Pj)).user.email;if(!Ce)throw new Error("No se pudo obtener el email.");await Yh(Ce)?(r(!0),b(Ce),await q()):(await Tu(mi),g("Este correo no tiene permisos de administrador."),r(!1))}catch(ee){console.error("Login error:",ee),g(ee.message||"Error al iniciar sesión.")}finally{h(!1)}},R=async()=>{if(!_||!P){g("Por favor ingresa correo y contraseña.");return}h(!0),g("");try{const Ce=(await mD(mi,_.trim(),P)).user.email;if(!Ce)throw new Error("No se pudo obtener el email.");await Yh(Ce)?(r(!0),b(Ce),await q()):(await Tu(mi),g("Este correo no tiene permisos de administrador."),r(!1))}catch(ee){console.error("Login error:",ee),ee.code==="auth/invalid-credential"||ee.code==="auth/user-not-found"?g('Cuenta no encontrada o contraseña incorrecta. Si es tu primera vez, usa "Registrarse".'):g(ee.message||"Error al iniciar sesión.")}finally{h(!1)}},$=async()=>{if(!_||!P){g("Ingresa un correo y contraseña para registrarte.");return}h(!0),g("");try{const Ce=(await pD(mi,_.trim(),P)).user.email;if(!Ce)throw new Error("Error al obtener email.");await Yh(Ce)?(r(!0),b(Ce),await q(),await q(),Ct.success("Cuenta creada y verificada exitosamente.")):(await Tu(mi),g("Cuenta creada, pero tu correo NO está autorizado como administrador."),r(!1))}catch(ee){console.error("Register error:",ee),ee.code==="auth/email-already-in-use"?g('Este correo ya está registrado. Intenta "Ingresar".'):ee.code==="auth/weak-password"?g("La contraseña debe tener al menos 6 caracteres."):g(ee.message||"Error al registrar.")}finally{h(!1)}},Z=async()=>{try{await Tu(mi),r(!1),b(null),E([])}catch(ee){console.error("Logout error:",ee)}},ie=async()=>{if(O.trim())try{await y3(O.trim()),L(""),await q(),await q(),Ct.success("Administrador añadido correctamente.")}catch(ee){Ct.error("Error al añadir: "+ee.message)}},Te=async ee=>{if(window.confirm(`¿Seguro que quieres eliminar a ${ee}?`))try{await v3(ee),await q(),Ct.success(`Administrador ${ee} eliminado.`)}catch(Ce){Ct.error("Error: "+Ce.message)}},fe=async()=>{if(!w.trim()){Ct.error("El texto del anuncio no puede estar vacío");return}let ee=0;j==="seconds"&&(ee=A*1e3),j==="minutes"&&(ee=A*60*1e3),j==="hours"&&(ee=A*60*60*1e3),j==="days"&&(ee=A*24*60*60*1e3);try{await Kx(w,ee),Ct.success("Anuncio publicado exitosamente"),T(""),e()}catch(Ce){console.error(Ce),Ct.error("Error al publicar el anuncio")}},Fe=async()=>{try{await Kx("",null),T(""),he(!1),Ct.success("Anuncio eliminado.")}catch(ee){console.error(ee),Ct.error("Error al eliminar")}};return t?d.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50 p-4 animate-in fade-in duration-200",children:d.jsxs("div",{className:"bg-[#121212] rounded-2xl border border-gray-800 w-full max-w-lg shadow-2xl overflow-hidden flex flex-col max-h-[90vh]",children:[d.jsxs("div",{className:"bg-[#1a1a1a] border-b border-gray-800 px-6 py-4 flex items-center justify-between sticky top-0 z-10",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx("div",{className:"p-2 bg-[#bb86fc]/10 rounded-lg text-[#bb86fc]",children:d.jsx(lb,{className:"w-5 h-5"})}),d.jsx("h2",{className:"text-xl font-bold text-white",children:"Ajustes"})]}),d.jsx("button",{onClick:e,className:"text-gray-400 hover:text-white transition-colors p-2 hover:bg-white/5 rounded-lg",children:d.jsx(Vn,{className:"w-5 h-5"})})]}),d.jsxs("div",{className:"p-6 space-y-8 overflow-y-auto custom-scrollbar",children:[d.jsxs("section",{className:"space-y-4",children:[d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx("div",{className:`p-2 rounded-lg ${n?"bg-green-500/10 text-green-500":"bg-gray-800 text-gray-400"}`,children:n?d.jsx(j2,{className:"w-5 h-5"}):d.jsx(A2,{className:"w-5 h-5"})}),d.jsxs("div",{children:[d.jsx("h3",{className:"tex-sm font-semibold text-white",children:"Modo Administrador"}),d.jsx("p",{className:"text-xs text-gray-400",children:n?`Conectado como ${D}`:"Requiere acceso autorizado"})]})]}),n&&d.jsx("button",{onClick:Z,className:"text-gray-400 hover:text-white p-2 rounded-lg hover:bg-white/5 transition-colors",title:"Cerrar Sessión",children:d.jsx(P2,{className:"w-5 h-5"})})]}),n?d.jsxs("div",{className:"bg-[#1a1a1a] p-4 rounded-xl border border-gray-800 space-y-4",children:[d.jsxs("h4",{className:"text-sm font-semibold text-white mb-2 flex items-center gap-2",children:[d.jsx(av,{className:"w-4 h-4 text-[#bb86fc]"}),"Gestión de Administradores"]}),d.jsxs("div",{className:"flex gap-2",children:[d.jsx("input",{type:"email",placeholder:"nuevo_admin@gmail.com",value:O,onChange:ee=>L(ee.target.value),className:"flex-1 bg-black/50 border border-gray-700 rounded-lg px-3 py-2 text-sm text-white focus:outline-none focus:border-[#bb86fc]"}),d.jsx("button",{onClick:ie,disabled:!O.trim(),className:"bg-[#bb86fc]/20 hover:bg-[#bb86fc]/30 text-[#bb86fc] p-2 rounded-lg transition-colors disabled:opacity-50",children:d.jsx(L2,{className:"w-5 h-5"})})]}),d.jsx("div",{className:"space-y-2 max-h-40 overflow-y-auto pr-1 custom-scrollbar",children:x.map(ee=>d.jsxs("div",{className:"flex items-center justify-between bg-black/30 p-2 rounded-lg border border-gray-800/50",children:[d.jsx("span",{className:"text-xs text-gray-300 truncate",children:ee}),d.jsx("button",{onClick:()=>Te(ee),className:"text-gray-500 hover:text-red-400 p-1 hover:bg-white/5 rounded transition-colors",title:"Eliminar admin",children:d.jsx(O2,{className:"w-4 h-4"})})]},ee))})]}):d.jsxs("div",{className:"bg-[#1a1a1a] p-6 rounded-xl border border-gray-800 animate-in slide-in-from-top-2 duration-200 text-center",children:[d.jsx("p",{className:"text-sm text-gray-400 mb-4",children:"Inicia sesión con una cuenta autorizada."}),d.jsxs("div",{className:"space-y-3 mb-4",children:[d.jsx("input",{type:"email",placeholder:"Correo electrónico",value:_,onChange:ee=>S(ee.target.value),className:"w-full bg-black/50 border border-gray-700 rounded-lg px-3 py-2 text-sm text-white focus:outline-none focus:border-[#bb86fc]"}),d.jsx("input",{type:"password",placeholder:"Contraseña",value:P,onChange:ee=>v(ee.target.value),onKeyDown:ee=>ee.key==="Enter"&&R(),className:"w-full bg-black/50 border border-gray-700 rounded-lg px-3 py-2 text-sm text-white focus:outline-none focus:border-[#bb86fc]"}),d.jsx("button",{onClick:R,disabled:f,className:"w-full bg-[#bb86fc] text-white hover:bg-[#9966dd] py-2 rounded-lg font-semibold text-sm transition-colors disabled:opacity-70",children:f?"Verificando...":"Ingresar"}),d.jsx("button",{onClick:$,disabled:f,className:"w-full bg-transparent border border-gray-600 text-gray-300 hover:border-gray-400 hover:text-white py-1.5 rounded-lg text-xs transition-colors disabled:opacity-50",children:"¿Primera vez? Crear cuenta"})]}),d.jsxs("div",{className:"flex items-center gap-2 my-4",children:[d.jsx("div",{className:"h-px bg-gray-800 flex-1"}),d.jsx("span",{className:"text-xs text-gray-500",children:"O usa Google"}),d.jsx("div",{className:"h-px bg-gray-800 flex-1"})]}),d.jsxs("button",{onClick:ye,disabled:f,className:"w-full bg-white text-gray-900 hover:bg-gray-100 py-2.5 rounded-lg font-semibold flex items-center justify-center gap-2 transition-colors disabled:opacity-70",children:[f?d.jsx("div",{className:"w-5 h-5 border-2 border-gray-900 border-t-transparent rounded-full animate-spin"}):d.jsxs("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",children:[d.jsx("path",{fill:"currentColor",d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"}),d.jsx("path",{fill:"currentColor",d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"}),d.jsx("path",{fill:"currentColor",d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.84z"}),d.jsx("path",{fill:"currentColor",d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"})]}),"Iniciar con Google"]}),p&&d.jsx("p",{className:"text-red-500 text-xs mt-3 bg-red-500/10 p-2 rounded border border-red-500/20",children:p})]})]}),d.jsx("section",{className:"space-y-4 pt-4 border-t border-gray-800",children:d.jsxs("div",{className:"flex items-center justify-between",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx("div",{className:`p-2 rounded-lg ${i?"bg-purple-500/10 text-purple-400":"bg-gray-800 text-gray-400"}`,children:d.jsx(ib,{className:"w-5 h-5"})}),d.jsxs("div",{children:[d.jsx("h3",{className:"text-sm font-semibold text-white",children:"Categorías Plus"}),d.jsx("p",{className:"text-xs text-gray-400",children:"Habilitar selección múltiple y edición masiva"})]})]}),d.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[d.jsx("input",{type:"checkbox",className:"sr-only peer",checked:i,onChange:ee=>s(ee.target.checked)}),d.jsx("div",{className:"w-11 h-6 bg-gray-700 peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-purple-300 dark:peer-focus:ring-purple-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-[#bb86fc]"})]})]})}),n&&d.jsxs("section",{className:"space-y-4 pt-4 border-t border-gray-800",children:[d.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[d.jsx("div",{className:"p-2 bg-red-500/10 rounded-lg text-red-500",children:d.jsx(rp,{className:"w-5 h-5"})}),d.jsxs("div",{children:[d.jsx("h3",{className:"tex-sm font-semibold text-white",children:"Gestión de Vistas"}),d.jsx("p",{className:"text-xs text-gray-400",children:"Restablecer contadores de visualización"})]})]}),d.jsx("button",{onClick:async()=>{if(window.confirm("¿Seguro que quieres reiniciar las vistas de TODOS los mangas a 0? Esta acción no se puede deshacer."))try{await Oj(),Ct.success("Vistas reiniciadas correctamente.")}catch(ee){console.error(ee),Ct.error("Error al reiniciar vistas.")}},className:"w-full bg-red-500/10 hover:bg-red-500/20 text-red-500 py-2.5 rounded-lg font-semibold text-sm transition-all border border-red-500/20 hover:border-red-500/40",children:"Reiniciar Vistas a 0"})]}),n&&d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"h-px bg-gray-800"}),d.jsxs("section",{className:"space-y-4",children:[d.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[d.jsx("div",{className:"p-2 bg-purple-500/10 rounded-lg text-purple-400",children:d.jsx(sb,{className:"w-5 h-5"})}),d.jsxs("div",{children:[d.jsx("h3",{className:"tex-sm font-semibold text-white",children:"Publicar Anuncio"}),d.jsx("p",{className:"text-xs text-gray-400",children:"Visible para todos los usuarios"})]})]}),d.jsxs("div",{className:"space-y-3",children:[d.jsx("textarea",{value:w,onChange:ee=>T(ee.target.value),placeholder:"Escribe el mensaje del anuncio...",className:"w-full bg-[#1a1a1a] border border-gray-700 rounded-lg px-4 py-3 text-sm text-white placeholder-gray-600 focus:outline-none focus:border-[#bb86fc] min-h-[100px] resize-none"}),d.jsxs("div",{className:"flex gap-3",children:[d.jsxs("div",{className:"flex-1 bg-[#1a1a1a] border border-gray-700 rounded-lg px-3 py-2 flex items-center gap-2",children:[d.jsx(k2,{className:"w-4 h-4 text-gray-400"}),d.jsx("input",{type:"number",min:"1",value:A,onChange:ee=>N(Number(ee.target.value)),className:"bg-transparent text-white text-sm w-full focus:outline-none"})]}),d.jsxs("select",{value:j,onChange:ee=>C(ee.target.value),className:"bg-[#1a1a1a] border border-gray-700 rounded-lg px-3 py-2 text-sm text-white focus:outline-none focus:border-[#bb86fc]",children:[d.jsx("option",{value:"seconds",children:"Segundos"}),d.jsx("option",{value:"minutes",children:"Minutos"}),d.jsx("option",{value:"hours",children:"Horas"}),d.jsx("option",{value:"days",children:"Días"})]})]}),d.jsxs("div",{className:"flex gap-2",children:[d.jsx("button",{onClick:()=>he(!0),className:"px-4 py-2.5 rounded-lg font-semibold text-sm bg-red-500/10 text-red-500 border border-red-500/20 hover:bg-red-500/20 transition-colors",title:"Eliminar anuncio",children:d.jsx(zr,{className:"w-5 h-5"})}),d.jsx("button",{onClick:fe,className:"flex-1 bg-gradient-to-r from-[#bb86fc] to-[#9966dd] hover:from-[#9966dd] hover:to-[#7744cc] text-white py-2.5 rounded-lg font-semibold text-sm transition-all shadow-lg shadow-[#bb86fc]/20",children:"Publicar Anuncio"})]})]})]})]}),d.jsx("div",{className:"h-px bg-gray-800"}),d.jsxs("section",{className:"space-y-4",children:[d.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[d.jsx("div",{className:"p-2 bg-blue-500/10 rounded-lg text-blue-400",children:d.jsx(C2,{className:"w-5 h-5"})}),d.jsxs("div",{children:[d.jsx("h3",{className:"tex-sm font-semibold text-white",children:"Configuración de API"}),d.jsx("p",{className:"text-xs text-gray-400",children:"Gestiona tu clave personal de ImgBB"})]})]}),u&&d.jsx("div",{className:"bg-green-500/10 border border-green-500/20 rounded-lg p-3",children:d.jsxs("p",{className:"text-green-400 text-xs font-medium flex items-center gap-2",children:[d.jsx(av,{className:"w-3 h-3"}),"API personal activa"]})}),d.jsxs("div",{className:"space-y-2",children:[d.jsx("input",{type:"text",placeholder:"Pega tu API Key de ImgBB aquí...",value:o,onChange:ee=>a(ee.target.value),className:"w-full bg-[#1a1a1a] border border-gray-700 rounded-lg px-4 py-3 text-sm text-white placeholder-gray-600 focus:outline-none focus:border-[#bb86fc] focus:ring-1 focus:ring-[#bb86fc] transition-all font-mono"}),d.jsxs("p",{className:"text-xs text-gray-500",children:["Obtén tu API key gratuitamente en ",d.jsx("a",{href:"https://api.imgbb.com/",target:"_blank",rel:"noopener noreferrer",className:"text-[#bb86fc] hover:underline",children:"api.imgbb.com"})]})]}),d.jsxs("div",{className:"flex gap-3",children:[u&&d.jsxs("button",{onClick:ge,className:"flex-1 bg-red-500/10 border border-red-500/30 hover:bg-red-500/20 text-red-500 px-4 py-2.5 rounded-lg font-medium text-sm transition-colors flex items-center justify-center gap-2",children:[d.jsx(zr,{className:"w-4 h-4"}),"Eliminar"]}),d.jsxs("button",{onClick:oe,disabled:!o.trim(),className:"flex-1 bg-[#1a1a1a] border border-gray-700 hover:border-[#bb86fc] hover:text-[#bb86fc] disabled:opacity-50 disabled:hover:border-gray-700 disabled:hover:text-gray-500 text-gray-300 px-4 py-2.5 rounded-lg font-medium text-sm transition-all flex items-center justify-center gap-2 group",children:[d.jsx(zm,{className:"w-4 h-4 group-hover:scale-110 transition-transform"}),"Guardar Cambios"]})]})]})]}),se&&d.jsx("div",{className:"absolute inset-0 bg-black/80 backdrop-blur-sm flex items-center justify-center z-50 p-6 animate-in fade-in duration-200",children:d.jsx("div",{className:"bg-[#1a1a1a] border border-gray-700 w-full max-w-sm rounded-xl shadow-2xl p-6 transform scale-100 animate-in zoom-in-95 duration-200",children:d.jsxs("div",{className:"flex flex-col items-center text-center gap-4",children:[d.jsx("div",{className:"p-3 bg-red-500/10 rounded-full text-red-500",children:d.jsx(zr,{className:"w-8 h-8"})}),d.jsxs("div",{children:[d.jsx("h3",{className:"text-lg font-bold text-white mb-1",children:"¿Eliminar anuncio?"}),d.jsx("p",{className:"text-sm text-gray-400",children:"Esta acción eliminará el anuncio actual inmediatamente. No se puede deshacer."})]}),d.jsxs("div",{className:"flex gap-3 w-full mt-2",children:[d.jsx("button",{onClick:()=>he(!1),className:"flex-1 px-4 py-2 rounded-lg text-sm font-semibold text-gray-300 hover:bg-gray-800 transition-colors",children:"Cancelar"}),d.jsx("button",{onClick:Fe,className:"flex-1 px-4 py-2 rounded-lg text-sm font-semibold bg-red-500 hover:bg-red-600 text-white transition-colors shadow-lg shadow-red-500/20",children:"Eliminar"})]})]})})}),le&&d.jsx("div",{className:"absolute inset-0 bg-black/80 backdrop-blur-sm flex items-center justify-center z-50 p-6 animate-in fade-in duration-200",children:d.jsx("div",{className:"bg-[#1a1a1a] border border-gray-700 w-full max-w-sm rounded-xl shadow-2xl p-6 transform scale-100 animate-in zoom-in-95 duration-200",children:d.jsxs("div",{className:"flex flex-col items-center text-center gap-4",children:[d.jsx("div",{className:"p-3 bg-red-500/10 rounded-full text-red-500",children:d.jsx(zr,{className:"w-8 h-8"})}),d.jsxs("div",{children:[d.jsx("h3",{className:"text-lg font-bold text-white mb-1",children:"¿Eliminar API personal?"}),d.jsx("p",{className:"text-sm text-gray-400",children:"Perderás el acceso a tus subidas privadas hasta que ingreses una clave válida."})]}),d.jsxs("div",{className:"flex gap-3 w-full mt-2",children:[d.jsx("button",{onClick:()=>me(!1),className:"flex-1 px-4 py-2 rounded-lg text-sm font-semibold text-gray-300 hover:bg-gray-800 transition-colors",children:"Cancelar"}),d.jsx("button",{onClick:k,className:"flex-1 px-4 py-2 rounded-lg text-sm font-semibold bg-red-500 hover:bg-red-600 text-white transition-colors shadow-lg shadow-red-500/20",children:"Eliminar"})]})]})})})]})}):null}function w3({isAdmin:t}){const[e,n]=F.useState(""),[r,i]=F.useState(null),[s,o]=F.useState(""),[a,u]=F.useState(!0);return F.useEffect(()=>{const c=m3(f=>{f?(n(f.text),i(f.expiresAt)):(n(""),i(null)),u(!1)});return()=>c()},[]),F.useEffect(()=>{if(!r){o("");return}const c=setInterval(()=>{const f=new Date().getTime(),p=new Date(r).getTime()-f;if(p<=0)n(""),i(null),clearInterval(c);else{const g=Math.floor(p/864e5),_=Math.floor(p%(1e3*60*60*24)/(1e3*60*60)),S=Math.floor(p%(1e3*60*60)/(1e3*60)),P=Math.floor(p%(1e3*60)/1e3);let v="";g>0&&(v+=`${g}d `),v+=`${_.toString().padStart(2,"0")}h ${S.toString().padStart(2,"0")}m ${P.toString().padStart(2,"0")}s`,o(v)}},1e3);return()=>clearInterval(c)},[r]),!e&&!a||!e?null:d.jsx("div",{className:"w-full max-w-[1800px] mx-auto px-4 sm:px-6 md:px-12 mt-6 mb-8 animate-in fade-in slide-in-from-top-4 duration-500 flex justify-center",children:d.jsxs("div",{className:"bg-gradient-to-r from-[#bb86fc]/20 to-[#121212] border border-[#bb86fc]/30 rounded-xl p-6 flex flex-col items-center gap-4 shadow-lg shadow-[#bb86fc]/10 relative group backdrop-blur-sm max-w-2xl w-full text-center",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx("div",{className:"p-2.5 bg-[#bb86fc]/20 rounded-lg animate-pulse",children:d.jsx(sb,{className:"w-6 h-6 text-[#bb86fc]"})}),d.jsxs("h3",{className:"text-sm font-bold text-[#bb86fc] uppercase tracking-wider flex items-center gap-2",children:["Información Importante",d.jsx("span",{className:"w-2 h-2 rounded-full bg-[#bb86fc] animate-ping"})]})]}),d.jsx("div",{className:"text-base text-gray-200 leading-relaxed whitespace-pre-wrap font-medium max-w-lg",children:e}),s&&d.jsxs("div",{className:"flex items-center gap-2 text-xs font-mono text-gray-400 bg-black/30 px-3 py-1.5 rounded-full border border-gray-800",children:[d.jsx(D2,{className:"w-3.5 h-3.5"}),d.jsxs("span",{children:["Expira en: ",s]})]})]})})}const GI=()=>"",_3=t=>{if(!t)return;if(t.startsWith("blob:")||t.startsWith("data:"))return t;const e=GI(),n=new URLSearchParams({url:t,width:"600",quality:"85",format:"webp"});return`${e}/api/image-proxy?${n.toString()}`},b3=(t,e)=>{if(!t)return"";if(t.startsWith("blob:")||t.startsWith("data:"))return t;const n=GI(),r=new URLSearchParams({url:t});return`${n}/api/image-proxy?${r.toString()}`};function KI({id:t,title:e,author:n,pageCount:r,thumbnail:i,manga:s,onSelect:o,onEdit:a,onDelete:u,isCategoryPlusEnabled:c,isSelected:f,onToggleSelect:h}){const[p,g]=F.useState(!1),_=i?_3(i):void 0,S=x=>{x.stopPropagation(),g(!0)},P=x=>{x.stopPropagation(),u==null||u(t),g(!1)},v=x=>{x.stopPropagation(),s&&(a==null||a(s))};return d.jsxs("div",{className:"group cursor-pointer flex flex-col w-full max-w-xs",children:[d.jsxs("div",{onClick:()=>{c&&h?h():(Lj(t),o==null||o(t))},className:`relative bg-black rounded-lg shadow-lg overflow-hidden transition-transform duration-300 hover:scale-[1.02] aspect-[2/3] ${f?"ring-4 ring-[#bb86fc]":""}`,children:[_?d.jsxs(d.Fragment,{children:[d.jsx(Kn,{src:_,alt:e,aspectRatio:"2/3",objectFit:"cover",loading:"lazy",imgClassName:"group-hover:scale-110"}),d.jsx("div",{className:"absolute inset-x-0 bottom-0 h-1/3 bg-gradient-to-t from-black/60 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300 pointer-events-none"})]}):d.jsx("div",{className:"w-full aspect-[2/3] flex items-center justify-center text-white/40 bg-gradient-to-br from-gray-800 to-gray-900 rounded-lg group-hover:text-white/60",children:d.jsx(hl,{className:"w-12 h-12"})}),d.jsxs("div",{className:"absolute bottom-2 left-2 bg-black/70 text-white text-xs px-2 py-1 rounded-md font-semibold opacity-0 group-hover:opacity-100 transition-opacity duration-300",children:[r," paginas"]}),c&&d.jsx("div",{className:`absolute top-2 left-2 w-6 h-6 rounded-md border-2 flex items-center justify-center transition-all ${f?"bg-[#bb86fc] border-[#bb86fc]":"bg-black/50 border-white/50 hover:border-white"}`,children:f&&d.jsx(fd,{className:"w-4 h-4 text-white"})}),!c&&d.jsxs("div",{className:"absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity duration-300 flex gap-1",children:[s&&a&&d.jsx("button",{onClick:v,className:"bg-black/60 hover:bg-purple-600 text-white p-1.5 rounded-full transition-colors backdrop-blur-sm",title:"Editar manga",children:d.jsx(ob,{className:"w-3 h-3"})}),u&&d.jsx("button",{onClick:S,className:"bg-black/60 hover:bg-red-600 text-white p-1.5 rounded-full transition-colors backdrop-blur-sm",title:"Eliminar manga",children:d.jsx(zr,{className:"w-3 h-3"})})]}),p&&d.jsxs("div",{className:"absolute inset-0 bg-black/80 backdrop-blur-sm flex flex-col items-center justify-center gap-3 rounded-lg z-20 animate-in fade-in duration-200",children:[d.jsx("p",{className:"text-white text-sm font-semibold text-center px-3",children:"Eliminar manga?"}),d.jsxs("div",{className:"flex gap-2",children:[d.jsx("button",{onClick:x=>{x.stopPropagation(),g(!1)},className:"bg-gray-600 hover:bg-gray-700 text-white px-3 py-1.5 rounded-md text-xs font-semibold transition-all duration-200 transform hover:scale-105 active:scale-95",children:"Cancelar"}),d.jsx("button",{onClick:P,className:"bg-red-600 hover:bg-red-700 text-white px-3 py-1.5 rounded-md text-xs font-semibold transition-all duration-200 transform hover:scale-105 active:scale-95",children:"Eliminar"})]})]})]}),d.jsxs("div",{className:"mt-1 sm:mt-2 flex flex-col gap-0.5 text-center mb-2",children:[d.jsx("h3",{onClick:()=>o==null?void 0:o(t),className:"font-semibold text-xs sm:text-sm text-white line-clamp-2 cursor-pointer text-center group-hover:text-purple-400 transition-colors duration-300 ease-out",children:e}),n&&n.trim()!==""&&n.toLowerCase()!=="anónimo"&&n.toLowerCase()!=="anonimo"&&d.jsx("p",{className:"text-xs text-gray-400 text-center group-hover:text-gray-300 transition-colors duration-300 ease-out",children:n})]})]})}function E3({id:t,onBack:e,onNavigateToManga:n,onMangaLoaded:r,onSelectCategory:i,isAdmin:s=!1}){var K,J,je,Ue,De;const[o,a]=F.useState(null),[u,c]=F.useState(!0),[f,h]=F.useState(!1),[p,g]=F.useState(0),[_,S]=F.useState(!1),[P,v]=F.useState(!1),[x,E]=F.useState(!1),[O,L]=F.useState(0),[D,b]=F.useState(!1),[w,T]=F.useState({name:"",url:""}),[A,N]=F.useState([]),[j,C]=F.useState("portrait"),[se,he]=F.useState("vertical"),[le,me]=F.useState(!1),[q,oe]=F.useState(0),[k,ge]=F.useState([]),[ye,R]=F.useState(!1),[$,Z]=F.useState(""),[ie,Te]=F.useState([]),[fe,Fe]=F.useState(!1),[ee,Ce]=F.useState(!1),[tt,Dt]=F.useState(1),[jt,te]=F.useState(1),ve=6,Ae=()=>te(H=>Math.min(H+.25,3)),Le=()=>te(H=>Math.max(H-.25,.5)),we=()=>te(1);F.useEffect(()=>{tn();const H=Dj(t,de=>{de&&(a(()=>de),c(!1))});Qe(),Z("");const Q=localStorage.getItem("manga-view-mode");return(Q==="vertical"||Q==="gallery"||Q==="grid")&&he(Q),()=>H()},[t]);async function Qe(){try{Fe(!0);const H=await qd();Te(H)}catch(H){console.error("Error loading all mangas:",H)}finally{Fe(!1)}}F.useEffect(()=>{function H(Q){const de=Q.target;_&&!de.closest(".download-menu-container")&&S(!1),P&&!de.closest(".pdf-menu-container")&&v(!1)}return document.addEventListener("mousedown",H),()=>document.removeEventListener("mousedown",H)},[_,P]);const Ht=async()=>{if(w.name.trim()&&w.url.trim()&&o)try{await Vj(o.id,w),N([...A,w]),T({name:"",url:""}),b(!1)}catch(H){console.error("Error al guardar el enlace:",H),alert("Error al guardar el enlace")}},Xe=async H=>{if(o)try{await Fj(o.id,H),N(A.filter((Q,de)=>de!==H))}catch(Q){console.error("Error al eliminar el enlace:",Q),alert("Error al eliminar el enlace")}},ht=H=>{he(H),localStorage.setItem("manga-view-mode",H)};async function tn(){try{c(!0);const H=await UI(t);if(H){if(a(H),N(H.external_links||[]),H.cover_url)try{const Q=await z2(H.cover_url);C(Q)}catch(Q){console.warn("Failed to detect image orientation:",Q),C("portrait")}qt(H)}}catch(H){console.error("Error loading manga:",H)}finally{}}async function qt(H){var Q;try{R(!0);const de=((Q=H.categories)==null?void 0:Q.map(pe=>pe.id))||[],Ie=await Uj(H.id,de,H.title);ge(Ie),Dt(1)}catch(de){console.error("Error loading recommendations:",de)}finally{R(!1)}}async function z(H){const Q=(o==null?void 0:o.id)||t;if(!Q){alert("Error: ID no encontrado.");return}const de=Q;console.log(`🚀 [CLIENTE] Suscribiendo a progreso: ${de}`);const Ie=new EventSource(`/api/download/progress/${de}`);Ie.onmessage=pe=>{const qe=JSON.parse(pe.data);g(qe.progress),qe.progress>=100&&Ie.close()};try{console.log("🚀 [CLIENTE] Iniciando descarga para ID:",Q),h(!0),S(!1),g(0);const pe=await fetch("/api/download/zip",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mangaId:Q,mangaTitle:(o==null?void 0:o.title)||"Descarga",format:H,jobId:de})});if(!pe.ok)throw new Error("Error en el servidor");const qe=await pe.blob(),nt=window.URL.createObjectURL(qe),ft=document.createElement("a");ft.href=nt,ft.download=`${(o==null?void 0:o.title)||"manga"}.zip`,document.body.appendChild(ft),ft.click(),ft.remove(),window.URL.revokeObjectURL(nt),console.log("✅ [CLIENTE] Descarga disparada con éxito")}catch(pe){console.error("❌ Error en la descarga:",pe),alert("Hubo un fallo en la matriz de descarga.")}finally{h(!1),Ie.close()}}async function V(H){const Q=(o==null?void 0:o.id)||t;if(!Q){alert("Error: ID no encontrado.");return}const de=Q;console.log(`🚀 [CLIENTE] Suscribiendo a progreso PDF: ${de}`);const Ie=new EventSource(`/api/download/progress/${de}`);Ie.onmessage=pe=>{const qe=JSON.parse(pe.data);qe.progress&&L(qe.progress),qe.progress>=100&&Ie.close()};try{console.log("🚀 [CLIENTE] Iniciando PDF para ID:",Q),E(!0),L(0),v(!1);const pe=await fetch("/api/download/pdf",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mangaId:Q,mangaTitle:(o==null?void 0:o.title)||"Descarga",format:H,jobId:de})});if(!pe.ok)throw new Error("Error en el servidor al generar PDF");const qe=await pe.blob(),nt=window.URL.createObjectURL(qe),ft=document.createElement("a");ft.href=nt,ft.download=`${(o==null?void 0:o.title)||"manga"}.pdf`,document.body.appendChild(ft),ft.click(),ft.remove(),window.URL.revokeObjectURL(nt),console.log("✅ [CLIENTE] PDF descargado con éxito")}catch(pe){console.error("Error initiating PDF generation:",pe),alert("Error al generar PDF (puede que el archivo sea muy grande o Python falló).")}finally{E(!1),Ie.close()}}if(u)return d.jsxs("div",{className:"h-screen bg-[#121212] flex flex-col items-center justify-center gap-4",children:[d.jsx(bs,{size:40,borderWidth:2}),d.jsx("div",{className:"text-gray-400 text-sm",children:"Cargando..."})]});if(!o)return d.jsx("div",{className:"h-screen bg-[#121212] flex items-center justify-center",children:d.jsx("div",{className:"text-gray-400 text-lg",children:"Manga no encontrado"})});const B=$.trim()?ie.filter(H=>{var qe;if(!H.id||!H.title||H.id===o.id)return!1;const Q=$.toLowerCase(),de=H.title.toLowerCase().includes(Q),Ie=H.author?H.author.toLowerCase().includes(Q):!1,pe=((qe=H.categories)==null?void 0:qe.some(nt=>{var ft;return(ft=nt==null?void 0:nt.name)==null?void 0:ft.toLowerCase().includes(Q)}))||!1;return de||Ie||pe}):[];return d.jsxs("div",{className:"h-screen flex flex-col bg-[#121212] overflow-hidden",children:[d.jsx("header",{className:"border-b border-gray-800 z-40 bg-[#121212] flex-shrink-0",children:d.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 py-3 sm:py-4 flex items-center gap-3 sm:gap-4",children:[d.jsx("button",{onClick:e,className:"p-2 hover:bg-[#333] rounded-lg transition-colors text-gray-300 hover:text-white flex-shrink-0",children:d.jsx(No,{className:"w-5 h-5"})}),d.jsx("h1",{className:"text-base sm:text-lg font-bold text-white truncate flex-shrink-0",children:o.title}),d.jsx("div",{className:"flex-1 max-w-md ml-auto",children:d.jsxs("div",{className:"relative",children:[d.jsx(Tc,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400"}),d.jsx("input",{type:"text",placeholder:"Buscar comics…",value:$,onChange:H=>Z(H.target.value),className:"w-full bg-[#1a1a1a] text-white rounded-lg pl-10 pr-3 py-2 text-sm placeholder-gray-400 focus:ring-2 focus:ring-[#bb86fc] focus:outline-none transition-all border border-gray-700/50 focus:border-[#bb86fc]"})]})})]})}),d.jsxs("main",{className:"flex-1 overflow-y-auto bg-[#121212]",children:[d.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 py-4 sm:py-8",children:[!$.trim()&&d.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 sm:gap-6",children:[d.jsx("div",{className:"flex-shrink-0 mx-auto sm:mx-0",children:d.jsx("div",{className:"group w-56 sm:w-64",children:d.jsx("div",{className:"relative bg-black rounded-lg shadow-lg overflow-hidden transition-transform duration-300 hover:scale-[1.02]",children:o.cover_url?d.jsxs(d.Fragment,{children:[d.jsx(Kn,{src:o.cover_url,alt:o.title,aspectRatio:"2/3",objectFit:"cover",loading:"eager",imgClassName:"group-hover:scale-110"}),d.jsx("div",{className:"absolute inset-x-0 bottom-0 h-1/3 bg-gradient-to-t from-black/60 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300 ease-in-out pointer-events-none"})]}):d.jsx("div",{className:"w-full aspect-[2/3] flex items-center justify-center text-white/40 bg-black",children:d.jsx(rv,{className:"w-16 h-16"})})})})}),d.jsxs("div",{className:"flex-1 min-w-0",children:[d.jsx("h2",{className:"text-2xl sm:text-4xl font-bold text-white mb-3 sm:mb-4",children:o.title}),d.jsx("div",{className:"mb-4",children:d.jsxs("div",{className:"flex items-center gap-2 text-gray-300",children:[o.author&&o.author.toLowerCase()!=="anónimo"&&o.author.toLowerCase()!=="anonimo"&&d.jsxs(d.Fragment,{children:[d.jsx(M2,{className:"w-4 h-4 text-[#bb86fc]"}),d.jsx("span",{className:"text-sm",children:o.author}),d.jsx("div",{className:"w-1 h-1 bg-gray-600 rounded-full mx-2"})]}),d.jsx(rp,{className:"w-4 h-4 text-[#bb86fc]"}),d.jsxs("span",{className:"text-sm",children:[((K=o.views)==null?void 0:K.toLocaleString())||0," vistas"]})]})}),d.jsxs("div",{className:"mb-6",children:[d.jsx("h3",{className:"text-sm font-semibold text-gray-300 mb-3",children:"Categorías"}),d.jsx("div",{className:"flex gap-2 flex-wrap",children:(J=o.categories)==null?void 0:J.sort((H,Q)=>{const de={series:1,character:2,genre:3,tag:4,other:5},Ie=H.type||"genre",pe=Q.type||"genre";return(de[Ie]||5)-(de[pe]||5)}).map(H=>{let Q="bg-[#bb86fc]/20 text-[#bb86fc] border-[#bb86fc]/40";return H.type==="character"?Q="bg-blue-500/20 text-blue-300 border-blue-500/30":H.type==="series"?Q="bg-green-500/20 text-green-300 border-green-500/30":H.type==="tag"&&(Q="bg-pink-500/20 text-pink-300 border-pink-500/30"),d.jsx("button",{onClick:()=>i==null?void 0:i(H.name),className:`px-3 py-1.5 text-xs rounded-full border ${Q} hover:opacity-80 transition-opacity cursor-pointer`,children:H.name},H.id)})})]}),o.description&&o.description.trim()!==""&&d.jsxs("div",{className:"mb-6",children:[d.jsx("h3",{className:"text-sm font-semibold text-gray-300 mb-2",children:"Sinopsis"}),d.jsx("p",{className:"text-sm text-gray-400 leading-relaxed whitespace-pre-wrap",children:o.description})]}),d.jsx("div",{className:"flex flex-col gap-3 sm:gap-4",children:o.chapters&&o.chapters.length>0&&o.chapters[0].pages&&o.chapters[0].pages.length>0&&d.jsxs(d.Fragment,{children:[f&&d.jsxs("div",{className:"w-full",children:[d.jsxs("div",{className:"flex items-center justify-between mb-2",children:[d.jsx("span",{className:"text-xs sm:text-sm font-semibold text-[#bb86fc]",children:"Descargando ZIP"}),d.jsxs("span",{className:"text-xs sm:text-sm font-bold text-[#bb86fc]",children:[p,"%"]})]}),d.jsx("div",{className:"w-full bg-gray-700/40 rounded-full h-2 overflow-hidden border border-[#bb86fc]/30",children:d.jsx("div",{className:"bg-gradient-to-r from-[#bb86fc] to-[#9966dd] h-full transition-all duration-300 ease-out",style:{width:`${p}%`}})})]}),x&&d.jsxs("div",{className:"w-full",children:[d.jsxs("div",{className:"flex items-center justify-between mb-2",children:[d.jsx("span",{className:"text-xs sm:text-sm font-semibold text-[#bb86fc]",children:"Generando PDF"}),d.jsxs("span",{className:"text-xs sm:text-sm font-bold text-[#bb86fc]",children:[O,"%"]})]}),d.jsx("div",{className:"w-full bg-gray-700/40 rounded-full h-2 overflow-hidden border border-[#bb86fc]/30",children:d.jsx("div",{className:"bg-gradient-to-r from-[#bb86fc] to-[#9966dd] h-full transition-all duration-300 ease-out",style:{width:`${O}%`}})})]}),d.jsxs("div",{className:"flex flex-wrap gap-2 items-center",children:[d.jsxs("div",{className:"relative download-menu-container",children:[d.jsxs("button",{onClick:()=>S(!_),disabled:f,className:"bg-[#121212] hover:bg-[#1f1f1f] border border-[#bb86fc]/50 hover:border-[#bb86fc] text-[#bb86fc] px-2 sm:px-3 py-1.5 sm:py-2 rounded-lg flex items-center gap-1 font-semibold text-xs sm:text-sm transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed",children:[d.jsx(ga,{className:"w-3 h-3 sm:w-4 sm:h-4 flex-shrink-0"}),d.jsx("span",{className:"hidden sm:inline",children:f?`Descargando (${p}%)`:"ZIP"}),d.jsx("span",{className:"sm:hidden",children:"ZIP"})]}),_&&!f&&d.jsxs("div",{className:"absolute top-full mt-2 left-0 bg-[#1f1f1f] border border-gray-700/60 rounded-lg shadow-2xl shadow-black/50 overflow-hidden z-50 min-w-[200px]",children:[d.jsxs("button",{onClick:()=>z("original"),className:"w-full px-3 py-2 text-left text-xs sm:text-sm text-white hover:bg-[#bb86fc]/20 transition-colors flex items-center gap-2 border-b border-gray-700/40",children:[d.jsx(ga,{className:"w-3 h-3 text-[#bb86fc]"}),d.jsxs("div",{children:[d.jsx("div",{className:"font-semibold",children:"Original"}),d.jsx("div",{className:"text-xs text-gray-400",children:"Sin cambios"})]})]}),d.jsxs("button",{onClick:()=>z("webp"),className:"w-full px-3 py-2 text-left text-xs sm:text-sm text-white hover:bg-[#bb86fc]/20 transition-colors flex items-center gap-2 border-b border-gray-700/40",children:[d.jsx(ga,{className:"w-3 h-3 text-[#bb86fc]"}),d.jsxs("div",{children:[d.jsx("div",{className:"font-semibold",children:"WebP"}),d.jsx("div",{className:"text-xs text-gray-400",children:"Optimizado"})]})]}),d.jsxs("button",{onClick:()=>z("png"),className:"w-full px-3 py-2 text-left text-xs sm:text-sm text-white hover:bg-[#bb86fc]/20 transition-colors flex items-center gap-2 border-b border-gray-700/40",children:[d.jsx(ga,{className:"w-3 h-3 text-[#bb86fc]"}),d.jsxs("div",{children:[d.jsx("div",{className:"font-semibold",children:"PNG"}),d.jsx("div",{className:"text-xs text-gray-400",children:"Sin pérdida"})]})]}),d.jsxs("button",{onClick:()=>z("jpg"),className:"w-full px-3 py-2 text-left text-xs sm:text-sm text-white hover:bg-[#bb86fc]/20 transition-colors flex items-center gap-2",children:[d.jsx(ga,{className:"w-3 h-3 text-[#bb86fc]"}),d.jsxs("div",{children:[d.jsx("div",{className:"font-semibold",children:"JPG"}),d.jsx("div",{className:"text-xs text-gray-400",children:"Comprimido"})]})]})]})]}),d.jsxs("div",{className:"relative pdf-menu-container",children:[d.jsxs("button",{onClick:()=>v(!P),disabled:x,className:"bg-[#121212] hover:bg-[#1f1f1f] border border-[#bb86fc]/50 hover:border-[#bb86fc] text-[#bb86fc] px-2 sm:px-3 py-1.5 sm:py-2 rounded-lg flex items-center gap-1 font-semibold text-xs sm:text-sm transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed",children:[d.jsx(ya,{className:"w-3 h-3 sm:w-4 sm:h-4 flex-shrink-0"}),d.jsx("span",{className:"hidden sm:inline",children:x?`Generando (${O}%)`:"PDF"}),d.jsx("span",{className:"sm:hidden",children:"PDF"})]}),P&&!x&&d.jsxs("div",{className:"absolute top-full mt-2 left-0 bg-[#1f1f1f] border border-gray-700/60 rounded-lg shadow-2xl shadow-black/50 overflow-hidden z-50 min-w-[200px]",children:[d.jsxs("button",{onClick:()=>V("original"),className:"w-full px-3 py-2 text-left text-xs sm:text-sm text-white hover:bg-[#bb86fc]/20 transition-colors flex items-center gap-2 border-b border-gray-700/40",children:[d.jsx(ya,{className:"w-3 h-3 text-[#bb86fc]"}),d.jsxs("div",{children:[d.jsx("div",{className:"font-semibold",children:"Original"}),d.jsx("div",{className:"text-xs text-gray-400",children:"Sin cambios"})]})]}),d.jsxs("button",{onClick:()=>V("webp"),className:"w-full px-3 py-2 text-left text-xs sm:text-sm text-white hover:bg-[#bb86fc]/20 transition-colors flex items-center gap-2 border-b border-gray-700/40",children:[d.jsx(ya,{className:"w-3 h-3 text-[#bb86fc]"}),d.jsxs("div",{children:[d.jsx("div",{className:"font-semibold",children:"WebP"}),d.jsx("div",{className:"text-xs text-gray-400",children:"Optimizado"})]})]}),d.jsxs("button",{onClick:()=>V("png"),className:"w-full px-3 py-2 text-left text-xs sm:text-sm text-white hover:bg-[#bb86fc]/20 transition-colors flex items-center gap-2 border-b border-gray-700/40",children:[d.jsx(ya,{className:"w-3 h-3 text-[#bb86fc]"}),d.jsxs("div",{children:[d.jsx("div",{className:"font-semibold",children:"PNG"}),d.jsx("div",{className:"text-xs text-gray-400",children:"Sin pérdida"})]})]}),d.jsxs("button",{onClick:()=>V("jpg"),className:"w-full px-3 py-2 text-left text-xs sm:text-sm text-white hover:bg-[#bb86fc]/20 transition-colors flex items-center gap-2",children:[d.jsx(ya,{className:"w-3 h-3 text-[#bb86fc]"}),d.jsxs("div",{children:[d.jsx("div",{className:"font-semibold",children:"JPG"}),d.jsx("div",{className:"text-xs text-gray-400",children:"Comprimido"})]})]})]})]}),d.jsxs("button",{onClick:()=>{o!=null&&o.id&&(window.location.hash=`manga/${o.id}/hd`)},className:"bg-[#121212] hover:bg-[#1f1f1f] border border-[#bb86fc]/50 hover:border-[#bb86fc] text-[#bb86fc] px-2 sm:px-3 py-1.5 sm:py-2 rounded-lg flex items-center gap-1 font-semibold text-xs sm:text-sm transition-all duration-200",children:[d.jsx(rp,{className:"w-3 h-3 sm:w-4 sm:h-4 flex-shrink-0"}),d.jsx("span",{className:"hidden sm:inline",children:"Ver HD"}),d.jsx("span",{className:"sm:hidden",children:"HD"})]}),d.jsxs("button",{onClick:async()=>{try{await navigator.clipboard.writeText(o.id),Ce(!0),setTimeout(()=>Ce(!1),2e3),window.open("https://t.me/waifuofbrodybot","_blank")}catch(H){console.error("Failed to copy:",H)}},className:"bg-[#121212] hover:bg-[#1f1f1f] border border-[#bb86fc]/50 hover:border-[#bb86fc] text-[#bb86fc] px-2 sm:px-3 py-1.5 sm:py-2 rounded-lg flex items-center gap-1 font-semibold text-xs sm:text-sm transition-all duration-200",children:[ee?d.jsx(fd,{className:"w-3 h-3 sm:w-4 sm:h-4 flex-shrink-0"}):d.jsx(R2,{className:"w-3 h-3 sm:w-4 sm:h-4 flex-shrink-0"}),d.jsx("span",{className:"hidden sm:inline",children:ee?"ID Copiado":"Bot Telegram"}),d.jsx("span",{className:"sm:hidden",children:ee?"Copiado":"Bot"})]}),A.map((H,Q)=>d.jsxs("a",{href:H.url,target:"_blank",rel:"noopener noreferrer",className:"bg-[#121212] hover:bg-[#1f1f1f] border border-[#bb86fc]/50 hover:border-[#bb86fc] text-[#bb86fc] px-2 sm:px-3 py-1.5 sm:py-2 rounded-lg flex items-center gap-1.5 font-semibold text-xs sm:text-sm transition-all duration-200 group",children:[d.jsx(N2,{className:"w-3 h-3 sm:w-4 sm:h-4 flex-shrink-0"}),d.jsx("span",{className:"truncate max-w-[150px]",children:H.name}),s&&d.jsx("button",{onClick:de=>{de.preventDefault(),de.stopPropagation(),Xe(Q)},className:"opacity-0 group-hover:opacity-100 hover:text-red-400 transition-all flex-shrink-0",children:d.jsx(Vn,{className:"w-3 h-3 sm:w-4 sm:h-4"})})]},Q)),s&&d.jsx("button",{onClick:()=>b(!0),className:"bg-[#121212] hover:bg-[#1f1f1f] border border-[#bb86fc]/50 hover:border-[#bb86fc] text-[#bb86fc] p-1.5 sm:p-2 rounded-lg transition-all duration-200 flex items-center justify-center",title:"Añadir enlace externo",children:d.jsx(fl,{className:"w-4 h-4 sm:w-5 sm:h-5"})})]})]})})]})]}),$.trim()?d.jsxs("div",{className:"mt-2",children:[d.jsxs("h3",{className:"text-lg font-semibold text-white mb-4",children:["Resultados de búsqueda",B.length>0&&d.jsxs("span",{className:"text-sm text-gray-400 ml-2",children:["(",B.length," ",B.length===1?"resultado":"resultados",")"]})]}),fe?d.jsx("div",{className:"flex justify-center py-12",children:d.jsx(bs,{size:40,borderWidth:2})}):B.length===0?d.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[d.jsx(Tc,{className:"w-12 h-12 text-gray-600 mb-3"}),d.jsxs("p",{className:"text-gray-400 text-sm",children:['No se encontraron comics que coincidan con "',$,'"']})]}):d.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 gap-1.5 sm:gap-2 md:gap-3",children:B.map(H=>{var de,Ie;if(!H.id||!H.title)return null;(de=H.chapters)!=null&&de.length;const Q=((Ie=H.chapters)==null?void 0:Ie.reduce((pe,qe)=>{var nt;return pe+(((nt=qe.pages)==null?void 0:nt.length)||0)},0))||0;return d.jsx(KI,{id:H.id,title:H.title,author:H.author||"Desconocido",pageCount:Q,thumbnail:H.cover_url||H.thumbnail_url||void 0,manga:H,onSelect:pe=>{n&&(window.scrollTo({top:0,behavior:"smooth"}),n(pe))}},H.id)})})]}):o.chapters&&o.chapters.length>0&&o.chapters[0].pages&&o.chapters[0].pages.length>0&&d.jsxs("div",{className:"mt-6 sm:mt-8 border-t border-gray-800 pt-6 sm:pt-8",children:[d.jsxs("div",{className:"flex items-center justify-between mb-4 sm:mb-6",children:[d.jsx("h3",{className:"text-lg font-semibold text-white",children:"Páginas"}),d.jsxs("div",{className:"flex items-center gap-1 bg-[#0a0a0a] border border-gray-800 rounded-lg p-1",children:[d.jsxs("button",{onClick:()=>ht("vertical"),className:`px-3 py-2 rounded-md flex items-center gap-2 text-xs sm:text-sm font-medium transition-all duration-200 ${se==="vertical"?"bg-gradient-to-r from-[#bb86fc] to-[#9966dd] text-white shadow-lg shadow-[#bb86fc]/30":"text-gray-400 hover:text-white hover:bg-[#242424]"}`,title:"Vista vertical",children:[d.jsx(op,{className:"w-4 h-4"}),d.jsx("span",{className:"hidden sm:inline",children:"Vertical"})]}),d.jsxs("button",{onClick:()=>ht("gallery"),className:`px-3 py-2 rounded-md flex items-center gap-2 text-xs sm:text-sm font-medium transition-all duration-200 ${se==="gallery"?"bg-gradient-to-r from-[#bb86fc] to-[#9966dd] text-white shadow-lg shadow-[#bb86fc]/30":"text-gray-400 hover:text-white hover:bg-[#242424]"}`,title:"Vista galería",children:[d.jsx(ip,{className:"w-4 h-4"}),d.jsx("span",{className:"hidden sm:inline",children:"Galería"})]}),d.jsxs("button",{onClick:()=>ht("grid"),className:`px-3 py-2 rounded-md flex items-center gap-2 text-xs sm:text-sm font-medium transition-all duration-200 ${se==="grid"?"bg-gradient-to-r from-[#bb86fc] to-[#9966dd] text-white shadow-lg shadow-[#bb86fc]/30":"text-gray-400 hover:text-white hover:bg-[#242424]"}`,title:"Vista cuadrícula",children:[d.jsx(sp,{className:"w-4 h-4"}),d.jsx("span",{className:"hidden sm:inline",children:"Cuadrícula"})]}),se==="vertical"&&d.jsxs("div",{className:"flex items-center gap-1 ml-2 border-l border-gray-700 pl-2",children:[d.jsx("button",{onClick:Le,className:"p-2 text-gray-400 hover:text-white hover:bg-[#242424] rounded-md transition-colors",title:"Reducir",children:d.jsx($m,{className:"w-4 h-4"})}),d.jsxs("span",{className:"text-xs text-gray-300 w-8 text-center hidden sm:inline-block",children:[Math.round(jt*100),"%"]}),d.jsx("button",{onClick:Ae,className:"p-2 text-gray-400 hover:text-white hover:bg-[#242424] rounded-md transition-colors",title:"Aumentar",children:d.jsx(Bm,{className:"w-4 h-4"})}),d.jsx("button",{onClick:we,className:"p-2 text-gray-400 hover:text-white hover:bg-[#242424] rounded-md transition-colors",title:"Restablecer",children:d.jsx(ab,{className:"w-3 h-3"})})]})]})]}),d.jsx("div",{className:`bg-[#121212] rounded-lg p-2 sm:p-4 transition-all duration-150 ease-out ${se==="vertical"?"flex flex-col items-center gap-4":se==="gallery"?"masonry-container":"grid grid-cols-3 md:grid-cols-5 gap-2"}`,children:se==="gallery"?o.chapters[0].pages.map((H,Q)=>({pageUrl:H,index:Q})).map(({pageUrl:H,index:Q})=>d.jsx("div",{className:"masonry-item group cursor-pointer relative bg-black rounded-lg shadow-lg overflow-hidden transition-transform duration-300 hover:scale-[1.02]",onClick:()=>{oe(Q),me(!0)},children:d.jsx(Kn,{src:H,alt:`Página ${Q+1}`,aspectRatio:"auto",objectFit:"contain",loading:Q>2?"lazy":"eager",className:"rounded-lg",imgClassName:"group-hover:scale-110"})},Q)):o.chapters[0].pages.map((H,Q)=>({pageUrl:H,index:Q})).map(({pageUrl:H,index:Q})=>d.jsx("div",{className:se==="vertical"?"relative transition-all duration-200 mx-auto":"group cursor-pointer relative bg-black rounded-lg shadow-lg overflow-hidden transition-transform duration-300 hover:scale-[1.02]",style:se==="vertical"?{width:`${Math.min(100*jt,100)}%`,maxWidth:jt>1?"none":void 0}:void 0,onClick:()=>{se==="grid"&&(oe(Q),me(!0))},children:d.jsx(Kn,{src:H,alt:`Página ${Q+1}`,aspectRatio:se==="vertical"?"auto":"1/1",objectFit:se==="vertical"?"contain":"cover",loading:Q>2?"lazy":"eager",className:se==="vertical"?"rounded-lg shadow-2xl w-full":"rounded-lg",imgClassName:se==="vertical"?"w-full":"group-hover:scale-110"})},Q))})]}),!$.trim()&&k.length>0&&d.jsxs("div",{className:"mt-8 sm:mt-12 border-t border-gray-800 pt-8 sm:pt-12",children:[d.jsx("h3",{className:"text-xl sm:text-2xl font-bold text-white mb-6",children:"Recomendaciones"}),ye?d.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 gap-1.5 sm:gap-2 md:gap-3",children:Array.from({length:6}).map((H,Q)=>d.jsxs("div",{className:"animate-pulse",children:[d.jsx("div",{className:"bg-gray-800 rounded-lg aspect-[2/3] w-full mb-2"}),d.jsx("div",{className:"h-3 bg-gray-800 rounded w-3/4 mx-auto mb-1"}),d.jsx("div",{className:"h-2 bg-gray-800 rounded w-1/2 mx-auto"})]},Q))}):d.jsxs(d.Fragment,{children:[d.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 gap-1.5 sm:gap-2 md:gap-3 mb-6 animate-slide-in-right",children:k.slice((tt-1)*ve,tt*ve).map((H,Q)=>d.jsx("div",{children:d.jsxs("div",{onClick:()=>{window.scrollTo({top:0,behavior:"smooth"}),n&&n(H.id)},className:"group cursor-pointer flex flex-col",children:[d.jsx("div",{className:"relative bg-black rounded-lg shadow-lg overflow-hidden transition-transform duration-300 hover:scale-[1.02]",children:H.cover_url||H.thumbnail_url?d.jsxs(d.Fragment,{children:[d.jsx(Kn,{src:H.cover_url||H.thumbnail_url||"",alt:H.title,aspectRatio:"2/3",objectFit:"cover",loading:"lazy",imgClassName:"group-hover:scale-110"}),d.jsx("div",{className:"absolute inset-x-0 bottom-0 h-1/3 bg-gradient-to-t from-black/60 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300 ease-in-out pointer-events-none"})]}):d.jsx("div",{className:"w-full aspect-[2/3] flex items-center justify-center text-white/40 bg-black",children:d.jsx(rv,{className:"w-8 h-8"})})}),d.jsxs("div",{className:"mt-2 flex flex-col gap-0.5",children:[d.jsx("h4",{className:"font-semibold text-xs text-white line-clamp-2 text-center group-hover:text-[#bb86fc] transition-colors duration-300",children:H.title}),H.categories&&H.categories.length>0&&d.jsx("p",{className:"text-xs text-gray-500 text-center truncate",children:(H.categories.find(de=>de.type==="series")||H.categories[0]).name})]})]})},H.id))},tt),k.length>ve&&d.jsxs("div",{className:"flex items-center justify-center gap-2 mt-4 flex-wrap",children:[d.jsx("button",{onClick:()=>Dt(1),disabled:tt===1,className:"p-2 rounded-lg bg-[#1a1a1a] text-white hover:bg-[#bb86fc] disabled:opacity-50 disabled:hover:bg-[#1a1a1a] transition-colors",children:d.jsx(eb,{className:"w-4 h-4"})}),d.jsx("button",{onClick:()=>Dt(H=>Math.max(1,H-1)),disabled:tt===1,className:"p-2 rounded-lg bg-[#1a1a1a] text-white hover:bg-[#bb86fc] disabled:opacity-50 disabled:hover:bg-[#1a1a1a] transition-colors",children:d.jsx(pd,{className:"w-4 h-4"})}),d.jsxs("span",{className:"text-sm text-gray-400 px-2",children:["Página ",tt," de ",Math.ceil(k.length/ve)]}),d.jsx("button",{onClick:()=>Dt(H=>Math.min(Math.ceil(k.length/ve),H+1)),disabled:tt===Math.ceil(k.length/ve),className:"p-2 rounded-lg bg-[#1a1a1a] text-white hover:bg-[#bb86fc] disabled:opacity-50 disabled:hover:bg-[#1a1a1a] transition-colors",children:d.jsx(md,{className:"w-4 h-4"})}),d.jsx("button",{onClick:()=>Dt(Math.ceil(k.length/ve)),disabled:tt===Math.ceil(k.length/ve),className:"p-2 rounded-lg bg-[#1a1a1a] text-white hover:bg-[#bb86fc] disabled:opacity-50 disabled:hover:bg-[#1a1a1a] transition-colors",children:d.jsx(tb,{className:"w-4 h-4"})})]})]})]})]}),d.jsx(gd,{})]}),le&&((Ue=(je=o.chapters)==null?void 0:je[0])==null?void 0:Ue.pages)&&d.jsx(ub,{images:((De=o.chapters)==null?void 0:De[0].pages)||[],initialIndex:q,onClose:()=>me(!1)}),D&&d.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",children:d.jsxs("div",{className:"bg-gradient-to-b from-[#1f1f1f] to-[#121212] rounded-2xl border border-gray-700/40 w-full max-w-md shadow-2xl",children:[d.jsxs("div",{className:"bg-gradient-to-b from-[#2a2a2a]/80 to-[#1f1f1f]/80 border-b border-gray-700/30 px-6 py-4 flex items-center justify-between",children:[d.jsx("h2",{className:"text-xl font-bold text-white",children:"Añadir Enlace Externo"}),d.jsx("button",{onClick:()=>b(!1),className:"text-gray-500 hover:text-white transition-colors p-1.5 rounded-lg hover:bg-white/10",children:d.jsx(Vn,{className:"w-5 h-5"})})]}),d.jsxs("div",{className:"p-6 space-y-4",children:[d.jsxs("div",{children:[d.jsx("label",{className:"block text-sm font-semibold text-gray-200 mb-2",children:"Nombre del Enlace"}),d.jsx("input",{type:"text",placeholder:"Ej: Servidor Alternativo",value:w.name,onChange:H=>T({...w,name:H.target.value}),className:"w-full bg-[#1a1a1a] border border-gray-600/50 rounded-lg px-4 py-3 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-[#bb86fc] focus:ring-2 focus:ring-[#bb86fc]/30 transition-all"})]}),d.jsxs("div",{children:[d.jsx("label",{className:"block text-sm font-semibold text-gray-200 mb-2",children:"URL del Enlace"}),d.jsx("input",{type:"url",placeholder:"https://ejemplo.com/descarga",value:w.url,onChange:H=>T({...w,url:H.target.value}),className:"w-full bg-[#1a1a1a] border border-gray-600/50 rounded-lg px-4 py-3 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-[#bb86fc] focus:ring-2 focus:ring-[#bb86fc]/30 transition-all"})]}),d.jsxs("div",{className:"flex gap-3 pt-2",children:[d.jsx("button",{onClick:()=>b(!1),className:"flex-1 bg-[#1a1a1a] border border-gray-600/50 hover:border-gray-500 hover:bg-[#242424] text-white px-4 py-3 rounded-lg font-semibold text-sm transition-all",children:"Cancelar"}),d.jsx("button",{onClick:Ht,disabled:!w.name.trim()||!w.url.trim(),className:"flex-1 bg-gradient-to-r from-[#bb86fc] to-[#9966dd] hover:from-[#9966dd] hover:to-[#7744cc] disabled:opacity-50 disabled:cursor-not-allowed text-white px-4 py-3 rounded-lg font-semibold text-sm transition-all shadow-lg shadow-[#bb86fc]/40 hover:shadow-[#bb86fc]/60",children:"Añadir Enlace"})]})]})]})})]})}function I3({manga:t,chapter:e,onBack:n}){const[r,i]=F.useState(0);if(!e.pages||e.pages.length===0)return d.jsxs("div",{className:"h-screen bg-[#121212] flex flex-col items-center justify-center",children:[d.jsx("button",{onClick:n,className:"absolute top-6 left-6 p-2 hover:bg-[#333] rounded-lg transition-colors text-gray-300 hover:text-white",children:d.jsx(No,{className:"w-5 h-5"})}),d.jsx("div",{className:"text-gray-400 text-lg",children:"No hay páginas disponibles"})]});const s=()=>{r>0&&i(r-1)},o=()=>{r{const c=u<2,f=b3(a);return d.jsx("div",{className:"w-full flex justify-center",children:d.jsx(Kn,{src:f,alt:`Página ${u+1}`,aspectRatio:"auto",objectFit:"contain",loading:c?"eager":"lazy",className:"max-w-full shadow-2xl",showPlaceholder:u>0})},u)}),d.jsx("div",{className:"w-full mt-8",children:d.jsx(gd,{})})]})}),d.jsx("div",{className:"border-t border-gray-700/60 bg-gradient-to-r from-[#2a2a2a] to-[#252525] px-6 py-6 flex-shrink-0",children:d.jsxs("div",{className:"max-w-7xl mx-auto flex items-center justify-between",children:[d.jsxs("button",{onClick:s,disabled:r===0,className:"flex items-center gap-2 px-4 py-2 rounded-lg bg-gray-800 hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed text-white transition-all",children:[d.jsx(pd,{className:"w-5 h-5"}),"Anterior"]}),d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx("input",{type:"range",min:"0",max:e.pages.length-1,value:r,onChange:a=>i(parseInt(a.target.value)),className:"w-64 h-2 bg-gray-700 rounded-lg appearance-none cursor-pointer accent-[#bb86fc]"}),d.jsxs("span",{className:"text-sm text-gray-400 w-12 text-right",children:[r+1,"/",e.pages.length]})]}),d.jsxs("button",{onClick:o,disabled:r===e.pages.length-1,className:"flex items-center gap-2 px-4 py-2 rounded-lg bg-gray-800 hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed text-white transition-all",children:["Siguiente",d.jsx(md,{className:"w-5 h-5"})]})]})})]})}const QI="settings",YI="info",T3=`# Bienvenid@ a Twisted Brody MangaFlow +¡Tu plataforma definitiva para la gestión y lectura de mangas! + +Este proyecto nació con la misión de ofrecer una experiencia de lectura fluida, moderna y sin interrupciones, diseñada por fans para fans. + +## 🌟 Características Principales + +* **⚡ Lectura sin límites:** Disfruta de una interfaz optimizada, rápida y responsiva. +* **📥 Descargas Flexibles:** Baja tus capítulos favoritos en formato **ZIP** o **PDF** para leer offline. +* **🔄 Conversión Inteligente:** Nuestro servidor procesa las imágenes para darte la mejor calidad y compatibilidad. + +## 🤝 Comunidad y Apoyo + +Este es un proyecto **sin fines de lucro**, desarrollado por pura pasión. + +Sin embargo, si valoras mi trabajo y quieres apoyarme para mantener el proyecto vivo, puedes suscribirte a mi **Patreon**. ¡Tu apoyo significa mucho! + +* [**💜 Apóyame en Patreon**](https://www.patreon.com/cw/Twistedbrody) + +### 💡 ¿Tienes nuevas ideas? +¡Quiero escucharlas! Si tienes sugerencias, feedback o ideas locas, háblame directamente: + +* **Telegram:** [@twistedbrodyoficial](https://t.me/twistedbrodyoficial) + +También puedes unirte a nuestros canales: +* [Canal Principal](https://t.me/twistedbrody) +* [Canal Hub](https://t.me/+CmmZFHM9hpViYzMx) +* [X (Twitter)](https://x.com/TwistedBrody) + +--- +> **Disclaimer:** Todo el contenido es propiedad de sus respectivos autores. Apoya el material original siempre que sea posible. + + +`;async function S3(t){const e=vt(Ge,QI,YI),n={content:t,updatedAt:new Date().toISOString()};await Og(e,n)}function k3(t){const e=vt(Ge,QI,YI);return Mg(e,n=>{n.exists()?t(n.data()):t({content:T3,updatedAt:new Date().toISOString()})})}function C3(t,e){const n={};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const N3=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,A3=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,P3={};function Qx(t,e){return(P3.jsx?A3:N3).test(t)}const R3=/[ \t\n\f\r]/g;function D3(t){return typeof t=="object"?t.type==="text"?Yx(t.value):!1:Yx(t)}function Yx(t){return t.replace(R3,"")===""}class Bl{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}Bl.prototype.normal={};Bl.prototype.property={};Bl.prototype.space=void 0;function XI(t,e){const n={},r={};for(const i of t)Object.assign(n,i.property),Object.assign(r,i.normal);return new Bl(n,r,e)}function Lp(t){return t.toLowerCase()}class Cn{constructor(e,n){this.attribute=n,this.property=e}}Cn.prototype.attribute="";Cn.prototype.booleanish=!1;Cn.prototype.boolean=!1;Cn.prototype.commaOrSpaceSeparated=!1;Cn.prototype.commaSeparated=!1;Cn.prototype.defined=!1;Cn.prototype.mustUseProperty=!1;Cn.prototype.number=!1;Cn.prototype.overloadedBoolean=!1;Cn.prototype.property="";Cn.prototype.spaceSeparated=!1;Cn.prototype.space=void 0;let j3=0;const Oe=zs(),Nt=zs(),Mp=zs(),X=zs(),it=zs(),wo=zs(),Rn=zs();function zs(){return 2**++j3}const Vp=Object.freeze(Object.defineProperty({__proto__:null,boolean:Oe,booleanish:Nt,commaOrSpaceSeparated:Rn,commaSeparated:wo,number:X,overloadedBoolean:Mp,spaceSeparated:it},Symbol.toStringTag,{value:"Module"})),Xh=Object.keys(Vp);class Qg extends Cn{constructor(e,n,r,i){let s=-1;if(super(e,n),Xx(this,"space",i),typeof r=="number")for(;++s4&&n.slice(0,4)==="data"&&F3.test(e)){if(e.charAt(4)==="-"){const s=e.slice(5).replace(Jx,B3);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=e.slice(4);if(!Jx.test(s)){let o=s.replace(V3,z3);o.charAt(0)!=="-"&&(o="-"+o),e="data"+o}}i=Qg}return new i(r,e)}function z3(t){return"-"+t.toLowerCase()}function B3(t){return t.charAt(1).toUpperCase()}const $3=XI([JI,O3,tT,nT,rT],"html"),Yg=XI([JI,L3,tT,nT,rT],"svg");function H3(t){return t.join(" ").trim()}var Xg={},Zx=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,q3=/\n/g,W3=/^\s*/,G3=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,K3=/^:\s*/,Q3=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,Y3=/^[;\s]*/,X3=/^\s+|\s+$/g,J3=` +`,ew="/",tw="*",hs="",Z3="comment",e5="declaration";function t5(t,e){if(typeof t!="string")throw new TypeError("First argument must be a string");if(!t)return[];e=e||{};var n=1,r=1;function i(_){var S=_.match(q3);S&&(n+=S.length);var P=_.lastIndexOf(J3);r=~P?_.length-P:r+_.length}function s(){var _={line:n,column:r};return function(S){return S.position=new o(_),c(),S}}function o(_){this.start=_,this.end={line:n,column:r},this.source=e.source}o.prototype.content=t;function a(_){var S=new Error(e.source+":"+n+":"+r+": "+_);if(S.reason=_,S.filename=e.source,S.line=n,S.column=r,S.source=t,!e.silent)throw S}function u(_){var S=_.exec(t);if(S){var P=S[0];return i(P),t=t.slice(P.length),S}}function c(){u(W3)}function f(_){var S;for(_=_||[];S=h();)S!==!1&&_.push(S);return _}function h(){var _=s();if(!(ew!=t.charAt(0)||tw!=t.charAt(1))){for(var S=2;hs!=t.charAt(S)&&(tw!=t.charAt(S)||ew!=t.charAt(S+1));)++S;if(S+=2,hs===t.charAt(S-1))return a("End of comment missing");var P=t.slice(2,S-2);return r+=2,i(P),t=t.slice(S),r+=2,_({type:Z3,comment:P})}}function p(){var _=s(),S=u(G3);if(S){if(h(),!u(K3))return a("property missing ':'");var P=u(Q3),v=_({type:e5,property:nw(S[0].replace(Zx,hs)),value:P?nw(P[0].replace(Zx,hs)):hs});return u(Y3),v}}function g(){var _=[];f(_);for(var S;S=p();)S!==!1&&(_.push(S),f(_));return _}return c(),g()}function nw(t){return t?t.replace(X3,hs):hs}var n5=t5,r5=ec&&ec.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Xg,"__esModule",{value:!0});Xg.default=s5;const i5=r5(n5);function s5(t,e){let n=null;if(!t||typeof t!="string")return n;const r=(0,i5.default)(t),i=typeof e=="function";return r.forEach(s=>{if(s.type!=="declaration")return;const{property:o,value:a}=s;i?e(o,a,s):a&&(n=n||{},n[o]=a)}),n}var Kd={};Object.defineProperty(Kd,"__esModule",{value:!0});Kd.camelCase=void 0;var o5=/^--[a-zA-Z0-9_-]+$/,a5=/-([a-z])/g,l5=/^[^-]+$/,u5=/^-(webkit|moz|ms|o|khtml)-/,c5=/^-(ms)-/,d5=function(t){return!t||l5.test(t)||o5.test(t)},h5=function(t,e){return e.toUpperCase()},rw=function(t,e){return"".concat(e,"-")},f5=function(t,e){return e===void 0&&(e={}),d5(t)?t:(t=t.toLowerCase(),e.reactCompat?t=t.replace(c5,rw):t=t.replace(u5,rw),t.replace(a5,h5))};Kd.camelCase=f5;var p5=ec&&ec.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},m5=p5(Xg),g5=Kd;function Fp(t,e){var n={};return!t||typeof t!="string"||(0,m5.default)(t,function(r,i){r&&i&&(n[(0,g5.camelCase)(r,e)]=i)}),n}Fp.default=Fp;var y5=Fp;const v5=Yc(y5),iT=sT("end"),Jg=sT("start");function sT(t){return e;function e(n){const r=n&&n.position&&n.position[t]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function x5(t){const e=Jg(t),n=iT(t);if(e&&n)return{start:e,end:n}}function Wa(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?iw(t.position):"start"in t||"end"in t?iw(t):"line"in t||"column"in t?Up(t):""}function Up(t){return sw(t&&t.line)+":"+sw(t&&t.column)}function iw(t){return Up(t&&t.start)+"-"+Up(t&&t.end)}function sw(t){return t&&typeof t=="number"?t:1}class dn extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",s={},o=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof e=="string"?i=e:!s.cause&&e&&(o=!0,i=e.message,s.cause=e),!s.ruleId&&!s.source&&typeof r=="string"){const u=r.indexOf(":");u===-1?s.ruleId=r:(s.source=r.slice(0,u),s.ruleId=r.slice(u+1))}if(!s.place&&s.ancestors&&s.ancestors){const u=s.ancestors[s.ancestors.length-1];u&&(s.place=u.position)}const a=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=a?a.line:void 0,this.name=Wa(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}dn.prototype.file="";dn.prototype.name="";dn.prototype.reason="";dn.prototype.message="";dn.prototype.stack="";dn.prototype.column=void 0;dn.prototype.line=void 0;dn.prototype.ancestors=void 0;dn.prototype.cause=void 0;dn.prototype.fatal=void 0;dn.prototype.place=void 0;dn.prototype.ruleId=void 0;dn.prototype.source=void 0;const Zg={}.hasOwnProperty,w5=new Map,_5=/[A-Z]/g,b5=new Set(["table","tbody","thead","tfoot","tr"]),E5=new Set(["td","th"]),oT="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function I5(t,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=e.filePath||void 0;let r;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=R5(n,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=P5(n,e.jsx,e.jsxs)}const i={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:r,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?Yg:$3,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},s=aT(i,t,void 0);return s&&typeof s!="string"?s:i.create(t,i.Fragment,{children:s||void 0},void 0)}function aT(t,e,n){if(e.type==="element")return T5(t,e,n);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return S5(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return C5(t,e,n);if(e.type==="mdxjsEsm")return k5(t,e);if(e.type==="root")return N5(t,e,n);if(e.type==="text")return A5(t,e)}function T5(t,e,n){const r=t.schema;let i=r;e.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=Yg,t.schema=i),t.ancestors.push(e);const s=uT(t,e.tagName,!1),o=D5(t,e);let a=ty(t,e);return b5.has(e.tagName)&&(a=a.filter(function(u){return typeof u=="string"?!D3(u):!0})),lT(t,o,s,e),ey(o,a),t.ancestors.pop(),t.schema=r,t.create(e,s,o,n)}function S5(t,e){if(e.data&&e.data.estree&&t.evaluater){const r=e.data.estree.body[0];return r.type,t.evaluater.evaluateExpression(r.expression)}Il(t,e.position)}function k5(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);Il(t,e.position)}function C5(t,e,n){const r=t.schema;let i=r;e.name==="svg"&&r.space==="html"&&(i=Yg,t.schema=i),t.ancestors.push(e);const s=e.name===null?t.Fragment:uT(t,e.name,!0),o=j5(t,e),a=ty(t,e);return lT(t,o,s,e),ey(o,a),t.ancestors.pop(),t.schema=r,t.create(e,s,o,n)}function N5(t,e,n){const r={};return ey(r,ty(t,e)),t.create(e,t.Fragment,r,n)}function A5(t,e){return e.value}function lT(t,e,n,r){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=r)}function ey(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function P5(t,e,n){return r;function r(i,s,o,a){const c=Array.isArray(o.children)?n:e;return a?c(s,o,a):c(s,o)}}function R5(t,e){return n;function n(r,i,s,o){const a=Array.isArray(s.children),u=Jg(r);return e(i,s,o,a,{columnNumber:u?u.column-1:void 0,fileName:t,lineNumber:u?u.line:void 0},void 0)}}function D5(t,e){const n={};let r,i;for(i in e.properties)if(i!=="children"&&Zg.call(e.properties,i)){const s=O5(t,i,e.properties[i]);if(s){const[o,a]=s;t.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&E5.has(e.tagName)?r=a:n[o]=a}}if(r){const s=n.style||(n.style={});s[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function j5(t,e){const n={};for(const r of e.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&t.evaluater){const s=r.data.estree.body[0];s.type;const o=s.expression;o.type;const a=o.properties[0];a.type,Object.assign(n,t.evaluater.evaluateExpression(a.argument))}else Il(t,e.position);else{const i=r.name;let s;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&t.evaluater){const a=r.value.data.estree.body[0];a.type,s=t.evaluater.evaluateExpression(a.expression)}else Il(t,e.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function ty(t,e){const n=[];let r=-1;const i=t.passKeys?new Map:w5;for(;++ri?0:i+e:e=e>i?i:e,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(e,n),t.splice(...o);else for(n&&t.splice(e,n);s0?(Rr(t,t.length,0,e),t):e}const lw={}.hasOwnProperty;function $5(t){const e={};let n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function _o(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const _r=is(/[A-Za-z]/),Ln=is(/[\dA-Za-z]/),W5=is(/[#-'*+\--9=?A-Z^-~]/);function zp(t){return t!==null&&(t<32||t===127)}const Bp=is(/\d/),G5=is(/[\dA-Fa-f]/),K5=is(/[!-/:-@[-`{-~]/);function Se(t){return t!==null&&t<-2}function kn(t){return t!==null&&(t<0||t===32)}function Ye(t){return t===-2||t===-1||t===32}const Q5=is(new RegExp("\\p{P}|\\p{S}","u")),Y5=is(/\s/);function is(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function Xo(t){const e=[];let n=-1,r=0,i=0;for(;++n55295&&s<57344){const a=t.charCodeAt(n+1);s<56320&&a>56319&&a<57344?(o=String.fromCharCode(s,a),i=1):o="�"}else o=String.fromCharCode(s);o&&(e.push(t.slice(r,n),encodeURIComponent(o)),r=n+i+1,o=""),i&&(n+=i,i=0)}return e.join("")+t.slice(r)}function at(t,e,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(u){return Ye(u)?(t.enter(n),a(u)):e(u)}function a(u){return Ye(u)&&s++o))return;const b=e.events.length;let w=b,T,A;for(;w--;)if(e.events[w][0]==="exit"&&e.events[w][1].type==="chunkFlow"){if(T){A=e.events[w][1].end;break}T=!0}for(v(r),D=b;DE;){const L=n[O];e.containerState=L[1],L[0].exit.call(e,t)}n.length=E}function x(){i.write([null]),s=void 0,i=void 0,e.containerState._closeFlow=void 0}}function t6(t,e,n){return at(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function cw(t){if(t===null||kn(t)||Y5(t))return 1;if(Q5(t))return 2}function ry(t,e,n){const r=[];let i=-1;for(;++i1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const h={...t[r][1].end},p={...t[n][1].start};dw(h,-u),dw(p,u),o={type:u>1?"strongSequence":"emphasisSequence",start:h,end:{...t[r][1].end}},a={type:u>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:p},s={type:u>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},i={type:u>1?"strong":"emphasis",start:{...o.start},end:{...a.end}},t[r][1].end={...o.start},t[n][1].start={...a.end},c=[],t[r][1].end.offset-t[r][1].start.offset&&(c=qn(c,[["enter",t[r][1],e],["exit",t[r][1],e]])),c=qn(c,[["enter",i,e],["enter",o,e],["exit",o,e],["enter",s,e]]),c=qn(c,ry(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),c=qn(c,[["exit",s,e],["enter",a,e],["exit",a,e],["exit",i,e]]),t[n][1].end.offset-t[n][1].start.offset?(f=2,c=qn(c,[["enter",t[n][1],e],["exit",t[n][1],e]])):f=0,Rr(t,r-1,n-r+3,c),n=r+c.length-f-2;break}}for(n=-1;++n0&&Ye(D)?at(t,x,"linePrefix",s+1)(D):x(D)}function x(D){return D===null||Se(D)?t.check(hw,S,O)(D):(t.enter("codeFlowValue"),E(D))}function E(D){return D===null||Se(D)?(t.exit("codeFlowValue"),x(D)):(t.consume(D),E)}function O(D){return t.exit("codeFenced"),e(D)}function L(D,b,w){let T=0;return A;function A(he){return D.enter("lineEnding"),D.consume(he),D.exit("lineEnding"),N}function N(he){return D.enter("codeFencedFence"),Ye(he)?at(D,j,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(he):j(he)}function j(he){return he===a?(D.enter("codeFencedFenceSequence"),C(he)):w(he)}function C(he){return he===a?(T++,D.consume(he),C):T>=o?(D.exit("codeFencedFenceSequence"),Ye(he)?at(D,se,"whitespace")(he):se(he)):w(he)}function se(he){return he===null||Se(he)?(D.exit("codeFencedFence"),b(he)):w(he)}}}function f6(t,e,n){const r=this;return i;function i(o){return o===null?n(o):(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s)}function s(o){return r.parser.lazy[r.now().line]?n(o):e(o)}}const Zh={name:"codeIndented",tokenize:m6},p6={partial:!0,tokenize:g6};function m6(t,e,n){const r=this;return i;function i(c){return t.enter("codeIndented"),at(t,s,"linePrefix",5)(c)}function s(c){const f=r.events[r.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?o(c):n(c)}function o(c){return c===null?u(c):Se(c)?t.attempt(p6,o,u)(c):(t.enter("codeFlowValue"),a(c))}function a(c){return c===null||Se(c)?(t.exit("codeFlowValue"),o(c)):(t.consume(c),a)}function u(c){return t.exit("codeIndented"),e(c)}}function g6(t,e,n){const r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):Se(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),i):at(t,s,"linePrefix",5)(o)}function s(o){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(o):Se(o)?i(o):n(o)}}const y6={name:"codeText",previous:x6,resolve:v6,tokenize:w6};function v6(t){let e=t.length-4,n=3,r,i;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(r=n;++r=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return ethis.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(e,n,r){const i=n||0;this.setCursor(Math.trunc(e));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&va(this.left,r),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),va(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),va(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e=4?e(o):t.interrupt(r.parser.constructs.flow,n,e)(o)}}function gT(t,e,n,r,i,s,o,a,u){const c=u||Number.POSITIVE_INFINITY;let f=0;return h;function h(v){return v===60?(t.enter(r),t.enter(i),t.enter(s),t.consume(v),t.exit(s),p):v===null||v===32||v===41||zp(v)?n(v):(t.enter(r),t.enter(o),t.enter(a),t.enter("chunkString",{contentType:"string"}),S(v))}function p(v){return v===62?(t.enter(s),t.consume(v),t.exit(s),t.exit(i),t.exit(r),e):(t.enter(a),t.enter("chunkString",{contentType:"string"}),g(v))}function g(v){return v===62?(t.exit("chunkString"),t.exit(a),p(v)):v===null||v===60||Se(v)?n(v):(t.consume(v),v===92?_:g)}function _(v){return v===60||v===62||v===92?(t.consume(v),g):g(v)}function S(v){return!f&&(v===null||v===41||kn(v))?(t.exit("chunkString"),t.exit(a),t.exit(o),t.exit(r),e(v)):f999||g===null||g===91||g===93&&!u||g===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?n(g):g===93?(t.exit(s),t.enter(i),t.consume(g),t.exit(i),t.exit(r),e):Se(g)?(t.enter("lineEnding"),t.consume(g),t.exit("lineEnding"),f):(t.enter("chunkString",{contentType:"string"}),h(g))}function h(g){return g===null||g===91||g===93||Se(g)||a++>999?(t.exit("chunkString"),f(g)):(t.consume(g),u||(u=!Ye(g)),g===92?p:h)}function p(g){return g===91||g===92||g===93?(t.consume(g),a++,h):h(g)}}function vT(t,e,n,r,i,s){let o;return a;function a(p){return p===34||p===39||p===40?(t.enter(r),t.enter(i),t.consume(p),t.exit(i),o=p===40?41:p,u):n(p)}function u(p){return p===o?(t.enter(i),t.consume(p),t.exit(i),t.exit(r),e):(t.enter(s),c(p))}function c(p){return p===o?(t.exit(s),u(o)):p===null?n(p):Se(p)?(t.enter("lineEnding"),t.consume(p),t.exit("lineEnding"),at(t,c,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===o||p===null||Se(p)?(t.exit("chunkString"),c(p)):(t.consume(p),p===92?h:f)}function h(p){return p===o||p===92?(t.consume(p),f):f(p)}}function Ga(t,e){let n;return r;function r(i){return Se(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),n=!0,r):Ye(i)?at(t,r,n?"linePrefix":"lineSuffix")(i):e(i)}}const C6={name:"definition",tokenize:A6},N6={partial:!0,tokenize:P6};function A6(t,e,n){const r=this;let i;return s;function s(g){return t.enter("definition"),o(g)}function o(g){return yT.call(r,t,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(g)}function a(g){return i=_o(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),g===58?(t.enter("definitionMarker"),t.consume(g),t.exit("definitionMarker"),u):n(g)}function u(g){return kn(g)?Ga(t,c)(g):c(g)}function c(g){return gT(t,f,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(g)}function f(g){return t.attempt(N6,h,h)(g)}function h(g){return Ye(g)?at(t,p,"whitespace")(g):p(g)}function p(g){return g===null||Se(g)?(t.exit("definition"),r.parser.defined.push(i),e(g)):n(g)}}function P6(t,e,n){return r;function r(a){return kn(a)?Ga(t,i)(a):n(a)}function i(a){return vT(t,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function s(a){return Ye(a)?at(t,o,"whitespace")(a):o(a)}function o(a){return a===null||Se(a)?e(a):n(a)}}const R6={name:"hardBreakEscape",tokenize:D6};function D6(t,e,n){return r;function r(s){return t.enter("hardBreakEscape"),t.consume(s),i}function i(s){return Se(s)?(t.exit("hardBreakEscape"),e(s)):n(s)}}const j6={name:"headingAtx",resolve:O6,tokenize:L6};function O6(t,e){let n=t.length-2,r=3,i,s;return t[r][1].type==="whitespace"&&(r+=2),n-2>r&&t[n][1].type==="whitespace"&&(n-=2),t[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&t[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:t[r][1].start,end:t[n][1].end},s={type:"chunkText",start:t[r][1].start,end:t[n][1].end,contentType:"text"},Rr(t,r,n-r+1,[["enter",i,e],["enter",s,e],["exit",s,e],["exit",i,e]])),t}function L6(t,e,n){let r=0;return i;function i(f){return t.enter("atxHeading"),s(f)}function s(f){return t.enter("atxHeadingSequence"),o(f)}function o(f){return f===35&&r++<6?(t.consume(f),o):f===null||kn(f)?(t.exit("atxHeadingSequence"),a(f)):n(f)}function a(f){return f===35?(t.enter("atxHeadingSequence"),u(f)):f===null||Se(f)?(t.exit("atxHeading"),e(f)):Ye(f)?at(t,a,"whitespace")(f):(t.enter("atxHeadingText"),c(f))}function u(f){return f===35?(t.consume(f),u):(t.exit("atxHeadingSequence"),a(f))}function c(f){return f===null||f===35||kn(f)?(t.exit("atxHeadingText"),a(f)):(t.consume(f),c)}}const M6=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],pw=["pre","script","style","textarea"],V6={concrete:!0,name:"htmlFlow",resolveTo:z6,tokenize:B6},F6={partial:!0,tokenize:H6},U6={partial:!0,tokenize:$6};function z6(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function B6(t,e,n){const r=this;let i,s,o,a,u;return c;function c(R){return f(R)}function f(R){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(R),h}function h(R){return R===33?(t.consume(R),p):R===47?(t.consume(R),s=!0,S):R===63?(t.consume(R),i=3,r.interrupt?e:k):_r(R)?(t.consume(R),o=String.fromCharCode(R),P):n(R)}function p(R){return R===45?(t.consume(R),i=2,g):R===91?(t.consume(R),i=5,a=0,_):_r(R)?(t.consume(R),i=4,r.interrupt?e:k):n(R)}function g(R){return R===45?(t.consume(R),r.interrupt?e:k):n(R)}function _(R){const $="CDATA[";return R===$.charCodeAt(a++)?(t.consume(R),a===$.length?r.interrupt?e:j:_):n(R)}function S(R){return _r(R)?(t.consume(R),o=String.fromCharCode(R),P):n(R)}function P(R){if(R===null||R===47||R===62||kn(R)){const $=R===47,Z=o.toLowerCase();return!$&&!s&&pw.includes(Z)?(i=1,r.interrupt?e(R):j(R)):M6.includes(o.toLowerCase())?(i=6,$?(t.consume(R),v):r.interrupt?e(R):j(R)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(R):s?x(R):E(R))}return R===45||Ln(R)?(t.consume(R),o+=String.fromCharCode(R),P):n(R)}function v(R){return R===62?(t.consume(R),r.interrupt?e:j):n(R)}function x(R){return Ye(R)?(t.consume(R),x):A(R)}function E(R){return R===47?(t.consume(R),A):R===58||R===95||_r(R)?(t.consume(R),O):Ye(R)?(t.consume(R),E):A(R)}function O(R){return R===45||R===46||R===58||R===95||Ln(R)?(t.consume(R),O):L(R)}function L(R){return R===61?(t.consume(R),D):Ye(R)?(t.consume(R),L):E(R)}function D(R){return R===null||R===60||R===61||R===62||R===96?n(R):R===34||R===39?(t.consume(R),u=R,b):Ye(R)?(t.consume(R),D):w(R)}function b(R){return R===u?(t.consume(R),u=null,T):R===null||Se(R)?n(R):(t.consume(R),b)}function w(R){return R===null||R===34||R===39||R===47||R===60||R===61||R===62||R===96||kn(R)?L(R):(t.consume(R),w)}function T(R){return R===47||R===62||Ye(R)?E(R):n(R)}function A(R){return R===62?(t.consume(R),N):n(R)}function N(R){return R===null||Se(R)?j(R):Ye(R)?(t.consume(R),N):n(R)}function j(R){return R===45&&i===2?(t.consume(R),le):R===60&&i===1?(t.consume(R),me):R===62&&i===4?(t.consume(R),ge):R===63&&i===3?(t.consume(R),k):R===93&&i===5?(t.consume(R),oe):Se(R)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(F6,ye,C)(R)):R===null||Se(R)?(t.exit("htmlFlowData"),C(R)):(t.consume(R),j)}function C(R){return t.check(U6,se,ye)(R)}function se(R){return t.enter("lineEnding"),t.consume(R),t.exit("lineEnding"),he}function he(R){return R===null||Se(R)?C(R):(t.enter("htmlFlowData"),j(R))}function le(R){return R===45?(t.consume(R),k):j(R)}function me(R){return R===47?(t.consume(R),o="",q):j(R)}function q(R){if(R===62){const $=o.toLowerCase();return pw.includes($)?(t.consume(R),ge):j(R)}return _r(R)&&o.length<8?(t.consume(R),o+=String.fromCharCode(R),q):j(R)}function oe(R){return R===93?(t.consume(R),k):j(R)}function k(R){return R===62?(t.consume(R),ge):R===45&&i===2?(t.consume(R),k):j(R)}function ge(R){return R===null||Se(R)?(t.exit("htmlFlowData"),ye(R)):(t.consume(R),ge)}function ye(R){return t.exit("htmlFlow"),e(R)}}function $6(t,e,n){const r=this;return i;function i(o){return Se(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s):n(o)}function s(o){return r.parser.lazy[r.now().line]?n(o):e(o)}}function H6(t,e,n){return r;function r(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(Qd,e,n)}}const q6={name:"htmlText",tokenize:W6};function W6(t,e,n){const r=this;let i,s,o;return a;function a(k){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(k),u}function u(k){return k===33?(t.consume(k),c):k===47?(t.consume(k),L):k===63?(t.consume(k),E):_r(k)?(t.consume(k),w):n(k)}function c(k){return k===45?(t.consume(k),f):k===91?(t.consume(k),s=0,_):_r(k)?(t.consume(k),x):n(k)}function f(k){return k===45?(t.consume(k),g):n(k)}function h(k){return k===null?n(k):k===45?(t.consume(k),p):Se(k)?(o=h,me(k)):(t.consume(k),h)}function p(k){return k===45?(t.consume(k),g):h(k)}function g(k){return k===62?le(k):k===45?p(k):h(k)}function _(k){const ge="CDATA[";return k===ge.charCodeAt(s++)?(t.consume(k),s===ge.length?S:_):n(k)}function S(k){return k===null?n(k):k===93?(t.consume(k),P):Se(k)?(o=S,me(k)):(t.consume(k),S)}function P(k){return k===93?(t.consume(k),v):S(k)}function v(k){return k===62?le(k):k===93?(t.consume(k),v):S(k)}function x(k){return k===null||k===62?le(k):Se(k)?(o=x,me(k)):(t.consume(k),x)}function E(k){return k===null?n(k):k===63?(t.consume(k),O):Se(k)?(o=E,me(k)):(t.consume(k),E)}function O(k){return k===62?le(k):E(k)}function L(k){return _r(k)?(t.consume(k),D):n(k)}function D(k){return k===45||Ln(k)?(t.consume(k),D):b(k)}function b(k){return Se(k)?(o=b,me(k)):Ye(k)?(t.consume(k),b):le(k)}function w(k){return k===45||Ln(k)?(t.consume(k),w):k===47||k===62||kn(k)?T(k):n(k)}function T(k){return k===47?(t.consume(k),le):k===58||k===95||_r(k)?(t.consume(k),A):Se(k)?(o=T,me(k)):Ye(k)?(t.consume(k),T):le(k)}function A(k){return k===45||k===46||k===58||k===95||Ln(k)?(t.consume(k),A):N(k)}function N(k){return k===61?(t.consume(k),j):Se(k)?(o=N,me(k)):Ye(k)?(t.consume(k),N):T(k)}function j(k){return k===null||k===60||k===61||k===62||k===96?n(k):k===34||k===39?(t.consume(k),i=k,C):Se(k)?(o=j,me(k)):Ye(k)?(t.consume(k),j):(t.consume(k),se)}function C(k){return k===i?(t.consume(k),i=void 0,he):k===null?n(k):Se(k)?(o=C,me(k)):(t.consume(k),C)}function se(k){return k===null||k===34||k===39||k===60||k===61||k===96?n(k):k===47||k===62||kn(k)?T(k):(t.consume(k),se)}function he(k){return k===47||k===62||kn(k)?T(k):n(k)}function le(k){return k===62?(t.consume(k),t.exit("htmlTextData"),t.exit("htmlText"),e):n(k)}function me(k){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(k),t.exit("lineEnding"),q}function q(k){return Ye(k)?at(t,oe,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(k):oe(k)}function oe(k){return t.enter("htmlTextData"),o(k)}}const iy={name:"labelEnd",resolveAll:Y6,resolveTo:X6,tokenize:J6},G6={tokenize:Z6},K6={tokenize:eO},Q6={tokenize:tO};function Y6(t){let e=-1;const n=[];for(;++e=3&&(c===null||Se(c))?(t.exit("thematicBreak"),e(c)):n(c)}function u(c){return c===i?(t.consume(c),r++,u):(t.exit("thematicBreakSequence"),Ye(c)?at(t,a,"whitespace")(c):a(c))}}const gn={continuation:{tokenize:dO},exit:fO,name:"list",tokenize:cO},lO={partial:!0,tokenize:pO},uO={partial:!0,tokenize:hO};function cO(t,e,n){const r=this,i=r.events[r.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return a;function a(g){const _=r.containerState.type||(g===42||g===43||g===45?"listUnordered":"listOrdered");if(_==="listUnordered"?!r.containerState.marker||g===r.containerState.marker:Bp(g)){if(r.containerState.type||(r.containerState.type=_,t.enter(_,{_container:!0})),_==="listUnordered")return t.enter("listItemPrefix"),g===42||g===45?t.check(Ju,n,c)(g):c(g);if(!r.interrupt||g===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),u(g)}return n(g)}function u(g){return Bp(g)&&++o<10?(t.consume(g),u):(!r.interrupt||o<2)&&(r.containerState.marker?g===r.containerState.marker:g===41||g===46)?(t.exit("listItemValue"),c(g)):n(g)}function c(g){return t.enter("listItemMarker"),t.consume(g),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||g,t.check(Qd,r.interrupt?n:f,t.attempt(lO,p,h))}function f(g){return r.containerState.initialBlankLine=!0,s++,p(g)}function h(g){return Ye(g)?(t.enter("listItemPrefixWhitespace"),t.consume(g),t.exit("listItemPrefixWhitespace"),p):n(g)}function p(g){return r.containerState.size=s+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(g)}}function dO(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(Qd,i,s);function i(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,at(t,e,"listItemIndent",r.containerState.size+1)(a)}function s(a){return r.containerState.furtherBlankLines||!Ye(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(uO,e,o)(a))}function o(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,at(t,t.attempt(gn,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function hO(t,e,n){const r=this;return at(t,i,"listItemIndent",r.containerState.size+1);function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?e(s):n(s)}}function fO(t){t.exit(this.containerState.type)}function pO(t,e,n){const r=this;return at(t,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const o=r.events[r.events.length-1];return!Ye(s)&&o&&o[1].type==="listItemPrefixWhitespace"?e(s):n(s)}}const mw={name:"setextUnderline",resolveTo:mO,tokenize:gO};function mO(t,e){let n=t.length,r,i,s;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){r=n;break}t[n][1].type==="paragraph"&&(i=n)}else t[n][1].type==="content"&&t.splice(n,1),!s&&t[n][1].type==="definition"&&(s=n);const o={type:"setextHeading",start:{...t[r][1].start},end:{...t[t.length-1][1].end}};return t[i][1].type="setextHeadingText",s?(t.splice(i,0,["enter",o,e]),t.splice(s+1,0,["exit",t[r][1],e]),t[r][1].end={...t[s][1].end}):t[r][1]=o,t.push(["exit",o,e]),t}function gO(t,e,n){const r=this;let i;return s;function s(c){let f=r.events.length,h;for(;f--;)if(r.events[f][1].type!=="lineEnding"&&r.events[f][1].type!=="linePrefix"&&r.events[f][1].type!=="content"){h=r.events[f][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||h)?(t.enter("setextHeadingLine"),i=c,o(c)):n(c)}function o(c){return t.enter("setextHeadingLineSequence"),a(c)}function a(c){return c===i?(t.consume(c),a):(t.exit("setextHeadingLineSequence"),Ye(c)?at(t,u,"lineSuffix")(c):u(c))}function u(c){return c===null||Se(c)?(t.exit("setextHeadingLine"),e(c)):n(c)}}const yO={tokenize:vO};function vO(t){const e=this,n=t.attempt(Qd,r,t.attempt(this.parser.constructs.flowInitial,i,at(t,t.attempt(this.parser.constructs.flow,i,t.attempt(E6,i)),"linePrefix")));return n;function r(s){if(s===null){t.consume(s);return}return t.enter("lineEndingBlank"),t.consume(s),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n}function i(s){if(s===null){t.consume(s);return}return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),e.currentConstruct=void 0,n}}const xO={resolveAll:wT()},wO=xT("string"),_O=xT("text");function xT(t){return{resolveAll:wT(t==="text"?bO:void 0),tokenize:e};function e(n){const r=this,i=this.parser.constructs[t],s=n.attempt(i,o,a);return o;function o(f){return c(f)?s(f):a(f)}function a(f){if(f===null){n.consume(f);return}return n.enter("data"),n.consume(f),u}function u(f){return c(f)?(n.exit("data"),s(f)):(n.consume(f),u)}function c(f){if(f===null)return!0;const h=i[f];let p=-1;if(h)for(;++p-1){const a=o[0];typeof a=="string"?o[0]=a.slice(r):o.shift()}s>0&&o.push(t[i].slice(0,s))}return o}function OO(t,e){let n=-1;const r=[];let i;for(;++n0){const je=B.tokenStack[B.tokenStack.length-1];(je[1]||yw).call(B,void 0,je[0])}for(V.position={start:gi(z.length>0?z[0][1].start:{line:1,column:1,offset:0}),end:gi(z.length>0?z[z.length-2][1].end:{line:1,column:1,offset:0})},J=-1;++J0&&(r.className=["language-"+i[0]]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return e.meta&&(s.data={meta:e.meta}),t.patch(e,s),s=t.applyData(e,s),s={type:"element",tagName:"pre",properties:{},children:[s]},t.patch(e,s),s}function QO(t,e){const n={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function YO(t,e){const n={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function XO(t,e){const n=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=String(e.identifier).toUpperCase(),i=Xo(r.toLowerCase()),s=t.footnoteOrder.indexOf(r);let o,a=t.footnoteCounts.get(r);a===void 0?(a=0,t.footnoteOrder.push(r),o=t.footnoteOrder.length):o=s+1,a+=1,t.footnoteCounts.set(r,a);const u={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};t.patch(e,u);const c={type:"element",tagName:"sup",properties:{},children:[u]};return t.patch(e,c),t.applyData(e,c)}function JO(t,e){const n={type:"element",tagName:"h"+e.depth,properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function ZO(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}}function ET(t,e){const n=e.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+r}];const i=t.all(e),s=i[0];s&&s.type==="text"?s.value="["+s.value:i.unshift({type:"text",value:"["});const o=i[i.length-1];return o&&o.type==="text"?o.value+=r:i.push({type:"text",value:r}),i}function eL(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return ET(t,e);const i={src:Xo(r.url||""),alt:e.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"img",properties:i,children:[]};return t.patch(e,s),t.applyData(e,s)}function tL(t,e){const n={src:Xo(e.url)};e.alt!==null&&e.alt!==void 0&&(n.alt=e.alt),e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"img",properties:n,children:[]};return t.patch(e,r),t.applyData(e,r)}function nL(t,e){const n={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};t.patch(e,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return t.patch(e,r),t.applyData(e,r)}function rL(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return ET(t,e);const i={href:Xo(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"a",properties:i,children:t.all(e)};return t.patch(e,s),t.applyData(e,s)}function iL(t,e){const n={href:Xo(e.url)};e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"a",properties:n,children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function sL(t,e,n){const r=t.all(e),i=n?oL(n):IT(e),s={},o=[];if(typeof e.checked=="boolean"){const f=r[0];let h;f&&f.type==="element"&&f.tagName==="p"?h=f:(h={type:"element",tagName:"p",properties:{},children:[]},r.unshift(h)),h.children.length>0&&h.children.unshift({type:"text",value:" "}),h.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let a=-1;for(;++a1}function aL(t,e){const n={},r=t.all(e);let i=-1;for(typeof e.start=="number"&&e.start!==1&&(n.start=e.start);++i0){const o={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},a=Jg(e.children[1]),u=iT(e.children[e.children.length-1]);a&&u&&(o.position={start:a,end:u}),i.push(o)}const s={type:"element",tagName:"table",properties:{},children:t.wrap(i,!0)};return t.patch(e,s),t.applyData(e,s)}function hL(t,e,n){const r=n?n.children:void 0,s=(r?r.indexOf(e):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,a=o?o.length:e.children.length;let u=-1;const c=[];for(;++u0,!0),r[0]),i=r.index+r[0].length,r=n.exec(e);return s.push(ww(e.slice(i),i>0,!1)),s.join("")}function ww(t,e,n){let r=0,i=t.length;if(e){let s=t.codePointAt(r);for(;s===vw||s===xw;)r++,s=t.codePointAt(r)}if(n){let s=t.codePointAt(i-1);for(;s===vw||s===xw;)i--,s=t.codePointAt(i-1)}return i>r?t.slice(r,i):""}function mL(t,e){const n={type:"text",value:pL(String(e.value))};return t.patch(e,n),t.applyData(e,n)}function gL(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)}const yL={blockquote:WO,break:GO,code:KO,delete:QO,emphasis:YO,footnoteReference:XO,heading:JO,html:ZO,imageReference:eL,image:tL,inlineCode:nL,linkReference:rL,link:iL,listItem:sL,list:aL,paragraph:lL,root:uL,strong:cL,table:dL,tableCell:fL,tableRow:hL,text:mL,thematicBreak:gL,toml:ku,yaml:ku,definition:ku,footnoteDefinition:ku};function ku(){}const TT=-1,Yd=0,Ka=1,Kc=2,sy=3,oy=4,ay=5,ly=6,ST=7,kT=8,_w=typeof self=="object"?self:globalThis,vL=(t,e)=>{const n=(i,s)=>(t.set(s,i),i),r=i=>{if(t.has(i))return t.get(i);const[s,o]=e[i];switch(s){case Yd:case TT:return n(o,i);case Ka:{const a=n([],i);for(const u of o)a.push(r(u));return a}case Kc:{const a=n({},i);for(const[u,c]of o)a[r(u)]=r(c);return a}case sy:return n(new Date(o),i);case oy:{const{source:a,flags:u}=o;return n(new RegExp(a,u),i)}case ay:{const a=n(new Map,i);for(const[u,c]of o)a.set(r(u),r(c));return a}case ly:{const a=n(new Set,i);for(const u of o)a.add(r(u));return a}case ST:{const{name:a,message:u}=o;return n(new _w[a](u),i)}case kT:return n(BigInt(o),i);case"BigInt":return n(Object(BigInt(o)),i);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:a}=new Uint8Array(o);return n(new DataView(a),o)}}return n(new _w[s](o),i)};return r},bw=t=>vL(new Map,t)(0),qs="",{toString:xL}={},{keys:wL}=Object,xa=t=>{const e=typeof t;if(e!=="object"||!t)return[Yd,e];const n=xL.call(t).slice(8,-1);switch(n){case"Array":return[Ka,qs];case"Object":return[Kc,qs];case"Date":return[sy,qs];case"RegExp":return[oy,qs];case"Map":return[ay,qs];case"Set":return[ly,qs];case"DataView":return[Ka,n]}return n.includes("Array")?[Ka,n]:n.includes("Error")?[ST,n]:[Kc,n]},Cu=([t,e])=>t===Yd&&(e==="function"||e==="symbol"),_L=(t,e,n,r)=>{const i=(o,a)=>{const u=r.push(o)-1;return n.set(a,u),u},s=o=>{if(n.has(o))return n.get(o);let[a,u]=xa(o);switch(a){case Yd:{let f=o;switch(u){case"bigint":a=kT,f=o.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+u);f=null;break;case"undefined":return i([TT],o)}return i([a,f],o)}case Ka:{if(u){let p=o;return u==="DataView"?p=new Uint8Array(o.buffer):u==="ArrayBuffer"&&(p=new Uint8Array(o)),i([u,[...p]],o)}const f=[],h=i([a,f],o);for(const p of o)f.push(s(p));return h}case Kc:{if(u)switch(u){case"BigInt":return i([u,o.toString()],o);case"Boolean":case"Number":case"String":return i([u,o.valueOf()],o)}if(e&&"toJSON"in o)return s(o.toJSON());const f=[],h=i([a,f],o);for(const p of wL(o))(t||!Cu(xa(o[p])))&&f.push([s(p),s(o[p])]);return h}case sy:return i([a,o.toISOString()],o);case oy:{const{source:f,flags:h}=o;return i([a,{source:f,flags:h}],o)}case ay:{const f=[],h=i([a,f],o);for(const[p,g]of o)(t||!(Cu(xa(p))||Cu(xa(g))))&&f.push([s(p),s(g)]);return h}case ly:{const f=[],h=i([a,f],o);for(const p of o)(t||!Cu(xa(p)))&&f.push(s(p));return h}}const{message:c}=o;return i([a,{name:u,message:c}],o)};return s},Ew=(t,{json:e,lossy:n}={})=>{const r=[];return _L(!(e||n),!!e,new Map,r)(t),r},Qc=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?bw(Ew(t,e)):structuredClone(t):(t,e)=>bw(Ew(t,e));function bL(t,e){const n=[{type:"text",value:"↩"}];return e>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),n}function EL(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function IL(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=t.options.footnoteBackContent||bL,r=t.options.footnoteBackLabel||EL,i=t.options.footnoteLabel||"Footnotes",s=t.options.footnoteLabelTagName||"h2",o=t.options.footnoteLabelProperties||{className:["sr-only"]},a=[];let u=-1;for(;++u0&&_.push({type:"text",value:" "});let x=typeof n=="string"?n:n(u,g);typeof x=="string"&&(x={type:"text",value:x}),_.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+p+(g>1?"-"+g:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(u,g),className:["data-footnote-backref"]},children:Array.isArray(x)?x:[x]})}const P=f[f.length-1];if(P&&P.type==="element"&&P.tagName==="p"){const x=P.children[P.children.length-1];x&&x.type==="text"?x.value+=" ":P.children.push({type:"text",value:" "}),P.children.push(..._)}else f.push(..._);const v={type:"element",tagName:"li",properties:{id:e+"fn-"+p},children:t.wrap(f,!0)};t.patch(c,v),a.push(v)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...Qc(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:` +`},{type:"element",tagName:"ol",properties:{},children:t.wrap(a,!0)},{type:"text",value:` +`}]}}const CT=function(t){if(t==null)return CL;if(typeof t=="function")return Xd(t);if(typeof t=="object")return Array.isArray(t)?TL(t):SL(t);if(typeof t=="string")return kL(t);throw new Error("Expected function, string, or object as test")};function TL(t){const e=[];let n=-1;for(;++n":""))+")"})}return p;function p(){let g=NT,_,S,P;if((!e||s(u,c,f[f.length-1]||void 0))&&(g=DL(n(u,f)),g[0]===Iw))return g;if("children"in u&&u.children){const v=u;if(v.children&&g[0]!==PL)for(S=(r?v.children.length:-1)+o,P=f.concat(v);S>-1&&S0&&n.push({type:"text",value:` +`}),n}function Tw(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function Sw(t,e){const n=OL(t,e),r=n.one(t,void 0),i=IL(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&s.children.push({type:"text",value:` +`},i),s}function UL(t,e){return t&&"run"in t?async function(n,r){const i=Sw(n,{file:r,...e});await t.run(i,r)}:function(n,r){return Sw(n,{file:r,...t||e})}}function kw(t){if(t)throw t}var Zu=Object.prototype.hasOwnProperty,PT=Object.prototype.toString,Cw=Object.defineProperty,Nw=Object.getOwnPropertyDescriptor,Aw=function(e){return typeof Array.isArray=="function"?Array.isArray(e):PT.call(e)==="[object Array]"},Pw=function(e){if(!e||PT.call(e)!=="[object Object]")return!1;var n=Zu.call(e,"constructor"),r=e.constructor&&e.constructor.prototype&&Zu.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!r)return!1;var i;for(i in e);return typeof i>"u"||Zu.call(e,i)},Rw=function(e,n){Cw&&n.name==="__proto__"?Cw(e,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):e[n.name]=n.newValue},Dw=function(e,n){if(n==="__proto__")if(Zu.call(e,n)){if(Nw)return Nw(e,n).value}else return;return e[n]},zL=function t(){var e,n,r,i,s,o,a=arguments[0],u=1,c=arguments.length,f=!1;for(typeof a=="boolean"&&(f=a,a=arguments[1]||{},u=2),(a==null||typeof a!="object"&&typeof a!="function")&&(a={});uo.length;let u;a&&o.push(i);try{u=t.apply(this,o)}catch(c){const f=c;if(a&&n)throw f;return i(f)}a||(u&&u.then&&typeof u.then=="function"?u.then(s,i):u instanceof Error?i(u):s(u))}function i(o,...a){n||(n=!0,e(o,...a))}function s(o){i(null,o)}}const vr={basename:HL,dirname:qL,extname:WL,join:GL,sep:"/"};function HL(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');$l(t);let n=0,r=-1,i=t.length,s;if(e===void 0||e.length===0||e.length>t.length){for(;i--;)if(t.codePointAt(i)===47){if(s){n=i+1;break}}else r<0&&(s=!0,r=i+1);return r<0?"":t.slice(n,r)}if(e===t)return"";let o=-1,a=e.length-1;for(;i--;)if(t.codePointAt(i)===47){if(s){n=i+1;break}}else o<0&&(s=!0,o=i+1),a>-1&&(t.codePointAt(i)===e.codePointAt(a--)?a<0&&(r=i):(a=-1,r=o));return n===r?r=o:r<0&&(r=t.length),t.slice(n,r)}function qL(t){if($l(t),t.length===0)return".";let e=-1,n=t.length,r;for(;--n;)if(t.codePointAt(n)===47){if(r){e=n;break}}else r||(r=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function WL(t){$l(t);let e=t.length,n=-1,r=0,i=-1,s=0,o;for(;e--;){const a=t.codePointAt(e);if(a===47){if(o){r=e+1;break}continue}n<0&&(o=!0,n=e+1),a===46?i<0?i=e:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||n<0||s===0||s===1&&i===n-1&&i===r+1?"":t.slice(i,n)}function GL(...t){let e=-1,n;for(;++e0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function QL(t,e){let n="",r=0,i=-1,s=0,o=-1,a,u;for(;++o<=t.length;){if(o2){if(u=n.lastIndexOf("/"),u!==n.length-1){u<0?(n="",r=0):(n=n.slice(0,u),r=n.length-1-n.lastIndexOf("/")),i=o,s=0;continue}}else if(n.length>0){n="",r=0,i=o,s=0;continue}}e&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+t.slice(i+1,o):n=t.slice(i+1,o),r=o-i-1;i=o,s=0}else a===46&&s>-1?s++:s=-1}return n}function $l(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const YL={cwd:XL};function XL(){return"/"}function Wp(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function JL(t){if(typeof t=="string")t=new URL(t);else if(!Wp(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return ZL(t)}function ZL(t){if(t.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const e=t.pathname;let n=-1;for(;++n0){let[g,..._]=f;const S=r[p][1];qp(S)&&qp(g)&&(g=tf(!0,S,g)),r[p]=[c,g,..._]}}}}const rM=new uy().freeze();function of(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function af(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function lf(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Ow(t){if(!qp(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function Lw(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function Nu(t){return iM(t)?t:new RT(t)}function iM(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function sM(t){return typeof t=="string"||oM(t)}function oM(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const aM="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Mw=[],Vw={allowDangerousHtml:!0},lM=/^(https?|ircs?|mailto|xmpp)$/i,uM=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function cM(t){const e=dM(t),n=hM(t);return fM(e.runSync(e.parse(n),n),t)}function dM(t){const e=t.rehypePlugins||Mw,n=t.remarkPlugins||Mw,r=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...Vw}:Vw;return rM().use(qO).use(n).use(UL,r).use(e)}function hM(t){const e=t.children||"",n=new RT;return typeof e=="string"&&(n.value=e),n}function fM(t,e){const n=e.allowedElements,r=e.allowElement,i=e.components,s=e.disallowedElements,o=e.skipHtml,a=e.unwrapDisallowed,u=e.urlTransform||pM;for(const f of uM)Object.hasOwn(e,f.from)&&(""+f.from+(f.to?"use `"+f.to+"` instead":"remove it")+aM+f.id,void 0);return AT(t,c),I5(t,{Fragment:d.Fragment,components:i,ignoreInvalidStyle:!0,jsx:d.jsx,jsxs:d.jsxs,passKeys:!0,passNode:!0});function c(f,h,p){if(f.type==="raw"&&p&&typeof h=="number")return o?p.children.splice(h,1):p.children[h]={type:"text",value:f.value},h;if(f.type==="element"){let g;for(g in Jh)if(Object.hasOwn(Jh,g)&&Object.hasOwn(f.properties,g)){const _=f.properties[g],S=Jh[g];(S===null||S.includes(f.tagName))&&(f.properties[g]=u(String(_||""),g,f))}}if(f.type==="element"){let g=n?!n.includes(f.tagName):s?s.includes(f.tagName):!1;if(!g&&r&&typeof h=="number"&&(g=!r(f,h,p)),g&&p&&typeof h=="number")return a&&f.children?p.children.splice(h,1,...f.children):p.children.splice(h,1),h}}}function pM(t){const e=t.indexOf(":"),n=t.indexOf("?"),r=t.indexOf("#"),i=t.indexOf("/");return e===-1||i!==-1&&e>i||n!==-1&&e>n||r!==-1&&e>r||lM.test(t.slice(0,e))?t:""}function mM({onBack:t,isAdmin:e}){const[n,r]=F.useState(""),[i,s]=F.useState(!1),[o,a]=F.useState(""),[u,c]=F.useState(!0);F.useEffect(()=>{const p=k3(g=>{g&&r(g.content),c(!1)});return()=>p()},[]);const f=async()=>{try{await S3(o),s(!1)}catch(p){console.error("Error saving info:",p),alert("Error al guardar la información.")}},h=()=>{a(n),s(!0)};return d.jsx("div",{className:"min-h-screen bg-[#0a0a0a] text-white p-4 sm:p-6 md:p-12 animate-in fade-in slide-in-from-bottom-4 duration-300",children:d.jsxs("div",{className:"max-w-4xl mx-auto",children:[d.jsxs("button",{onClick:t,className:"flex items-center gap-2 text-gray-400 hover:text-white transition-colors mb-8 group",children:[d.jsx(No,{className:"w-5 h-5 group-hover:-translate-x-1 transition-transform"}),d.jsx("span",{className:"font-medium",children:"Volver al inicio"})]}),d.jsxs("div",{className:"bg-[#1a1a1a] rounded-2xl border border-gray-800 p-8 sm:p-12 shadow-2xl relative",children:[e&&!i&&d.jsx("button",{onClick:h,className:"absolute top-8 right-8 p-2 rounded-lg bg-gray-800 text-gray-400 hover:text-[#bb86fc] hover:bg-[#bb86fc]/10 transition-colors",title:"Editar información",children:d.jsx(ob,{className:"w-5 h-5"})}),d.jsxs("div",{className:"flex items-center gap-4 mb-8 border-b border-gray-800 pb-8",children:[d.jsx("div",{className:"p-3 bg-gradient-to-br from-[#bb86fc] to-[#9966dd] rounded-xl shadow-lg shadow-[#bb86fc]/20",children:d.jsx(rb,{className:"w-8 h-8 text-white"})}),d.jsxs("div",{children:[d.jsx("h1",{className:"text-3xl font-bold bg-gradient-to-r from-white to-gray-400 bg-clip-text text-transparent",children:"Información"}),d.jsx("p",{className:"text-gray-400 mt-1",children:"Sobre Twisted Brody MangaFlow"})]})]}),i?d.jsxs("div",{className:"space-y-4",children:[d.jsx("textarea",{value:o,onChange:p=>a(p.target.value),className:"w-full h-[500px] bg-black/50 border border-[#bb86fc]/50 rounded-lg p-4 text-sm text-white focus:outline-none focus:border-[#bb86fc] font-mono",placeholder:"Escribe el contenido en Markdown..."}),d.jsxs("div",{className:"flex gap-3 justify-end",children:[d.jsxs("button",{onClick:()=>s(!1),className:"px-4 py-2 rounded-lg font-semibold text-gray-400 hover:text-white hover:bg-white/10 transition-colors flex items-center gap-2",children:[d.jsx(Vn,{className:"w-4 h-4"}),"Cancelar"]}),d.jsxs("button",{onClick:f,className:"px-4 py-2 rounded-lg font-semibold bg-[#bb86fc] hover:bg-[#9966dd] text-white transition-colors shadow-lg shadow-[#bb86fc]/20 flex items-center gap-2",children:[d.jsx(zm,{className:"w-4 h-4"}),"Guardar Cambios"]})]})]}):d.jsx("div",{className:"prose prose-invert prose-p:text-gray-300 prose-headings:text-white prose-a:no-underline max-w-none",children:d.jsx(cM,{components:{h1:({node:p,...g})=>d.jsx("h1",{className:"text-3xl font-bold bg-gradient-to-r from-[#bb86fc] to-[#7744cc] bg-clip-text text-transparent mb-6 pb-2 border-b border-gray-800",...g}),h2:({node:p,...g})=>d.jsx("h2",{className:"text-xl font-semibold text-white mt-8 mb-4 flex items-center gap-2",...g}),p:({node:p,...g})=>d.jsx("p",{className:"text-gray-300 leading-relaxed mb-4",...g}),ul:({node:p,...g})=>d.jsx("ul",{className:"space-y-2 mb-6",...g}),li:({node:p,...g})=>d.jsx("li",{className:"flex items-start gap-2 text-gray-300",...g}),a:({node:p,href:g,children:_,...S})=>{const P=g==null?void 0:g.startsWith("http");if((g==null?void 0:g.includes("t.me"))||(g==null?void 0:g.includes("patreon.com"))||(g==null?void 0:g.includes("x.com"))){let x="bg-[#1a1a1a] border border-gray-700 hover:border-gray-500",E="text-gray-300 hover:text-white";return g!=null&&g.includes("patreon")&&(x="bg-[#1a1a1a] border border-gray-700 hover:border-[#FF424D] hover:text-[#FF424D]"),g!=null&&g.includes("t.me")&&(x="bg-[#1a1a1a] border border-gray-700 hover:border-[#24A1DE] hover:text-[#24A1DE]"),g!=null&&g.includes("x.com")&&(x="bg-[#1a1a1a] border border-gray-700 hover:border-white hover:text-white"),d.jsx("a",{href:g,target:P?"_blank":void 0,rel:P?"noopener noreferrer":void 0,className:`inline-flex items-center gap-2 px-3 py-1.5 rounded-lg transition-all transform hover:scale-105 shadow-sm my-1 mr-2 no-underline text-xs sm:text-sm font-medium ${x} ${E}`,...S,children:_})}return d.jsx("a",{href:g,className:"text-[#bb86fc] hover:underline",target:P?"_blank":void 0,rel:P?"noopener noreferrer":void 0,...S,children:_})},blockquote:({node:p,...g})=>d.jsx("blockquote",{className:"border-l-4 border-[#bb86fc] pl-4 py-2 bg-[#bb86fc]/10 rounded-r-lg italic text-gray-400 my-6",...g}),hr:({node:p,...g})=>d.jsx("hr",{className:"border-gray-800 my-8",...g}),img:()=>null},children:n})}),!i&&d.jsxs("div",{className:"pt-8 border-t border-gray-800 text-center text-sm text-gray-500 mt-8",children:["© ",new Date().getFullYear()," Twisted Brody. Todos los derechos reservados."]})]})]})})}function gM({isOpen:t,onClose:e,selectedMangaIds:n,onSaveComplete:r}){const[i,s]=F.useState([]),[o,a]=F.useState([]),[u,c]=F.useState(!1),[f,h]=F.useState(!1);F.useEffect(()=>{t&&(p(),a([]))},[t]);const p=async()=>{try{h(!0);const x=await zI();s(x)}catch(x){console.error("Error loading categories:",x)}finally{h(!1)}},g=async(x,E)=>{if(x.trim()){if(E==="tag"){const O=x.split(" ").map(L=>L.trim()).filter(L=>L.length>0);for(const L of O)await _(L,E);return}await _(x,E)}},_=async(x,E)=>{try{const O=i.find(L=>L.name.toLowerCase()===x.trim().toLowerCase()&&L.type===E);if(O)a(L=>L.includes(O.id)?L:[...L,O.id]);else{const L=await BI(x.trim(),E);s(D=>D.find(b=>b.id===L.id)?D:[...D,L]),a(D=>D.includes(L.id)?D:[...D,L.id])}}catch(O){console.error("Error creating category:",O)}},S=x=>{a(E=>E.filter(O=>O!==x))},P=async x=>{try{await $I(x),s(E=>E.filter(O=>O.id!==x)),a(E=>E.filter(O=>O!==x))}catch(E){console.error("Error deleting category:",E),Ct.error("Error al eliminar la categoría")}},v=async()=>{if(o.length===0){Ct.error("Selecciona al menos una categoría para aplicar.");return}c(!0);try{const x=n.map(async E=>{var O;try{const L=await UI(E);if(!L)return;const D=((O=L.categories)==null?void 0:O.map(w=>w.id))||[],b=Array.from(new Set([...D,...o]));await HI(E,{title:L.title,author:L.author,categoryIds:b})}catch(L){console.error(`Error updating manga ${E}`,L)}});await Promise.all(x),Ct.success("Categorías aplicadas correctamente."),r(),e()}catch(x){console.error("Error bulk updating mangas:",x),Ct.error("Error al aplicar cambios.")}finally{c(!1)}};return t?d.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50 p-4 animate-in fade-in duration-200",children:d.jsxs("div",{className:"bg-[#121212] rounded-2xl border border-gray-800 w-full max-w-2xl shadow-2xl overflow-hidden flex flex-col max-h-[90vh]",children:[d.jsxs("div",{className:"bg-[#1a1a1a] border-b border-gray-800 px-6 py-4 flex items-center justify-between sticky top-0 z-10",children:[d.jsxs("h2",{className:"text-xl font-bold text-white",children:["Aplicar Categorías a ",n.length," Mangas"]}),d.jsx("button",{onClick:e,className:"text-gray-400 hover:text-white transition-colors p-2 hover:bg-white/5 rounded-lg",children:d.jsx(Vn,{className:"w-5 h-5"})})]}),d.jsx("div",{className:"p-6 overflow-y-auto custom-scrollbar flex-1",children:f?d.jsx("div",{className:"flex justify-center p-8",children:d.jsx(bs,{size:32})}):d.jsxs("div",{className:"space-y-6",children:[d.jsx(ki,{label:"Personajes",type:"character",categories:i,selectedIds:o,onSelect:x=>{o.includes(x)||a(E=>[...E,x])},onRemove:S,onCreate:x=>g(x,"character"),onDeleteCategory:P,colorClass:"text-blue-400",placeholder:"Añadir personaje..."}),d.jsx(ki,{label:"Series",type:"series",categories:i,selectedIds:o,onSelect:x=>{o.includes(x)||a(E=>[...E,x])},onRemove:S,onCreate:x=>g(x,"series"),onDeleteCategory:P,colorClass:"text-green-400",placeholder:"Añadir serie..."}),d.jsx(ki,{label:"Géneros",type:"genre",categories:i,selectedIds:o,onSelect:x=>{o.includes(x)||a(E=>[...E,x])},onRemove:S,onCreate:x=>g(x,"genre"),onDeleteCategory:P,colorClass:"text-purple-400",placeholder:"Añadir género..."}),d.jsx(ki,{label:"Etiquetas",type:"tag",categories:i,selectedIds:o,onSelect:x=>{o.includes(x)||a(E=>[...E,x])},onRemove:S,onCreate:x=>g(x,"tag"),onDeleteCategory:P,colorClass:"text-pink-400",placeholder:"Añadir etiqueta..."})]})}),d.jsxs("div",{className:"p-6 border-t border-gray-800 flex justify-end gap-3 bg-[#1a1a1a]",children:[d.jsx("button",{onClick:e,className:"px-4 py-2 rounded-lg text-sm font-semibold text-gray-300 hover:text-white transition-colors",children:"Cancelar"}),d.jsx("button",{onClick:v,disabled:u||o.length===0,className:"bg-[#bb86fc] hover:bg-[#9966dd] text-white px-6 py-2 rounded-lg font-semibold text-sm transition-all shadow-lg shadow-[#bb86fc]/20 flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed",children:u?d.jsxs(d.Fragment,{children:[d.jsx(bs,{size:16}),"Guardando..."]}):d.jsxs(d.Fragment,{children:[d.jsx(zm,{className:"w-4 h-4"}),"Aplicar Cambios"]})})]})]})}):null}const Fw=["series","character","genre","tag","other"],yM={series:"Series",character:"Personajes",genre:"Géneros",tag:"Etiquetas",other:"Otros"};function vM({isOpen:t,onClose:e,categories:n,selectedCategories:r,onToggleCategory:i,onClearFilters:s}){const[o,a]=F.useState(""),u=F.useMemo(()=>{const c=n.filter(h=>h.name.toLowerCase().includes(o.toLowerCase())),f={};return Fw.forEach(h=>{f[h]=[]}),f.other=[],c.forEach(h=>{const p=h.type||"other";f[p]||(f[p]=[]),f[p].push(h)}),f},[n,o]);return t?d.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/80 backdrop-blur-sm animate-in fade-in duration-200",children:d.jsxs("div",{className:"bg-[#1a1a1a] w-full max-w-4xl max-h-[85vh] rounded-2xl border border-gray-800 shadow-2xl flex flex-col overflow-hidden animate-in zoom-in-95 duration-200",onClick:c=>c.stopPropagation(),children:[d.jsxs("div",{className:"p-4 sm:p-6 border-b border-gray-800 flex items-center justify-between bg-[#1a1a1a]",children:[d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx("div",{className:"bg-purple-500/20 p-2 rounded-lg",children:d.jsx(nb,{className:"w-5 h-5 text-purple-400"})}),d.jsxs("div",{children:[d.jsx("h2",{className:"text-xl font-bold text-white",children:"Filtrar por Categorías"}),d.jsx("p",{className:"text-sm text-gray-400",children:"Selecciona múltiples opciones para refinar tu búsqueda"})]})]}),d.jsx("button",{onClick:e,className:"text-gray-400 hover:text-white hover:bg-gray-800 p-2 rounded-lg transition-all",children:d.jsx(Vn,{className:"w-5 h-5"})})]}),d.jsx("div",{className:"p-4 border-b border-gray-800 bg-[#151515]",children:d.jsxs("div",{className:"relative",children:[d.jsx(Tc,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400"}),d.jsx("input",{type:"text",placeholder:"Buscar categorías...",value:o,onChange:c=>a(c.target.value),className:"w-full bg-[#0f0f0f] border border-gray-700/50 rounded-lg pl-10 pr-4 py-2.5 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-purple-500/50 focus:ring-1 focus:ring-purple-500/50 transition-all"})]})}),d.jsx("div",{className:"flex-1 overflow-y-auto p-4 sm:p-6 space-y-8 custom-scrollbar",children:Fw.map(c=>{const f=u[c];return!f||f.length===0?null:d.jsxs("div",{className:"animate-in slide-in-from-bottom-2 duration-300",children:[d.jsxs("h3",{className:"text-sm font-bold text-purple-400 uppercase tracking-wider mb-3 flex items-center gap-2",children:[d.jsx("span",{className:"w-1 h-4 bg-purple-500 rounded-full"}),yM[c]||c]}),d.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-2",children:f.sort((h,p)=>h.name.localeCompare(p.name)).map(h=>{const p=r.includes(h.name);return d.jsxs("button",{onClick:()=>i(h.name),className:` + relative group flex items-center justify-between px-3 py-2 rounded-lg text-sm text-left transition-all duration-200 border + ${p?"bg-purple-500/20 border-purple-500/50 text-purple-100 shadow-[0_0_15px_-3px_rgba(168,85,247,0.3)]":"bg-[#252525] border-transparent text-gray-300 hover:bg-[#2a2a2a] hover:border-gray-700"} + `,children:[d.jsx("span",{className:"truncate mr-2 font-medium",children:h.name}),p&&d.jsx("div",{className:"bg-purple-500 rounded-full p-0.5 animate-in zoom-in duration-200",children:d.jsx(fd,{className:"w-3 h-3 text-white"})})]},h.id)})})]},c)})}),d.jsxs("div",{className:"p-4 border-t border-gray-800 bg-[#1a1a1a] flex items-center justify-between",children:[d.jsxs("div",{className:"text-sm text-gray-400",children:[r.length," seleccionada",r.length!==1?"s":""]}),d.jsxs("div",{className:"flex items-center gap-3",children:[r.length>0&&d.jsx("button",{onClick:s,className:"px-4 py-2 text-sm text-gray-400 hover:text-white transition-colors",children:"Limpiar todo"}),d.jsx("button",{onClick:e,className:"px-6 py-2 bg-purple-600 hover:bg-purple-700 text-white rounded-lg text-sm font-semibold shadow-lg shadow-purple-900/20 transition-all hover:scale-105 active:scale-95",children:"Listo"})]})]})]})}):null}const xM={random:"Aleatorio",name:"Nombre",date:"Fecha de creación",modified:"Última modificación",pages:"Páginas",views:"Vistas"};function wM({value:t,onChange:e,placeholder:n="Buscar manga...",sortType:r="random",onSortTypeChange:i,sortDirection:s="asc",onSortDirectionChange:o,onOpenFilter:a}){const[u,c]=F.useState(!1),f=()=>{e("")},h=()=>{const _=["modified","name","date","pages","views","random"],P=(_.indexOf(r)+1)%_.length;i==null||i(_[P])},p=()=>{const _=s==="asc"?"desc":"asc";o==null||o(_)},g=()=>r==="views"?s==="asc"?"Menos vistos":"Más vistos":s==="asc"?"ASC":"DESC";return d.jsxs("div",{className:"w-full flex gap-2 items-center",children:[d.jsxs("div",{className:"relative flex-1",children:[d.jsx(Tc,{className:`absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 pointer-events-none ${u?"text-purple-400":"text-gray-400"}`}),d.jsx("input",{type:"text",placeholder:n,value:t,onChange:_=>e(_.target.value),onFocus:()=>c(!0),onBlur:()=>c(!1),className:"w-full bg-[#1a1a1a] text-white rounded-lg pl-10 pr-10 py-2.5 text-sm placeholder-gray-400 border border-gray-700/50 focus:border-purple-500 focus:outline-none"}),t&&d.jsx("button",{onClick:f,className:"absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-400 hover:text-purple-400 transition-all p-1 hover:scale-125 hover:rotate-90 duration-300",title:"Limpiar búsqueda",children:d.jsx(Vn,{className:"w-4 h-4"})})]}),d.jsx("button",{onClick:a,className:"bg-gray-800 hover:bg-gray-700 border border-gray-700 hover:border-purple-500/50 text-white p-2.5 rounded-lg transition-all duration-300 hover:shadow-lg hover:shadow-purple-500/10 group",title:"Filtrar por categorías",children:d.jsx(nb,{className:"w-4 h-4 text-gray-400 group-hover:text-purple-400 transition-colors"})}),d.jsxs("button",{onClick:h,className:"bg-gradient-to-r from-gray-700/40 to-gray-600/40 hover:from-gray-700/60 hover:to-gray-600/60 border border-gray-600/50 hover:border-purple-500/50 text-white px-2.5 py-2.5 rounded-lg flex items-center justify-center gap-1.5 font-medium text-xs transition-all duration-300 active:scale-95 whitespace-nowrap hover:scale-110 hover:shadow-lg hover:shadow-purple-500/20 hover:border-purple-500",title:"Cambiar tipo de ordenamiento",children:[d.jsx(S2,{className:"w-3.5 h-3.5 transition-transform duration-300 hover:rotate-180"}),d.jsx("span",{className:"hidden sm:inline",children:xM[r]})]}),d.jsxs("button",{onClick:p,className:"bg-gradient-to-r from-gray-700/40 to-gray-600/40 hover:from-gray-700/60 hover:to-gray-600/60 border border-gray-600/50 hover:border-purple-500/50 text-white px-2.5 py-2.5 rounded-lg flex items-center justify-center gap-1.5 font-medium text-xs transition-all duration-300 active:scale-95 whitespace-nowrap hover:scale-110 hover:shadow-lg hover:shadow-purple-500/20 hover:border-purple-500",title:s==="asc"?"Cambiar a descendente":"Cambiar a ascendente",children:[d.jsx(I2,{className:`w-3.5 h-3.5 transition-all duration-500 ${s==="desc"?"rotate-180":""} hover:scale-125`}),d.jsx("span",{className:"hidden sm:inline text-[10px]",children:g()})]})]})}function _M(){return d.jsxs("div",{className:"flex flex-col w-full max-w-xs",children:[d.jsx("div",{className:"relative bg-black rounded-lg shadow-lg overflow-hidden aspect-[2/3] mb-2",children:d.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:d.jsx("div",{className:"rounded-full animate-spin",style:{width:"30px",height:"30px",borderWidth:"2px",borderStyle:"solid",borderColor:"rgba(187, 134, 252, 0.2)",borderTopColor:"#bb86fc",animation:"spin 0.6s linear infinite"}})})}),d.jsxs("div",{className:"flex flex-col gap-2 items-center animate-pulse",children:[d.jsx("div",{className:"h-4 bg-gray-800 rounded w-3/4"}),d.jsx("div",{className:"h-3 bg-gray-800 rounded w-1/2"})]})]})}const uf=24;function bM({items:t,searchTerm:e,isSearching:n,onSelectComic:r,onEditManga:i,onDeleteManga:s,isLoading:o=!1,isCategoryPlusEnabled:a=!1,selectedMangaIds:u=[],onToggleSelectManga:c}){const[f,h]=F.useState(()=>{const v=new URLSearchParams(window.location.search).get("page");return v?Math.max(1,Number(v)):1});F.useEffect(()=>{const P=()=>{const x=new URLSearchParams(window.location.search).get("page");h(x?Math.max(1,Number(x)):1)};return window.addEventListener("popstate",P),()=>window.removeEventListener("popstate",P)},[]);const p=Math.ceil(t.length/uf);F.useEffect(()=>{if(p>0&&f>p){h(p);const P=new URL(window.location.href);P.searchParams.set("page",String(p)),window.history.replaceState({},"",P)}},[p,f]),F.useEffect(()=>{if(e){h(1);const P=new URL(window.location.href);P.searchParams.delete("page"),window.history.replaceState({},"",P)}},[e]);const g=t.slice((f-1)*uf,f*uf),_=P=>{h(P);const v=new URL(window.location.href);v.searchParams.set("page",String(P)),window.history.pushState({},"",v),window.scrollTo({top:0,behavior:"smooth"})},S=()=>{if(p<=1)return null;const P=[],v=5;let x=Math.max(1,f-Math.floor(v/2)),E=Math.min(p,x+v-1);E-x+1_(1),disabled:f===1,className:"p-2 rounded-lg bg-[#1a1a1a] text-white hover:bg-[#bb86fc] disabled:opacity-50 disabled:hover:bg-[#1a1a1a] transition-colors",title:"Primera página",children:d.jsx(eb,{className:"w-4 h-4"})}),d.jsx("button",{onClick:()=>_(f-1),disabled:f===1,className:"p-2 rounded-lg bg-[#1a1a1a] text-white hover:bg-[#bb86fc] disabled:opacity-50 disabled:hover:bg-[#1a1a1a] transition-colors",title:"Anterior",children:d.jsx(pd,{className:"w-4 h-4"})}),x>1&&d.jsx("span",{className:"text-gray-500 px-1",children:"..."}),P.map(O=>d.jsx("button",{onClick:()=>_(O),className:`w-8 h-8 rounded-lg text-sm font-medium transition-colors ${f===O?"bg-[#bb86fc] text-white":"bg-[#1a1a1a] text-gray-400 hover:bg-[#333] hover:text-white"}`,children:O},O)),E_(f+1),disabled:f===p,className:"p-2 rounded-lg bg-[#1a1a1a] text-white hover:bg-[#bb86fc] disabled:opacity-50 disabled:hover:bg-[#1a1a1a] transition-colors",title:"Siguiente",children:d.jsx(md,{className:"w-4 h-4"})}),d.jsx("button",{onClick:()=>_(p),disabled:f===p,className:"p-2 rounded-lg bg-[#1a1a1a] text-white hover:bg-[#bb86fc] disabled:opacity-50 disabled:hover:bg-[#1a1a1a] transition-colors",title:"Última página",children:d.jsx(tb,{className:"w-4 h-4"})})]})};return n&&e?d.jsx("div",{className:"flex flex-col items-center justify-center py-16 animate-in fade-in duration-300",children:d.jsxs("div",{className:"text-gray-400 text-sm animate-pulse",children:['Buscando "',e,'"...']})}):o?d.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 2xl:grid-cols-6 gap-1.5 sm:gap-2 md:gap-3 justify-center items-start animate-in fade-in duration-300",children:Array.from({length:12}).map((P,v)=>d.jsx(_M,{},v))}):e&&t.length===0?d.jsxs("div",{className:"flex flex-col items-center justify-center py-16 animate-in fade-in duration-300",children:[d.jsx(hl,{className:"w-16 h-16 text-gray-600 mb-4 animate-bounce"}),d.jsx("p",{className:"text-gray-400 text-lg mb-2",children:"No se encontraron resultados"}),d.jsx("p",{className:"text-gray-500 text-sm",children:"Intenta con otros términos de búsqueda"})]}):!e&&t.length===0?d.jsxs("div",{className:"flex flex-col items-center justify-center py-20 animate-in fade-in duration-300",children:[d.jsx(hl,{className:"w-16 h-16 text-gray-600 mb-4 animate-bounce"}),d.jsx("p",{className:"text-gray-400 text-lg mb-2",children:"No hay mangas disponibles"}),d.jsx("p",{className:"text-gray-500 text-sm",children:'Crea tu primer manga usando el botón "Nuevo"'})]}):d.jsxs("div",{className:"flex flex-col gap-6",children:[d.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 2xl:grid-cols-6 gap-1.5 sm:gap-2 md:gap-3 justify-center items-start",children:g.map(P=>d.jsx("div",{children:d.jsx(KI,{id:P.id,title:P.title,author:P.author,pageCount:P.pageCount,thumbnail:P.thumbnail,manga:P.manga,onSelect:()=>r(P.id),onEdit:i,onDelete:s?()=>s(P.id):void 0,isCategoryPlusEnabled:a,isSelected:u.includes(P.id),onToggleSelect:c?()=>c(P.id):void 0})},P.id))}),S()]})}function lo(t){return t.toLowerCase().trim().normalize("NFD").replace(/[\u0300-\u036f]/g,"")}function cf(t,e){const n=lo(t),r=lo(e);if(n===r)return 1;if(n.length<2||r.length<2)return n.includes(r)?.8:0;const i=n.length>r.length?n:r,s=n.length>r.length?r:n,o=EM(s,i);return(i.length-o)/i.length}function EM(t,e){const n=[];for(let r=0;r<=t.length;r++){let i=r;for(let s=0;s<=e.length;s++)if(r===0)n[s]=s;else if(s>0){let o=n[s-1];t.charAt(r-1)!==e.charAt(s-1)&&(o=Math.min(Math.min(o,i),n[s])+1),n[s-1]=i,i=o}r>0&&(n[e.length]=i)}return n[e.length]}function IM(t,e,n={}){const{minChars:r=1,fuzzyMatch:i=!0}=n;if(!e.trim()||e.length{let u=0;const c=cf(a.title,e),f=cf(a.author,e),h=lo(a.title).includes(s)?.3:0,p=lo(a.author).includes(s)?.2:0;let g=0,_=0;if(a.categories&&a.categories.length>0){const S=a.categories.map(v=>cf(v,e));g=Math.max(...S),_=a.categories.some(v=>lo(v).includes(s))?.3:0}return u=Math.max(c*.6+h,f*.4+p,g*.5+_),{item:a,score:u}}).filter(a=>i?a.score>.3:a.score>.7).sort((a,u)=>u.score-a.score).map(a=>a.item);return{items:o,query:e,resultCount:o.length}}function TM(){const[t,e]=F.useState(!1),[n,r]=F.useState(!1),[i,s]=F.useState(!1),[o,a]=F.useState(()=>localStorage.getItem("isAdmin")==="true"),[u,c]=F.useState(null),[f,h]=F.useState(!1),[p,g]=F.useState([]),[_,S]=F.useState(!1),[P,v]=F.useState(null),[x,E]=F.useState([]),[O,L]=F.useState(null),[D,b]=F.useState([]),[w,T]=F.useState(!1),[A,N]=F.useState(!1),[j,C]=F.useState(!0),[se,he]=F.useState(""),[le,me]=F.useState([]),[q,oe]=F.useState(()=>localStorage.getItem("sortType")||"modified"),[k,ge]=F.useState(()=>localStorage.getItem("sortDirection")||"desc");F.useEffect(()=>{localStorage.setItem("isAdmin",String(o))},[o]),F.useEffect(()=>{localStorage.setItem("sortType",q)},[q]),F.useEffect(()=>{localStorage.setItem("sortDirection",k)},[k]),F.useEffect(()=>{var Ae;(Ae=window.Telegram)!=null&&Ae.WebApp&&window.Telegram.WebApp.ready(),ye();const te=window.location.hash.slice(1);if(te&&te.startsWith("manga/"))if(te.endsWith("/hd")){const Le=te.replace("manga/","").replace("/hd","");v(Le),T(!0)}else{const Le=te.replace("manga/","");v(Le),T(!1)}else te==="info"&&N(!0);const ve=()=>{const Le=window.location.hash.slice(1);if(!Le)v(null),L(null),N(!1),T(!1);else if(Le.startsWith("manga/")){if(Le.endsWith("/hd")){const we=Le.replace("manga/","").replace("/hd","");v(we),T(!0)}else{const we=Le.replace("manga/","");v(we),T(!1)}L(null),N(!1)}else Le==="info"&&(N(!0),v(null),L(null))};return window.addEventListener("hashchange",ve),()=>window.removeEventListener("hashchange",ve)},[]);async function ye(){try{C(!0);const te=await qd();b(te)}catch(te){console.error("Error loading mangas:",te)}finally{C(!1)}}const R=F.useMemo(()=>{const te=new Map;return D.forEach(ve=>{var Ae;(Ae=ve.categories)==null||Ae.forEach(Le=>{te.has(Le.id)||te.set(Le.id,Le)})}),Array.from(te.values())},[D]),$=F.useMemo(()=>se.trim()?IM(D.map(te=>({id:te.id,title:te.title,author:te.author,categories:te.categories?te.categories.map(ve=>ve.name):[]})),se,{fuzzyMatch:!0,minChars:1}):{items:D,query:"",resultCount:D.length},[D,se]),Z=F.useMemo(()=>{let te=$.items.length>0?$.items.map(Ae=>D.find(Le=>Le.id===Ae.id)).filter(Boolean):[];le.length>0&&(te=te.filter(Ae=>le.some(Le=>{var we;return(we=Ae.categories)==null?void 0:we.some(Qe=>Qe.name===Le)})));const ve=[...te];return q==="random"?ve.sort(()=>Math.random()-.5):(ve.sort((Ae,Le)=>{var Qe,Ht;let we=0;if(q==="name")we=Ae.title.localeCompare(Le.title);else if(q==="date"){const Xe=new Date(Ae.created_at||0).getTime(),ht=new Date(Le.created_at||0).getTime();we=Xe-ht}else if(q==="modified"){const Xe=new Date(Ae.updated_at||Ae.created_at||0).getTime(),ht=new Date(Le.updated_at||Le.created_at||0).getTime();we=Xe-ht}else if(q==="pages"){const Xe=((Qe=Ae.chapters)==null?void 0:Qe.reduce((tn,qt)=>{var z;return tn+(((z=qt.pages)==null?void 0:z.length)||0)},0))||0,ht=((Ht=Le.chapters)==null?void 0:Ht.reduce((tn,qt)=>{var z;return tn+(((z=qt.pages)==null?void 0:z.length)||0)},0))||0;we=Xe-ht}else q==="views"&&(we=(Ae.views||0)-(Le.views||0));return k==="asc"?we:-we}),ve)},[D,se,$.items,q,k,le]),ie=te=>{c(te),e(!0)},Te=async te=>{try{await Mj(te),await ye()}catch(ve){console.error("Error deleting manga:",ve),alert("Error al eliminar el manga. Por favor intenta de nuevo.")}},fe=te=>{g(ve=>ve.includes(te)?ve.filter(Ae=>Ae!==te):[...ve,te])},Fe=te=>{if(f){fe(te);return}window.location.hash=`manga/${te}`,v(te),T(!1)},ee=()=>{window.location.hash="",v(null),N(!1)},Ce=te=>{P&&E([...x,P]),window.location.hash=`manga / ${te} `,v(te)},tt=te=>{me(ve=>ve.includes(te)?ve.filter(Ae=>Ae!==te):[...ve,te]),ee()},Dt=te=>{me(ve=>ve.filter(Ae=>Ae!==te))},jt=F.useMemo(()=>Z.map(te=>{var Le,we;const ve=((Le=te.chapters)==null?void 0:Le.length)||0,Ae=((we=te.chapters)==null?void 0:we.reduce((Qe,Ht)=>{var Xe;return Qe+(((Xe=Ht.pages)==null?void 0:Xe.length)||0)},0))||0;return{id:te.id,title:te.title,author:te.author,chapterCount:ve,pageCount:Ae,thumbnail:te.cover_url||te.thumbnail_url||void 0,manga:te}}),[Z]);if(O)return d.jsx(I3,{manga:O.manga,chapter:O.chapter,onBack:()=>L(null)});if(A)return d.jsx(mM,{onBack:ee,isAdmin:o});if(P!==null){let te=D.find(ve=>ve.id===P);return w&&te?d.jsx(V2,{manga:te,onBack:()=>{window.history.back()}}):d.jsx(E3,{id:P,onBack:()=>{if(x.length>0){const ve=x[x.length-1];E(x.slice(0,-1)),window.location.hash=`manga / ${ve} `,v(ve)}else ee()},onReadChapter:ve=>{te&&L({manga:te,chapter:ve})},onMangaLoaded:ve=>{te||(te=ve)},onNavigateToManga:Ce,onSelectCategory:tt,isAdmin:o})}return d.jsxs("div",{className:"min-h-screen bg-[#121212] text-white flex flex-col",children:[d.jsx("header",{className:"border-b border-gray-800/50 px-3 sm:px-6 md:px-12 py-4 sm:py-6 flex-shrink-0 transition-all duration-300",children:d.jsxs("div",{className:"max-w-[1800px] mx-auto flex items-center justify-between gap-2 sm:gap-0",children:[d.jsxs("div",{className:"flex items-center gap-1 sm:gap-1.5 group cursor-pointer",children:[d.jsx("img",{src:"/icons/icones.png",alt:"Twisted Brody Logo",className:"w-10 h-10 sm:w-14 sm:h-14 object-contain transition-all duration-300 group-hover:rotate-12 group-hover:scale-110"}),d.jsx("h1",{className:"text-lg sm:text-2xl font-bold text-white transition-colors duration-300 group-hover:text-[#bb86fc]",children:"Twisted Brody MangaFlow"})]}),d.jsxs("div",{className:"flex items-center gap-1.5 sm:gap-3",children:[f&&d.jsxs("div",{className:"hidden sm:flex items-center gap-2 mr-2 px-3 py-1.5 bg-purple-500/10 rounded-lg border border-purple-500/20",children:[d.jsx(ib,{className:"w-4 h-4 text-purple-400"}),d.jsx("span",{className:"text-xs font-semibold text-purple-300",children:"Modo Plus Activo"}),d.jsx("span",{className:"text-xs bg-purple-500/20 px-2 py-0.5 rounded text-purple-200",children:p.length})]}),d.jsxs("button",{onClick:()=>r(!0),className:"bg-gray-800 hover:bg-gray-700 active:scale-95 text-white px-2 py-2 sm:px-4 sm:py-2.5 rounded-lg flex items-center gap-1.5 sm:gap-2 font-semibold transition-all duration-300 border border-gray-700/50 hover:border-gray-600 text-xs sm:text-sm hover:scale-110 hover:shadow-lg hover:shadow-700/50",title:"Ajustes y Admin",children:[d.jsx(lb,{className:"w-4 h-4 sm:w-5 sm:h-5 transition-transform duration-300 hover:rotate-180"}),d.jsx("span",{className:"hidden sm:inline",children:"Ajustes"})]}),d.jsxs("button",{onClick:()=>e(!0),className:"bg-purple-600 hover:bg-purple-700 active:scale-95 text-white px-2 py-2 sm:px-4 sm:py-2.5 rounded-lg flex items-center gap-1.5 sm:gap-2 font-semibold transition-all duration-300 shadow-lg shadow-purple-600/30 hover:shadow-purple-600/50 text-xs sm:text-sm hover:scale-110",children:[d.jsx(fl,{className:"w-4 h-4 sm:w-5 sm:h-5 transition-transform duration-300 hover:rotate-180"}),d.jsx("span",{className:"hidden sm:inline",children:"Nuevo Manga"})]})]})]})}),d.jsxs("main",{className:"flex-1 px-4 sm:px-6 md:px-12 py-8",children:[d.jsx(w3,{isAdmin:o}),d.jsxs("div",{className:"max-w-[1800px] mx-auto mb-8 flex-shrink-0",children:[d.jsx(wM,{value:se,onChange:he,placeholder:"Buscar por título, autor...",sortType:q,onSortTypeChange:oe,sortDirection:k,onSortDirectionChange:ge,onOpenFilter:()=>s(!0)}),se&&d.jsxs("div",{className:"mt-2 text-sm text-gray-400",children:[$.resultCount," resultado",$.resultCount!==1?"s":""," encontrado",$.resultCount!==1?"s":""]}),le.length>0&&d.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-2 animate-in fade-in slide-in-from-top-2 duration-300",children:[d.jsx("span",{className:"text-sm text-gray-400",children:"Filtrado por:"}),le.map(te=>d.jsxs("button",{onClick:()=>Dt(te),className:"bg-purple-500/20 hover:bg-purple-500/30 text-purple-300 px-3 py-1 rounded-full text-sm font-medium flex items-center gap-2 border border-purple-500/30 hover:border-purple-500/50 transition-all group",children:[te,d.jsx("div",{className:"bg-purple-500/20 rounded-full p-0.5 group-hover:bg-purple-500/40 transition-colors",children:d.jsx(fl,{className:"w-3 h-3 transform rotate-45"})})]},te)),le.length>1&&d.jsx("button",{onClick:()=>me([]),className:"text-xs text-gray-400 hover:text-white underline decoration-gray-600 hover:decoration-white transition-colors ml-2",children:"Limpiar todo"})]})]}),d.jsx("div",{className:"max-w-[1800px] mx-auto",children:d.jsxs(d.Fragment,{children:[d.jsx("link",{rel:"preconnect",href:"https://i.ibb.co"}),d.jsx(bM,{items:jt,searchTerm:se,isSearching:!1,isLoading:j,onSelectComic:Fe,onEditManga:o?ie:void 0,onDeleteManga:o?Te:void 0,isCategoryPlusEnabled:f,selectedMangaIds:p,onToggleSelectManga:fe})]})})]}),f&&p.length>0&&d.jsx("div",{className:"fixed bottom-6 left-1/2 transform -translate-x-1/2 z-40 animate-in slide-in-from-bottom-4 duration-200",children:d.jsxs("div",{className:"bg-[#1a1a1a] border border-gray-700/50 shadow-2xl rounded-xl px-6 py-3 flex items-center gap-4",children:[d.jsxs("div",{className:"flex flex-col",children:[d.jsxs("span",{className:"text-sm font-bold text-white",children:[p.length," seleccionados"]}),d.jsx("span",{className:"text-xs text-gray-400",children:"Listos para editar"})]}),d.jsx("div",{className:"h-8 w-px bg-gray-700"}),d.jsx("button",{onClick:()=>g([]),className:"text-gray-400 hover:text-white text-sm font-semibold transition-colors",children:"Cancelar"}),d.jsx("button",{onClick:()=>S(!0),className:"bg-[#bb86fc] hover:bg-[#9966dd] text-white px-4 py-2 rounded-lg text-sm font-bold shadow-lg shadow-purple-500/20 transition-all transform hover:scale-105 active:scale-95",children:"Aplicar Categorías"})]})}),d.jsx(gd,{}),d.jsx(p3,{isOpen:t,onClose:()=>{e(!1),c(null)},editingManga:u,onMangaCreated:te=>{ye(),c(null),te&&!u&&setTimeout(()=>{Fe(te)},500)},onDelete:o?Te:void 0}),d.jsx(gM,{isOpen:_,onClose:()=>S(!1),selectedMangaIds:p,onSaveComplete:()=>{ye(),g([])}}),d.jsx(x3,{isOpen:n,onClose:()=>r(!1),isAdmin:o,onAdminChange:a,isCategoryPlusEnabled:f,onCategoryPlusChange:h}),d.jsx(vM,{isOpen:i,onClose:()=>s(!1),categories:R,selectedCategories:le,onToggleCategory:tt,onClearFilters:()=>me([])}),d.jsx(f3,{position:"top-center",richColors:!0,theme:"dark"})]})}Z1(document.getElementById("root")).render(d.jsx(F.StrictMode,{children:d.jsx(TM,{})})); diff --git a/dist/icons/1.png b/dist/icons/1.png new file mode 100644 index 0000000000000000000000000000000000000000..df4bceda02851d735aa317699159f032aeca8807 --- /dev/null +++ b/dist/icons/1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:85d7e3678cda8a4496d66ee777d1fc4893b53452c84ec7b7bb1560ff7cf1a6db +size 1526625 diff --git a/dist/icons/2.png b/dist/icons/2.png new file mode 100644 index 0000000000000000000000000000000000000000..61728560bc2c4eeda7947a12b900ed2ad561e1c0 --- /dev/null +++ b/dist/icons/2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f1aaefd4770be8859c42931b6850277c4b04f22eaadb0d4d54d731ba96351b99 +size 1649544 diff --git a/dist/icons/3.png b/dist/icons/3.png new file mode 100644 index 0000000000000000000000000000000000000000..e1d9bc71dc46129ccee14bbaff0274d8fa885f6f --- /dev/null +++ b/dist/icons/3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e46ad7e338ebc55e1e4e0b4158da6b84987c14f17cc327e299d36680b948a780 +size 1442924 diff --git a/dist/icons/4.png b/dist/icons/4.png new file mode 100644 index 0000000000000000000000000000000000000000..6a6f888029605804f6f58475e1b79509d90e0faf --- /dev/null +++ b/dist/icons/4.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:78c74dafcebd872cfdc50174d4b54b85fedc590c6fc9892761c702b1934b753d +size 1343452 diff --git a/dist/icons/@twistedbrody dowload.png b/dist/icons/@twistedbrody dowload.png new file mode 100644 index 0000000000000000000000000000000000000000..99b34dd64d42fd7dacd1054b2d2caa7fb8740a96 --- /dev/null +++ b/dist/icons/@twistedbrody dowload.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:66fc41948d1e7218f432c928873f3ca345f6f4ab020992188b1042f9d3cc0b07 +size 289754 diff --git a/dist/icons/@twistedbrody.png b/dist/icons/@twistedbrody.png new file mode 100644 index 0000000000000000000000000000000000000000..2c97c4d25c14ea33756636c08ae20f1e26fd2dec --- /dev/null +++ b/dist/icons/@twistedbrody.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6e05f5e183d8d8aa7642fa54913ddcd08dffd9763568611be04c253bd09fc7c7 +size 101247 diff --git a/dist/icons/icones.png b/dist/icons/icones.png new file mode 100644 index 0000000000000000000000000000000000000000..00225e67c4e9013359ebb45b4845d7043c1f3d8e --- /dev/null +++ b/dist/icons/icones.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2b906ab62cb436a7eeb3afbc4f2a266157ae30a7bcf9581ce0aeeca2033cf049 +size 1329654 diff --git a/dist/icons/logo pagina.png b/dist/icons/logo pagina.png new file mode 100644 index 0000000000000000000000000000000000000000..3aca924bba66aa57a743347154ee175754e27d30 Binary files /dev/null and b/dist/icons/logo pagina.png differ diff --git a/dist/icons/logo.png b/dist/icons/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..79b82f660b067177eb50ba1bfcf8c1fc110abf22 --- /dev/null +++ b/dist/icons/logo.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dbf84689628529b5b8ce923188e84f42d663b6455332681aae32d94d92603f33 +size 1063322 diff --git a/dist/index.html b/dist/index.html new file mode 100644 index 0000000000000000000000000000000000000000..41bb1c8bd1e61e021c0ceb9283afaddb38f4c210 --- /dev/null +++ b/dist/index.html @@ -0,0 +1,18 @@ + + + + + + + + + Twisted brody + + + + + +
+ + + \ No newline at end of file diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000000000000000000000000000000000000..71a2a23dfa8b611bdf03aa131a55b6623a3f97d7 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,28 @@ +import js from '@eslint/js'; +import globals from 'globals'; +import reactHooks from 'eslint-plugin-react-hooks'; +import reactRefresh from 'eslint-plugin-react-refresh'; +import tseslint from 'typescript-eslint'; + +export default tseslint.config( + { ignores: ['dist'] }, + { + extends: [js.configs.recommended, ...tseslint.configs.recommended], + files: ['**/*.{ts,tsx}'], + languageOptions: { + ecmaVersion: 2020, + globals: globals.browser, + }, + plugins: { + 'react-hooks': reactHooks, + 'react-refresh': reactRefresh, + }, + rules: { + ...reactHooks.configs.recommended.rules, + 'react-refresh/only-export-components': [ + 'warn', + { allowConstantExport: true }, + ], + }, + } +); diff --git a/index.css b/index.css new file mode 100644 index 0000000000000000000000000000000000000000..e7fc085a0f74333c42c7bb0e8297f82ef6cdd2c1 --- /dev/null +++ b/index.css @@ -0,0 +1,215 @@ +@tailwind base; +@tailwind components; +@tailwind utilities; + +@keyframes spin { + from { + transform: rotate(0deg); + } + to { + transform: rotate(360deg); + } +} + +.animate-spin { + animation: spin 1s linear infinite; +} + +@keyframes fadeIn { + from { + opacity: 0; + transform: scale(0.95); + } + to { + opacity: 1; + transform: scale(1); + } +} + +@keyframes fadeOut { + from { + opacity: 1; + } + to { + opacity: 0; + } +} + +@keyframes fadeInUp { + from { + opacity: 0; + transform: translateY(20px); + } + to { + opacity: 1; + transform: translateY(0); + } +} + +@keyframes quickFadeIn { + from { + opacity: 0; + transform: scale(0.98); + } + to { + opacity: 1; + transform: scale(1); + } +} + +.animate-quick-fade-in { + animation: quickFadeIn 0.15s ease-out forwards; +} + +@keyframes smoothFadeIn { + 0% { + opacity: 0; + transform: scale(0.98); + } + 50% { + opacity: 0.5; + } + 100% { + opacity: 1; + transform: scale(1); + } +} + +.animate-smooth-fade-in { + animation: smoothFadeIn 1.2s ease-out forwards; +} + +.masonry-container { + column-count: 2; + column-gap: 4px; +} + +@media (min-width: 640px) { + .masonry-container { + column-count: 3; + } +} + +@media (min-width: 768px) { + .masonry-container { + column-count: 4; + } +} + +@media (min-width: 1024px) { + .masonry-container { + column-count: 5; + } +} + +@media (min-width: 1280px) { + .masonry-container { + column-count: 6; + } +} + +@keyframes shimmer { + 0% { + background-position: -1000px 0; + } + 100% { + background-position: 1000px 0; + } +} + +.animate-shimmer { + animation: shimmer 2.5s infinite; +} + +.masonry-item { + break-inside: avoid; + margin-bottom: 4px; + display: inline-block; + width: 100%; +} + +@keyframes slideInUp { + from { + opacity: 0; + transform: translateY(20px); + } + to { + opacity: 1; + transform: translateY(0); + } +} + +@keyframes slideInDown { + from { + opacity: 0; + transform: translateY(-20px); + } + to { + opacity: 1; + transform: translateY(0); + } +} + +@keyframes slideInLeft { + from { + opacity: 0; + transform: translateX(-20px); + } + to { + opacity: 1; + transform: translateX(0); + } +} + +@keyframes slideInRight { + from { + opacity: 0; + transform: translateX(20px); + } + to { + opacity: 1; + transform: translateX(0); + } +} + +@keyframes glow { + 0%, 100% { + box-shadow: 0 0 5px rgba(139, 92, 246, 0.1); + } + 50% { + box-shadow: 0 0 20px rgba(139, 92, 246, 0.3); + } +} + +@keyframes pulse-color { + 0%, 100% { + color: currentColor; + } + 50% { + color: rgba(139, 92, 246, 0.6); + } +} + +.animate-slide-in-up { + animation: slideInUp 0.5s ease-out forwards; +} + +.animate-slide-in-down { + animation: slideInDown 0.5s ease-out forwards; +} + +.animate-slide-in-left { + animation: slideInLeft 0.5s ease-out forwards; +} + +.animate-slide-in-right { + animation: slideInRight 0.5s ease-out forwards; +} + +.animate-glow { + animation: glow 2s ease-in-out infinite; +} + +.animate-pulse-color { + animation: pulse-color 2s ease-in-out infinite; +} diff --git a/index.html b/index.html new file mode 100644 index 0000000000000000000000000000000000000000..566a9429485267199ba3337df857cabbff36e749 --- /dev/null +++ b/index.html @@ -0,0 +1,17 @@ + + + + + + + + + Twisted Streaming Brody + + + +
+ + + + \ No newline at end of file diff --git a/main.tsx b/main.tsx new file mode 100644 index 0000000000000000000000000000000000000000..a53427345bb27e18113acc274f715e3b642b4920 --- /dev/null +++ b/main.tsx @@ -0,0 +1,10 @@ +import { StrictMode } from 'react'; +import { createRoot } from 'react-dom/client'; +import App from './App.tsx'; +import './index.css'; + +createRoot(document.getElementById('root')!).render( + + + +); diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000000000000000000000000000000000000..a116a729a1bca9333dc23beabb52c31cb9c77ba3 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,10377 @@ +{ + "name": "vite-react-typescript-starter", + "version": "0.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "vite-react-typescript-starter", + "version": "0.0.0", + "dependencies": { + "archiver": "^7.0.1", + "axios": "^1.13.2", + "cors": "^2.8.5", + "express": "^5.2.1", + "firebase": "^12.11.0", + "framer-motion": "^12.38.0", + "jspdf": "^3.0.3", + "jszip": "^3.10.1", + "lucide-react": "^0.344.0", + "pdfkit": "^0.17.2", + "react": "^18.3.1", + "react-dom": "^18.3.1", + "react-markdown": "^10.1.0", + "sharp": "^0.34.5", + "sonner": "^2.0.7", + "swiper": "^12.1.3" + }, + "devDependencies": { + "@eslint/js": "^9.9.1", + "@types/react": "^18.3.5", + "@types/react-dom": "^18.3.0", + "@vitejs/plugin-react": "^4.3.1", + "autoprefixer": "^10.4.18", + "dotenv": "^17.3.1", + "eslint": "^9.9.1", + "eslint-plugin-react-hooks": "^5.1.0-rc.0", + "eslint-plugin-react-refresh": "^0.4.11", + "firebase-admin": "^13.7.0", + "globals": "^15.9.0", + "postcss": "^8.4.35", + "tailwindcss": "^3.4.1", + "typescript": "^5.5.3", + "typescript-eslint": "^8.3.0", + "vite": "^5.4.2" + } + }, + "node_modules/@alloc/quick-lru": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@alloc/quick-lru/-/quick-lru-5.2.0.tgz", + "integrity": "sha512-UrcABB+4bUrFABwbluTIBErXwvbsU/V7TZWfmbgJfbkwiBuziS9gxdODUyuiecfdGQ85jglMW6juS3+z5TsKLw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.27.1.tgz", + "integrity": "sha512-cjQ7ZlQ0Mv3b47hABuTevyTuYN4i+loJKGeV9flcCgIK37cCXRh+L1bd3iBHlynerhQ7BhCkn2BPbQUL+rGqFg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-validator-identifier": "^7.27.1", + "js-tokens": "^4.0.0", + "picocolors": "^1.1.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/compat-data": { + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.28.5.tgz", + "integrity": "sha512-6uFXyCayocRbqhZOB+6XcuZbkMNimwfVGFji8CTZnCzOHVGvDqzvitu1re2AU5LROliz7eQPhB8CpAMvnx9EjA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/core": { + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.28.5.tgz", + "integrity": "sha512-e7jT4DxYvIDLk1ZHmU/m/mB19rex9sv0c2ftBtjSBv+kVM/902eh0fINUzD7UwLLNR+jU585GxUJ8/EBfAM5fw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@babel/code-frame": "^7.27.1", + "@babel/generator": "^7.28.5", + "@babel/helper-compilation-targets": "^7.27.2", + "@babel/helper-module-transforms": "^7.28.3", + "@babel/helpers": "^7.28.4", + "@babel/parser": "^7.28.5", + "@babel/template": "^7.27.2", + "@babel/traverse": "^7.28.5", + "@babel/types": "^7.28.5", + "@jridgewell/remapping": "^2.3.5", + "convert-source-map": "^2.0.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.3", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" + } + }, + "node_modules/@babel/generator": { + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.28.5.tgz", + "integrity": "sha512-3EwLFhZ38J4VyIP6WNtt2kUdW9dokXA9Cr4IVIFHuCpZ3H8/YFOl5JjZHisrn1fATPBmKKqXzDFvh9fUwHz6CQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.28.5", + "@babel/types": "^7.28.5", + "@jridgewell/gen-mapping": "^0.3.12", + "@jridgewell/trace-mapping": "^0.3.28", + "jsesc": "^3.0.2" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-compilation-targets": { + "version": "7.27.2", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.27.2.tgz", + "integrity": "sha512-2+1thGUUWWjLTYTHZWK1n8Yga0ijBz1XAhUXcKy81rd5g6yh7hGqMp45v7cadSbEHc9G3OTv45SyneRN3ps4DQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/compat-data": "^7.27.2", + "@babel/helper-validator-option": "^7.27.1", + "browserslist": "^4.24.0", + "lru-cache": "^5.1.1", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-globals": { + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@babel/helper-globals/-/helper-globals-7.28.0.tgz", + "integrity": "sha512-+W6cISkXFa1jXsDEdYA8HeevQT/FULhxzR99pxphltZcVaugps53THCeiWA8SguxxpSp3gKPiuYfSWopkLQ4hw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-imports": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.27.1.tgz", + "integrity": "sha512-0gSFWUPNXNopqtIPQvlD5WgXYI5GY2kP2cCvoT8kczjbfcfuIljTbcWrulD1CIPIX2gt1wghbDy08yE1p+/r3w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/traverse": "^7.27.1", + "@babel/types": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-transforms": { + "version": "7.28.3", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.28.3.tgz", + "integrity": "sha512-gytXUbs8k2sXS9PnQptz5o0QnpLL51SwASIORY6XaBKF88nsOT0Zw9szLqlSGQDP/4TljBAD5y98p2U1fqkdsw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-module-imports": "^7.27.1", + "@babel/helper-validator-identifier": "^7.27.1", + "@babel/traverse": "^7.28.3" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-plugin-utils": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.27.1.tgz", + "integrity": "sha512-1gn1Up5YXka3YYAHGKpbideQ5Yjf1tDa9qYcgysz+cNCXukyLl6DjPXhD3VRwSb8c0J9tA4b2+rHEZtc6R0tlw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-string-parser": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz", + "integrity": "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz", + "integrity": "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-option": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.27.1.tgz", + "integrity": "sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helpers": { + "version": "7.28.4", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.28.4.tgz", + "integrity": "sha512-HFN59MmQXGHVyYadKLVumYsA9dBFun/ldYxipEjzA4196jpLZd8UjEEBLkbEkvfYreDqJhZxYAWFPtrfhNpj4w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/template": "^7.27.2", + "@babel/types": "^7.28.4" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/parser": { + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.28.5.tgz", + "integrity": "sha512-KKBU1VGYR7ORr3At5HAtUQ+TV3SzRCXmA/8OdDZiLDBIZxVyzXuztPjfLd3BV1PRAQGCMWWSHYhL0F8d5uHBDQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.28.5" + }, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/plugin-transform-react-jsx-self": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.27.1.tgz", + "integrity": "sha512-6UzkCs+ejGdZ5mFFC/OCUrv028ab2fp1znZmCZjAOBKiBK2jXD1O+BPSfX8X2qjJ75fZBMSnQn3Rq2mrBJK2mw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-react-jsx-source": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-source/-/plugin-transform-react-jsx-source-7.27.1.tgz", + "integrity": "sha512-zbwoTsBruTeKB9hSq73ha66iFeJHuaFkUbwvqElnygoNbj/jHRsSeokowZFN3CZ64IvEqcmmkVe89OPXc7ldAw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/runtime": { + "version": "7.28.4", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.28.4.tgz", + "integrity": "sha512-Q/N6JNWvIvPnLDvjlE1OUBLPQHH6l3CltCEsHIujp45zQUSSh8K+gHnaEX45yAT1nyngnINhvWtzN+Nb9D8RAQ==", + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/template": { + "version": "7.27.2", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.27.2.tgz", + "integrity": "sha512-LPDZ85aEJyYSd18/DkjNh4/y1ntkE5KwUHWTiqgRxruuZL2F1yuHligVHLvcHY2vMHXttKFpJn6LwfI7cw7ODw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.27.1", + "@babel/parser": "^7.27.2", + "@babel/types": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse": { + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.28.5.tgz", + "integrity": "sha512-TCCj4t55U90khlYkVV/0TfkJkAkUg3jZFA3Neb7unZT8CPok7iiRfaX0F+WnqWqt7OxhOn0uBKXCw4lbL8W0aQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.27.1", + "@babel/generator": "^7.28.5", + "@babel/helper-globals": "^7.28.0", + "@babel/parser": "^7.28.5", + "@babel/template": "^7.27.2", + "@babel/types": "^7.28.5", + "debug": "^4.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/types": { + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.28.5.tgz", + "integrity": "sha512-qQ5m48eI/MFLQ5PxQj4PFaprjyCTLI37ElWMmNs0K8Lk3dVeOdNpB3ks8jc7yM5CDmVC73eMVk/trk3fgmrUpA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-string-parser": "^7.27.1", + "@babel/helper-validator-identifier": "^7.28.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@emnapi/runtime": { + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.7.1.tgz", + "integrity": "sha512-PVtJr5CmLwYAU9PZDMITZoR5iAOShYREoR45EyyLrbntV50mdePTgUn4AmOw90Ifcj+x2kRjdzr1HP3RrNiHGA==", + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz", + "integrity": "sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.21.5.tgz", + "integrity": "sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.21.5.tgz", + "integrity": "sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.21.5.tgz", + "integrity": "sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.21.5.tgz", + "integrity": "sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.21.5.tgz", + "integrity": "sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.5.tgz", + "integrity": "sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.21.5.tgz", + "integrity": "sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.21.5.tgz", + "integrity": "sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.21.5.tgz", + "integrity": "sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.21.5.tgz", + "integrity": "sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.21.5.tgz", + "integrity": "sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.21.5.tgz", + "integrity": "sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.21.5.tgz", + "integrity": "sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.21.5.tgz", + "integrity": "sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.21.5.tgz", + "integrity": "sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.21.5.tgz", + "integrity": "sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.21.5.tgz", + "integrity": "sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.21.5.tgz", + "integrity": "sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.21.5.tgz", + "integrity": "sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.21.5.tgz", + "integrity": "sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.21.5.tgz", + "integrity": "sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.21.5.tgz", + "integrity": "sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.9.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.9.0.tgz", + "integrity": "sha512-ayVFHdtZ+hsq1t2Dy24wCmGXGe4q9Gu3smhLYALJrr473ZH27MsnSL+LKUlimp4BWJqMDMLmPpx/Q9R3OAlL4g==", + "dev": true, + "license": "MIT", + "dependencies": { + "eslint-visitor-keys": "^3.4.3" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.12.2", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.2.tgz", + "integrity": "sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, + "node_modules/@eslint/config-array": { + "version": "0.21.1", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.21.1.tgz", + "integrity": "sha512-aw1gNayWpdI/jSYVgzN5pL0cfzU02GT3NBpeT/DXbx1/1x7ZKxFPd9bwrzygx/qiwIQiJ1sw/zD8qY/kRvlGHA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/object-schema": "^2.1.7", + "debug": "^4.3.1", + "minimatch": "^3.1.2" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/config-helpers": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.4.2.tgz", + "integrity": "sha512-gBrxN88gOIf3R7ja5K9slwNayVcZgK6SOUORm2uBzTeIEfeVaIhOpCtTox3P6R7o2jLFwLFTLnC7kU/RGcYEgw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/core": "^0.17.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/core": { + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.17.0.tgz", + "integrity": "sha512-yL/sLrpmtDaFEiUj1osRP4TI2MDz1AddJL+jZ7KSqvBuliN4xqYY54IfdN8qD8Toa6g1iloph1fxQNkjOxrrpQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@types/json-schema": "^7.0.15" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/eslintrc": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.3.3.tgz", + "integrity": "sha512-Kr+LPIUVKz2qkx1HAMH8q1q6azbqBAsXJUxBl/ODDuVPX45Z9DfwB8tPjTi6nNZ8BuM3nbJxC5zCAg5elnBUTQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^10.0.1", + "globals": "^14.0.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.1", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint/eslintrc/node_modules/globals": { + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", + "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@eslint/js": { + "version": "9.39.1", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.39.1.tgz", + "integrity": "sha512-S26Stp4zCy88tH94QbBv3XCuzRQiZ9yXofEILmglYTh/Ug/a9/umqvgFtYBAo3Lp0nsI/5/qH1CCrbdK3AP1Tw==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://eslint.org/donate" + } + }, + "node_modules/@eslint/object-schema": { + "version": "2.1.7", + "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.7.tgz", + "integrity": "sha512-VtAOaymWVfZcmZbp6E2mympDIHvyjXs/12LqWYjVw6qjrfF+VK+fyG33kChz3nnK+SU5/NeHOqrTEHS8sXO3OA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/plugin-kit": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.4.1.tgz", + "integrity": "sha512-43/qtrDUokr7LJqoF2c3+RInu/t4zfrpYdoSDfYyhg52rwLV6TnOvdG4fXm7IkSB3wErkcmJS9iEhjVtOSEjjA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/core": "^0.17.0", + "levn": "^0.4.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@fastify/busboy": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-3.2.0.tgz", + "integrity": "sha512-m9FVDXU3GT2ITSe0UaMA5rU3QkfC/UXtCU8y0gSN/GugTqtVldOBWIB5V6V3sbmenVZUIpU6f+mPEO2+m5iTaA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@firebase/ai": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/@firebase/ai/-/ai-2.10.0.tgz", + "integrity": "sha512-1lI6HomyoO/8RSJb6ItyHLpHnB2z27m5F4aX/Vpi1nhwWoxdNjkq+6UQOykHyCE0KairojOE5qQ20i1tnF0nNA==", + "license": "Apache-2.0", + "dependencies": { + "@firebase/app-check-interop-types": "0.3.3", + "@firebase/component": "0.7.2", + "@firebase/logger": "0.5.0", + "@firebase/util": "1.15.0", + "tslib": "^2.1.0" + }, + "engines": { + "node": ">=20.0.0" + }, + "peerDependencies": { + "@firebase/app": "0.x", + "@firebase/app-types": "0.x" + } + }, + "node_modules/@firebase/analytics": { + "version": "0.10.21", + "resolved": "https://registry.npmjs.org/@firebase/analytics/-/analytics-0.10.21.tgz", + "integrity": "sha512-j2y2q65BlgLGB5Pwjhv/Jopw2X/TBTzvAtI5z/DSp56U4wBj7LfhBfzbdCtFPges+Wz0g55GdoawXibOH5jGng==", + "license": "Apache-2.0", + "dependencies": { + "@firebase/component": "0.7.2", + "@firebase/installations": "0.6.21", + "@firebase/logger": "0.5.0", + "@firebase/util": "1.15.0", + "tslib": "^2.1.0" + }, + "peerDependencies": { + "@firebase/app": "0.x" + } + }, + "node_modules/@firebase/analytics-compat": { + "version": "0.2.27", + "resolved": "https://registry.npmjs.org/@firebase/analytics-compat/-/analytics-compat-0.2.27.tgz", + "integrity": "sha512-ZObpYpAxL6JfgH7GnvlDD0sbzGZ0o4nijV8skatV9ZX49hJtCYbFqaEcPYptT94rgX1KUoKEderC7/fa7hybtw==", + "license": "Apache-2.0", + "dependencies": { + "@firebase/analytics": "0.10.21", + "@firebase/analytics-types": "0.8.3", + "@firebase/component": "0.7.2", + "@firebase/util": "1.15.0", + "tslib": "^2.1.0" + }, + "peerDependencies": { + "@firebase/app-compat": "0.x" + } + }, + "node_modules/@firebase/analytics-types": { + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/@firebase/analytics-types/-/analytics-types-0.8.3.tgz", + "integrity": "sha512-VrIp/d8iq2g501qO46uGz3hjbDb8xzYMrbu8Tp0ovzIzrvJZ2fvmj649gTjge/b7cCCcjT0H37g1gVtlNhnkbg==", + "license": "Apache-2.0" + }, + "node_modules/@firebase/app": { + "version": "0.14.10", + "resolved": "https://registry.npmjs.org/@firebase/app/-/app-0.14.10.tgz", + "integrity": "sha512-PlPhdtjgWUra+LImQTnXOUqUa/jcufZhizdR93ZjlQSS3ahCtDTG6pJw7j0OwFal18DQjICXfeVNsUUrcNisfA==", + "license": "Apache-2.0", + "peer": true, + "dependencies": { + "@firebase/component": "0.7.2", + "@firebase/logger": "0.5.0", + "@firebase/util": "1.15.0", + "idb": "7.1.1", + "tslib": "^2.1.0" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@firebase/app-check": { + "version": "0.11.2", + "resolved": "https://registry.npmjs.org/@firebase/app-check/-/app-check-0.11.2.tgz", + "integrity": "sha512-jcXQVMHAQ5AEKzVD5C7s5fmAYeFOuN6lAJeNTgZK2B9aLnofWaJt8u1A8Idm8gpsBBYSaY3cVyeH5SWMOVPBLQ==", + "license": "Apache-2.0", + "dependencies": { + "@firebase/component": "0.7.2", + "@firebase/logger": "0.5.0", + "@firebase/util": "1.15.0", + "tslib": "^2.1.0" + }, + "engines": { + "node": ">=20.0.0" + }, + "peerDependencies": { + "@firebase/app": "0.x" + } + }, + "node_modules/@firebase/app-check-compat": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/@firebase/app-check-compat/-/app-check-compat-0.4.2.tgz", + "integrity": "sha512-M91NhxqbSkI0ChkJWy69blC+rPr6HEgaeRllddSaU1pQ/7IiegeCQM9pPDIgvWnwnBSzKhUHpe6ro/jhJ+cvzw==", + "license": "Apache-2.0", + "dependencies": { + "@firebase/app-check": "0.11.2", + "@firebase/app-check-types": "0.5.3", + "@firebase/component": "0.7.2", + "@firebase/logger": "0.5.0", + "@firebase/util": "1.15.0", + "tslib": "^2.1.0" + }, + "engines": { + "node": ">=20.0.0" + }, + "peerDependencies": { + "@firebase/app-compat": "0.x" + } + }, + "node_modules/@firebase/app-check-interop-types": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@firebase/app-check-interop-types/-/app-check-interop-types-0.3.3.tgz", + "integrity": "sha512-gAlxfPLT2j8bTI/qfe3ahl2I2YcBQ8cFIBdhAQA4I2f3TndcO+22YizyGYuttLHPQEpWkhmpFW60VCFEPg4g5A==", + "license": "Apache-2.0" + }, + "node_modules/@firebase/app-check-types": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/@firebase/app-check-types/-/app-check-types-0.5.3.tgz", + "integrity": "sha512-hyl5rKSj0QmwPdsAxrI5x1otDlByQ7bvNvVt8G/XPO2CSwE++rmSVf3VEhaeOR4J8ZFaF0Z0NDSmLejPweZ3ng==", + "license": "Apache-2.0" + }, + "node_modules/@firebase/app-compat": { + "version": "0.5.10", + "resolved": "https://registry.npmjs.org/@firebase/app-compat/-/app-compat-0.5.10.tgz", + "integrity": "sha512-tFmBuZL0/v1h6eyKRgWI58ucft6dEJmAi9nhPUXoAW4ZbPSTlnsh31AuEwUoRTz+wwRk9gmgss9GZV05ZM9Kug==", + "license": "Apache-2.0", + "peer": true, + "dependencies": { + "@firebase/app": "0.14.10", + "@firebase/component": "0.7.2", + "@firebase/logger": "0.5.0", + "@firebase/util": "1.15.0", + "tslib": "^2.1.0" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@firebase/app-types": { + "version": "0.9.3", + "resolved": "https://registry.npmjs.org/@firebase/app-types/-/app-types-0.9.3.tgz", + "integrity": "sha512-kRVpIl4vVGJ4baogMDINbyrIOtOxqhkZQg4jTq3l8Lw6WSk0xfpEYzezFu+Kl4ve4fbPl79dvwRtaFqAC/ucCw==", + "license": "Apache-2.0", + "peer": true + }, + "node_modules/@firebase/auth-compat": { + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/@firebase/auth-compat/-/auth-compat-0.6.4.tgz", + "integrity": "sha512-2pj8m/hnqXvMLfC0Mk+fORVTM5DQPkS6l8JpMgtoAWGVgCmYnoWdFMaNWtKbmCxBEyvMA3FlnCJyzrUSMWTfuA==", + "license": "Apache-2.0", + "dependencies": { + "@firebase/auth": "1.12.2", + "@firebase/auth-types": "0.13.0", + "@firebase/component": "0.7.2", + "@firebase/util": "1.15.0", + "tslib": "^2.1.0" + }, + "engines": { + "node": ">=20.0.0" + }, + "peerDependencies": { + "@firebase/app-compat": "0.x" + } + }, + "node_modules/@firebase/auth-compat/node_modules/@firebase/auth": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@firebase/auth/-/auth-1.12.2.tgz", + "integrity": "sha512-CZJL8V10Vzibs+pDTXdQF+hot1IigIoqF4a4lA/qr5Deo1srcefiyIfgg28B67Lk7IxZhwfJMuI+1bu2xBmV0A==", + "license": "Apache-2.0", + "dependencies": { + "@firebase/component": "0.7.2", + "@firebase/logger": "0.5.0", + "@firebase/util": "1.15.0", + "tslib": "^2.1.0" + }, + "engines": { + "node": ">=20.0.0" + }, + "peerDependencies": { + "@firebase/app": "0.x", + "@react-native-async-storage/async-storage": "^2.2.0" + }, + "peerDependenciesMeta": { + "@react-native-async-storage/async-storage": { + "optional": true + } + } + }, + "node_modules/@firebase/auth-interop-types": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/@firebase/auth-interop-types/-/auth-interop-types-0.2.4.tgz", + "integrity": "sha512-JPgcXKCuO+CWqGDnigBtvo09HeBs5u/Ktc2GaFj2m01hLarbxthLNm7Fk8iOP1aqAtXV+fnnGj7U28xmk7IwVA==", + "license": "Apache-2.0" + }, + "node_modules/@firebase/auth-types": { + "version": "0.13.0", + "resolved": "https://registry.npmjs.org/@firebase/auth-types/-/auth-types-0.13.0.tgz", + "integrity": "sha512-S/PuIjni0AQRLF+l9ck0YpsMOdE8GO2KU6ubmBB7P+7TJUCQDa3R1dlgYm9UzGbbePMZsp0xzB93f2b/CgxMOg==", + "license": "Apache-2.0", + "peerDependencies": { + "@firebase/app-types": "0.x", + "@firebase/util": "1.x" + } + }, + "node_modules/@firebase/component": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/@firebase/component/-/component-0.7.2.tgz", + "integrity": "sha512-iyVDGc6Vjx7Rm0cAdccLH/NG6fADsgJak/XW9IA2lPf8AjIlsemOpFGKczYyPHxm4rnKdR8z6sK4+KEC7NwmEg==", + "license": "Apache-2.0", + "dependencies": { + "@firebase/util": "1.15.0", + "tslib": "^2.1.0" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@firebase/data-connect": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/@firebase/data-connect/-/data-connect-0.5.0.tgz", + "integrity": "sha512-G3GYHpWNJJ95502RQLApzw0jaG3pScHl+J/2MdxIuB51xtHnkRL6KvIAP3fFF1drUewWJHOnDA1U+q4Evf3KSw==", + "license": "Apache-2.0", + "dependencies": { + "@firebase/auth-interop-types": "0.2.4", + "@firebase/component": "0.7.2", + "@firebase/logger": "0.5.0", + "@firebase/util": "1.15.0", + "tslib": "^2.1.0" + }, + "peerDependencies": { + "@firebase/app": "0.x" + } + }, + "node_modules/@firebase/database": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@firebase/database/-/database-1.1.2.tgz", + "integrity": "sha512-lP96CMjMPy/+d1d9qaaHjHHdzdwvEOuyyLq9ehX89e2XMKwS1jHNzYBO+42bdSumuj5ukPbmnFtViZu8YOMT+w==", + "license": "Apache-2.0", + "dependencies": { + "@firebase/app-check-interop-types": "0.3.3", + "@firebase/auth-interop-types": "0.2.4", + "@firebase/component": "0.7.2", + "@firebase/logger": "0.5.0", + "@firebase/util": "1.15.0", + "faye-websocket": "0.11.4", + "tslib": "^2.1.0" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@firebase/database-compat": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@firebase/database-compat/-/database-compat-2.1.2.tgz", + "integrity": "sha512-j4A6IhVZbgxAzT6gJJC2PfOxYCK9SrDrUO7nTM4EscTYtKkAkzsbKoCnDdjFapQfnsncvPWjqVTr/0PffUwg3g==", + "license": "Apache-2.0", + "dependencies": { + "@firebase/component": "0.7.2", + "@firebase/database": "1.1.2", + "@firebase/database-types": "1.0.18", + "@firebase/logger": "0.5.0", + "@firebase/util": "1.15.0", + "tslib": "^2.1.0" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@firebase/database-types": { + "version": "1.0.18", + "resolved": "https://registry.npmjs.org/@firebase/database-types/-/database-types-1.0.18.tgz", + "integrity": "sha512-yOY8IC2go9lfbVDMiy2ATun4EB2AFwocPaQADwMN/RHRUAZSM4rlAV7PGbWPSG/YhkJ2A9xQAiAENgSua9G5Fg==", + "license": "Apache-2.0", + "dependencies": { + "@firebase/app-types": "0.9.3", + "@firebase/util": "1.15.0" + } + }, + "node_modules/@firebase/firestore": { + "version": "4.13.0", + "resolved": "https://registry.npmjs.org/@firebase/firestore/-/firestore-4.13.0.tgz", + "integrity": "sha512-7i4cVNJXTMim7/P7UsNim0DwyLPk4QQ3y1oSNzv4l0ykJOKYCiFMOuEeUxUYvrReXDJxWHrT/4XMeVQm+13rRw==", + "license": "Apache-2.0", + "dependencies": { + "@firebase/component": "0.7.2", + "@firebase/logger": "0.5.0", + "@firebase/util": "1.15.0", + "@firebase/webchannel-wrapper": "1.0.5", + "@grpc/grpc-js": "~1.9.0", + "@grpc/proto-loader": "^0.7.8", + "tslib": "^2.1.0" + }, + "engines": { + "node": ">=20.0.0" + }, + "peerDependencies": { + "@firebase/app": "0.x" + } + }, + "node_modules/@firebase/firestore-compat": { + "version": "0.4.7", + "resolved": "https://registry.npmjs.org/@firebase/firestore-compat/-/firestore-compat-0.4.7.tgz", + "integrity": "sha512-Et4XxtGnjp0Q9tmaEMETnY5GHJ8gQ9+RN6sSTT4ETWKmym2d6gIjarw0rCQcx+7BrWVYLEIOAXSXysl0b3xnUA==", + "license": "Apache-2.0", + "dependencies": { + "@firebase/component": "0.7.2", + "@firebase/firestore": "4.13.0", + "@firebase/firestore-types": "3.0.3", + "@firebase/util": "1.15.0", + "tslib": "^2.1.0" + }, + "engines": { + "node": ">=20.0.0" + }, + "peerDependencies": { + "@firebase/app-compat": "0.x" + } + }, + "node_modules/@firebase/firestore-types": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@firebase/firestore-types/-/firestore-types-3.0.3.tgz", + "integrity": "sha512-hD2jGdiWRxB/eZWF89xcK9gF8wvENDJkzpVFb4aGkzfEaKxVRD1kjz1t1Wj8VZEp2LCB53Yx1zD8mrhQu87R6Q==", + "license": "Apache-2.0", + "peerDependencies": { + "@firebase/app-types": "0.x", + "@firebase/util": "1.x" + } + }, + "node_modules/@firebase/functions": { + "version": "0.13.3", + "resolved": "https://registry.npmjs.org/@firebase/functions/-/functions-0.13.3.tgz", + "integrity": "sha512-csO7ckK3SSs+NUZW1nms9EK7ckHe/1QOjiP8uAkCYa7ND18s44vjE9g3KxEeIUpyEPqZaX1EhJuFyZjHigAcYw==", + "license": "Apache-2.0", + "dependencies": { + "@firebase/app-check-interop-types": "0.3.3", + "@firebase/auth-interop-types": "0.2.4", + "@firebase/component": "0.7.2", + "@firebase/messaging-interop-types": "0.2.3", + "@firebase/util": "1.15.0", + "tslib": "^2.1.0" + }, + "engines": { + "node": ">=20.0.0" + }, + "peerDependencies": { + "@firebase/app": "0.x" + } + }, + "node_modules/@firebase/functions-compat": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/@firebase/functions-compat/-/functions-compat-0.4.3.tgz", + "integrity": "sha512-BxkEwWgx1of0tKaao/r2VR6WBLk/RAiyztatiONPrPE8gkitFkOnOCxf8i9cUyA5hX5RGt5H30uNn25Q6QNEmQ==", + "license": "Apache-2.0", + "dependencies": { + "@firebase/component": "0.7.2", + "@firebase/functions": "0.13.3", + "@firebase/functions-types": "0.6.3", + "@firebase/util": "1.15.0", + "tslib": "^2.1.0" + }, + "engines": { + "node": ">=20.0.0" + }, + "peerDependencies": { + "@firebase/app-compat": "0.x" + } + }, + "node_modules/@firebase/functions-types": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/@firebase/functions-types/-/functions-types-0.6.3.tgz", + "integrity": "sha512-EZoDKQLUHFKNx6VLipQwrSMh01A1SaL3Wg6Hpi//x6/fJ6Ee4hrAeswK99I5Ht8roiniKHw4iO0B1Oxj5I4plg==", + "license": "Apache-2.0" + }, + "node_modules/@firebase/installations": { + "version": "0.6.21", + "resolved": "https://registry.npmjs.org/@firebase/installations/-/installations-0.6.21.tgz", + "integrity": "sha512-xGFGTeICJZ5vhrmmDukeczIcFULFXybojML2+QSDFoKj5A7zbGN7KzFGSKNhDkIxpjzsYG9IleJyUebuAcmqWA==", + "license": "Apache-2.0", + "dependencies": { + "@firebase/component": "0.7.2", + "@firebase/util": "1.15.0", + "idb": "7.1.1", + "tslib": "^2.1.0" + }, + "peerDependencies": { + "@firebase/app": "0.x" + } + }, + "node_modules/@firebase/installations-compat": { + "version": "0.2.21", + "resolved": "https://registry.npmjs.org/@firebase/installations-compat/-/installations-compat-0.2.21.tgz", + "integrity": "sha512-zahIUkaVKbR8zmTeBHkdfaVl6JGWlhVoSjF7CVH33nFqD3SlPEpEEegn2GNT5iAfsVdtlCyJJ9GW4YKjq+RJKQ==", + "license": "Apache-2.0", + "dependencies": { + "@firebase/component": "0.7.2", + "@firebase/installations": "0.6.21", + "@firebase/installations-types": "0.5.3", + "@firebase/util": "1.15.0", + "tslib": "^2.1.0" + }, + "peerDependencies": { + "@firebase/app-compat": "0.x" + } + }, + "node_modules/@firebase/installations-types": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/@firebase/installations-types/-/installations-types-0.5.3.tgz", + "integrity": "sha512-2FJI7gkLqIE0iYsNQ1P751lO3hER+Umykel+TkLwHj6plzWVxqvfclPUZhcKFVQObqloEBTmpi2Ozn7EkCABAA==", + "license": "Apache-2.0", + "peerDependencies": { + "@firebase/app-types": "0.x" + } + }, + "node_modules/@firebase/logger": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/@firebase/logger/-/logger-0.5.0.tgz", + "integrity": "sha512-cGskaAvkrnh42b3BA3doDWeBmuHFO/Mx5A83rbRDYakPjO9bJtRL3dX7javzc2Rr/JHZf4HlterTW2lUkfeN4g==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.1.0" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@firebase/messaging": { + "version": "0.12.25", + "resolved": "https://registry.npmjs.org/@firebase/messaging/-/messaging-0.12.25.tgz", + "integrity": "sha512-7RhDwoDHlOK1/ou0/LeubxmjcngsTjDdrY/ssg2vwAVpUuVAhQzQvuCAOYxcX5wNC1zCgQ54AP1vdngBwbCmOQ==", + "license": "Apache-2.0", + "dependencies": { + "@firebase/component": "0.7.2", + "@firebase/installations": "0.6.21", + "@firebase/messaging-interop-types": "0.2.3", + "@firebase/util": "1.15.0", + "idb": "7.1.1", + "tslib": "^2.1.0" + }, + "peerDependencies": { + "@firebase/app": "0.x" + } + }, + "node_modules/@firebase/messaging-compat": { + "version": "0.2.25", + "resolved": "https://registry.npmjs.org/@firebase/messaging-compat/-/messaging-compat-0.2.25.tgz", + "integrity": "sha512-eoOQqGLtRlseTdiemTN44LlHZpltK5gnhq8XVUuLgtIOG+odtDzrz2UoTpcJWSzaJQVxNLb/x9f39tHdDM4N4w==", + "license": "Apache-2.0", + "dependencies": { + "@firebase/component": "0.7.2", + "@firebase/messaging": "0.12.25", + "@firebase/util": "1.15.0", + "tslib": "^2.1.0" + }, + "peerDependencies": { + "@firebase/app-compat": "0.x" + } + }, + "node_modules/@firebase/messaging-interop-types": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@firebase/messaging-interop-types/-/messaging-interop-types-0.2.3.tgz", + "integrity": "sha512-xfzFaJpzcmtDjycpDeCUj0Ge10ATFi/VHVIvEEjDNc3hodVBQADZ7BWQU7CuFpjSHE+eLuBI13z5F/9xOoGX8Q==", + "license": "Apache-2.0" + }, + "node_modules/@firebase/performance": { + "version": "0.7.11", + "resolved": "https://registry.npmjs.org/@firebase/performance/-/performance-0.7.11.tgz", + "integrity": "sha512-V3uAhrz7IYJuji+OgT3qYTGKxpek/TViXti9OSsUJ4AexZ3jQjYH5Yrn7JvBxk8MGiSLsC872hh+BxQiPZsm7g==", + "license": "Apache-2.0", + "dependencies": { + "@firebase/component": "0.7.2", + "@firebase/installations": "0.6.21", + "@firebase/logger": "0.5.0", + "@firebase/util": "1.15.0", + "tslib": "^2.1.0", + "web-vitals": "^4.2.4" + }, + "peerDependencies": { + "@firebase/app": "0.x" + } + }, + "node_modules/@firebase/performance-compat": { + "version": "0.2.24", + "resolved": "https://registry.npmjs.org/@firebase/performance-compat/-/performance-compat-0.2.24.tgz", + "integrity": "sha512-YRlejH8wLt7ThWao+HXoKUHUrZKGYq+otxkPS+8nuE5PeN1cBXX7NAJl9ueuUkBwMIrnKdnDqL/voHXxDAAt3g==", + "license": "Apache-2.0", + "dependencies": { + "@firebase/component": "0.7.2", + "@firebase/logger": "0.5.0", + "@firebase/performance": "0.7.11", + "@firebase/performance-types": "0.2.3", + "@firebase/util": "1.15.0", + "tslib": "^2.1.0" + }, + "peerDependencies": { + "@firebase/app-compat": "0.x" + } + }, + "node_modules/@firebase/performance-types": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@firebase/performance-types/-/performance-types-0.2.3.tgz", + "integrity": "sha512-IgkyTz6QZVPAq8GSkLYJvwSLr3LS9+V6vNPQr0x4YozZJiLF5jYixj0amDtATf1X0EtYHqoPO48a9ija8GocxQ==", + "license": "Apache-2.0" + }, + "node_modules/@firebase/remote-config": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/@firebase/remote-config/-/remote-config-0.8.2.tgz", + "integrity": "sha512-5EXqOThV4upjK9D38d/qOSVwOqRhemlaOFk9vCkMNNALeIlwr+4pLjtLNo4qoY8etQmU/1q4aIATE9N8PFqg0g==", + "license": "Apache-2.0", + "dependencies": { + "@firebase/component": "0.7.2", + "@firebase/installations": "0.6.21", + "@firebase/logger": "0.5.0", + "@firebase/util": "1.15.0", + "tslib": "^2.1.0" + }, + "peerDependencies": { + "@firebase/app": "0.x" + } + }, + "node_modules/@firebase/remote-config-compat": { + "version": "0.2.23", + "resolved": "https://registry.npmjs.org/@firebase/remote-config-compat/-/remote-config-compat-0.2.23.tgz", + "integrity": "sha512-4+KqRRHEUUmKT6tFmnpWATOsaFfmSuBs1jXH8JzVtMLEYqq/WS9IDM92OdefFDSrAA2xGd0WN004z8mKeIIscw==", + "license": "Apache-2.0", + "dependencies": { + "@firebase/component": "0.7.2", + "@firebase/logger": "0.5.0", + "@firebase/remote-config": "0.8.2", + "@firebase/remote-config-types": "0.5.0", + "@firebase/util": "1.15.0", + "tslib": "^2.1.0" + }, + "peerDependencies": { + "@firebase/app-compat": "0.x" + } + }, + "node_modules/@firebase/remote-config-types": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/@firebase/remote-config-types/-/remote-config-types-0.5.0.tgz", + "integrity": "sha512-vI3bqLoF14L/GchtgayMiFpZJF+Ao3uR8WCde0XpYNkSokDpAKca2DxvcfeZv7lZUqkUwQPL2wD83d3vQ4vvrg==", + "license": "Apache-2.0" + }, + "node_modules/@firebase/storage": { + "version": "0.14.2", + "resolved": "https://registry.npmjs.org/@firebase/storage/-/storage-0.14.2.tgz", + "integrity": "sha512-o/culaTeJ8GRpKXRJov21rux/n9dRaSOWLebyatFP2sqEdCxQPjVA1H9Z2fzYwQxMIU0JVmC7SPPmU11v7L6vQ==", + "license": "Apache-2.0", + "dependencies": { + "@firebase/component": "0.7.2", + "@firebase/util": "1.15.0", + "tslib": "^2.1.0" + }, + "engines": { + "node": ">=20.0.0" + }, + "peerDependencies": { + "@firebase/app": "0.x" + } + }, + "node_modules/@firebase/storage-compat": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/@firebase/storage-compat/-/storage-compat-0.4.2.tgz", + "integrity": "sha512-R+aB38wxCH5zjIO/xu9KznI7fgiPuZAG98uVm1NcidHyyupGgIDLKigGmRGBZMnxibe/m2oxNKoZpfEbUX2aQQ==", + "license": "Apache-2.0", + "dependencies": { + "@firebase/component": "0.7.2", + "@firebase/storage": "0.14.2", + "@firebase/storage-types": "0.8.3", + "@firebase/util": "1.15.0", + "tslib": "^2.1.0" + }, + "engines": { + "node": ">=20.0.0" + }, + "peerDependencies": { + "@firebase/app-compat": "0.x" + } + }, + "node_modules/@firebase/storage-types": { + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/@firebase/storage-types/-/storage-types-0.8.3.tgz", + "integrity": "sha512-+Muk7g9uwngTpd8xn9OdF/D48uiQ7I1Fae7ULsWPuKoCH3HU7bfFPhxtJYzyhjdniowhuDpQcfPmuNRAqZEfvg==", + "license": "Apache-2.0", + "peerDependencies": { + "@firebase/app-types": "0.x", + "@firebase/util": "1.x" + } + }, + "node_modules/@firebase/util": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/@firebase/util/-/util-1.15.0.tgz", + "integrity": "sha512-AmWf3cHAOMbrCPG4xdPKQaj5iHnyYfyLKZxwz+Xf55bqKbpAmcYifB4jQinT2W9XhDRHISOoPyBOariJpCG6FA==", + "hasInstallScript": true, + "license": "Apache-2.0", + "peer": true, + "dependencies": { + "tslib": "^2.1.0" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@firebase/webchannel-wrapper": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@firebase/webchannel-wrapper/-/webchannel-wrapper-1.0.5.tgz", + "integrity": "sha512-+uGNN7rkfn41HLO0vekTFhTxk61eKa8mTpRGLO0QSqlQdKvIoGAvLp3ppdVIWbTGYJWM6Kp0iN+PjMIOcnVqTw==", + "license": "Apache-2.0" + }, + "node_modules/@google-cloud/firestore": { + "version": "7.11.6", + "resolved": "https://registry.npmjs.org/@google-cloud/firestore/-/firestore-7.11.6.tgz", + "integrity": "sha512-EW/O8ktzwLfyWBOsNuhRoMi8lrC3clHM5LVFhGvO1HCsLozCOOXRAlHrYBoE6HL42Sc8yYMuCb2XqcnJ4OOEpw==", + "dev": true, + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@opentelemetry/api": "^1.3.0", + "fast-deep-equal": "^3.1.1", + "functional-red-black-tree": "^1.0.1", + "google-gax": "^4.3.3", + "protobufjs": "^7.2.6" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@google-cloud/paginator": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/@google-cloud/paginator/-/paginator-5.0.2.tgz", + "integrity": "sha512-DJS3s0OVH4zFDB1PzjxAsHqJT6sKVbRwwML0ZBP9PbU7Yebtu/7SWMRzvO2J3nUi9pRNITCfu4LJeooM2w4pjg==", + "dev": true, + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "arrify": "^2.0.0", + "extend": "^3.0.2" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@google-cloud/projectify": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@google-cloud/projectify/-/projectify-4.0.0.tgz", + "integrity": "sha512-MmaX6HeSvyPbWGwFq7mXdo0uQZLGBYCwziiLIGq5JVX+/bdI3SAq6bP98trV5eTWfLuvsMcIC1YJOF2vfteLFA==", + "dev": true, + "license": "Apache-2.0", + "optional": true, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@google-cloud/promisify": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@google-cloud/promisify/-/promisify-4.0.0.tgz", + "integrity": "sha512-Orxzlfb9c67A15cq2JQEyVc7wEsmFBmHjZWZYQMUyJ1qivXyMwdyNOs9odi79hze+2zqdTtu1E19IM/FtqZ10g==", + "dev": true, + "license": "Apache-2.0", + "optional": true, + "engines": { + "node": ">=14" + } + }, + "node_modules/@google-cloud/storage": { + "version": "7.19.0", + "resolved": "https://registry.npmjs.org/@google-cloud/storage/-/storage-7.19.0.tgz", + "integrity": "sha512-n2FjE7NAOYyshogdc7KQOl/VZb4sneqPjWouSyia9CMDdMhRX5+RIbqalNmC7LOLzuLAN89VlF2HvG8na9G+zQ==", + "dev": true, + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@google-cloud/paginator": "^5.0.0", + "@google-cloud/projectify": "^4.0.0", + "@google-cloud/promisify": "<4.1.0", + "abort-controller": "^3.0.0", + "async-retry": "^1.3.3", + "duplexify": "^4.1.3", + "fast-xml-parser": "^5.3.4", + "gaxios": "^6.0.2", + "google-auth-library": "^9.6.3", + "html-entities": "^2.5.2", + "mime": "^3.0.0", + "p-limit": "^3.0.1", + "retry-request": "^7.0.0", + "teeny-request": "^9.0.0", + "uuid": "^8.0.0" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/@google-cloud/storage/node_modules/gcp-metadata": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-6.1.1.tgz", + "integrity": "sha512-a4tiq7E0/5fTjxPAaH4jpjkSv/uCaU2p5KC6HVGrvl0cDjA8iBZv4vv1gyzlmK0ZUKqwpOyQMKzZQe3lTit77A==", + "dev": true, + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "gaxios": "^6.1.1", + "google-logging-utils": "^0.0.2", + "json-bigint": "^1.0.0" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/@google-cloud/storage/node_modules/google-auth-library": { + "version": "9.15.1", + "resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-9.15.1.tgz", + "integrity": "sha512-Jb6Z0+nvECVz+2lzSMt9u98UsoakXxA2HGHMCxh+so3n90XgYWkq5dur19JAJV7ONiJY22yBTyJB1TSkvPq9Ng==", + "dev": true, + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "base64-js": "^1.3.0", + "ecdsa-sig-formatter": "^1.0.11", + "gaxios": "^6.1.1", + "gcp-metadata": "^6.1.0", + "gtoken": "^7.0.0", + "jws": "^4.0.0" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/@google-cloud/storage/node_modules/google-logging-utils": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/google-logging-utils/-/google-logging-utils-0.0.2.tgz", + "integrity": "sha512-NEgUnEcBiP5HrPzufUkBzJOD/Sxsco3rLNo1F1TNf7ieU8ryUzBhqba8r756CjLX7rn3fHl6iLEwPYuqpoKgQQ==", + "dev": true, + "license": "Apache-2.0", + "optional": true, + "engines": { + "node": ">=14" + } + }, + "node_modules/@google-cloud/storage/node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "dev": true, + "license": "MIT", + "optional": true, + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/@grpc/grpc-js": { + "version": "1.9.15", + "resolved": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.9.15.tgz", + "integrity": "sha512-nqE7Hc0AzI+euzUwDAy0aY5hCp10r734gMGRdU+qOPX0XSceI2ULrcXB5U2xSc5VkWwalCj4M7GzCAygZl2KoQ==", + "license": "Apache-2.0", + "dependencies": { + "@grpc/proto-loader": "^0.7.8", + "@types/node": ">=12.12.47" + }, + "engines": { + "node": "^8.13.0 || >=10.10.0" + } + }, + "node_modules/@grpc/proto-loader": { + "version": "0.7.15", + "resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.7.15.tgz", + "integrity": "sha512-tMXdRCfYVixjuFK+Hk0Q1s38gV9zDiDJfWL3h1rv4Qc39oILCu1TRTDt7+fGUI8K4G1Fj125Hx/ru3azECWTyQ==", + "license": "Apache-2.0", + "dependencies": { + "lodash.camelcase": "^4.3.0", + "long": "^5.0.0", + "protobufjs": "^7.2.5", + "yargs": "^17.7.2" + }, + "bin": { + "proto-loader-gen-types": "build/bin/proto-loader-gen-types.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@humanfs/core": { + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz", + "integrity": "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/node": { + "version": "0.16.7", + "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.7.tgz", + "integrity": "sha512-/zUx+yOsIrG4Y43Eh2peDeKCxlRt/gET6aHfaKpuq267qXdYDFViVHfMaLyygZOnl0kGWxFIgsBy8QFuTLUXEQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@humanfs/core": "^0.19.1", + "@humanwhocodes/retry": "^0.4.0" + }, + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/retry": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.3.tgz", + "integrity": "sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@img/colour": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@img/colour/-/colour-1.0.0.tgz", + "integrity": "sha512-A5P/LfWGFSl6nsckYtjw9da+19jB8hkJ6ACTGcDfEJ0aE+l2n2El7dsVM7UVHZQ9s2lmYMWlrS21YLy2IR1LUw==", + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/@img/sharp-darwin-arm64": { + "version": "0.34.5", + "resolved": "https://registry.npmjs.org/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.34.5.tgz", + "integrity": "sha512-imtQ3WMJXbMY4fxb/Ndp6HBTNVtWCUI0WdobyheGf5+ad6xX8VIDO8u2xE4qc/fr08CKG/7dDseFtn6M6g/r3w==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-darwin-arm64": "1.2.4" + } + }, + "node_modules/@img/sharp-darwin-x64": { + "version": "0.34.5", + "resolved": "https://registry.npmjs.org/@img/sharp-darwin-x64/-/sharp-darwin-x64-0.34.5.tgz", + "integrity": "sha512-YNEFAF/4KQ/PeW0N+r+aVVsoIY0/qxxikF2SWdp+NRkmMB7y9LBZAVqQ4yhGCm/H3H270OSykqmQMKLBhBJDEw==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-darwin-x64": "1.2.4" + } + }, + "node_modules/@img/sharp-libvips-darwin-arm64": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-arm64/-/sharp-libvips-darwin-arm64-1.2.4.tgz", + "integrity": "sha512-zqjjo7RatFfFoP0MkQ51jfuFZBnVE2pRiaydKJ1G/rHZvnsrHAOcQALIi9sA5co5xenQdTugCvtb1cuf78Vf4g==", + "cpu": [ + "arm64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "darwin" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-darwin-x64": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-x64/-/sharp-libvips-darwin-x64-1.2.4.tgz", + "integrity": "sha512-1IOd5xfVhlGwX+zXv2N93k0yMONvUlANylbJw1eTah8K/Jtpi15KC+WSiaX/nBmbm2HxRM1gZ0nSdjSsrZbGKg==", + "cpu": [ + "x64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "darwin" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-arm": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm/-/sharp-libvips-linux-arm-1.2.4.tgz", + "integrity": "sha512-bFI7xcKFELdiNCVov8e44Ia4u2byA+l3XtsAj+Q8tfCwO6BQ8iDojYdvoPMqsKDkuoOo+X6HZA0s0q11ANMQ8A==", + "cpu": [ + "arm" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-arm64": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm64/-/sharp-libvips-linux-arm64-1.2.4.tgz", + "integrity": "sha512-excjX8DfsIcJ10x1Kzr4RcWe1edC9PquDRRPx3YVCvQv+U5p7Yin2s32ftzikXojb1PIFc/9Mt28/y+iRklkrw==", + "cpu": [ + "arm64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-ppc64": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-ppc64/-/sharp-libvips-linux-ppc64-1.2.4.tgz", + "integrity": "sha512-FMuvGijLDYG6lW+b/UvyilUWu5Ayu+3r2d1S8notiGCIyYU/76eig1UfMmkZ7vwgOrzKzlQbFSuQfgm7GYUPpA==", + "cpu": [ + "ppc64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-riscv64": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-riscv64/-/sharp-libvips-linux-riscv64-1.2.4.tgz", + "integrity": "sha512-oVDbcR4zUC0ce82teubSm+x6ETixtKZBh/qbREIOcI3cULzDyb18Sr/Wcyx7NRQeQzOiHTNbZFF1UwPS2scyGA==", + "cpu": [ + "riscv64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-s390x": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-s390x/-/sharp-libvips-linux-s390x-1.2.4.tgz", + "integrity": "sha512-qmp9VrzgPgMoGZyPvrQHqk02uyjA0/QrTO26Tqk6l4ZV0MPWIW6LTkqOIov+J1yEu7MbFQaDpwdwJKhbJvuRxQ==", + "cpu": [ + "s390x" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-x64": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-x64/-/sharp-libvips-linux-x64-1.2.4.tgz", + "integrity": "sha512-tJxiiLsmHc9Ax1bz3oaOYBURTXGIRDODBqhveVHonrHJ9/+k89qbLl0bcJns+e4t4rvaNBxaEZsFtSfAdquPrw==", + "cpu": [ + "x64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linuxmusl-arm64": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-arm64/-/sharp-libvips-linuxmusl-arm64-1.2.4.tgz", + "integrity": "sha512-FVQHuwx1IIuNow9QAbYUzJ+En8KcVm9Lk5+uGUQJHaZmMECZmOlix9HnH7n1TRkXMS0pGxIJokIVB9SuqZGGXw==", + "cpu": [ + "arm64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linuxmusl-x64": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.2.4.tgz", + "integrity": "sha512-+LpyBk7L44ZIXwz/VYfglaX/okxezESc6UxDSoyo2Ks6Jxc4Y7sGjpgU9s4PMgqgjj1gZCylTieNamqA1MF7Dg==", + "cpu": [ + "x64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-linux-arm": { + "version": "0.34.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm/-/sharp-linux-arm-0.34.5.tgz", + "integrity": "sha512-9dLqsvwtg1uuXBGZKsxem9595+ujv0sJ6Vi8wcTANSFpwV/GONat5eCkzQo/1O6zRIkh0m/8+5BjrRr7jDUSZw==", + "cpu": [ + "arm" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-arm": "1.2.4" + } + }, + "node_modules/@img/sharp-linux-arm64": { + "version": "0.34.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm64/-/sharp-linux-arm64-0.34.5.tgz", + "integrity": "sha512-bKQzaJRY/bkPOXyKx5EVup7qkaojECG6NLYswgktOZjaXecSAeCWiZwwiFf3/Y+O1HrauiE3FVsGxFg8c24rZg==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-arm64": "1.2.4" + } + }, + "node_modules/@img/sharp-linux-ppc64": { + "version": "0.34.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-ppc64/-/sharp-linux-ppc64-0.34.5.tgz", + "integrity": "sha512-7zznwNaqW6YtsfrGGDA6BRkISKAAE1Jo0QdpNYXNMHu2+0dTrPflTLNkpc8l7MUP5M16ZJcUvysVWWrMefZquA==", + "cpu": [ + "ppc64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-ppc64": "1.2.4" + } + }, + "node_modules/@img/sharp-linux-riscv64": { + "version": "0.34.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-riscv64/-/sharp-linux-riscv64-0.34.5.tgz", + "integrity": "sha512-51gJuLPTKa7piYPaVs8GmByo7/U7/7TZOq+cnXJIHZKavIRHAP77e3N2HEl3dgiqdD/w0yUfiJnII77PuDDFdw==", + "cpu": [ + "riscv64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-riscv64": "1.2.4" + } + }, + "node_modules/@img/sharp-linux-s390x": { + "version": "0.34.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-s390x/-/sharp-linux-s390x-0.34.5.tgz", + "integrity": "sha512-nQtCk0PdKfho3eC5MrbQoigJ2gd1CgddUMkabUj+rBevs8tZ2cULOx46E7oyX+04WGfABgIwmMC0VqieTiR4jg==", + "cpu": [ + "s390x" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-s390x": "1.2.4" + } + }, + "node_modules/@img/sharp-linux-x64": { + "version": "0.34.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-x64/-/sharp-linux-x64-0.34.5.tgz", + "integrity": "sha512-MEzd8HPKxVxVenwAa+JRPwEC7QFjoPWuS5NZnBt6B3pu7EG2Ge0id1oLHZpPJdn3OQK+BQDiw9zStiHBTJQQQQ==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-x64": "1.2.4" + } + }, + "node_modules/@img/sharp-linuxmusl-arm64": { + "version": "0.34.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-arm64/-/sharp-linuxmusl-arm64-0.34.5.tgz", + "integrity": "sha512-fprJR6GtRsMt6Kyfq44IsChVZeGN97gTD331weR1ex1c1rypDEABN6Tm2xa1wE6lYb5DdEnk03NZPqA7Id21yg==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linuxmusl-arm64": "1.2.4" + } + }, + "node_modules/@img/sharp-linuxmusl-x64": { + "version": "0.34.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.34.5.tgz", + "integrity": "sha512-Jg8wNT1MUzIvhBFxViqrEhWDGzqymo3sV7z7ZsaWbZNDLXRJZoRGrjulp60YYtV4wfY8VIKcWidjojlLcWrd8Q==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linuxmusl-x64": "1.2.4" + } + }, + "node_modules/@img/sharp-wasm32": { + "version": "0.34.5", + "resolved": "https://registry.npmjs.org/@img/sharp-wasm32/-/sharp-wasm32-0.34.5.tgz", + "integrity": "sha512-OdWTEiVkY2PHwqkbBI8frFxQQFekHaSSkUIJkwzclWZe64O1X4UlUjqqqLaPbUpMOQk6FBu/HtlGXNblIs0huw==", + "cpu": [ + "wasm32" + ], + "license": "Apache-2.0 AND LGPL-3.0-or-later AND MIT", + "optional": true, + "dependencies": { + "@emnapi/runtime": "^1.7.0" + }, + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-arm64": { + "version": "0.34.5", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-arm64/-/sharp-win32-arm64-0.34.5.tgz", + "integrity": "sha512-WQ3AgWCWYSb2yt+IG8mnC6Jdk9Whs7O0gxphblsLvdhSpSTtmu69ZG1Gkb6NuvxsNACwiPV6cNSZNzt0KPsw7g==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0 AND LGPL-3.0-or-later", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-ia32": { + "version": "0.34.5", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-ia32/-/sharp-win32-ia32-0.34.5.tgz", + "integrity": "sha512-FV9m/7NmeCmSHDD5j4+4pNI8Cp3aW+JvLoXcTUo0IqyjSfAZJ8dIUmijx1qaJsIiU+Hosw6xM5KijAWRJCSgNg==", + "cpu": [ + "ia32" + ], + "license": "Apache-2.0 AND LGPL-3.0-or-later", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-x64": { + "version": "0.34.5", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-x64/-/sharp-win32-x64-0.34.5.tgz", + "integrity": "sha512-+29YMsqY2/9eFEiW93eqWnuLcWcufowXewwSNIT6UwZdUUCrM3oFjMWH/Z6/TMmb4hlFenmfAVbpWeup2jryCw==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0 AND LGPL-3.0-or-later", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@isaacs/cliui": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", + "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", + "license": "ISC", + "dependencies": { + "string-width": "^5.1.2", + "string-width-cjs": "npm:string-width@^4.2.0", + "strip-ansi": "^7.0.1", + "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", + "wrap-ansi": "^8.1.0", + "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@isaacs/cliui/node_modules/ansi-regex": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz", + "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/@isaacs/cliui/node_modules/ansi-styles": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz", + "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/@isaacs/cliui/node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "license": "MIT" + }, + "node_modules/@isaacs/cliui/node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "license": "MIT", + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@isaacs/cliui/node_modules/strip-ansi": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.2.tgz", + "integrity": "sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA==", + "license": "MIT", + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/@isaacs/cliui/node_modules/wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.13", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", + "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/remapping": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz", + "integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.5.5", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz", + "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==", + "dev": true, + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.31", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", + "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@js-sdsl/ordered-map": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/@js-sdsl/ordered-map/-/ordered-map-4.4.2.tgz", + "integrity": "sha512-iUKgm52T8HOE/makSxjqoWhe95ZJA1/G1sYsGev2JDKUSS14KAgg1LHb+Ba+IPow0xflbnSkOsZcO08C7w1gYw==", + "dev": true, + "license": "MIT", + "optional": true, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/js-sdsl" + } + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@opentelemetry/api": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.9.0.tgz", + "integrity": "sha512-3giAOQvZiH5F9bMlMiv8+GSPMeqg0dbaeo58/0SlA9sxSqZhnUtxzX9/2FzyhS9sWQf5S0GJE0AKBrFqjpeYcg==", + "dev": true, + "license": "Apache-2.0", + "optional": true, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/@pkgjs/parseargs": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", + "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=14" + } + }, + "node_modules/@protobufjs/aspromise": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", + "integrity": "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/base64": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz", + "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/codegen": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz", + "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/eventemitter": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz", + "integrity": "sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/fetch": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz", + "integrity": "sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ==", + "license": "BSD-3-Clause", + "dependencies": { + "@protobufjs/aspromise": "^1.1.1", + "@protobufjs/inquire": "^1.1.0" + } + }, + "node_modules/@protobufjs/float": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz", + "integrity": "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/inquire": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz", + "integrity": "sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/path": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz", + "integrity": "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/pool": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz", + "integrity": "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==", + "license": "BSD-3-Clause" + }, + "node_modules/@protobufjs/utf8": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", + "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==", + "license": "BSD-3-Clause" + }, + "node_modules/@rolldown/pluginutils": { + "version": "1.0.0-beta.27", + "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.0-beta.27.tgz", + "integrity": "sha512-+d0F4MKMCbeVUJwG96uQ4SgAznZNSq93I3V+9NHA4OpvqG8mRCpGdKmK8l/dl02h2CCDHwW2FqilnTyDcAnqjA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@rollup/rollup-android-arm-eabi": { + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.53.3.tgz", + "integrity": "sha512-mRSi+4cBjrRLoaal2PnqH82Wqyb+d3HsPUN/W+WslCXsZsyHa9ZeQQX/pQsZaVIWDkPcpV6jJ+3KLbTbgnwv8w==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-android-arm64": { + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.53.3.tgz", + "integrity": "sha512-CbDGaMpdE9sh7sCmTrTUyllhrg65t6SwhjlMJsLr+J8YjFuPmCEjbBSx4Z/e4SmDyH3aB5hGaJUP2ltV/vcs4w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-darwin-arm64": { + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.53.3.tgz", + "integrity": "sha512-Nr7SlQeqIBpOV6BHHGZgYBuSdanCXuw09hon14MGOLGmXAFYjx1wNvquVPmpZnl0tLjg25dEdr4IQ6GgyToCUA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-darwin-x64": { + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.53.3.tgz", + "integrity": "sha512-DZ8N4CSNfl965CmPktJ8oBnfYr3F8dTTNBQkRlffnUarJ2ohudQD17sZBa097J8xhQ26AwhHJ5mvUyQW8ddTsQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-freebsd-arm64": { + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.53.3.tgz", + "integrity": "sha512-yMTrCrK92aGyi7GuDNtGn2sNW+Gdb4vErx4t3Gv/Tr+1zRb8ax4z8GWVRfr3Jw8zJWvpGHNpss3vVlbF58DZ4w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-freebsd-x64": { + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.53.3.tgz", + "integrity": "sha512-lMfF8X7QhdQzseM6XaX0vbno2m3hlyZFhwcndRMw8fbAGUGL3WFMBdK0hbUBIUYcEcMhVLr1SIamDeuLBnXS+Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.53.3.tgz", + "integrity": "sha512-k9oD15soC/Ln6d2Wv/JOFPzZXIAIFLp6B+i14KhxAfnq76ajt0EhYc5YPeX6W1xJkAdItcVT+JhKl1QZh44/qw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm-musleabihf": { + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.53.3.tgz", + "integrity": "sha512-vTNlKq+N6CK/8UktsrFuc+/7NlEYVxgaEgRXVUVK258Z5ymho29skzW1sutgYjqNnquGwVUObAaxae8rZ6YMhg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-gnu": { + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.53.3.tgz", + "integrity": "sha512-RGrFLWgMhSxRs/EWJMIFM1O5Mzuz3Xy3/mnxJp/5cVhZ2XoCAxJnmNsEyeMJtpK+wu0FJFWz+QF4mjCA7AUQ3w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-musl": { + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.53.3.tgz", + "integrity": "sha512-kASyvfBEWYPEwe0Qv4nfu6pNkITLTb32p4yTgzFCocHnJLAHs+9LjUu9ONIhvfT/5lv4YS5muBHyuV84epBo/A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loong64-gnu": { + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.53.3.tgz", + "integrity": "sha512-JiuKcp2teLJwQ7vkJ95EwESWkNRFJD7TQgYmCnrPtlu50b4XvT5MOmurWNrCj3IFdyjBQ5p9vnrX4JM6I8OE7g==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-gnu": { + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.53.3.tgz", + "integrity": "sha512-EoGSa8nd6d3T7zLuqdojxC20oBfNT8nexBbB/rkxgKj5T5vhpAQKKnD+h3UkoMuTyXkP5jTjK/ccNRmQrPNDuw==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-gnu": { + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.53.3.tgz", + "integrity": "sha512-4s+Wped2IHXHPnAEbIB0YWBv7SDohqxobiiPA1FIWZpX+w9o2i4LezzH/NkFUl8LRci/8udci6cLq+jJQlh+0g==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-musl": { + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.53.3.tgz", + "integrity": "sha512-68k2g7+0vs2u9CxDt5ktXTngsxOQkSEV/xBbwlqYcUrAVh6P9EgMZvFsnHy4SEiUl46Xf0IObWVbMvPrr2gw8A==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-s390x-gnu": { + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.53.3.tgz", + "integrity": "sha512-VYsFMpULAz87ZW6BVYw3I6sWesGpsP9OPcyKe8ofdg9LHxSbRMd7zrVrr5xi/3kMZtpWL/wC+UIJWJYVX5uTKg==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.53.3.tgz", + "integrity": "sha512-3EhFi1FU6YL8HTUJZ51imGJWEX//ajQPfqWLI3BQq4TlvHy4X0MOr5q3D2Zof/ka0d5FNdPwZXm3Yyib/UEd+w==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.53.3.tgz", + "integrity": "sha512-eoROhjcc6HbZCJr+tvVT8X4fW3/5g/WkGvvmwz/88sDtSJzO7r/blvoBDgISDiCjDRZmHpwud7h+6Q9JxFwq1Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-openharmony-arm64": { + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.53.3.tgz", + "integrity": "sha512-OueLAWgrNSPGAdUdIjSWXw+u/02BRTcnfw9PN41D2vq/JSEPnJnVuBgw18VkN8wcd4fjUs+jFHVM4t9+kBSNLw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ] + }, + "node_modules/@rollup/rollup-win32-arm64-msvc": { + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.53.3.tgz", + "integrity": "sha512-GOFuKpsxR/whszbF/bzydebLiXIHSgsEUp6M0JI8dWvi+fFa1TD6YQa4aSZHtpmh2/uAlj/Dy+nmby3TJ3pkTw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-ia32-msvc": { + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.53.3.tgz", + "integrity": "sha512-iah+THLcBJdpfZ1TstDFbKNznlzoxa8fmnFYK4V67HvmuNYkVdAywJSoteUszvBQ9/HqN2+9AZghbajMsFT+oA==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-gnu": { + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.53.3.tgz", + "integrity": "sha512-J9QDiOIZlZLdcot5NXEepDkstocktoVjkaKUtqzgzpt2yWjGlbYiKyp05rWwk4nypbYUNoFAztEgixoLaSETkg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.53.3.tgz", + "integrity": "sha512-UhTd8u31dXadv0MopwGgNOBpUVROFKWVQgAg5N1ESyCz8AuBcMqm4AuTjrwgQKGDfoFuz02EuMRHQIw/frmYKQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@swc/helpers": { + "version": "0.5.18", + "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.18.tgz", + "integrity": "sha512-TXTnIcNJQEKwThMMqBXsZ4VGAza6bvN4pa41Rkqoio6QBKMvo+5lexeTMScGCIxtzgQJzElcvIltani+adC5PQ==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.8.0" + } + }, + "node_modules/@tootallnate/once": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-2.0.0.tgz", + "integrity": "sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==", + "dev": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">= 10" + } + }, + "node_modules/@types/babel__core": { + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz", + "integrity": "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.20.7", + "@babel/types": "^7.20.7", + "@types/babel__generator": "*", + "@types/babel__template": "*", + "@types/babel__traverse": "*" + } + }, + "node_modules/@types/babel__generator": { + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.27.0.tgz", + "integrity": "sha512-ufFd2Xi92OAVPYsy+P4n7/U7e68fex0+Ee8gSG9KX7eo084CWiQ4sdxktvdl0bOPupXtVJPY19zk6EwWqUQ8lg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__template": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.4.tgz", + "integrity": "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.1.0", + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__traverse": { + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.28.0.tgz", + "integrity": "sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.28.2" + } + }, + "node_modules/@types/caseless": { + "version": "0.12.5", + "resolved": "https://registry.npmjs.org/@types/caseless/-/caseless-0.12.5.tgz", + "integrity": "sha512-hWtVTC2q7hc7xZ/RLbxapMvDMgUnDvKvMOpKal4DrMyfGBUfB1oKaZlIRr6mJL+If3bAP6sV/QneGzF6tJjZDg==", + "dev": true, + "license": "MIT", + "optional": true + }, + "node_modules/@types/debug": { + "version": "4.1.12", + "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.12.tgz", + "integrity": "sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==", + "license": "MIT", + "dependencies": { + "@types/ms": "*" + } + }, + "node_modules/@types/estree": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", + "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", + "license": "MIT" + }, + "node_modules/@types/estree-jsx": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@types/estree-jsx/-/estree-jsx-1.0.5.tgz", + "integrity": "sha512-52CcUVNFyfb1A2ALocQw/Dd1BQFNmSdkuC3BkZ6iqhdMfQz7JWOFRuJFloOzjk+6WijU56m9oKXFAXc7o3Towg==", + "license": "MIT", + "dependencies": { + "@types/estree": "*" + } + }, + "node_modules/@types/hast": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/hast/-/hast-3.0.4.tgz", + "integrity": "sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==", + "license": "MIT", + "dependencies": { + "@types/unist": "*" + } + }, + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/jsonwebtoken": { + "version": "9.0.10", + "resolved": "https://registry.npmjs.org/@types/jsonwebtoken/-/jsonwebtoken-9.0.10.tgz", + "integrity": "sha512-asx5hIG9Qmf/1oStypjanR7iKTv0gXQ1Ov/jfrX6kS/EO0OFni8orbmGCn0672NHR3kXHwpAwR+B368ZGN/2rA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/ms": "*", + "@types/node": "*" + } + }, + "node_modules/@types/long": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.2.tgz", + "integrity": "sha512-MqTGEo5bj5t157U6fA/BiDynNkn0YknVdh48CMPkTSpFTVmvao5UQmm7uEF6xBEo7qIMAlY/JSleYaE6VOdpaA==", + "dev": true, + "license": "MIT", + "optional": true + }, + "node_modules/@types/mdast": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-4.0.4.tgz", + "integrity": "sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==", + "license": "MIT", + "dependencies": { + "@types/unist": "*" + } + }, + "node_modules/@types/ms": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@types/ms/-/ms-2.1.0.tgz", + "integrity": "sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==", + "license": "MIT" + }, + "node_modules/@types/node": { + "version": "25.0.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-25.0.0.tgz", + "integrity": "sha512-rl78HwuZlaDIUSeUKkmogkhebA+8K1Hy7tddZuJ3D0xV8pZSfsYGTsliGUol1JPzu9EKnTxPC4L1fiWouStRew==", + "license": "MIT", + "dependencies": { + "undici-types": "~7.16.0" + } + }, + "node_modules/@types/pako": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@types/pako/-/pako-2.0.4.tgz", + "integrity": "sha512-VWDCbrLeVXJM9fihYodcLiIv0ku+AlOa/TQ1SvYOaBuyrSKgEcro95LJyIsJ4vSo6BXIxOKxiJAat04CmST9Fw==", + "license": "MIT" + }, + "node_modules/@types/prop-types": { + "version": "15.7.15", + "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.15.tgz", + "integrity": "sha512-F6bEyamV9jKGAFBEmlQnesRPGOQqS2+Uwi0Em15xenOxHaf2hv6L8YCVn3rPdPJOiJfPiCnLIRyvwVaqMY3MIw==", + "license": "MIT" + }, + "node_modules/@types/raf": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/@types/raf/-/raf-3.4.3.tgz", + "integrity": "sha512-c4YAvMedbPZ5tEyxzQdMoOhhJ4RD3rngZIdwC2/qDN3d7JpEhB6fiBRKVY1lg5B7Wk+uPBjn5f39j1/2MY1oOw==", + "license": "MIT", + "optional": true + }, + "node_modules/@types/react": { + "version": "18.3.27", + "resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.27.tgz", + "integrity": "sha512-cisd7gxkzjBKU2GgdYrTdtQx1SORymWyaAFhaxQPK9bYO9ot3Y5OikQRvY0VYQtvwjeQnizCINJAenh/V7MK2w==", + "license": "MIT", + "peer": true, + "dependencies": { + "@types/prop-types": "*", + "csstype": "^3.2.2" + } + }, + "node_modules/@types/react-dom": { + "version": "18.3.7", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.3.7.tgz", + "integrity": "sha512-MEe3UeoENYVFXzoXEWsvcpg6ZvlrFNlOQ7EOsvhI3CfAXwzPfO8Qwuxd40nepsYKqyyVQnTdEfv68q91yLcKrQ==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "@types/react": "^18.0.0" + } + }, + "node_modules/@types/request": { + "version": "2.48.13", + "resolved": "https://registry.npmjs.org/@types/request/-/request-2.48.13.tgz", + "integrity": "sha512-FGJ6udDNUCjd19pp0Q3iTiDkwhYup7J8hpMW9c4k53NrccQFFWKRho6hvtPPEhnXWKvukfwAlB6DbDz4yhH5Gg==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@types/caseless": "*", + "@types/node": "*", + "@types/tough-cookie": "*", + "form-data": "^2.5.5" + } + }, + "node_modules/@types/request/node_modules/form-data": { + "version": "2.5.5", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.5.tgz", + "integrity": "sha512-jqdObeR2rxZZbPSGL+3VckHMYtu+f9//KXBsVny6JSX/pa38Fy+bGjuG8eW/H6USNQWhLi8Num++cU2yOCNz4A==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "es-set-tostringtag": "^2.1.0", + "hasown": "^2.0.2", + "mime-types": "^2.1.35", + "safe-buffer": "^5.2.1" + }, + "engines": { + "node": ">= 0.12" + } + }, + "node_modules/@types/request/node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "dev": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/@types/request/node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/@types/request/node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "optional": true + }, + "node_modules/@types/tough-cookie": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-4.0.5.tgz", + "integrity": "sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA==", + "dev": true, + "license": "MIT", + "optional": true + }, + "node_modules/@types/trusted-types": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz", + "integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==", + "license": "MIT", + "optional": true + }, + "node_modules/@types/unist": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.3.tgz", + "integrity": "sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q==", + "license": "MIT" + }, + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "8.49.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.49.0.tgz", + "integrity": "sha512-JXij0vzIaTtCwu6SxTh8qBc66kmf1xs7pI4UOiMDFVct6q86G0Zs7KRcEoJgY3Cav3x5Tq0MF5jwgpgLqgKG3A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/regexpp": "^4.10.0", + "@typescript-eslint/scope-manager": "8.49.0", + "@typescript-eslint/type-utils": "8.49.0", + "@typescript-eslint/utils": "8.49.0", + "@typescript-eslint/visitor-keys": "8.49.0", + "ignore": "^7.0.0", + "natural-compare": "^1.4.0", + "ts-api-utils": "^2.1.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^8.49.0", + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore": { + "version": "7.0.5", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.5.tgz", + "integrity": "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/@typescript-eslint/parser": { + "version": "8.49.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.49.0.tgz", + "integrity": "sha512-N9lBGA9o9aqb1hVMc9hzySbhKibHmB+N3IpoShyV6HyQYRGIhlrO5rQgttypi+yEeKsKI4idxC8Jw6gXKD4THA==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@typescript-eslint/scope-manager": "8.49.0", + "@typescript-eslint/types": "8.49.0", + "@typescript-eslint/typescript-estree": "8.49.0", + "@typescript-eslint/visitor-keys": "8.49.0", + "debug": "^4.3.4" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/@typescript-eslint/project-service": { + "version": "8.49.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.49.0.tgz", + "integrity": "sha512-/wJN0/DKkmRUMXjZUXYZpD1NEQzQAAn9QWfGwo+Ai8gnzqH7tvqS7oNVdTjKqOcPyVIdZdyCMoqN66Ia789e7g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/tsconfig-utils": "^8.49.0", + "@typescript-eslint/types": "^8.49.0", + "debug": "^4.3.4" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/@typescript-eslint/scope-manager": { + "version": "8.49.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.49.0.tgz", + "integrity": "sha512-npgS3zi+/30KSOkXNs0LQXtsg9ekZ8OISAOLGWA/ZOEn0ZH74Ginfl7foziV8DT+D98WfQ5Kopwqb/PZOaIJGg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.49.0", + "@typescript-eslint/visitor-keys": "8.49.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/tsconfig-utils": { + "version": "8.49.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.49.0.tgz", + "integrity": "sha512-8prixNi1/6nawsRYxet4YOhnbW+W9FK/bQPxsGB1D3ZrDzbJ5FXw5XmzxZv82X3B+ZccuSxo/X8q9nQ+mFecWA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/@typescript-eslint/type-utils": { + "version": "8.49.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.49.0.tgz", + "integrity": "sha512-KTExJfQ+svY8I10P4HdxKzWsvtVnsuCifU5MvXrRwoP2KOlNZ9ADNEWWsQTJgMxLzS5VLQKDjkCT/YzgsnqmZg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.49.0", + "@typescript-eslint/typescript-estree": "8.49.0", + "@typescript-eslint/utils": "8.49.0", + "debug": "^4.3.4", + "ts-api-utils": "^2.1.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/@typescript-eslint/types": { + "version": "8.49.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.49.0.tgz", + "integrity": "sha512-e9k/fneezorUo6WShlQpMxXh8/8wfyc+biu6tnAqA81oWrEic0k21RHzP9uqqpyBBeBKu4T+Bsjy9/b8u7obXQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/typescript-estree": { + "version": "8.49.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.49.0.tgz", + "integrity": "sha512-jrLdRuAbPfPIdYNppHJ/D0wN+wwNfJ32YTAm10eJVsFmrVpXQnDWBn8niCSMlWjvml8jsce5E/O+86IQtTbJWA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/project-service": "8.49.0", + "@typescript-eslint/tsconfig-utils": "8.49.0", + "@typescript-eslint/types": "8.49.0", + "@typescript-eslint/visitor-keys": "8.49.0", + "debug": "^4.3.4", + "minimatch": "^9.0.4", + "semver": "^7.6.0", + "tinyglobby": "^0.2.15", + "ts-api-utils": "^2.1.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/semver": { + "version": "7.7.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.3.tgz", + "integrity": "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@typescript-eslint/utils": { + "version": "8.49.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.49.0.tgz", + "integrity": "sha512-N3W7rJw7Rw+z1tRsHZbK395TWSYvufBXumYtEGzypgMUthlg0/hmCImeA8hgO2d2G4pd7ftpxxul2J8OdtdaFA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.7.0", + "@typescript-eslint/scope-manager": "8.49.0", + "@typescript-eslint/types": "8.49.0", + "@typescript-eslint/typescript-estree": "8.49.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "8.49.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.49.0.tgz", + "integrity": "sha512-LlKaciDe3GmZFphXIc79THF/YYBugZ7FS1pO581E/edlVVNbZKDy93evqmrfQ9/Y4uN0vVhX4iuchq26mK/iiA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.49.0", + "eslint-visitor-keys": "^4.2.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@ungap/structured-clone": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.0.tgz", + "integrity": "sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==", + "license": "ISC" + }, + "node_modules/@vitejs/plugin-react": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-4.7.0.tgz", + "integrity": "sha512-gUu9hwfWvvEDBBmgtAowQCojwZmJ5mcLn3aufeCsitijs3+f2NsrPtlAWIR6OPiqljl96GVCUbLe0HyqIpVaoA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/core": "^7.28.0", + "@babel/plugin-transform-react-jsx-self": "^7.27.1", + "@babel/plugin-transform-react-jsx-source": "^7.27.1", + "@rolldown/pluginutils": "1.0.0-beta.27", + "@types/babel__core": "^7.20.5", + "react-refresh": "^0.17.0" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "peerDependencies": { + "vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0" + } + }, + "node_modules/abort-controller": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", + "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "license": "MIT", + "dependencies": { + "event-target-shim": "^5.0.0" + }, + "engines": { + "node": ">=6.5" + } + }, + "node_modules/accepts": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-2.0.0.tgz", + "integrity": "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==", + "license": "MIT", + "dependencies": { + "mime-types": "^3.0.0", + "negotiator": "^1.0.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/acorn": { + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", + "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", + "dev": true, + "license": "MIT", + "peer": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/agent-base": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz", + "integrity": "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 14" + } + }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/any-promise": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", + "integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==", + "dev": true, + "license": "MIT" + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "license": "ISC", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/archiver": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/archiver/-/archiver-7.0.1.tgz", + "integrity": "sha512-ZcbTaIqJOfCc03QwD468Unz/5Ir8ATtvAHsK+FdXbDIbGfihqh9mrvdcYunQzqn4HrvWWaFyaxJhGZagaJJpPQ==", + "license": "MIT", + "dependencies": { + "archiver-utils": "^5.0.2", + "async": "^3.2.4", + "buffer-crc32": "^1.0.0", + "readable-stream": "^4.0.0", + "readdir-glob": "^1.1.2", + "tar-stream": "^3.0.0", + "zip-stream": "^6.0.1" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/archiver-utils": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/archiver-utils/-/archiver-utils-5.0.2.tgz", + "integrity": "sha512-wuLJMmIBQYCsGZgYLTy5FIB2pF6Lfb6cXMSF8Qywwk3t20zWnAi7zLcQFdKQmIB8wyZpY5ER38x08GbwtR2cLA==", + "license": "MIT", + "dependencies": { + "glob": "^10.0.0", + "graceful-fs": "^4.2.0", + "is-stream": "^2.0.1", + "lazystream": "^1.0.0", + "lodash": "^4.17.15", + "normalize-path": "^3.0.0", + "readable-stream": "^4.0.0" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/archiver-utils/node_modules/readable-stream": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.7.0.tgz", + "integrity": "sha512-oIGGmcpTLwPga8Bn6/Z75SVaH1z5dUut2ibSyAMVhmUggWpmDn2dapB0n7f8nwaSiRtepAsfJyfXIO5DCVAODg==", + "license": "MIT", + "dependencies": { + "abort-controller": "^3.0.0", + "buffer": "^6.0.3", + "events": "^3.3.0", + "process": "^0.11.10", + "string_decoder": "^1.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/archiver-utils/node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/archiver-utils/node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/archiver/node_modules/readable-stream": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.7.0.tgz", + "integrity": "sha512-oIGGmcpTLwPga8Bn6/Z75SVaH1z5dUut2ibSyAMVhmUggWpmDn2dapB0n7f8nwaSiRtepAsfJyfXIO5DCVAODg==", + "license": "MIT", + "dependencies": { + "abort-controller": "^3.0.0", + "buffer": "^6.0.3", + "events": "^3.3.0", + "process": "^0.11.10", + "string_decoder": "^1.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/archiver/node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/archiver/node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/arg": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/arg/-/arg-5.0.2.tgz", + "integrity": "sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==", + "dev": true, + "license": "MIT" + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true, + "license": "Python-2.0" + }, + "node_modules/arrify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-2.0.1.tgz", + "integrity": "sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==", + "dev": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/async": { + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.6.tgz", + "integrity": "sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==", + "license": "MIT" + }, + "node_modules/async-retry": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/async-retry/-/async-retry-1.3.3.tgz", + "integrity": "sha512-wfr/jstw9xNi/0teMHrRW7dsz3Lt5ARhYNZ2ewpadnhaIp5mbALhOAP+EAdsC7t4Z6wqsDVv9+W6gm1Dk9mEyw==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "retry": "0.13.1" + } + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", + "license": "MIT" + }, + "node_modules/autoprefixer": { + "version": "10.4.22", + "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.22.tgz", + "integrity": "sha512-ARe0v/t9gO28Bznv6GgqARmVqcWOV3mfgUPn9becPHMiD3o9BwlRgaeccZnwTpZ7Zwqrm+c1sUSsMxIzQzc8Xg==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/autoprefixer" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "browserslist": "^4.27.0", + "caniuse-lite": "^1.0.30001754", + "fraction.js": "^5.3.4", + "normalize-range": "^0.1.2", + "picocolors": "^1.1.1", + "postcss-value-parser": "^4.2.0" + }, + "bin": { + "autoprefixer": "bin/autoprefixer" + }, + "engines": { + "node": "^10 || ^12 || >=14" + }, + "peerDependencies": { + "postcss": "^8.1.0" + } + }, + "node_modules/axios": { + "version": "1.13.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.13.2.tgz", + "integrity": "sha512-VPk9ebNqPcy5lRGuSlKx752IlDatOjT9paPlm8A7yOuW2Fbvp4X3JznJtT4f0GzGLLiWE9W8onz51SqLYwzGaA==", + "license": "MIT", + "dependencies": { + "follow-redirects": "^1.15.6", + "form-data": "^4.0.4", + "proxy-from-env": "^1.1.0" + } + }, + "node_modules/bail": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/bail/-/bail-2.0.2.tgz", + "integrity": "sha512-0xO6mYd7JB2YesxDKplafRpsiOzPt9V02ddPCLbY1xYGPOX24NTyN50qnUxgCPcSoYMhKpAuBTjQoRZCAkUDRw==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "license": "MIT" + }, + "node_modules/bare-events": { + "version": "2.8.2", + "resolved": "https://registry.npmjs.org/bare-events/-/bare-events-2.8.2.tgz", + "integrity": "sha512-riJjyv1/mHLIPX4RwiK+oW9/4c3TEUeORHKefKAKnZ5kyslbN+HXowtbaVEqt4IMUB7OXlfixcs6gsFeo/jhiQ==", + "license": "Apache-2.0", + "peerDependencies": { + "bare-abort-controller": "*" + }, + "peerDependenciesMeta": { + "bare-abort-controller": { + "optional": true + } + } + }, + "node_modules/base64-arraybuffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-1.0.2.tgz", + "integrity": "sha512-I3yl4r9QB5ZRY3XuJVEPfc2XhZO6YweFPI+UovAzn+8/hb3oJ6lnysaFcjVpkCPfVWFUDvoZ8kmVDP7WyRtYtQ==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">= 0.6.0" + } + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/baseline-browser-mapping": { + "version": "2.9.6", + "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.9.6.tgz", + "integrity": "sha512-v9BVVpOTLB59C9E7aSnmIF8h7qRsFpx+A2nugVMTszEOMcfjlZMsXRm4LF23I3Z9AJxc8ANpIvzbzONoX9VJlg==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "baseline-browser-mapping": "dist/cli.js" + } + }, + "node_modules/bignumber.js": { + "version": "9.3.1", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.3.1.tgz", + "integrity": "sha512-Ko0uX15oIUS7wJ3Rb30Fs6SkVbLmPBAKdlm7q9+ak9bbIeFf0MwuBsQV6z7+X768/cHsfg+WlysDWJcmthjsjQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "*" + } + }, + "node_modules/binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/body-parser": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.2.1.tgz", + "integrity": "sha512-nfDwkulwiZYQIGwxdy0RUmowMhKcFVcYXUU7m4QlKYim1rUtg83xm2yjZ40QjDuc291AJjjeSc9b++AWHSgSHw==", + "license": "MIT", + "dependencies": { + "bytes": "^3.1.2", + "content-type": "^1.0.5", + "debug": "^4.4.3", + "http-errors": "^2.0.0", + "iconv-lite": "^0.7.0", + "on-finished": "^2.4.1", + "qs": "^6.14.0", + "raw-body": "^3.0.1", + "type-is": "^2.0.1" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/brace-expansion": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "license": "MIT", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/brotli": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/brotli/-/brotli-1.3.3.tgz", + "integrity": "sha512-oTKjJdShmDuGW94SyyaoQvAjf30dZaHnjJ8uAF+u2/vGJkJbJPJAT1gDiOJP5v1Zb6f9KEyW/1HpuaWIXtGHPg==", + "license": "MIT", + "dependencies": { + "base64-js": "^1.1.2" + } + }, + "node_modules/browserslist": { + "version": "4.28.1", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.1.tgz", + "integrity": "sha512-ZC5Bd0LgJXgwGqUknZY/vkUQ04r8NXnJZ3yYi4vDmSiZmC/pdSN0NbNRPxZpbtO4uAfDUAFffO8IZoM3Gj8IkA==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "peer": true, + "dependencies": { + "baseline-browser-mapping": "^2.9.0", + "caniuse-lite": "^1.0.30001759", + "electron-to-chromium": "^1.5.263", + "node-releases": "^2.0.27", + "update-browserslist-db": "^1.2.0" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + } + }, + "node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "node_modules/buffer-crc32": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-1.0.0.tgz", + "integrity": "sha512-Db1SbgBS/fg/392AblrMJk97KggmvYhr4pB5ZIMTWtaivCPMWLkmb7m21cJvpvgK+J3nsU2CmmixNBZx4vFj/w==", + "license": "MIT", + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/buffer-equal-constant-time": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", + "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==", + "dev": true, + "license": "BSD-3-Clause" + }, + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/camelcase-css": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/camelcase-css/-/camelcase-css-2.0.1.tgz", + "integrity": "sha512-QOSvevhslijgYwRx6Rv7zKdMF8lbRmx+uQGx2+vDc+KI/eBnsy9kit5aj23AgGu3pa4t9AgwbnXWqS+iOY+2aA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/caniuse-lite": { + "version": "1.0.30001760", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001760.tgz", + "integrity": "sha512-7AAMPcueWELt1p3mi13HR/LHH0TJLT11cnwDJEs3xA4+CK/PLKeO9Kl1oru24htkyUKtkGCvAx4ohB0Ttry8Dw==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "CC-BY-4.0" + }, + "node_modules/canvg": { + "version": "3.0.11", + "resolved": "https://registry.npmjs.org/canvg/-/canvg-3.0.11.tgz", + "integrity": "sha512-5ON+q7jCTgMp9cjpu4Jo6XbvfYwSB2Ow3kzHKfIyJfaCAOHLbdKPQqGKgfED/R5B+3TFFfe8pegYA+b423SRyA==", + "license": "MIT", + "optional": true, + "dependencies": { + "@babel/runtime": "^7.12.5", + "@types/raf": "^3.4.0", + "core-js": "^3.8.3", + "raf": "^3.4.1", + "regenerator-runtime": "^0.13.7", + "rgbcolor": "^1.0.1", + "stackblur-canvas": "^2.0.0", + "svg-pathdata": "^6.0.3" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/ccount": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/ccount/-/ccount-2.0.1.tgz", + "integrity": "sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/character-entities": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-2.0.2.tgz", + "integrity": "sha512-shx7oQ0Awen/BRIdkjkvz54PnEEI/EjwXDSIZp86/KKdbafHh1Df/RYGBhn4hbe2+uKC9FnT5UCEdyPz3ai9hQ==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/character-entities-html4": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/character-entities-html4/-/character-entities-html4-2.1.0.tgz", + "integrity": "sha512-1v7fgQRj6hnSwFpq1Eu0ynr/CDEw0rXo2B61qXrLNdHZmPKgb7fqS1a2JwF0rISo9q77jDI8VMEHoApn8qDoZA==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/character-entities-legacy": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-3.0.0.tgz", + "integrity": "sha512-RpPp0asT/6ufRm//AJVwpViZbGM/MkjQFxJccQRHmISF/22NBtsHqAWmL+/pmkPWoIUJdWyeVleTl1wydHATVQ==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/character-reference-invalid": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-2.0.1.tgz", + "integrity": "sha512-iBZ4F4wRbyORVsu0jPV7gXkOsGYjGHPmAyv+HiHG8gi5PtC9KI2j1+v8/tlibRvjoWX027ypmG/n0HtO5t7unw==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/chokidar/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "license": "ISC", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/clone": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz", + "integrity": "sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w==", + "license": "MIT", + "engines": { + "node": ">=0.8" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "license": "MIT" + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "license": "MIT", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/comma-separated-tokens": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz", + "integrity": "sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/commander": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz", + "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/compress-commons": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/compress-commons/-/compress-commons-6.0.2.tgz", + "integrity": "sha512-6FqVXeETqWPoGcfzrXb37E50NP0LXT8kAMu5ooZayhWWdgEY4lBEEcbQNXtkuKQsGduxiIcI4gOTsxTmuq/bSg==", + "license": "MIT", + "dependencies": { + "crc-32": "^1.2.0", + "crc32-stream": "^6.0.0", + "is-stream": "^2.0.1", + "normalize-path": "^3.0.0", + "readable-stream": "^4.0.0" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/compress-commons/node_modules/readable-stream": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.7.0.tgz", + "integrity": "sha512-oIGGmcpTLwPga8Bn6/Z75SVaH1z5dUut2ibSyAMVhmUggWpmDn2dapB0n7f8nwaSiRtepAsfJyfXIO5DCVAODg==", + "license": "MIT", + "dependencies": { + "abort-controller": "^3.0.0", + "buffer": "^6.0.3", + "events": "^3.3.0", + "process": "^0.11.10", + "string_decoder": "^1.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/compress-commons/node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/compress-commons/node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true, + "license": "MIT" + }, + "node_modules/content-disposition": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-1.0.1.tgz", + "integrity": "sha512-oIXISMynqSqm241k6kcQ5UwttDILMK4BiurCfGEREw6+X9jkkpEe5T9FZaApyLGGOnFuyMWZpdolTXMtvEJ08Q==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/content-type": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "dev": true, + "license": "MIT" + }, + "node_modules/cookie": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", + "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-signature": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.2.2.tgz", + "integrity": "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==", + "license": "MIT", + "engines": { + "node": ">=6.6.0" + } + }, + "node_modules/core-js": { + "version": "3.47.0", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.47.0.tgz", + "integrity": "sha512-c3Q2VVkGAUyupsjRnaNX6u8Dq2vAdzm9iuPj5FW0fRxzlxgq9Q39MDq10IvmQSpLgHQNyQzQmOo6bgGHmH3NNg==", + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/core-js" + } + }, + "node_modules/core-util-is": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", + "license": "MIT" + }, + "node_modules/cors": { + "version": "2.8.5", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", + "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==", + "license": "MIT", + "dependencies": { + "object-assign": "^4", + "vary": "^1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/crc-32": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.2.tgz", + "integrity": "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==", + "license": "Apache-2.0", + "bin": { + "crc32": "bin/crc32.njs" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/crc32-stream": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/crc32-stream/-/crc32-stream-6.0.0.tgz", + "integrity": "sha512-piICUB6ei4IlTv1+653yq5+KoqfBYmj9bw6LqXoOneTMDXk5nM1qt12mFW1caG3LlJXEKW1Bp0WggEmIfQB34g==", + "license": "MIT", + "dependencies": { + "crc-32": "^1.2.0", + "readable-stream": "^4.0.0" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/crc32-stream/node_modules/readable-stream": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.7.0.tgz", + "integrity": "sha512-oIGGmcpTLwPga8Bn6/Z75SVaH1z5dUut2ibSyAMVhmUggWpmDn2dapB0n7f8nwaSiRtepAsfJyfXIO5DCVAODg==", + "license": "MIT", + "dependencies": { + "abort-controller": "^3.0.0", + "buffer": "^6.0.3", + "events": "^3.3.0", + "process": "^0.11.10", + "string_decoder": "^1.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/crc32-stream/node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/crc32-stream/node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/crypto-js": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.2.0.tgz", + "integrity": "sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q==", + "license": "MIT" + }, + "node_modules/css-line-break": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/css-line-break/-/css-line-break-2.1.0.tgz", + "integrity": "sha512-FHcKFCZcAha3LwfVBhCQbW2nCNbkZXn7KVUJcsT5/P8YmfsVja0FMPJr0B903j/E69HUphKiV9iQArX8SDYA4w==", + "license": "MIT", + "optional": true, + "dependencies": { + "utrie": "^1.0.2" + } + }, + "node_modules/cssesc": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", + "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==", + "dev": true, + "license": "MIT", + "bin": { + "cssesc": "bin/cssesc" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/csstype": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", + "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==", + "license": "MIT" + }, + "node_modules/data-uri-to-buffer": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz", + "integrity": "sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 12" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/decode-named-character-reference": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decode-named-character-reference/-/decode-named-character-reference-1.2.0.tgz", + "integrity": "sha512-c6fcElNV6ShtZXmsgNgFFV5tVX2PaV4g+MOAkb8eXHvn6sryJBrZa9r0zV6+dtTyoCKxtDy5tyQ5ZwQuidtd+Q==", + "license": "MIT", + "dependencies": { + "character-entities": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/dequal": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", + "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/detect-libc": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", + "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==", + "license": "Apache-2.0", + "engines": { + "node": ">=8" + } + }, + "node_modules/devlop": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/devlop/-/devlop-1.1.0.tgz", + "integrity": "sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==", + "license": "MIT", + "dependencies": { + "dequal": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/dfa": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/dfa/-/dfa-1.2.0.tgz", + "integrity": "sha512-ED3jP8saaweFTjeGX8HQPjeC1YYyZs98jGNZx6IiBvxW7JG5v492kamAQB3m2wop07CvU/RQmzcKr6bgcC5D/Q==", + "license": "MIT" + }, + "node_modules/didyoumean": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz", + "integrity": "sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==", + "dev": true, + "license": "Apache-2.0" + }, + "node_modules/dlv": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/dlv/-/dlv-1.1.3.tgz", + "integrity": "sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==", + "dev": true, + "license": "MIT" + }, + "node_modules/dompurify": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.3.1.tgz", + "integrity": "sha512-qkdCKzLNtrgPFP1Vo+98FRzJnBRGe4ffyCea9IwHB1fyxPOeNTHpLKYGd4Uk9xvNoH0ZoOjwZxNptyMwqrId1Q==", + "license": "(MPL-2.0 OR Apache-2.0)", + "optional": true, + "optionalDependencies": { + "@types/trusted-types": "^2.0.7" + } + }, + "node_modules/dotenv": { + "version": "17.3.1", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-17.3.1.tgz", + "integrity": "sha512-IO8C/dzEb6O3F9/twg6ZLXz164a2fhTnEWb95H23Dm4OuN+92NmEAlTrupP9VW6Jm3sO26tQlqyvyi4CsnY9GA==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/duplexify": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-4.1.3.tgz", + "integrity": "sha512-M3BmBhwJRZsSx38lZyhE53Csddgzl5R7xGJNk7CVddZD6CcmwMCH8J+7AprIrQKH7TonKxaCjcv27Qmf+sQ+oA==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "end-of-stream": "^1.4.1", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1", + "stream-shift": "^1.0.2" + } + }, + "node_modules/duplexify/node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", + "license": "MIT" + }, + "node_modules/ecdsa-sig-formatter": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", + "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "safe-buffer": "^5.0.1" + } + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", + "license": "MIT" + }, + "node_modules/electron-to-chromium": { + "version": "1.5.267", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.267.tgz", + "integrity": "sha512-0Drusm6MVRXSOJpGbaSVgcQsuB4hEkMpHXaVstcPmhu5LIedxs1xNK/nIxmQIU/RPC0+1/o0AVZfBTkTNJOdUw==", + "dev": true, + "license": "ISC" + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "license": "MIT" + }, + "node_modules/encodeurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/end-of-stream": { + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.5.tgz", + "integrity": "sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "once": "^1.4.0" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-set-tostringtag": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz", + "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/esbuild": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.21.5.tgz", + "integrity": "sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.21.5", + "@esbuild/android-arm": "0.21.5", + "@esbuild/android-arm64": "0.21.5", + "@esbuild/android-x64": "0.21.5", + "@esbuild/darwin-arm64": "0.21.5", + "@esbuild/darwin-x64": "0.21.5", + "@esbuild/freebsd-arm64": "0.21.5", + "@esbuild/freebsd-x64": "0.21.5", + "@esbuild/linux-arm": "0.21.5", + "@esbuild/linux-arm64": "0.21.5", + "@esbuild/linux-ia32": "0.21.5", + "@esbuild/linux-loong64": "0.21.5", + "@esbuild/linux-mips64el": "0.21.5", + "@esbuild/linux-ppc64": "0.21.5", + "@esbuild/linux-riscv64": "0.21.5", + "@esbuild/linux-s390x": "0.21.5", + "@esbuild/linux-x64": "0.21.5", + "@esbuild/netbsd-x64": "0.21.5", + "@esbuild/openbsd-x64": "0.21.5", + "@esbuild/sunos-x64": "0.21.5", + "@esbuild/win32-arm64": "0.21.5", + "@esbuild/win32-ia32": "0.21.5", + "@esbuild/win32-x64": "0.21.5" + } + }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", + "license": "MIT" + }, + "node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint": { + "version": "9.39.1", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.39.1.tgz", + "integrity": "sha512-BhHmn2yNOFA9H9JmmIVKJmd288g9hrVRDkdoIgRCRuSySRUHH7r/DI6aAXW9T1WwUuY3DFgrcaqB+deURBLR5g==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@eslint-community/eslint-utils": "^4.8.0", + "@eslint-community/regexpp": "^4.12.1", + "@eslint/config-array": "^0.21.1", + "@eslint/config-helpers": "^0.4.2", + "@eslint/core": "^0.17.0", + "@eslint/eslintrc": "^3.3.1", + "@eslint/js": "9.39.1", + "@eslint/plugin-kit": "^0.4.1", + "@humanfs/node": "^0.16.6", + "@humanwhocodes/module-importer": "^1.0.1", + "@humanwhocodes/retry": "^0.4.2", + "@types/estree": "^1.0.6", + "ajv": "^6.12.4", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.6", + "debug": "^4.3.2", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^8.4.0", + "eslint-visitor-keys": "^4.2.1", + "espree": "^10.4.0", + "esquery": "^1.5.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^8.0.0", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://eslint.org/donate" + }, + "peerDependencies": { + "jiti": "*" + }, + "peerDependenciesMeta": { + "jiti": { + "optional": true + } + } + }, + "node_modules/eslint-plugin-react-hooks": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-5.2.0.tgz", + "integrity": "sha512-+f15FfK64YQwZdJNELETdn5ibXEUQmW1DZL6KXhNnc2heoy/sg9VJJeT7n8TlMWouzWqSWavFkIhHyIbIAEapg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "eslint": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 || ^9.0.0" + } + }, + "node_modules/eslint-plugin-react-refresh": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/eslint-plugin-react-refresh/-/eslint-plugin-react-refresh-0.4.24.tgz", + "integrity": "sha512-nLHIW7TEq3aLrEYWpVaJ1dRgFR+wLDPN8e8FpYAql/bMV2oBEfC37K0gLEGgv9fy66juNShSMV8OkTqzltcG/w==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "eslint": ">=8.40" + } + }, + "node_modules/eslint-scope": { + "version": "8.4.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.4.0.tgz", + "integrity": "sha512-sNXOfKCn74rt8RICKMvJS7XKV/Xk9kA7DyJr8mJik3S7Cwgy3qlkkmyS2uQB3jiJg6VNdZd/pDBJu0nvG2NlTg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz", + "integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/espree": { + "version": "10.4.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-10.4.0.tgz", + "integrity": "sha512-j6PAQ2uUr79PZhBjP5C5fhl8e39FmRnOjsD5lGnWrFU8i2G776tBK7+nP8KuQUTTyAZUwfQqXAgrVH5MbH9CYQ==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "acorn": "^8.15.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^4.2.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/esquery": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz", + "integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estree-util-is-identifier-name": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/estree-util-is-identifier-name/-/estree-util-is-identifier-name-3.0.0.tgz", + "integrity": "sha512-hFtqIDZTIUZ9BXLb8y4pYGyk6+wekIivNVTcmvk8NoOh+VeRn5y6cEHzbURrWbfp1fIqdVipilzj+lfaadNZmg==", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/event-target-shim": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/events": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", + "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", + "license": "MIT", + "engines": { + "node": ">=0.8.x" + } + }, + "node_modules/events-universal": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/events-universal/-/events-universal-1.0.1.tgz", + "integrity": "sha512-LUd5euvbMLpwOF8m6ivPCbhQeSiYVNb8Vs0fQ8QjXo0JTkEHpz8pxdQf0gStltaPpw0Cca8b39KxvK9cfKRiAw==", + "license": "Apache-2.0", + "dependencies": { + "bare-events": "^2.7.0" + } + }, + "node_modules/express": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/express/-/express-5.2.1.tgz", + "integrity": "sha512-hIS4idWWai69NezIdRt2xFVofaF4j+6INOpJlVOLDO8zXGpUVEVzIYk12UUi2JzjEzWL3IOAxcTubgz9Po0yXw==", + "license": "MIT", + "dependencies": { + "accepts": "^2.0.0", + "body-parser": "^2.2.1", + "content-disposition": "^1.0.0", + "content-type": "^1.0.5", + "cookie": "^0.7.1", + "cookie-signature": "^1.2.1", + "debug": "^4.4.0", + "depd": "^2.0.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "finalhandler": "^2.1.0", + "fresh": "^2.0.0", + "http-errors": "^2.0.0", + "merge-descriptors": "^2.0.0", + "mime-types": "^3.0.0", + "on-finished": "^2.4.1", + "once": "^1.4.0", + "parseurl": "^1.3.3", + "proxy-addr": "^2.0.7", + "qs": "^6.14.0", + "range-parser": "^1.2.1", + "router": "^2.2.0", + "send": "^1.1.0", + "serve-static": "^2.2.0", + "statuses": "^2.0.1", + "type-is": "^2.0.1", + "vary": "^1.1.2" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "license": "MIT" + }, + "node_modules/farmhash-modern": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/farmhash-modern/-/farmhash-modern-1.1.0.tgz", + "integrity": "sha512-6ypT4XfgqJk/F3Yuv4SX26I3doUjt0GTG4a+JgWxXQpxXzTBq8fPUeGHfcYMMDPHJHm3yPOSjaeBwBGAHWXCdA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "license": "MIT" + }, + "node_modules/fast-fifo": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.2.tgz", + "integrity": "sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ==", + "license": "MIT" + }, + "node_modules/fast-glob": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz", + "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.8" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/fast-glob/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-png": { + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/fast-png/-/fast-png-6.4.0.tgz", + "integrity": "sha512-kAqZq1TlgBjZcLr5mcN6NP5Rv4V2f22z00c3g8vRrwkcqjerx7BEhPbOnWCPqaHUl2XWQBJQvOT/FQhdMT7X/Q==", + "license": "MIT", + "dependencies": { + "@types/pako": "^2.0.3", + "iobuffer": "^5.3.2", + "pako": "^2.1.0" + } + }, + "node_modules/fast-xml-builder": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/fast-xml-builder/-/fast-xml-builder-1.1.3.tgz", + "integrity": "sha512-1o60KoFw2+LWKQu3IdcfcFlGTW4dpqEWmjhYec6H82AYZU2TVBXep6tMl8Z1Y+wM+ZrzCwe3BZ9Vyd9N2rIvmg==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/NaturalIntelligence" + } + ], + "license": "MIT", + "optional": true, + "dependencies": { + "path-expression-matcher": "^1.1.3" + } + }, + "node_modules/fast-xml-parser": { + "version": "5.5.5", + "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-5.5.5.tgz", + "integrity": "sha512-NLY+V5NNbdmiEszx9n14mZBseJTC50bRq1VHsaxOmR72JDuZt+5J1Co+dC/4JPnyq+WrIHNM69r0sqf7BMb3Mg==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/NaturalIntelligence" + } + ], + "license": "MIT", + "optional": true, + "dependencies": { + "fast-xml-builder": "^1.1.3", + "path-expression-matcher": "^1.1.3", + "strnum": "^2.1.2" + }, + "bin": { + "fxparser": "src/cli/cli.js" + } + }, + "node_modules/fastq": { + "version": "1.19.1", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.19.1.tgz", + "integrity": "sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/faye-websocket": { + "version": "0.11.4", + "resolved": "https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.11.4.tgz", + "integrity": "sha512-CzbClwlXAuiRQAlUyfqPgvPoNKTckTPGfwZV4ZdAhVcP2lh9KUxJg2b5GkE7XbjKQ3YJnQ9z6D9ntLAlB+tP8g==", + "license": "Apache-2.0", + "dependencies": { + "websocket-driver": ">=0.5.1" + }, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/fetch-blob": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz", + "integrity": "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/jimmywarting" + }, + { + "type": "paypal", + "url": "https://paypal.me/jimmywarting" + } + ], + "license": "MIT", + "dependencies": { + "node-domexception": "^1.0.0", + "web-streams-polyfill": "^3.0.3" + }, + "engines": { + "node": "^12.20 || >= 14.13" + } + }, + "node_modules/fflate": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/fflate/-/fflate-0.8.2.tgz", + "integrity": "sha512-cPJU47OaAoCbg0pBvzsgpTPhmhqI5eJjh/JIu8tPj5q+T7iLvW/JAYUqmE7KOB4R1ZyEhzBaIQpQpardBF5z8A==", + "license": "MIT" + }, + "node_modules/file-entry-cache": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", + "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "flat-cache": "^4.0.0" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/finalhandler": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-2.1.1.tgz", + "integrity": "sha512-S8KoZgRZN+a5rNwqTxlZZePjT/4cnm0ROV70LedRHZ0p8u9fRID0hJUZQpkKLzro8LfmC8sx23bY6tVNxv8pQA==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "on-finished": "^2.4.1", + "parseurl": "^1.3.3", + "statuses": "^2.0.1" + }, + "engines": { + "node": ">= 18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/firebase": { + "version": "12.11.0", + "resolved": "https://registry.npmjs.org/firebase/-/firebase-12.11.0.tgz", + "integrity": "sha512-W9f3Y+cgQYgF9gvCGxt0upec8zwAtiQVcHuU8MfzUIgVU/9fRQWtu48Geiv1lsigtBz9QHML++Km9xAKO5GB5Q==", + "license": "Apache-2.0", + "dependencies": { + "@firebase/ai": "2.10.0", + "@firebase/analytics": "0.10.21", + "@firebase/analytics-compat": "0.2.27", + "@firebase/app": "0.14.10", + "@firebase/app-check": "0.11.2", + "@firebase/app-check-compat": "0.4.2", + "@firebase/app-compat": "0.5.10", + "@firebase/app-types": "0.9.3", + "@firebase/auth": "1.12.2", + "@firebase/auth-compat": "0.6.4", + "@firebase/data-connect": "0.5.0", + "@firebase/database": "1.1.2", + "@firebase/database-compat": "2.1.2", + "@firebase/firestore": "4.13.0", + "@firebase/firestore-compat": "0.4.7", + "@firebase/functions": "0.13.3", + "@firebase/functions-compat": "0.4.3", + "@firebase/installations": "0.6.21", + "@firebase/installations-compat": "0.2.21", + "@firebase/messaging": "0.12.25", + "@firebase/messaging-compat": "0.2.25", + "@firebase/performance": "0.7.11", + "@firebase/performance-compat": "0.2.24", + "@firebase/remote-config": "0.8.2", + "@firebase/remote-config-compat": "0.2.23", + "@firebase/storage": "0.14.2", + "@firebase/storage-compat": "0.4.2", + "@firebase/util": "1.15.0" + } + }, + "node_modules/firebase-admin": { + "version": "13.7.0", + "resolved": "https://registry.npmjs.org/firebase-admin/-/firebase-admin-13.7.0.tgz", + "integrity": "sha512-o3qS8zCJbApe7aKzkO2Pa380t9cHISqeSd3blqYTtOuUUUua3qZTLwNWgGUOss3td6wbzrZhiHIj3c8+fC046Q==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@fastify/busboy": "^3.0.0", + "@firebase/database-compat": "^2.0.0", + "@firebase/database-types": "^1.0.6", + "farmhash-modern": "^1.1.0", + "fast-deep-equal": "^3.1.1", + "google-auth-library": "^10.6.1", + "jsonwebtoken": "^9.0.0", + "jwks-rsa": "^3.1.0", + "node-forge": "^1.3.1", + "uuid": "^11.0.2" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@google-cloud/firestore": "^7.11.0", + "@google-cloud/storage": "^7.19.0" + } + }, + "node_modules/firebase/node_modules/@firebase/auth": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@firebase/auth/-/auth-1.12.2.tgz", + "integrity": "sha512-CZJL8V10Vzibs+pDTXdQF+hot1IigIoqF4a4lA/qr5Deo1srcefiyIfgg28B67Lk7IxZhwfJMuI+1bu2xBmV0A==", + "license": "Apache-2.0", + "dependencies": { + "@firebase/component": "0.7.2", + "@firebase/logger": "0.5.0", + "@firebase/util": "1.15.0", + "tslib": "^2.1.0" + }, + "engines": { + "node": ">=20.0.0" + }, + "peerDependencies": { + "@firebase/app": "0.x", + "@react-native-async-storage/async-storage": "^2.2.0" + }, + "peerDependenciesMeta": { + "@react-native-async-storage/async-storage": { + "optional": true + } + } + }, + "node_modules/flat-cache": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz", + "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", + "dev": true, + "license": "MIT", + "dependencies": { + "flatted": "^3.2.9", + "keyv": "^4.5.4" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/flatted": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.3.tgz", + "integrity": "sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==", + "dev": true, + "license": "ISC" + }, + "node_modules/follow-redirects": { + "version": "1.15.11", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.11.tgz", + "integrity": "sha512-deG2P0JfjrTxl50XGCDyfI97ZGVCxIpfKYmfyrQ54n5FO/0gfIES8C/Psl6kWVDolizcaaxZJnTS0QSMxvnsBQ==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "license": "MIT", + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/fontkit": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/fontkit/-/fontkit-2.0.4.tgz", + "integrity": "sha512-syetQadaUEDNdxdugga9CpEYVaQIxOwk7GlwZWWZ19//qW4zE5bknOKeMBDYAASwnpaSHKJITRLMF9m1fp3s6g==", + "license": "MIT", + "dependencies": { + "@swc/helpers": "^0.5.12", + "brotli": "^1.3.2", + "clone": "^2.1.2", + "dfa": "^1.2.0", + "fast-deep-equal": "^3.1.3", + "restructure": "^3.0.0", + "tiny-inflate": "^1.0.3", + "unicode-properties": "^1.4.0", + "unicode-trie": "^2.0.0" + } + }, + "node_modules/foreground-child": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.1.tgz", + "integrity": "sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==", + "license": "ISC", + "dependencies": { + "cross-spawn": "^7.0.6", + "signal-exit": "^4.0.1" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/form-data": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.5.tgz", + "integrity": "sha512-8RipRLol37bNs2bhoV67fiTEvdTrbMUYcFTiy3+wuuOnUog2QBHCZWXDRijWQfAkhBj2Uf5UnVaiWwA5vdd82w==", + "license": "MIT", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "es-set-tostringtag": "^2.1.0", + "hasown": "^2.0.2", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/form-data/node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/form-data/node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "license": "MIT", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/formdata-polyfill": { + "version": "4.0.10", + "resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz", + "integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fetch-blob": "^3.1.2" + }, + "engines": { + "node": ">=12.20.0" + } + }, + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fraction.js": { + "version": "5.3.4", + "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-5.3.4.tgz", + "integrity": "sha512-1X1NTtiJphryn/uLQz3whtY6jK3fTqoE3ohKs0tT+Ujr1W59oopxmoEh7Lu5p6vBaPbgoM0bzveAW4Qi5RyWDQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "*" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/rawify" + } + }, + "node_modules/framer-motion": { + "version": "12.38.0", + "resolved": "https://registry.npmjs.org/framer-motion/-/framer-motion-12.38.0.tgz", + "integrity": "sha512-rFYkY/pigbcswl1XQSb7q424kSTQ8q6eAC+YUsSKooHQYuLdzdHjrt6uxUC+PRAO++q5IS7+TamgIw1AphxR+g==", + "license": "MIT", + "dependencies": { + "motion-dom": "^12.38.0", + "motion-utils": "^12.36.0", + "tslib": "^2.4.0" + }, + "peerDependencies": { + "@emotion/is-prop-valid": "*", + "react": "^18.0.0 || ^19.0.0", + "react-dom": "^18.0.0 || ^19.0.0" + }, + "peerDependenciesMeta": { + "@emotion/is-prop-valid": { + "optional": true + }, + "react": { + "optional": true + }, + "react-dom": { + "optional": true + } + } + }, + "node_modules/fresh": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-2.0.0.tgz", + "integrity": "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/functional-red-black-tree": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", + "integrity": "sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g==", + "dev": true, + "license": "MIT", + "optional": true + }, + "node_modules/gaxios": { + "version": "6.7.1", + "resolved": "https://registry.npmjs.org/gaxios/-/gaxios-6.7.1.tgz", + "integrity": "sha512-LDODD4TMYx7XXdpwxAVRAIAuB0bzv0s+ywFonY46k126qzQHT9ygyoa9tncmOiQmmDrik65UYsEkv3lbfqQ3yQ==", + "dev": true, + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "extend": "^3.0.2", + "https-proxy-agent": "^7.0.1", + "is-stream": "^2.0.0", + "node-fetch": "^2.6.9", + "uuid": "^9.0.1" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/gaxios/node_modules/uuid": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "dev": true, + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "license": "MIT", + "optional": true, + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/gcp-metadata": { + "version": "8.1.2", + "resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-8.1.2.tgz", + "integrity": "sha512-zV/5HKTfCeKWnxG0Dmrw51hEWFGfcF2xiXqcA3+J90WDuP0SvoiSO5ORvcBsifmx/FoIjgQN3oNOGaQ5PhLFkg==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "gaxios": "^7.0.0", + "google-logging-utils": "^1.0.0", + "json-bigint": "^1.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/gcp-metadata/node_modules/gaxios": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/gaxios/-/gaxios-7.1.4.tgz", + "integrity": "sha512-bTIgTsM2bWn3XklZISBTQX7ZSddGW+IO3bMdGaemHZ3tbqExMENHLx6kKZ/KlejgrMtj8q7wBItt51yegqalrA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "extend": "^3.0.2", + "https-proxy-agent": "^7.0.1", + "node-fetch": "^3.3.2" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/gcp-metadata/node_modules/node-fetch": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.2.tgz", + "integrity": "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==", + "dev": true, + "license": "MIT", + "dependencies": { + "data-uri-to-buffer": "^4.0.0", + "fetch-blob": "^3.1.4", + "formdata-polyfill": "^4.0.10" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/node-fetch" + } + }, + "node_modules/gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "license": "ISC", + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/glob": { + "version": "10.5.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.5.0.tgz", + "integrity": "sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg==", + "license": "ISC", + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^3.1.2", + "minimatch": "^9.0.4", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^1.11.1" + }, + "bin": { + "glob": "dist/esm/bin.mjs" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/glob/node_modules/brace-expansion": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/glob/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/globals": { + "version": "15.15.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-15.15.0.tgz", + "integrity": "sha512-7ACyT3wmyp3I61S4fG682L0VA2RGD9otkqGJIwNUMF1SWUombIIk+af1unuDYgMm082aHYwD+mzJvv9Iu8dsgg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/google-auth-library": { + "version": "10.6.1", + "resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-10.6.1.tgz", + "integrity": "sha512-5awwuLrzNol+pFDmKJd0dKtZ0fPLAtoA5p7YO4ODsDu6ONJUVqbYwvv8y2ZBO5MBNp9TJXigB19710kYpBPdtA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "base64-js": "^1.3.0", + "ecdsa-sig-formatter": "^1.0.11", + "gaxios": "7.1.3", + "gcp-metadata": "8.1.2", + "google-logging-utils": "1.1.3", + "jws": "^4.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/google-auth-library/node_modules/gaxios": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/gaxios/-/gaxios-7.1.3.tgz", + "integrity": "sha512-YGGyuEdVIjqxkxVH1pUTMY/XtmmsApXrCVv5EU25iX6inEPbV+VakJfLealkBtJN69AQmh1eGOdCl9Sm1UP6XQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "extend": "^3.0.2", + "https-proxy-agent": "^7.0.1", + "node-fetch": "^3.3.2", + "rimraf": "^5.0.1" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/google-auth-library/node_modules/node-fetch": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.2.tgz", + "integrity": "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==", + "dev": true, + "license": "MIT", + "dependencies": { + "data-uri-to-buffer": "^4.0.0", + "fetch-blob": "^3.1.4", + "formdata-polyfill": "^4.0.10" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/node-fetch" + } + }, + "node_modules/google-gax": { + "version": "4.6.1", + "resolved": "https://registry.npmjs.org/google-gax/-/google-gax-4.6.1.tgz", + "integrity": "sha512-V6eky/xz2mcKfAd1Ioxyd6nmA61gao3n01C+YeuIwu3vzM9EDR6wcVzMSIbLMDXWeoi9SHYctXuKYC5uJUT3eQ==", + "dev": true, + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@grpc/grpc-js": "^1.10.9", + "@grpc/proto-loader": "^0.7.13", + "@types/long": "^4.0.0", + "abort-controller": "^3.0.0", + "duplexify": "^4.0.0", + "google-auth-library": "^9.3.0", + "node-fetch": "^2.7.0", + "object-hash": "^3.0.0", + "proto3-json-serializer": "^2.0.2", + "protobufjs": "^7.3.2", + "retry-request": "^7.0.0", + "uuid": "^9.0.1" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/google-gax/node_modules/@grpc/grpc-js": { + "version": "1.14.3", + "resolved": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.14.3.tgz", + "integrity": "sha512-Iq8QQQ/7X3Sac15oB6p0FmUg/klxQvXLeileoqrTRGJYLV+/9tubbr9ipz0GKHjmXVsgFPo/+W+2cA8eNcR+XA==", + "dev": true, + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@grpc/proto-loader": "^0.8.0", + "@js-sdsl/ordered-map": "^4.4.2" + }, + "engines": { + "node": ">=12.10.0" + } + }, + "node_modules/google-gax/node_modules/@grpc/grpc-js/node_modules/@grpc/proto-loader": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.8.0.tgz", + "integrity": "sha512-rc1hOQtjIWGxcxpb9aHAfLpIctjEnsDehj0DAiVfBlmT84uvR0uUtN2hEi/ecvWVjXUGf5qPF4qEgiLOx1YIMQ==", + "dev": true, + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "lodash.camelcase": "^4.3.0", + "long": "^5.0.0", + "protobufjs": "^7.5.3", + "yargs": "^17.7.2" + }, + "bin": { + "proto-loader-gen-types": "build/bin/proto-loader-gen-types.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/google-gax/node_modules/gcp-metadata": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-6.1.1.tgz", + "integrity": "sha512-a4tiq7E0/5fTjxPAaH4jpjkSv/uCaU2p5KC6HVGrvl0cDjA8iBZv4vv1gyzlmK0ZUKqwpOyQMKzZQe3lTit77A==", + "dev": true, + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "gaxios": "^6.1.1", + "google-logging-utils": "^0.0.2", + "json-bigint": "^1.0.0" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/google-gax/node_modules/google-auth-library": { + "version": "9.15.1", + "resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-9.15.1.tgz", + "integrity": "sha512-Jb6Z0+nvECVz+2lzSMt9u98UsoakXxA2HGHMCxh+so3n90XgYWkq5dur19JAJV7ONiJY22yBTyJB1TSkvPq9Ng==", + "dev": true, + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "base64-js": "^1.3.0", + "ecdsa-sig-formatter": "^1.0.11", + "gaxios": "^6.1.1", + "gcp-metadata": "^6.1.0", + "gtoken": "^7.0.0", + "jws": "^4.0.0" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/google-gax/node_modules/google-logging-utils": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/google-logging-utils/-/google-logging-utils-0.0.2.tgz", + "integrity": "sha512-NEgUnEcBiP5HrPzufUkBzJOD/Sxsco3rLNo1F1TNf7ieU8ryUzBhqba8r756CjLX7rn3fHl6iLEwPYuqpoKgQQ==", + "dev": true, + "license": "Apache-2.0", + "optional": true, + "engines": { + "node": ">=14" + } + }, + "node_modules/google-gax/node_modules/uuid": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "dev": true, + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "license": "MIT", + "optional": true, + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/google-logging-utils": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/google-logging-utils/-/google-logging-utils-1.1.3.tgz", + "integrity": "sha512-eAmLkjDjAFCVXg7A1unxHsLf961m6y17QFqXqAXGj/gVkKFrEICfStRfwUlGNfeCEjNRa32JEWOUTlYXPyyKvA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=14" + } + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "license": "ISC" + }, + "node_modules/gtoken": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/gtoken/-/gtoken-7.1.0.tgz", + "integrity": "sha512-pCcEwRi+TKpMlxAQObHDQ56KawURgyAf6jtIY046fJ5tIv3zDe/LEIubckAO8fj6JnAxLdmWkUfNyulQ2iKdEw==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "gaxios": "^6.0.0", + "jws": "^4.0.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "license": "MIT", + "dependencies": { + "has-symbols": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/hast-util-to-jsx-runtime": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/hast-util-to-jsx-runtime/-/hast-util-to-jsx-runtime-2.3.6.tgz", + "integrity": "sha512-zl6s8LwNyo1P9uw+XJGvZtdFF1GdAkOg8ujOw+4Pyb76874fLps4ueHXDhXWdk6YHQ6OgUtinliG7RsYvCbbBg==", + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0", + "@types/hast": "^3.0.0", + "@types/unist": "^3.0.0", + "comma-separated-tokens": "^2.0.0", + "devlop": "^1.0.0", + "estree-util-is-identifier-name": "^3.0.0", + "hast-util-whitespace": "^3.0.0", + "mdast-util-mdx-expression": "^2.0.0", + "mdast-util-mdx-jsx": "^3.0.0", + "mdast-util-mdxjs-esm": "^2.0.0", + "property-information": "^7.0.0", + "space-separated-tokens": "^2.0.0", + "style-to-js": "^1.0.0", + "unist-util-position": "^5.0.0", + "vfile-message": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/hast-util-whitespace": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/hast-util-whitespace/-/hast-util-whitespace-3.0.0.tgz", + "integrity": "sha512-88JUN06ipLwsnv+dVn+OIYOvAuvBMy/Qoi6O7mQHxdPXpjy+Cd6xRkWwux7DKO+4sYILtLBRIKgsdpS2gQc7qw==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/html-entities": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/html-entities/-/html-entities-2.6.0.tgz", + "integrity": "sha512-kig+rMn/QOVRvr7c86gQ8lWXq+Hkv6CbAH1hLu+RG338StTpE8Z0b44SDVaqVu7HGKf27frdmUYEs9hTUX/cLQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/mdevils" + }, + { + "type": "patreon", + "url": "https://patreon.com/mdevils" + } + ], + "license": "MIT", + "optional": true + }, + "node_modules/html-url-attributes": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/html-url-attributes/-/html-url-attributes-3.0.1.tgz", + "integrity": "sha512-ol6UPyBWqsrO6EJySPz2O7ZSr856WDrEzM5zMqp+FJJLGMW35cLYmmZnl0vztAZxRUoNZJFTCohfjuIJ8I4QBQ==", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/html2canvas": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/html2canvas/-/html2canvas-1.4.1.tgz", + "integrity": "sha512-fPU6BHNpsyIhr8yyMpTLLxAbkaK8ArIBcmZIRiBLiDhjeqvXolaEmDGmELFuX9I4xDcaKKcJl+TKZLqruBbmWA==", + "license": "MIT", + "optional": true, + "dependencies": { + "css-line-break": "^2.1.0", + "text-segmentation": "^1.0.3" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/http-errors": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz", + "integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==", + "license": "MIT", + "dependencies": { + "depd": "~2.0.0", + "inherits": "~2.0.4", + "setprototypeof": "~1.2.0", + "statuses": "~2.0.2", + "toidentifier": "~1.0.1" + }, + "engines": { + "node": ">= 0.8" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/http-parser-js": { + "version": "0.5.10", + "resolved": "https://registry.npmjs.org/http-parser-js/-/http-parser-js-0.5.10.tgz", + "integrity": "sha512-Pysuw9XpUq5dVc/2SMHpuTY01RFl8fttgcyunjL7eEMhGM3cI4eOmiCycJDVCo/7O7ClfQD3SaI6ftDzqOXYMA==", + "license": "MIT" + }, + "node_modules/http-proxy-agent": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz", + "integrity": "sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@tootallnate/once": "2", + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/http-proxy-agent/node_modules/agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/https-proxy-agent": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz", + "integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==", + "dev": true, + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.2", + "debug": "4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/iconv-lite": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.1.tgz", + "integrity": "sha512-2Tth85cXwGFHfvRgZWszZSvdo+0Xsqmw8k8ZwxScfcBneNUraK+dxRxRm24nszx80Y0TVio8kKLt5sLE7ZCLlw==", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/idb": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/idb/-/idb-7.1.1.tgz", + "integrity": "sha512-gchesWBzyvGHRO9W8tzUWFDycow5gwjvFKfyV9FF32Y7F50yZMp7mP+T2mJIWFx49zicqyC4uefHM17o6xKIVQ==", + "license": "ISC" + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "BSD-3-Clause" + }, + "node_modules/ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/immediate": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz", + "integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==", + "license": "MIT" + }, + "node_modules/import-fresh": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz", + "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "license": "ISC" + }, + "node_modules/inline-style-parser": { + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/inline-style-parser/-/inline-style-parser-0.2.7.tgz", + "integrity": "sha512-Nb2ctOyNR8DqQoR0OwRG95uNWIC0C1lCgf5Naz5H6Ji72KZ8OcFZLz2P5sNgwlyoJ8Yif11oMuYs5pBQa86csA==", + "license": "MIT" + }, + "node_modules/iobuffer": { + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/iobuffer/-/iobuffer-5.4.0.tgz", + "integrity": "sha512-DRebOWuqDvxunfkNJAlc3IzWIPD5xVxwUNbHr7xKB8E6aLJxIPfNX3CoMJghcFjpv6RWQsrcJbghtEwSPoJqMA==", + "license": "MIT" + }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/is-alphabetical": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-2.0.1.tgz", + "integrity": "sha512-FWyyY60MeTNyeSRpkM2Iry0G9hpr7/9kD40mD/cGQEuilcZYS4okz8SN2Q6rLCJ8gbCt6fN+rC+6tMGS99LaxQ==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-alphanumerical": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-2.0.1.tgz", + "integrity": "sha512-hmbYhX/9MUMF5uh7tOXyK/n0ZvWpad5caBA17GsC6vyuCqaWliRG5K1qS9inmUhEMaOBIW7/whAnSwveW/LtZw==", + "license": "MIT", + "dependencies": { + "is-alphabetical": "^2.0.0", + "is-decimal": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "license": "MIT", + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-core-module": { + "version": "2.16.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz", + "integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==", + "dev": true, + "license": "MIT", + "dependencies": { + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-decimal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-2.0.1.tgz", + "integrity": "sha512-AAB9hiomQs5DXWcRB1rqsxGUstbRroFOPPVAomNk/3XHR5JyEZChOyTWe2oayKnsSsr/kcGqF+z6yuH6HHpN0A==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-hexadecimal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-2.0.1.tgz", + "integrity": "sha512-DgZQp241c8oO6cA1SbTEWiXeoxV42vlcJxgH+B3hi1AiqqKruZR3ZGF8In3fj4+/y/7rHvlOZLZtgJ/4ttYGZg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-plain-obj": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-4.1.0.tgz", + "integrity": "sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-promise": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz", + "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==", + "license": "MIT" + }, + "node_modules/is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", + "license": "MIT" + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "license": "ISC" + }, + "node_modules/jackspeak": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz", + "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==", + "license": "BlueOak-1.0.0", + "dependencies": { + "@isaacs/cliui": "^8.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + }, + "optionalDependencies": { + "@pkgjs/parseargs": "^0.11.0" + } + }, + "node_modules/jiti": { + "version": "1.21.7", + "resolved": "https://registry.npmjs.org/jiti/-/jiti-1.21.7.tgz", + "integrity": "sha512-/imKNG4EbWNrVjoNC/1H5/9GFy+tqjGBHCaSsN+P2RnPqjsLmv6UD3Ej+Kj8nBWaRAwyk7kK5ZUc+OEatnTR3A==", + "dev": true, + "license": "MIT", + "peer": true, + "bin": { + "jiti": "bin/jiti.js" + } + }, + "node_modules/jose": { + "version": "4.15.9", + "resolved": "https://registry.npmjs.org/jose/-/jose-4.15.9.tgz", + "integrity": "sha512-1vUQX+IdDMVPj4k8kOxgUqlcK518yluMuGZwqlr44FS1ppZB/5GWh4rZG89erpOBOJjU/OBsnCVFfapsRz6nEA==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/panva" + } + }, + "node_modules/jpeg-exif": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/jpeg-exif/-/jpeg-exif-1.1.4.tgz", + "integrity": "sha512-a+bKEcCjtuW5WTdgeXFzswSrdqi0jk4XlEtZlx5A94wCoBpFjfFTbo/Tra5SpNCl/YFZPvcV1dJc+TAYeg6ROQ==", + "license": "MIT" + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "license": "MIT" + }, + "node_modules/js-yaml": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz", + "integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==", + "dev": true, + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/jsesc": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", + "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==", + "dev": true, + "license": "MIT", + "bin": { + "jsesc": "bin/jsesc" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/json-bigint": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-bigint/-/json-bigint-1.0.0.tgz", + "integrity": "sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "bignumber.js": "^9.0.0" + } + }, + "node_modules/json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true, + "license": "MIT" + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "dev": true, + "license": "MIT", + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/jsonwebtoken": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.3.tgz", + "integrity": "sha512-MT/xP0CrubFRNLNKvxJ2BYfy53Zkm++5bX9dtuPbqAeQpTVe0MQTFhao8+Cp//EmJp244xt6Drw/GVEGCUj40g==", + "dev": true, + "license": "MIT", + "dependencies": { + "jws": "^4.0.1", + "lodash.includes": "^4.3.0", + "lodash.isboolean": "^3.0.3", + "lodash.isinteger": "^4.0.4", + "lodash.isnumber": "^3.0.3", + "lodash.isplainobject": "^4.0.6", + "lodash.isstring": "^4.0.1", + "lodash.once": "^4.0.0", + "ms": "^2.1.1", + "semver": "^7.5.4" + }, + "engines": { + "node": ">=12", + "npm": ">=6" + } + }, + "node_modules/jsonwebtoken/node_modules/semver": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz", + "integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/jspdf": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/jspdf/-/jspdf-3.0.4.tgz", + "integrity": "sha512-dc6oQ8y37rRcHn316s4ngz/nOjayLF/FFxBF4V9zamQKRqXxyiH1zagkCdktdWhtoQId5K20xt1lB90XzkB+hQ==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.28.4", + "fast-png": "^6.2.0", + "fflate": "^0.8.1" + }, + "optionalDependencies": { + "canvg": "^3.0.11", + "core-js": "^3.6.0", + "dompurify": "^3.2.4", + "html2canvas": "^1.0.0-rc.5" + } + }, + "node_modules/jszip": { + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/jszip/-/jszip-3.10.1.tgz", + "integrity": "sha512-xXDvecyTpGLrqFrvkrUSoxxfJI5AH7U8zxxtVclpsUtMCq4JQ290LY8AW5c7Ggnr/Y/oK+bQMbqK2qmtk3pN4g==", + "license": "(MIT OR GPL-3.0-or-later)", + "dependencies": { + "lie": "~3.3.0", + "pako": "~1.0.2", + "readable-stream": "~2.3.6", + "setimmediate": "^1.0.5" + } + }, + "node_modules/jszip/node_modules/pako": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", + "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==", + "license": "(MIT AND Zlib)" + }, + "node_modules/jwa": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-2.0.1.tgz", + "integrity": "sha512-hRF04fqJIP8Abbkq5NKGN0Bbr3JxlQ+qhZufXVr0DvujKy93ZCbXZMHDL4EOtodSbCWxOqR8MS1tXA5hwqCXDg==", + "dev": true, + "license": "MIT", + "dependencies": { + "buffer-equal-constant-time": "^1.0.1", + "ecdsa-sig-formatter": "1.0.11", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/jwks-rsa": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/jwks-rsa/-/jwks-rsa-3.2.2.tgz", + "integrity": "sha512-BqTyEDV+lS8F2trk3A+qJnxV5Q9EqKCBJOPti3W97r7qTympCZjb7h2X6f2kc+0K3rsSTY1/6YG2eaXKoj497w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/jsonwebtoken": "^9.0.4", + "debug": "^4.3.4", + "jose": "^4.15.4", + "limiter": "^1.1.5", + "lru-memoizer": "^2.2.0" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/jws": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/jws/-/jws-4.0.1.tgz", + "integrity": "sha512-EKI/M/yqPncGUUh44xz0PxSidXFr/+r0pA70+gIYhjv+et7yxM+s29Y+VGDkovRofQem0fs7Uvf4+YmAdyRduA==", + "dev": true, + "license": "MIT", + "dependencies": { + "jwa": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/keyv": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "dev": true, + "license": "MIT", + "dependencies": { + "json-buffer": "3.0.1" + } + }, + "node_modules/lazystream": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/lazystream/-/lazystream-1.0.1.tgz", + "integrity": "sha512-b94GiNHQNy6JNTrt5w6zNyffMrNkXZb3KTkCZJb2V1xaEGCk093vkZ2jk3tpaeP33/OiXC+WvK9AxUebnf5nbw==", + "license": "MIT", + "dependencies": { + "readable-stream": "^2.0.5" + }, + "engines": { + "node": ">= 0.6.3" + } + }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/lie": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/lie/-/lie-3.3.0.tgz", + "integrity": "sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==", + "license": "MIT", + "dependencies": { + "immediate": "~3.0.5" + } + }, + "node_modules/lilconfig": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.1.3.tgz", + "integrity": "sha512-/vlFKAoH5Cgt3Ie+JLhRbwOsCQePABiU3tJ1egGvyQ+33R/vcwM2Zl2QR/LzjsBeItPt3oSVXapn+m4nQDvpzw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/antonk52" + } + }, + "node_modules/limiter": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/limiter/-/limiter-1.1.5.tgz", + "integrity": "sha512-FWWMIEOxz3GwUI4Ts/IvgVy6LPvoMPgjMdQ185nN6psJyBJ4yOpzqm695/h5umdLJg2vW3GR5iG11MAkR2AzJA==", + "dev": true + }, + "node_modules/linebreak": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/linebreak/-/linebreak-1.1.0.tgz", + "integrity": "sha512-MHp03UImeVhB7XZtjd0E4n6+3xr5Dq/9xI/5FptGk5FrbDR3zagPa2DS6U8ks/3HjbKWG9Q1M2ufOzxV2qLYSQ==", + "license": "MIT", + "dependencies": { + "base64-js": "0.0.8", + "unicode-trie": "^2.0.0" + } + }, + "node_modules/linebreak/node_modules/base64-js": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-0.0.8.tgz", + "integrity": "sha512-3XSA2cR/h/73EzlXXdU6YNycmYI7+kicTxks4eJg2g39biHR84slg2+des+p7iHYhbRg/udIS4TD53WabcOUkw==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "dev": true, + "license": "MIT" + }, + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "license": "MIT" + }, + "node_modules/lodash.camelcase": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", + "integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==", + "license": "MIT" + }, + "node_modules/lodash.clonedeep": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", + "integrity": "sha512-H5ZhCF25riFd9uB5UCkVKo61m3S/xZk1x4wA6yp/L3RFP6Z/eHH1ymQcGLo7J3GMPfm0V/7m1tryHuGVxpqEBQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash.includes": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", + "integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash.isboolean": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz", + "integrity": "sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash.isinteger": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz", + "integrity": "sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash.isnumber": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz", + "integrity": "sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash.isplainobject": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", + "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash.isstring": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", + "integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash.once": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", + "integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==", + "dev": true, + "license": "MIT" + }, + "node_modules/long": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/long/-/long-5.3.2.tgz", + "integrity": "sha512-mNAgZ1GmyNhD7AuqnTG3/VQ26o760+ZYBPKjPvugO8+nLbYfX6TVpJPseBvopbdY+qpZ/lKUnmEc1LeZYS3QAA==", + "license": "Apache-2.0" + }, + "node_modules/longest-streak": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/longest-streak/-/longest-streak-3.1.0.tgz", + "integrity": "sha512-9Ri+o0JYgehTaVBBDoMqIl8GXtbWg711O3srftcHhZ0dqnETqLaoIK0x17fUw9rFSlK/0NlsKe0Ahhyl5pXE2g==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "license": "MIT", + "dependencies": { + "js-tokens": "^3.0.0 || ^4.0.0" + }, + "bin": { + "loose-envify": "cli.js" + } + }, + "node_modules/lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "dev": true, + "license": "ISC", + "dependencies": { + "yallist": "^3.0.2" + } + }, + "node_modules/lru-memoizer": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/lru-memoizer/-/lru-memoizer-2.3.0.tgz", + "integrity": "sha512-GXn7gyHAMhO13WSKrIiNfztwxodVsP8IoZ3XfrJV4yH2x0/OeTO/FIaAHTY5YekdGgW94njfuKmyyt1E0mR6Ug==", + "dev": true, + "license": "MIT", + "dependencies": { + "lodash.clonedeep": "^4.5.0", + "lru-cache": "6.0.0" + } + }, + "node_modules/lru-memoizer/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/lru-memoizer/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true, + "license": "ISC" + }, + "node_modules/lucide-react": { + "version": "0.344.0", + "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-0.344.0.tgz", + "integrity": "sha512-6YyBnn91GB45VuVT96bYCOKElbJzUHqp65vX8cDcu55MQL9T969v4dhGClpljamuI/+KMO9P6w9Acq1CVQGvIQ==", + "license": "ISC", + "peerDependencies": { + "react": "^16.5.1 || ^17.0.0 || ^18.0.0" + } + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/mdast-util-from-markdown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/mdast-util-from-markdown/-/mdast-util-from-markdown-2.0.2.tgz", + "integrity": "sha512-uZhTV/8NBuw0WHkPTrCqDOl0zVe1BIng5ZtHoDk49ME1qqcjYmmLmOf0gELgcRMxN4w2iuIeVso5/6QymSrgmA==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "@types/unist": "^3.0.0", + "decode-named-character-reference": "^1.0.0", + "devlop": "^1.0.0", + "mdast-util-to-string": "^4.0.0", + "micromark": "^4.0.0", + "micromark-util-decode-numeric-character-reference": "^2.0.0", + "micromark-util-decode-string": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0", + "unist-util-stringify-position": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-mdx-expression": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/mdast-util-mdx-expression/-/mdast-util-mdx-expression-2.0.1.tgz", + "integrity": "sha512-J6f+9hUp+ldTZqKRSg7Vw5V6MqjATc+3E4gf3CFNcuZNWD8XdyI6zQ8GqH7f8169MM6P7hMBRDVGnn7oHB9kXQ==", + "license": "MIT", + "dependencies": { + "@types/estree-jsx": "^1.0.0", + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-mdx-jsx": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/mdast-util-mdx-jsx/-/mdast-util-mdx-jsx-3.2.0.tgz", + "integrity": "sha512-lj/z8v0r6ZtsN/cGNNtemmmfoLAFZnjMbNyLzBafjzikOM+glrjNHPlf6lQDOTccj9n5b0PPihEBbhneMyGs1Q==", + "license": "MIT", + "dependencies": { + "@types/estree-jsx": "^1.0.0", + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "@types/unist": "^3.0.0", + "ccount": "^2.0.0", + "devlop": "^1.1.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0", + "parse-entities": "^4.0.0", + "stringify-entities": "^4.0.0", + "unist-util-stringify-position": "^4.0.0", + "vfile-message": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-mdxjs-esm": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/mdast-util-mdxjs-esm/-/mdast-util-mdxjs-esm-2.0.1.tgz", + "integrity": "sha512-EcmOpxsZ96CvlP03NghtH1EsLtr0n9Tm4lPUJUBccV9RwUOneqSycg19n5HGzCf+10LozMRSObtVr3ee1WoHtg==", + "license": "MIT", + "dependencies": { + "@types/estree-jsx": "^1.0.0", + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "mdast-util-from-markdown": "^2.0.0", + "mdast-util-to-markdown": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-phrasing": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/mdast-util-phrasing/-/mdast-util-phrasing-4.1.0.tgz", + "integrity": "sha512-TqICwyvJJpBwvGAMZjj4J2n0X8QWp21b9l0o7eXyVJ25YNWYbJDVIyD1bZXE6WtV6RmKJVYmQAKWa0zWOABz2w==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "unist-util-is": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-to-hast": { + "version": "13.2.1", + "resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-13.2.1.tgz", + "integrity": "sha512-cctsq2wp5vTsLIcaymblUriiTcZd0CwWtCbLvrOzYCDZoWyMNV8sZ7krj09FSnsiJi3WVsHLM4k6Dq/yaPyCXA==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "@ungap/structured-clone": "^1.0.0", + "devlop": "^1.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "trim-lines": "^3.0.0", + "unist-util-position": "^5.0.0", + "unist-util-visit": "^5.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-to-markdown": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/mdast-util-to-markdown/-/mdast-util-to-markdown-2.1.2.tgz", + "integrity": "sha512-xj68wMTvGXVOKonmog6LwyJKrYXZPvlwabaryTjLh9LuvovB/KAH+kvi8Gjj+7rJjsFi23nkUxRQv1KqSroMqA==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "@types/unist": "^3.0.0", + "longest-streak": "^3.0.0", + "mdast-util-phrasing": "^4.0.0", + "mdast-util-to-string": "^4.0.0", + "micromark-util-classify-character": "^2.0.0", + "micromark-util-decode-string": "^2.0.0", + "unist-util-visit": "^5.0.0", + "zwitch": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/mdast-util-to-string": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/mdast-util-to-string/-/mdast-util-to-string-4.0.0.tgz", + "integrity": "sha512-0H44vDimn51F0YwvxSJSm0eCDOJTRlmN0R1yBh4HLj9wiV1Dn0QoXGbvFAWj2hSItVTlCmBF1hqKlIyUBVFLPg==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/media-typer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-1.1.0.tgz", + "integrity": "sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/merge-descriptors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-2.0.0.tgz", + "integrity": "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/micromark": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/micromark/-/micromark-4.0.2.tgz", + "integrity": "sha512-zpe98Q6kvavpCr1NPVSCMebCKfD7CA2NqZ+rykeNhONIJBpc1tFKt9hucLGwha3jNTNI8lHpctWJWoimVF4PfA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "@types/debug": "^4.0.0", + "debug": "^4.0.0", + "decode-named-character-reference": "^1.0.0", + "devlop": "^1.0.0", + "micromark-core-commonmark": "^2.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-combine-extensions": "^2.0.0", + "micromark-util-decode-numeric-character-reference": "^2.0.0", + "micromark-util-encode": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-resolve-all": "^2.0.0", + "micromark-util-sanitize-uri": "^2.0.0", + "micromark-util-subtokenize": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-core-commonmark": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/micromark-core-commonmark/-/micromark-core-commonmark-2.0.3.tgz", + "integrity": "sha512-RDBrHEMSxVFLg6xvnXmb1Ayr2WzLAWjeSATAoxwKYJV94TeNavgoIdA0a9ytzDSVzBy2YKFK+emCPOEibLeCrg==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "decode-named-character-reference": "^1.0.0", + "devlop": "^1.0.0", + "micromark-factory-destination": "^2.0.0", + "micromark-factory-label": "^2.0.0", + "micromark-factory-space": "^2.0.0", + "micromark-factory-title": "^2.0.0", + "micromark-factory-whitespace": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-classify-character": "^2.0.0", + "micromark-util-html-tag-name": "^2.0.0", + "micromark-util-normalize-identifier": "^2.0.0", + "micromark-util-resolve-all": "^2.0.0", + "micromark-util-subtokenize": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-destination": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-destination/-/micromark-factory-destination-2.0.1.tgz", + "integrity": "sha512-Xe6rDdJlkmbFRExpTOmRj9N3MaWmbAgdpSrBQvCFqhezUn4AHqJHbaEnfbVYYiexVSs//tqOdY/DxhjdCiJnIA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-label": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-label/-/micromark-factory-label-2.0.1.tgz", + "integrity": "sha512-VFMekyQExqIW7xIChcXn4ok29YE3rnuyveW3wZQWWqF4Nv9Wk5rgJ99KzPvHjkmPXF93FXIbBp6YdW3t71/7Vg==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-space": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-space/-/micromark-factory-space-2.0.1.tgz", + "integrity": "sha512-zRkxjtBxxLd2Sc0d+fbnEunsTj46SWXgXciZmHq0kDYGnck/ZSGj9/wULTV95uoeYiK5hRXP2mJ98Uo4cq/LQg==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-title": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-title/-/micromark-factory-title-2.0.1.tgz", + "integrity": "sha512-5bZ+3CjhAd9eChYTHsjy6TGxpOFSKgKKJPJxr293jTbfry2KDoWkhBb6TcPVB4NmzaPhMs1Frm9AZH7OD4Cjzw==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-factory-whitespace": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-factory-whitespace/-/micromark-factory-whitespace-2.0.1.tgz", + "integrity": "sha512-Ob0nuZ3PKt/n0hORHyvoD9uZhr+Za8sFoP+OnMcnWK5lngSzALgQYKMr9RJVOWLqQYuyn6ulqGWSXdwf6F80lQ==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-factory-space": "^2.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-character": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/micromark-util-character/-/micromark-util-character-2.1.1.tgz", + "integrity": "sha512-wv8tdUTJ3thSFFFJKtpYKOYiGP2+v96Hvk4Tu8KpCAsTMs6yi+nVmGh1syvSCsaxz45J6Jbw+9DD6g97+NV67Q==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-chunked": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-chunked/-/micromark-util-chunked-2.0.1.tgz", + "integrity": "sha512-QUNFEOPELfmvv+4xiNg2sRYeS/P84pTW0TCgP5zc9FpXetHY0ab7SxKyAQCNCc1eK0459uoLI1y5oO5Vc1dbhA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-classify-character": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-classify-character/-/micromark-util-classify-character-2.0.1.tgz", + "integrity": "sha512-K0kHzM6afW/MbeWYWLjoHQv1sgg2Q9EccHEDzSkxiP/EaagNzCm7T/WMKZ3rjMbvIpvBiZgwR3dKMygtA4mG1Q==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-combine-extensions": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-combine-extensions/-/micromark-util-combine-extensions-2.0.1.tgz", + "integrity": "sha512-OnAnH8Ujmy59JcyZw8JSbK9cGpdVY44NKgSM7E9Eh7DiLS2E9RNQf0dONaGDzEG9yjEl5hcqeIsj4hfRkLH/Bg==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-chunked": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-decode-numeric-character-reference": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/micromark-util-decode-numeric-character-reference/-/micromark-util-decode-numeric-character-reference-2.0.2.tgz", + "integrity": "sha512-ccUbYk6CwVdkmCQMyr64dXz42EfHGkPQlBj5p7YVGzq8I7CtjXZJrubAYezf7Rp+bjPseiROqe7G6foFd+lEuw==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-decode-string": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-decode-string/-/micromark-util-decode-string-2.0.1.tgz", + "integrity": "sha512-nDV/77Fj6eH1ynwscYTOsbK7rR//Uj0bZXBwJZRfaLEJ1iGBR6kIfNmlNqaqJf649EP0F3NWNdeJi03elllNUQ==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "decode-named-character-reference": "^1.0.0", + "micromark-util-character": "^2.0.0", + "micromark-util-decode-numeric-character-reference": "^2.0.0", + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-encode": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-encode/-/micromark-util-encode-2.0.1.tgz", + "integrity": "sha512-c3cVx2y4KqUnwopcO9b/SCdo2O67LwJJ/UyqGfbigahfegL9myoEFoDYZgkT7f36T0bLrM9hZTAaAyH+PCAXjw==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, + "node_modules/micromark-util-html-tag-name": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-html-tag-name/-/micromark-util-html-tag-name-2.0.1.tgz", + "integrity": "sha512-2cNEiYDhCWKI+Gs9T0Tiysk136SnR13hhO8yW6BGNyhOC4qYFnwF1nKfD3HFAIXA5c45RrIG1ub11GiXeYd1xA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, + "node_modules/micromark-util-normalize-identifier": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-normalize-identifier/-/micromark-util-normalize-identifier-2.0.1.tgz", + "integrity": "sha512-sxPqmo70LyARJs0w2UclACPUUEqltCkJ6PhKdMIDuJ3gSf/Q+/GIe3WKl0Ijb/GyH9lOpUkRAO2wp0GVkLvS9Q==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-resolve-all": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-resolve-all/-/micromark-util-resolve-all-2.0.1.tgz", + "integrity": "sha512-VdQyxFWFT2/FGJgwQnJYbe1jjQoNTS4RjglmSjTUlpUMa95Htx9NHeYW4rGDJzbjvCsl9eLjMQwGeElsqmzcHg==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-sanitize-uri": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-sanitize-uri/-/micromark-util-sanitize-uri-2.0.1.tgz", + "integrity": "sha512-9N9IomZ/YuGGZZmQec1MbgxtlgougxTodVwDzzEouPKo3qFWvymFHWcnDi2vzV1ff6kas9ucW+o3yzJK9YB1AQ==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "micromark-util-character": "^2.0.0", + "micromark-util-encode": "^2.0.0", + "micromark-util-symbol": "^2.0.0" + } + }, + "node_modules/micromark-util-subtokenize": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/micromark-util-subtokenize/-/micromark-util-subtokenize-2.1.0.tgz", + "integrity": "sha512-XQLu552iSctvnEcgXw6+Sx75GflAPNED1qx7eBJ+wydBb2KCbRZe+NwvIEEMM83uml1+2WSXpBAcp9IUCgCYWA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT", + "dependencies": { + "devlop": "^1.0.0", + "micromark-util-chunked": "^2.0.0", + "micromark-util-symbol": "^2.0.0", + "micromark-util-types": "^2.0.0" + } + }, + "node_modules/micromark-util-symbol": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/micromark-util-symbol/-/micromark-util-symbol-2.0.1.tgz", + "integrity": "sha512-vs5t8Apaud9N28kgCrRUdEed4UJ+wWNvicHLPxCa9ENlYuAY31M0ETy5y1vA33YoNPDFTghEbnh6efaE8h4x0Q==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, + "node_modules/micromark-util-types": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/micromark-util-types/-/micromark-util-types-2.0.2.tgz", + "integrity": "sha512-Yw0ECSpJoViF1qTU4DC6NwtC4aWGt1EkzaQB8KPPyCRR8z9TWeV0HbEFGTO+ZY1wB22zmxnJqhPyTpOVCpeHTA==", + "funding": [ + { + "type": "GitHub Sponsors", + "url": "https://github.com/sponsors/unifiedjs" + }, + { + "type": "OpenCollective", + "url": "https://opencollective.com/unified" + } + ], + "license": "MIT" + }, + "node_modules/micromatch": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", + "dev": true, + "license": "MIT", + "dependencies": { + "braces": "^3.0.3", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/mime": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-3.0.0.tgz", + "integrity": "sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A==", + "dev": true, + "license": "MIT", + "optional": true, + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/mime-db": { + "version": "1.54.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz", + "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.2.tgz", + "integrity": "sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==", + "license": "MIT", + "dependencies": { + "mime-db": "^1.54.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minipass": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", + "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", + "license": "ISC", + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, + "node_modules/motion-dom": { + "version": "12.38.0", + "resolved": "https://registry.npmjs.org/motion-dom/-/motion-dom-12.38.0.tgz", + "integrity": "sha512-pdkHLD8QYRp8VfiNLb8xIBJis1byQ9gPT3Jnh2jqfFtAsWUA3dEepDlsWe/xMpO8McV+VdpKVcp+E+TGJEtOoA==", + "license": "MIT", + "dependencies": { + "motion-utils": "^12.36.0" + } + }, + "node_modules/motion-utils": { + "version": "12.36.0", + "resolved": "https://registry.npmjs.org/motion-utils/-/motion-utils-12.36.0.tgz", + "integrity": "sha512-eHWisygbiwVvf6PZ1vhaHCLamvkSbPIeAYxWUuL3a2PD/TROgE7FvfHWTIH4vMl798QLfMw15nRqIaRDXTlYRg==", + "license": "MIT" + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/mz": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz", + "integrity": "sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "any-promise": "^1.0.0", + "object-assign": "^4.0.1", + "thenify-all": "^1.0.0" + } + }, + "node_modules/nanoid": { + "version": "3.3.11", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", + "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true, + "license": "MIT" + }, + "node_modules/negotiator": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.0.0.tgz", + "integrity": "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/node-domexception": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", + "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==", + "deprecated": "Use your platform's native DOMException instead", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/jimmywarting" + }, + { + "type": "github", + "url": "https://paypal.me/jimmywarting" + } + ], + "license": "MIT", + "engines": { + "node": ">=10.5.0" + } + }, + "node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "node_modules/node-forge": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.3.tgz", + "integrity": "sha512-rLvcdSyRCyouf6jcOIPe/BgwG/d7hKjzMKOas33/pHEr6gbq18IK9zV7DiPvzsz0oBJPme6qr6H6kGZuI9/DZg==", + "dev": true, + "license": "(BSD-3-Clause OR GPL-2.0)", + "engines": { + "node": ">= 6.13.0" + } + }, + "node_modules/node-releases": { + "version": "2.0.27", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.27.tgz", + "integrity": "sha512-nmh3lCkYZ3grZvqcCH+fjmQ7X+H0OeZgP40OierEaAptX4XofMh5kwNbWh7lBduUzCcV/8kZ+NDLCwm2iorIlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/normalize-range": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/normalize-range/-/normalize-range-0.1.2.tgz", + "integrity": "sha512-bdok/XvKII3nUpklnV6P2hxtMNrCboOjAcyBuQnWEhO665FwrSNRxU+AqpsyvO6LgGYPspN+lu5CLtw4jPRKNA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-hash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/object-hash/-/object-hash-3.0.0.tgz", + "integrity": "sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/object-inspect": { + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "license": "MIT", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/optionator": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", + "dev": true, + "license": "MIT", + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.5" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/package-json-from-dist": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz", + "integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==", + "license": "BlueOak-1.0.0" + }, + "node_modules/pako": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/pako/-/pako-2.1.0.tgz", + "integrity": "sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug==", + "license": "(MIT AND Zlib)" + }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "license": "MIT", + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/parse-entities": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-4.0.2.tgz", + "integrity": "sha512-GG2AQYWoLgL877gQIKeRPGO1xF9+eG1ujIb5soS5gPvLQ1y2o8FL90w2QWNdf9I361Mpp7726c+lj3U0qK1uGw==", + "license": "MIT", + "dependencies": { + "@types/unist": "^2.0.0", + "character-entities-legacy": "^3.0.0", + "character-reference-invalid": "^2.0.0", + "decode-named-character-reference": "^1.0.0", + "is-alphanumerical": "^2.0.0", + "is-decimal": "^2.0.0", + "is-hexadecimal": "^2.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/parse-entities/node_modules/@types/unist": { + "version": "2.0.11", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.11.tgz", + "integrity": "sha512-CmBKiL6NNo/OqgmMn95Fk9Whlp2mtvIv+KNpQKN2F4SjvrEesubTRWGYSg+BnWZOnlCaSTU1sMpsBOzgbYhnsA==", + "license": "MIT" + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-expression-matcher": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/path-expression-matcher/-/path-expression-matcher-1.1.3.tgz", + "integrity": "sha512-qdVgY8KXmVdJZRSS1JdEPOKPdTiEK/pi0RkcT2sw1RhXxohdujUlJFPuS1TSkevZ9vzd3ZlL7ULl1MHGTApKzQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/NaturalIntelligence" + } + ], + "license": "MIT", + "optional": true, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true, + "license": "MIT" + }, + "node_modules/path-scurry": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz", + "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", + "license": "BlueOak-1.0.0", + "dependencies": { + "lru-cache": "^10.2.0", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" + }, + "engines": { + "node": ">=16 || 14 >=14.18" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/path-scurry/node_modules/lru-cache": { + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", + "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", + "license": "ISC" + }, + "node_modules/path-to-regexp": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.3.0.tgz", + "integrity": "sha512-7jdwVIRtsP8MYpdXSwOS0YdD0Du+qOoF/AEPIt88PcCFrZCzx41oxku1jD88hZBwbNUIEfpqvuhjFaMAqMTWnA==", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/pdfkit": { + "version": "0.17.2", + "resolved": "https://registry.npmjs.org/pdfkit/-/pdfkit-0.17.2.tgz", + "integrity": "sha512-UnwF5fXy08f0dnp4jchFYAROKMNTaPqb/xgR8GtCzIcqoTnbOqtp3bwKvO4688oHI6vzEEs8Q6vqqEnC5IUELw==", + "license": "MIT", + "dependencies": { + "crypto-js": "^4.2.0", + "fontkit": "^2.0.4", + "jpeg-exif": "^1.1.4", + "linebreak": "^1.1.0", + "png-js": "^1.0.0" + } + }, + "node_modules/performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==", + "license": "MIT", + "optional": true + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/pirates": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.7.tgz", + "integrity": "sha512-TfySrs/5nm8fQJDcBDuUng3VOUKsd7S+zqvbOTiGXHfxX4wK31ard+hoNuvkicM/2YFzlpDgABOevKSsB4G/FA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/png-js": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/png-js/-/png-js-1.0.0.tgz", + "integrity": "sha512-k+YsbhpA9e+EFfKjTCH3VW6aoKlyNYI6NYdTfDL4CIvFnvsuO84ttonmZE7rc+v23SLTH8XX+5w/Ak9v0xGY4g==" + }, + "node_modules/postcss": { + "version": "8.5.6", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.6.tgz", + "integrity": "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "peer": true, + "dependencies": { + "nanoid": "^3.3.11", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/postcss-import": { + "version": "15.1.0", + "resolved": "https://registry.npmjs.org/postcss-import/-/postcss-import-15.1.0.tgz", + "integrity": "sha512-hpr+J05B2FVYUAXHeK1YyI267J/dDDhMU6B6civm8hSY1jYJnBXxzKDKDswzJmtLHryrjhnDjqqp/49t8FALew==", + "dev": true, + "license": "MIT", + "dependencies": { + "postcss-value-parser": "^4.0.0", + "read-cache": "^1.0.0", + "resolve": "^1.1.7" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "postcss": "^8.0.0" + } + }, + "node_modules/postcss-js": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/postcss-js/-/postcss-js-4.1.0.tgz", + "integrity": "sha512-oIAOTqgIo7q2EOwbhb8UalYePMvYoIeRY2YKntdpFQXNosSu3vLrniGgmH9OKs/qAkfoj5oB3le/7mINW1LCfw==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "camelcase-css": "^2.0.1" + }, + "engines": { + "node": "^12 || ^14 || >= 16" + }, + "peerDependencies": { + "postcss": "^8.4.21" + } + }, + "node_modules/postcss-load-config": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/postcss-load-config/-/postcss-load-config-6.0.1.tgz", + "integrity": "sha512-oPtTM4oerL+UXmx+93ytZVN82RrlY/wPUV8IeDxFrzIjXOLF1pN+EmKPLbubvKHT2HC20xXsCAH2Z+CKV6Oz/g==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "lilconfig": "^3.1.1" + }, + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "jiti": ">=1.21.0", + "postcss": ">=8.0.9", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "jiti": { + "optional": true + }, + "postcss": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } + } + }, + "node_modules/postcss-nested": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/postcss-nested/-/postcss-nested-6.2.0.tgz", + "integrity": "sha512-HQbt28KulC5AJzG+cZtj9kvKB93CFCdLvog1WFLf1D+xmMvPGlBstkpTEZfK5+AN9hfJocyBFCNiqyS48bpgzQ==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "postcss-selector-parser": "^6.1.1" + }, + "engines": { + "node": ">=12.0" + }, + "peerDependencies": { + "postcss": "^8.2.14" + } + }, + "node_modules/postcss-selector-parser": { + "version": "6.1.2", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.1.2.tgz", + "integrity": "sha512-Q8qQfPiZ+THO/3ZrOrO0cJJKfpYCagtMUkXbnEfmgUjwXg6z/WBeOyS9APBBPCTSiDV+s4SwQGu8yFsiMRIudg==", + "dev": true, + "license": "MIT", + "dependencies": { + "cssesc": "^3.0.0", + "util-deprecate": "^1.0.2" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/postcss-value-parser": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz", + "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==", + "license": "MIT", + "engines": { + "node": ">= 0.6.0" + } + }, + "node_modules/process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "license": "MIT" + }, + "node_modules/property-information": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/property-information/-/property-information-7.1.0.tgz", + "integrity": "sha512-TwEZ+X+yCJmYfL7TPUOcvBZ4QfoT5YenQiJuX//0th53DE6w0xxLEtfK3iyryQFddXuvkIk51EEgrJQ0WJkOmQ==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/proto3-json-serializer": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/proto3-json-serializer/-/proto3-json-serializer-2.0.2.tgz", + "integrity": "sha512-SAzp/O4Yh02jGdRc+uIrGoe87dkN/XtwxfZ4ZyafJHymd79ozp5VG5nyZ7ygqPM5+cpLDjjGnYFUkngonyDPOQ==", + "dev": true, + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "protobufjs": "^7.2.5" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/protobufjs": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.5.4.tgz", + "integrity": "sha512-CvexbZtbov6jW2eXAvLukXjXUW1TzFaivC46BpWc/3BpcCysb5Vffu+B3XHMm8lVEuy2Mm4XGex8hBSg1yapPg==", + "hasInstallScript": true, + "license": "BSD-3-Clause", + "dependencies": { + "@protobufjs/aspromise": "^1.1.2", + "@protobufjs/base64": "^1.1.2", + "@protobufjs/codegen": "^2.0.4", + "@protobufjs/eventemitter": "^1.1.0", + "@protobufjs/fetch": "^1.1.0", + "@protobufjs/float": "^1.0.2", + "@protobufjs/inquire": "^1.1.0", + "@protobufjs/path": "^1.1.2", + "@protobufjs/pool": "^1.1.0", + "@protobufjs/utf8": "^1.1.0", + "@types/node": ">=13.7.0", + "long": "^5.0.0" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "license": "MIT", + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", + "license": "MIT" + }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/qs": { + "version": "6.14.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.14.0.tgz", + "integrity": "sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w==", + "license": "BSD-3-Clause", + "dependencies": { + "side-channel": "^1.1.0" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/raf": { + "version": "3.4.1", + "resolved": "https://registry.npmjs.org/raf/-/raf-3.4.1.tgz", + "integrity": "sha512-Sq4CW4QhwOHE8ucn6J34MqtZCeWFP2aQSmrlroYgqAV1PjStIhJXxYuTgUIfkEk7zTLjmIjLmU5q+fbD1NnOJA==", + "license": "MIT", + "optional": true, + "dependencies": { + "performance-now": "^2.1.0" + } + }, + "node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/raw-body": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-3.0.2.tgz", + "integrity": "sha512-K5zQjDllxWkf7Z5xJdV0/B0WTNqx6vxG70zJE4N0kBs4LovmEYWJzQGxC9bS9RAKu3bgM40lrd5zoLJ12MQ5BA==", + "license": "MIT", + "dependencies": { + "bytes": "~3.1.2", + "http-errors": "~2.0.1", + "iconv-lite": "~0.7.0", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/react": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz", + "integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==", + "license": "MIT", + "peer": true, + "dependencies": { + "loose-envify": "^1.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-dom": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz", + "integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==", + "license": "MIT", + "peer": true, + "dependencies": { + "loose-envify": "^1.1.0", + "scheduler": "^0.23.2" + }, + "peerDependencies": { + "react": "^18.3.1" + } + }, + "node_modules/react-markdown": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/react-markdown/-/react-markdown-10.1.0.tgz", + "integrity": "sha512-qKxVopLT/TyA6BX3Ue5NwabOsAzm0Q7kAPwq6L+wWDwisYs7R8vZ0nRXqq6rkueboxpkjvLGU9fWifiX/ZZFxQ==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "devlop": "^1.0.0", + "hast-util-to-jsx-runtime": "^2.0.0", + "html-url-attributes": "^3.0.0", + "mdast-util-to-hast": "^13.0.0", + "remark-parse": "^11.0.0", + "remark-rehype": "^11.0.0", + "unified": "^11.0.0", + "unist-util-visit": "^5.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + }, + "peerDependencies": { + "@types/react": ">=18", + "react": ">=18" + } + }, + "node_modules/react-refresh": { + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.17.0.tgz", + "integrity": "sha512-z6F7K9bV85EfseRCp2bzrpyQ0Gkw1uLoCel9XBVWPg/TjRj94SkJzUTGfOa4bs7iJvBWtQG0Wq7wnI0syw3EBQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/read-cache": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz", + "integrity": "sha512-Owdv/Ft7IjOgm/i0xvNDZ1LrRANRfew4b2prF3OWMQLxLfu3bS8FVhCsrSCMK4lR56Y9ya+AThoTpDCTxCmpRA==", + "dev": true, + "license": "MIT", + "dependencies": { + "pify": "^2.3.0" + } + }, + "node_modules/readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "license": "MIT", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/readdir-glob": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/readdir-glob/-/readdir-glob-1.1.3.tgz", + "integrity": "sha512-v05I2k7xN8zXvPD9N+z/uhXPaj0sUFCe2rcWZIpBsqxfP7xXFQ0tipAd/wjj1YxWyWtUS5IDJpOG82JKt2EAVA==", + "license": "Apache-2.0", + "dependencies": { + "minimatch": "^5.1.0" + } + }, + "node_modules/readdir-glob/node_modules/brace-expansion": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/readdir-glob/node_modules/minimatch": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/regenerator-runtime": { + "version": "0.13.11", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz", + "integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==", + "license": "MIT", + "optional": true + }, + "node_modules/remark-parse": { + "version": "11.0.0", + "resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-11.0.0.tgz", + "integrity": "sha512-FCxlKLNGknS5ba/1lmpYijMUzX2esxW5xQqjWxw2eHFfS2MSdaHVINFmhjo+qN1WhZhNimq0dZATN9pH0IDrpA==", + "license": "MIT", + "dependencies": { + "@types/mdast": "^4.0.0", + "mdast-util-from-markdown": "^2.0.0", + "micromark-util-types": "^2.0.0", + "unified": "^11.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/remark-rehype": { + "version": "11.1.2", + "resolved": "https://registry.npmjs.org/remark-rehype/-/remark-rehype-11.1.2.tgz", + "integrity": "sha512-Dh7l57ianaEoIpzbp0PC9UKAdCSVklD8E5Rpw7ETfbTl3FqcOOgq5q2LVDhgGCkaBv7p24JXikPdvhhmHvKMsw==", + "license": "MIT", + "dependencies": { + "@types/hast": "^3.0.0", + "@types/mdast": "^4.0.0", + "mdast-util-to-hast": "^13.0.0", + "unified": "^11.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/resolve": { + "version": "1.22.11", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.11.tgz", + "integrity": "sha512-RfqAvLnMl313r7c9oclB1HhUEAezcpLjz95wFH4LVuhk9JF/r22qmVP9AMmOU4vMX7Q8pN8jwNg/CSpdFnMjTQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-core-module": "^2.16.1", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/restructure": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/restructure/-/restructure-3.0.2.tgz", + "integrity": "sha512-gSfoiOEA0VPE6Tukkrr7I0RBdE0s7H1eFCDBk05l1KIQT1UIKNc5JZy6jdyW6eYH3aR3g5b3PuL77rq0hvwtAw==", + "license": "MIT" + }, + "node_modules/retry": { + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.13.1.tgz", + "integrity": "sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==", + "dev": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/retry-request": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/retry-request/-/retry-request-7.0.2.tgz", + "integrity": "sha512-dUOvLMJ0/JJYEn8NrpOaGNE7X3vpI5XlZS/u0ANjqtcZVKnIxP7IgCFwrKTxENw29emmwug53awKtaMm4i9g5w==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@types/request": "^2.48.8", + "extend": "^3.0.2", + "teeny-request": "^9.0.0" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/reusify": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz", + "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==", + "dev": true, + "license": "MIT", + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/rgbcolor": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/rgbcolor/-/rgbcolor-1.0.1.tgz", + "integrity": "sha512-9aZLIrhRaD97sgVhtJOW6ckOEh6/GnvQtdVNfdZ6s67+3/XwLS9lBcQYzEEhYVeUowN7pRzMLsyGhK2i/xvWbw==", + "license": "MIT OR SEE LICENSE IN FEEL-FREE.md", + "optional": true, + "engines": { + "node": ">= 0.8.15" + } + }, + "node_modules/rimraf": { + "version": "5.0.10", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-5.0.10.tgz", + "integrity": "sha512-l0OE8wL34P4nJH/H2ffoaniAokM2qSmrtXHmlpvYr5AVVX8msAyW0l8NVJFDxlSK4u3Uh/f41cQheDVdnYijwQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "glob": "^10.3.7" + }, + "bin": { + "rimraf": "dist/esm/bin.mjs" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/rollup": { + "version": "4.53.3", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.53.3.tgz", + "integrity": "sha512-w8GmOxZfBmKknvdXU1sdM9NHcoQejwF/4mNgj2JuEEdRaHwwF12K7e9eXn1nLZ07ad+du76mkVsyeb2rKGllsA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "1.0.8" + }, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@rollup/rollup-android-arm-eabi": "4.53.3", + "@rollup/rollup-android-arm64": "4.53.3", + "@rollup/rollup-darwin-arm64": "4.53.3", + "@rollup/rollup-darwin-x64": "4.53.3", + "@rollup/rollup-freebsd-arm64": "4.53.3", + "@rollup/rollup-freebsd-x64": "4.53.3", + "@rollup/rollup-linux-arm-gnueabihf": "4.53.3", + "@rollup/rollup-linux-arm-musleabihf": "4.53.3", + "@rollup/rollup-linux-arm64-gnu": "4.53.3", + "@rollup/rollup-linux-arm64-musl": "4.53.3", + "@rollup/rollup-linux-loong64-gnu": "4.53.3", + "@rollup/rollup-linux-ppc64-gnu": "4.53.3", + "@rollup/rollup-linux-riscv64-gnu": "4.53.3", + "@rollup/rollup-linux-riscv64-musl": "4.53.3", + "@rollup/rollup-linux-s390x-gnu": "4.53.3", + "@rollup/rollup-linux-x64-gnu": "4.53.3", + "@rollup/rollup-linux-x64-musl": "4.53.3", + "@rollup/rollup-openharmony-arm64": "4.53.3", + "@rollup/rollup-win32-arm64-msvc": "4.53.3", + "@rollup/rollup-win32-ia32-msvc": "4.53.3", + "@rollup/rollup-win32-x64-gnu": "4.53.3", + "@rollup/rollup-win32-x64-msvc": "4.53.3", + "fsevents": "~2.3.2" + } + }, + "node_modules/router": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz", + "integrity": "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.0", + "depd": "^2.0.0", + "is-promise": "^4.0.0", + "parseurl": "^1.3.3", + "path-to-regexp": "^8.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, + "node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "license": "MIT" + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "license": "MIT" + }, + "node_modules/scheduler": { + "version": "0.23.2", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.2.tgz", + "integrity": "sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==", + "license": "MIT", + "dependencies": { + "loose-envify": "^1.1.0" + } + }, + "node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/send": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/send/-/send-1.2.1.tgz", + "integrity": "sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.3", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "fresh": "^2.0.0", + "http-errors": "^2.0.1", + "mime-types": "^3.0.2", + "ms": "^2.1.3", + "on-finished": "^2.4.1", + "range-parser": "^1.2.1", + "statuses": "^2.0.2" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/serve-static": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-2.2.1.tgz", + "integrity": "sha512-xRXBn0pPqQTVQiC8wyQrKs2MOlX24zQ0POGaj0kultvoOCstBQM5yvOhAVSUwOMjQtTvsPWoNCHfPGwaaQJhTw==", + "license": "MIT", + "dependencies": { + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "parseurl": "^1.3.3", + "send": "^1.2.0" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/setimmediate": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", + "integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==", + "license": "MIT" + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", + "license": "ISC" + }, + "node_modules/sharp": { + "version": "0.34.5", + "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.34.5.tgz", + "integrity": "sha512-Ou9I5Ft9WNcCbXrU9cMgPBcCK8LiwLqcbywW3t4oDV37n1pzpuNLsYiAV8eODnjbtQlSDwZ2cUEeQz4E54Hltg==", + "hasInstallScript": true, + "license": "Apache-2.0", + "dependencies": { + "@img/colour": "^1.0.0", + "detect-libc": "^2.1.2", + "semver": "^7.7.3" + }, + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-darwin-arm64": "0.34.5", + "@img/sharp-darwin-x64": "0.34.5", + "@img/sharp-libvips-darwin-arm64": "1.2.4", + "@img/sharp-libvips-darwin-x64": "1.2.4", + "@img/sharp-libvips-linux-arm": "1.2.4", + "@img/sharp-libvips-linux-arm64": "1.2.4", + "@img/sharp-libvips-linux-ppc64": "1.2.4", + "@img/sharp-libvips-linux-riscv64": "1.2.4", + "@img/sharp-libvips-linux-s390x": "1.2.4", + "@img/sharp-libvips-linux-x64": "1.2.4", + "@img/sharp-libvips-linuxmusl-arm64": "1.2.4", + "@img/sharp-libvips-linuxmusl-x64": "1.2.4", + "@img/sharp-linux-arm": "0.34.5", + "@img/sharp-linux-arm64": "0.34.5", + "@img/sharp-linux-ppc64": "0.34.5", + "@img/sharp-linux-riscv64": "0.34.5", + "@img/sharp-linux-s390x": "0.34.5", + "@img/sharp-linux-x64": "0.34.5", + "@img/sharp-linuxmusl-arm64": "0.34.5", + "@img/sharp-linuxmusl-x64": "0.34.5", + "@img/sharp-wasm32": "0.34.5", + "@img/sharp-win32-arm64": "0.34.5", + "@img/sharp-win32-ia32": "0.34.5", + "@img/sharp-win32-x64": "0.34.5" + } + }, + "node_modules/sharp/node_modules/semver": { + "version": "7.7.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.3.tgz", + "integrity": "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/side-channel": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", + "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3", + "side-channel-list": "^1.0.0", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-list": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz", + "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "license": "ISC", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/sonner": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/sonner/-/sonner-2.0.7.tgz", + "integrity": "sha512-W6ZN4p58k8aDKA4XPcx2hpIQXBRAgyiWVkYhT7CvK6D3iAu7xjvVyhQHg2/iaKJZ1XVJ4r7XuwGL+WGEK37i9w==", + "license": "MIT", + "peerDependencies": { + "react": "^18.0.0 || ^19.0.0 || ^19.0.0-rc", + "react-dom": "^18.0.0 || ^19.0.0 || ^19.0.0-rc" + } + }, + "node_modules/source-map-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/space-separated-tokens": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-2.0.2.tgz", + "integrity": "sha512-PEGlAwrG8yXGXRjW32fGbg66JAlOAwbObuqVoJpv/mRgoWDQfgH1wDPvtzWyUSNAXBGSk8h755YDbbcEy3SH2Q==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/stackblur-canvas": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/stackblur-canvas/-/stackblur-canvas-2.7.0.tgz", + "integrity": "sha512-yf7OENo23AGJhBriGx0QivY5JP6Y1HbrrDI6WLt6C5auYZXlQrheoY8hD4ibekFKz1HOfE48Ww8kMWMnJD/zcQ==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=0.1.14" + } + }, + "node_modules/statuses": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz", + "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/stream-events": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/stream-events/-/stream-events-1.0.5.tgz", + "integrity": "sha512-E1GUzBSgvct8Jsb3v2X15pjzN1tYebtbLaMg+eBOUOAxgbLoSbT2NS91ckc5lJD1KfLjId+jXJRgo0qnV5Nerg==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "stubs": "^3.0.0" + } + }, + "node_modules/stream-shift": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.3.tgz", + "integrity": "sha512-76ORR0DO1o1hlKwTbi/DM3EXWGf3ZJYO8cXX5RJwnul2DEg2oyoZyjLNoQM8WsvZiFKCRfC1O0J7iCvie3RZmQ==", + "dev": true, + "license": "MIT", + "optional": true + }, + "node_modules/streamx": { + "version": "2.23.0", + "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.23.0.tgz", + "integrity": "sha512-kn+e44esVfn2Fa/O0CPFcex27fjIL6MkVae0Mm6q+E6f0hWv578YCERbv+4m02cjxvDsPKLnmxral/rR6lBMAg==", + "license": "MIT", + "dependencies": { + "events-universal": "^1.0.0", + "fast-fifo": "^1.3.2", + "text-decoder": "^1.1.0" + } + }, + "node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/string-width-cjs": { + "name": "string-width", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/stringify-entities": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-4.0.4.tgz", + "integrity": "sha512-IwfBptatlO+QCJUo19AqvrPNqlVMpW9YEL2LIVY+Rpv2qsjCGxaDLNRgeGsQWJhfItebuJhsGSLjaBbNSQ+ieg==", + "license": "MIT", + "dependencies": { + "character-entities-html4": "^2.0.0", + "character-entities-legacy": "^3.0.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi-cjs": { + "name": "strip-ansi", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/strnum": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/strnum/-/strnum-2.2.0.tgz", + "integrity": "sha512-Y7Bj8XyJxnPAORMZj/xltsfo55uOiyHcU2tnAVzHUnSJR/KsEX+9RoDeXEnsXtl/CX4fAcrt64gZ13aGaWPeBg==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/NaturalIntelligence" + } + ], + "license": "MIT", + "optional": true + }, + "node_modules/stubs": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/stubs/-/stubs-3.0.0.tgz", + "integrity": "sha512-PdHt7hHUJKxvTCgbKX9C1V/ftOcjJQgz8BZwNfV5c4B6dcGqlpelTbJ999jBGZ2jYiPAwcX5dP6oBwVlBlUbxw==", + "dev": true, + "license": "MIT", + "optional": true + }, + "node_modules/style-to-js": { + "version": "1.1.21", + "resolved": "https://registry.npmjs.org/style-to-js/-/style-to-js-1.1.21.tgz", + "integrity": "sha512-RjQetxJrrUJLQPHbLku6U/ocGtzyjbJMP9lCNK7Ag0CNh690nSH8woqWH9u16nMjYBAok+i7JO1NP2pOy8IsPQ==", + "license": "MIT", + "dependencies": { + "style-to-object": "1.0.14" + } + }, + "node_modules/style-to-object": { + "version": "1.0.14", + "resolved": "https://registry.npmjs.org/style-to-object/-/style-to-object-1.0.14.tgz", + "integrity": "sha512-LIN7rULI0jBscWQYaSswptyderlarFkjQ+t79nzty8tcIAceVomEVlLzH5VP4Cmsv6MtKhs7qaAiwlcp+Mgaxw==", + "license": "MIT", + "dependencies": { + "inline-style-parser": "0.2.7" + } + }, + "node_modules/sucrase": { + "version": "3.35.1", + "resolved": "https://registry.npmjs.org/sucrase/-/sucrase-3.35.1.tgz", + "integrity": "sha512-DhuTmvZWux4H1UOnWMB3sk0sbaCVOoQZjv8u1rDoTV0HTdGem9hkAZtl4JZy8P2z4Bg0nT+YMeOFyVr4zcG5Tw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.2", + "commander": "^4.0.0", + "lines-and-columns": "^1.1.6", + "mz": "^2.7.0", + "pirates": "^4.0.1", + "tinyglobby": "^0.2.11", + "ts-interface-checker": "^0.1.9" + }, + "bin": { + "sucrase": "bin/sucrase", + "sucrase-node": "bin/sucrase-node" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/svg-pathdata": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/svg-pathdata/-/svg-pathdata-6.0.3.tgz", + "integrity": "sha512-qsjeeq5YjBZ5eMdFuUa4ZosMLxgr5RZ+F+Y1OrDhuOCEInRMA3x74XdBtggJcj9kOeInz0WE+LgCPDkZFlBYJw==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/swiper": { + "version": "12.1.3", + "resolved": "https://registry.npmjs.org/swiper/-/swiper-12.1.3.tgz", + "integrity": "sha512-XcWlVmkHFICI4fuoJKgbp8PscDcS4i7pBH8nwJRBi3dpQvhCySwsWRYm4bOf/BzKVWkHOYaFw7qz9uBSrY3oug==", + "funding": [ + { + "type": "patreon", + "url": "https://www.patreon.com/swiperjs" + }, + { + "type": "open_collective", + "url": "http://opencollective.com/swiper" + } + ], + "license": "MIT", + "engines": { + "node": ">= 4.7.0" + } + }, + "node_modules/tailwindcss": { + "version": "3.4.19", + "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.19.tgz", + "integrity": "sha512-3ofp+LL8E+pK/JuPLPggVAIaEuhvIz4qNcf3nA1Xn2o/7fb7s/TYpHhwGDv1ZU3PkBluUVaF8PyCHcm48cKLWQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@alloc/quick-lru": "^5.2.0", + "arg": "^5.0.2", + "chokidar": "^3.6.0", + "didyoumean": "^1.2.2", + "dlv": "^1.1.3", + "fast-glob": "^3.3.2", + "glob-parent": "^6.0.2", + "is-glob": "^4.0.3", + "jiti": "^1.21.7", + "lilconfig": "^3.1.3", + "micromatch": "^4.0.8", + "normalize-path": "^3.0.0", + "object-hash": "^3.0.0", + "picocolors": "^1.1.1", + "postcss": "^8.4.47", + "postcss-import": "^15.1.0", + "postcss-js": "^4.0.1", + "postcss-load-config": "^4.0.2 || ^5.0 || ^6.0", + "postcss-nested": "^6.2.0", + "postcss-selector-parser": "^6.1.2", + "resolve": "^1.22.8", + "sucrase": "^3.35.0" + }, + "bin": { + "tailwind": "lib/cli.js", + "tailwindcss": "lib/cli.js" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/tar-stream": { + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-3.1.7.tgz", + "integrity": "sha512-qJj60CXt7IU1Ffyc3NJMjh6EkuCFej46zUqJ4J7pqYlThyd9bO0XBTmcOIhSzZJVWfsLks0+nle/j538YAW9RQ==", + "license": "MIT", + "dependencies": { + "b4a": "^1.6.4", + "fast-fifo": "^1.2.0", + "streamx": "^2.15.0" + } + }, + "node_modules/tar-stream/node_modules/b4a": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/b4a/-/b4a-1.7.3.tgz", + "integrity": "sha512-5Q2mfq2WfGuFp3uS//0s6baOJLMoVduPYVeNmDYxu5OUA1/cBfvr2RIS7vi62LdNj/urk1hfmj867I3qt6uZ7Q==", + "license": "Apache-2.0", + "peerDependencies": { + "react-native-b4a": "*" + }, + "peerDependenciesMeta": { + "react-native-b4a": { + "optional": true + } + } + }, + "node_modules/teeny-request": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/teeny-request/-/teeny-request-9.0.0.tgz", + "integrity": "sha512-resvxdc6Mgb7YEThw6G6bExlXKkv6+YbuzGg9xuXxSgxJF7Ozs+o8Y9+2R3sArdWdW8nOokoQb1yrpFB0pQK2g==", + "dev": true, + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "http-proxy-agent": "^5.0.0", + "https-proxy-agent": "^5.0.0", + "node-fetch": "^2.6.9", + "stream-events": "^1.0.5", + "uuid": "^9.0.0" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/teeny-request/node_modules/agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/teeny-request/node_modules/https-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/teeny-request/node_modules/uuid": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "dev": true, + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "license": "MIT", + "optional": true, + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/text-decoder": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/text-decoder/-/text-decoder-1.2.3.tgz", + "integrity": "sha512-3/o9z3X0X0fTupwsYvR03pJ/DjWuqqrfwBgTQzdWDiQSm9KitAyz/9WqsT2JQW7KV2m+bC2ol/zqpW37NHxLaA==", + "license": "Apache-2.0", + "dependencies": { + "b4a": "^1.6.4" + } + }, + "node_modules/text-decoder/node_modules/b4a": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/b4a/-/b4a-1.7.3.tgz", + "integrity": "sha512-5Q2mfq2WfGuFp3uS//0s6baOJLMoVduPYVeNmDYxu5OUA1/cBfvr2RIS7vi62LdNj/urk1hfmj867I3qt6uZ7Q==", + "license": "Apache-2.0", + "peerDependencies": { + "react-native-b4a": "*" + }, + "peerDependenciesMeta": { + "react-native-b4a": { + "optional": true + } + } + }, + "node_modules/text-segmentation": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/text-segmentation/-/text-segmentation-1.0.3.tgz", + "integrity": "sha512-iOiPUo/BGnZ6+54OsWxZidGCsdU8YbE4PSpdPinp7DeMtUJNJBoJ/ouUSTJjHkh1KntHaltHl/gDs2FC4i5+Nw==", + "license": "MIT", + "optional": true, + "dependencies": { + "utrie": "^1.0.2" + } + }, + "node_modules/thenify": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz", + "integrity": "sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==", + "dev": true, + "license": "MIT", + "dependencies": { + "any-promise": "^1.0.0" + } + }, + "node_modules/thenify-all": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/thenify-all/-/thenify-all-1.6.0.tgz", + "integrity": "sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==", + "dev": true, + "license": "MIT", + "dependencies": { + "thenify": ">= 3.1.0 < 4" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/tiny-inflate": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/tiny-inflate/-/tiny-inflate-1.0.3.tgz", + "integrity": "sha512-pkY1fj1cKHb2seWDy0B16HeWyczlJA9/WW3u3c4z/NiWDsO3DOU5D7nhTLE9CF0yXv/QZFY7sEJmj24dK+Rrqw==", + "license": "MIT" + }, + "node_modules/tinyglobby": { + "version": "0.2.15", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz", + "integrity": "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.3" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/tinyglobby/node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/tinyglobby/node_modules/picomatch": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", + "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "license": "MIT", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", + "dev": true, + "license": "MIT", + "optional": true + }, + "node_modules/trim-lines": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/trim-lines/-/trim-lines-3.0.1.tgz", + "integrity": "sha512-kRj8B+YHZCc9kQYdWfJB2/oUl9rA99qbowYYBtr4ui4mZyAQ2JpvVBd/6U2YloATfqBhBTSMhTpgBHtU0Mf3Rg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/trough": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/trough/-/trough-2.2.0.tgz", + "integrity": "sha512-tmMpK00BjZiUyVyvrBK7knerNgmgvcV/KLVyuma/SC+TQN167GrMRciANTz09+k3zW8L8t60jWO1GpfkZdjTaw==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, + "node_modules/ts-api-utils": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.1.0.tgz", + "integrity": "sha512-CUgTZL1irw8u29bzrOD/nH85jqyc74D6SshFgujOIA7osm2Rz7dYH77agkx7H4FBNxDq7Cjf+IjaX/8zwFW+ZQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18.12" + }, + "peerDependencies": { + "typescript": ">=4.8.4" + } + }, + "node_modules/ts-interface-checker": { + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz", + "integrity": "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==", + "dev": true, + "license": "Apache-2.0" + }, + "node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "license": "0BSD" + }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/type-is": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-2.0.1.tgz", + "integrity": "sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw==", + "license": "MIT", + "dependencies": { + "content-type": "^1.0.5", + "media-typer": "^1.1.0", + "mime-types": "^3.0.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/typescript": { + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "dev": true, + "license": "Apache-2.0", + "peer": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/typescript-eslint": { + "version": "8.49.0", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.49.0.tgz", + "integrity": "sha512-zRSVH1WXD0uXczCXw+nsdjGPUdx4dfrs5VQoHnUWmv1U3oNlAKv4FUNdLDhVUg+gYn+a5hUESqch//Rv5wVhrg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/eslint-plugin": "8.49.0", + "@typescript-eslint/parser": "8.49.0", + "@typescript-eslint/typescript-estree": "8.49.0", + "@typescript-eslint/utils": "8.49.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/undici-types": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz", + "integrity": "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==", + "license": "MIT" + }, + "node_modules/unicode-properties": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/unicode-properties/-/unicode-properties-1.4.1.tgz", + "integrity": "sha512-CLjCCLQ6UuMxWnbIylkisbRj31qxHPAurvena/0iwSVbQ2G1VY5/HjV0IRabOEbDHlzZlRdCrD4NhB0JtU40Pg==", + "license": "MIT", + "dependencies": { + "base64-js": "^1.3.0", + "unicode-trie": "^2.0.0" + } + }, + "node_modules/unicode-trie": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unicode-trie/-/unicode-trie-2.0.0.tgz", + "integrity": "sha512-x7bc76x0bm4prf1VLg79uhAzKw8DVboClSN5VxJuQ+LKDOVEW9CdH+VY7SP+vX7xCYQqzzgQpFqz15zeLvAtZQ==", + "license": "MIT", + "dependencies": { + "pako": "^0.2.5", + "tiny-inflate": "^1.0.0" + } + }, + "node_modules/unicode-trie/node_modules/pako": { + "version": "0.2.9", + "resolved": "https://registry.npmjs.org/pako/-/pako-0.2.9.tgz", + "integrity": "sha512-NUcwaKxUxWrZLpDG+z/xZaCgQITkA/Dv4V/T6bw7VON6l1Xz/VnrBqrYjZQ12TamKHzITTfOEIYUj48y2KXImA==", + "license": "MIT" + }, + "node_modules/unified": { + "version": "11.0.5", + "resolved": "https://registry.npmjs.org/unified/-/unified-11.0.5.tgz", + "integrity": "sha512-xKvGhPWw3k84Qjh8bI3ZeJjqnyadK+GEFtazSfZv/rKeTkTjOJho6mFqh2SM96iIcZokxiOpg78GazTSg8+KHA==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "bail": "^2.0.0", + "devlop": "^1.0.0", + "extend": "^3.0.0", + "is-plain-obj": "^4.0.0", + "trough": "^2.0.0", + "vfile": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-is": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-6.0.1.tgz", + "integrity": "sha512-LsiILbtBETkDz8I9p1dQ0uyRUWuaQzd/cuEeS1hoRSyW5E5XGmTzlwY1OrNzzakGowI9Dr/I8HVaw4hTtnxy8g==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-position": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-5.0.0.tgz", + "integrity": "sha512-fucsC7HjXvkB5R3kTCO7kUjRdrS0BJt3M/FPxmHMBOm8JQi2BsHAHFsy27E0EolP8rp0NzXsJ+jNPyDWvOJZPA==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-stringify-position": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-4.0.0.tgz", + "integrity": "sha512-0ASV06AAoKCDkS2+xw5RXJywruurpbC4JZSm7nr7MOt1ojAzvyyaO+UxZf18j8FCF6kmzCZKcAgN/yu2gm2XgQ==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-visit": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-5.0.0.tgz", + "integrity": "sha512-MR04uvD+07cwl/yhVuVWAtw+3GOR/knlL55Nd/wAdblk27GCVt3lqpTivy/tkJcZoNPzTwS1Y+KMojlLDhoTzg==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-is": "^6.0.0", + "unist-util-visit-parents": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unist-util-visit-parents": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-6.0.2.tgz", + "integrity": "sha512-goh1s1TBrqSqukSc8wrjwWhL0hiJxgA8m4kFxGlQ+8FYQ3C/m11FcTs4YYem7V664AhHVvgoQLk890Ssdsr2IQ==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-is": "^6.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/update-browserslist-db": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.2.tgz", + "integrity": "sha512-E85pfNzMQ9jpKkA7+TJAi4TJN+tBCuWh5rUcS/sv6cFi+1q9LYDwDI5dpUL0u/73EElyQ8d3TEaeW4sPedBqYA==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "escalade": "^3.2.0", + "picocolors": "^1.1.1" + }, + "bin": { + "update-browserslist-db": "cli.js" + }, + "peerDependencies": { + "browserslist": ">= 4.21.0" + } + }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "license": "MIT" + }, + "node_modules/utrie": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/utrie/-/utrie-1.0.2.tgz", + "integrity": "sha512-1MLa5ouZiOmQzUbjbu9VmjLzn1QLXBhwpUa7kdLUQK+KQ5KA9I1vk5U4YHe/X2Ch7PYnJfWuWT+VbuxbGwljhw==", + "license": "MIT", + "optional": true, + "dependencies": { + "base64-arraybuffer": "^1.0.2" + } + }, + "node_modules/uuid": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-11.1.0.tgz", + "integrity": "sha512-0/A9rDy9P7cJ+8w1c9WD9V//9Wj15Ce2MPz8Ri6032usz+NfePxx5AcN3bN+r6ZL6jEo066/yNYB3tn4pQEx+A==", + "dev": true, + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "license": "MIT", + "bin": { + "uuid": "dist/esm/bin/uuid" + } + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/vfile": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/vfile/-/vfile-6.0.3.tgz", + "integrity": "sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "vfile-message": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/vfile-message": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-4.0.3.tgz", + "integrity": "sha512-QTHzsGd1EhbZs4AsQ20JX1rC3cOlt/IWJruk893DfLRr57lcnOeMaWG4K0JrRta4mIJZKth2Au3mM3u03/JWKw==", + "license": "MIT", + "dependencies": { + "@types/unist": "^3.0.0", + "unist-util-stringify-position": "^4.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, + "node_modules/vite": { + "version": "5.4.21", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.21.tgz", + "integrity": "sha512-o5a9xKjbtuhY6Bi5S3+HvbRERmouabWbyUcpXXUA1u+GNUKoROi9byOJ8M0nHbHYHkYICiMlqxkg1KkYmm25Sw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "esbuild": "^0.21.3", + "postcss": "^8.4.43", + "rollup": "^4.20.0" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^18.0.0 || >=20.0.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^18.0.0 || >=20.0.0", + "less": "*", + "lightningcss": "^1.21.0", + "sass": "*", + "sass-embedded": "*", + "stylus": "*", + "sugarss": "*", + "terser": "^5.4.0" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "less": { + "optional": true + }, + "lightningcss": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + } + } + }, + "node_modules/web-streams-polyfill": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz", + "integrity": "sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/web-vitals": { + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/web-vitals/-/web-vitals-4.2.4.tgz", + "integrity": "sha512-r4DIlprAGwJ7YM11VZp4R884m0Vmgr6EAKe3P+kO0PPj3Unqyvv59rczf6UiGcb9Z8QxZVcqKNwv/g0WNdWwsw==", + "license": "Apache-2.0" + }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", + "dev": true, + "license": "BSD-2-Clause", + "optional": true + }, + "node_modules/websocket-driver": { + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/websocket-driver/-/websocket-driver-0.7.4.tgz", + "integrity": "sha512-b17KeDIQVjvb0ssuSDF2cYXSg2iztliJ4B9WdsuB6J952qCPKmnVq4DyW5motImXHDC1cBT/1UezrJVsKw5zjg==", + "license": "Apache-2.0", + "dependencies": { + "http-parser-js": ">=0.5.1", + "safe-buffer": ">=5.1.0", + "websocket-extensions": ">=0.1.1" + }, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/websocket-extensions": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/websocket-extensions/-/websocket-extensions-0.1.4.tgz", + "integrity": "sha512-OqedPIGOfsDlo31UNwYbCFMSaO9m9G/0faIHj5/dZFDMFqPTcx6UwqyOy3COEaEOg/9VsGIpdqn62W5KhoKSpg==", + "license": "Apache-2.0", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/word-wrap": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs": { + "name": "wrap-ansi", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "license": "ISC" + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true, + "license": "ISC" + }, + "node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "license": "MIT", + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/zip-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/zip-stream/-/zip-stream-6.0.1.tgz", + "integrity": "sha512-zK7YHHz4ZXpW89AHXUPbQVGKI7uvkd3hzusTdotCg1UxyaVtg0zFJSTfW/Dq5f7OBBVnq6cZIaC8Ti4hb6dtCA==", + "license": "MIT", + "dependencies": { + "archiver-utils": "^5.0.0", + "compress-commons": "^6.0.2", + "readable-stream": "^4.0.0" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/zip-stream/node_modules/readable-stream": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.7.0.tgz", + "integrity": "sha512-oIGGmcpTLwPga8Bn6/Z75SVaH1z5dUut2ibSyAMVhmUggWpmDn2dapB0n7f8nwaSiRtepAsfJyfXIO5DCVAODg==", + "license": "MIT", + "dependencies": { + "abort-controller": "^3.0.0", + "buffer": "^6.0.3", + "events": "^3.3.0", + "process": "^0.11.10", + "string_decoder": "^1.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/zip-stream/node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/zip-stream/node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/zwitch": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/zwitch/-/zwitch-2.0.4.tgz", + "integrity": "sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000000000000000000000000000000000000..bce603b3a47f8bc8b2486aa53cd90b6512ea553e --- /dev/null +++ b/package.json @@ -0,0 +1,51 @@ +{ + "name": "vite-react-typescript-starter", + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "start": "node server.js", + "server": "node server.js", + "dev": "vite", + "build": "vite build", + "lint": "eslint .", + "preview": "vite preview", + "typecheck": "tsc --noEmit -p tsconfig.app.json" + }, + "dependencies": { + "archiver": "^7.0.1", + "axios": "^1.13.2", + "cors": "^2.8.5", + "express": "^5.2.1", + "firebase": "^12.11.0", + "framer-motion": "^12.38.0", + "jspdf": "^3.0.3", + "jszip": "^3.10.1", + "lucide-react": "^0.344.0", + "pdfkit": "^0.17.2", + "react": "^18.3.1", + "react-dom": "^18.3.1", + "react-markdown": "^10.1.0", + "sharp": "^0.34.5", + "sonner": "^2.0.7", + "swiper": "^12.1.3" + }, + "devDependencies": { + "@eslint/js": "^9.9.1", + "@types/react": "^18.3.5", + "@types/react-dom": "^18.3.0", + "@vitejs/plugin-react": "^4.3.1", + "autoprefixer": "^10.4.18", + "dotenv": "^17.3.1", + "eslint": "^9.9.1", + "eslint-plugin-react-hooks": "^5.1.0-rc.0", + "eslint-plugin-react-refresh": "^0.4.11", + "firebase-admin": "^13.7.0", + "globals": "^15.9.0", + "postcss": "^8.4.35", + "tailwindcss": "^3.4.1", + "typescript": "^5.5.3", + "typescript-eslint": "^8.3.0", + "vite": "^5.4.2" + } +} diff --git a/postcss.config.js b/postcss.config.js new file mode 100644 index 0000000000000000000000000000000000000000..daedffd2bf4950df77bf2c9d6920181331f4c48a --- /dev/null +++ b/postcss.config.js @@ -0,0 +1,6 @@ +export default { + plugins: { + tailwindcss: {}, + autoprefixer: {}, + }, +}; diff --git a/public/icons/1.png b/public/icons/1.png new file mode 100644 index 0000000000000000000000000000000000000000..df4bceda02851d735aa317699159f032aeca8807 --- /dev/null +++ b/public/icons/1.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:85d7e3678cda8a4496d66ee777d1fc4893b53452c84ec7b7bb1560ff7cf1a6db +size 1526625 diff --git a/public/icons/2.png b/public/icons/2.png new file mode 100644 index 0000000000000000000000000000000000000000..61728560bc2c4eeda7947a12b900ed2ad561e1c0 --- /dev/null +++ b/public/icons/2.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f1aaefd4770be8859c42931b6850277c4b04f22eaadb0d4d54d731ba96351b99 +size 1649544 diff --git a/public/icons/3.png b/public/icons/3.png new file mode 100644 index 0000000000000000000000000000000000000000..e1d9bc71dc46129ccee14bbaff0274d8fa885f6f --- /dev/null +++ b/public/icons/3.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e46ad7e338ebc55e1e4e0b4158da6b84987c14f17cc327e299d36680b948a780 +size 1442924 diff --git a/public/icons/4.png b/public/icons/4.png new file mode 100644 index 0000000000000000000000000000000000000000..6a6f888029605804f6f58475e1b79509d90e0faf --- /dev/null +++ b/public/icons/4.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:78c74dafcebd872cfdc50174d4b54b85fedc590c6fc9892761c702b1934b753d +size 1343452 diff --git a/public/icons/@twistedbrody dowload.png b/public/icons/@twistedbrody dowload.png new file mode 100644 index 0000000000000000000000000000000000000000..99b34dd64d42fd7dacd1054b2d2caa7fb8740a96 --- /dev/null +++ b/public/icons/@twistedbrody dowload.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:66fc41948d1e7218f432c928873f3ca345f6f4ab020992188b1042f9d3cc0b07 +size 289754 diff --git a/public/icons/@twistedbrody.png b/public/icons/@twistedbrody.png new file mode 100644 index 0000000000000000000000000000000000000000..2c97c4d25c14ea33756636c08ae20f1e26fd2dec --- /dev/null +++ b/public/icons/@twistedbrody.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6e05f5e183d8d8aa7642fa54913ddcd08dffd9763568611be04c253bd09fc7c7 +size 101247 diff --git a/public/icons/icones.png b/public/icons/icones.png new file mode 100644 index 0000000000000000000000000000000000000000..00225e67c4e9013359ebb45b4845d7043c1f3d8e --- /dev/null +++ b/public/icons/icones.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2b906ab62cb436a7eeb3afbc4f2a266157ae30a7bcf9581ce0aeeca2033cf049 +size 1329654 diff --git a/public/icons/logo pagina.png b/public/icons/logo pagina.png new file mode 100644 index 0000000000000000000000000000000000000000..3aca924bba66aa57a743347154ee175754e27d30 Binary files /dev/null and b/public/icons/logo pagina.png differ diff --git a/public/icons/logo.png b/public/icons/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..79b82f660b067177eb50ba1bfcf8c1fc110abf22 --- /dev/null +++ b/public/icons/logo.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dbf84689628529b5b8ce923188e84f42d663b6455332681aae32d94d92603f33 +size 1063322 diff --git a/remove_kemono_ids.py b/remove_kemono_ids.py new file mode 100644 index 0000000000000000000000000000000000000000..1106e1c3cfab57f7f3ec40b5a8c33227b1cd1957 --- /dev/null +++ b/remove_kemono_ids.py @@ -0,0 +1,75 @@ +import os +import re +import argparse + +def remove_kemono_ids(root_dir): + """ + Recursively scans the directory and renames folders by removing + patterns like ' [123456]' or '[123456]' from the end of their names. + """ + if not os.path.isdir(root_dir): + print(f"Error: The directory '{root_dir}' does not exist.") + return + + # Pattern: optional space, followed by '[', then 1 or more digits, then ']' + # We use $ to make sure it's at the end of the folder name, or we can just + # replace it anywhere. It's safer to just replace it anywhere if it matches. + # Pattern explanation: \s* matches spaces, \[\d+\] matches [12345] + pattern = re.compile(r'\s*\[\d+\]\s*$') + + # We walk bottom-up so that renaming a parent folder doesn't break the paths for its children + renamed_count = 0 + + for dirpath, dirnames, filenames in os.walk(root_dir, topdown=False): + # Rename files first + for filename in filenames: + name, ext = os.path.splitext(filename) + if pattern.search(name): + new_name = pattern.sub('', name).strip() + ext + + if not new_name or new_name == ext: + continue + + old_path = os.path.join(dirpath, filename) + new_path = os.path.join(dirpath, new_name) + + if not os.path.exists(new_path): + try: + os.rename(old_path, new_path) + print(f"Renamed file: '{filename}' -> '{new_name}'") + renamed_count += 1 + except Exception as e: + print(f"Failed to rename file '{filename}': {e}") + + # Rename folders + for dirname in dirnames: + if pattern.search(dirname): + new_name = pattern.sub('', dirname).strip() + + if not new_name: + continue + + old_path = os.path.join(dirpath, dirname) + new_path = os.path.join(dirpath, new_name) + + if os.path.exists(new_path): + print(f"Cannot rename folder '{dirname}' to '{new_name}' because the destination already exists.") + continue + + try: + os.rename(old_path, new_path) + print(f"Renamed folder: '{dirname}' -> '{new_name}'") + renamed_count += 1 + except Exception as e: + print(f"Failed to rename folder '{dirname}': {e}") + + print(f"\nScan complete. Total folders renamed: {renamed_count}") + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description="Remove Kemono post IDs (e.g. '[12345]') from folder names.") + parser.add_argument("path", nargs='?', default=".", help="The root directory to scan (default is current directory)") + + args = parser.parse_args() + + print(f"Starting to scan: {os.path.abspath(args.path)}\n") + remove_kemono_ids(args.path) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..506ae835bd1133db51fea279a0410f89ff0b7fc3 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +img2pdf +requests diff --git a/run_local.bat b/run_local.bat new file mode 100644 index 0000000000000000000000000000000000000000..33ccc162b36e49d11d60ed613e0e83121988ffda --- /dev/null +++ b/run_local.bat @@ -0,0 +1,10 @@ +@echo off +chcp 65001 > nul +title MangaFlow Engine - Local System +cls +echo. +echo [1m[ MANGAFLOW ENGINE ] [0m [90m- SISTEMA DE DESARROLLO LOCAL [0m +echo [90m------------------------------------------------------- [0m +echo. +call npx -y concurrently --raw -k "npm run server --silent" "npm run dev --silent" +pause diff --git a/server.js b/server.js new file mode 100644 index 0000000000000000000000000000000000000000..154056aa2680303f95f236483aa6827e1515ad59 --- /dev/null +++ b/server.js @@ -0,0 +1,612 @@ +import express from 'express'; +import cors from 'cors'; +import fs from 'fs'; +import path from 'path'; +import axios from 'axios'; +import archiver from 'archiver'; +import PDFDocument from 'pdfkit'; +import { spawn } from 'child_process'; +import { fileURLToPath } from 'url'; +import { initializeApp } from 'firebase/app'; +import sharp from 'sharp'; +import { getFirestore, collection, query, where, getDocs, orderBy } from 'firebase/firestore'; + +sharp.cache(false); // Disable cache to prevent memory growth during batch processing + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); + +const app = express(); +const PORT = process.env.PORT || 7860; + +app.use(cors()); +app.use(express.json({ limit: '50mb' })); + +// Serve static files from the dist directory +app.use(express.static(path.join(__dirname, 'dist'))); + +// --- Firebase Config --- +const firebaseConfig = { + apiKey: "TU_NUEVA_API_KEY", + authDomain: "twisted-streaming-brody.firebaseapp.com", + projectId: "twisted-streaming-brody", + storageBucket: "twisted-streaming-brody.firebasestorage.app", + messagingSenderId: "TU_NUEVA_SENDER", + appId: "TU_NUEVA_APPID", + measurementId: "TU_NUEVA_MEASUREMENT" +}; + +const firebaseApp = initializeApp(firebaseConfig); +const db = getFirestore(firebaseApp); + +// --- 1. Almacén global de progreso --- +const progresoDescargas = {}; + +// --- Helpers --- +const downloadsDir = path.join(__dirname, 'downloads'); +if (!fs.existsSync(downloadsDir)) { + fs.mkdirSync(downloadsDir); +} + +// --- Colores para la Terminal --- +const esc = String.fromCharCode(27); +const c = { + reset: `${esc}[0m`, + bold: `${esc}[1m`, + gray: `${esc}[90m`, + cyan: `${esc}[96m`, + green: `${esc}[92m`, + yellow: `${esc}[93m`, + magenta: `${esc}[95m`, + red: `${esc}[31m` +}; + +// --- Cleanup on Startup --- +function cleanDownloadsFolder() { + process.stdout.write(` ${c.gray}[SYSTEM]${c.reset} Limpiando archivos temporales...\n`); + try { + const files = fs.readdirSync(downloadsDir); + let deletedCount = 0; + for (const file of files) { + if (file === '.gitkeep') continue; + fs.unlinkSync(path.join(downloadsDir, file)); + deletedCount++; + } + if (deletedCount > 0) { + process.stdout.write(` ${c.gray}[SYSTEM]${c.reset} ${c.green}OK:${c.reset} Se eliminaron ${deletedCount} archivos antiguos.\n`); + } else { + process.stdout.write(` ${c.gray}[SYSTEM]${c.reset} ${c.green}OK:${c.reset} Carpeta limpia.\n`); + } + } catch (err) { + process.stdout.write(` ${c.gray}[SYSTEM]${c.reset} ${c.red}ERROR:${c.reset} ${err.message}\n`); + } +} +cleanDownloadsFolder(); + +function sanitizeFilename(name) { + return name.replace(/[^a-z0-9]/gi, '_'); +} + +async function downloadImage(url) { + try { + const response = await axios({ + url, + method: 'GET', + responseType: 'arraybuffer', + headers: { + 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36', + 'Referer': 'https://google.com' + } + }); + + if (response.status !== 200) throw new Error(`Status ${response.status}`); + return response.data; + } catch (error) { + console.error(`[DEBUG] Download failed: ${error.message} (${url})`); + throw error; + } +} + +// --- 2. Ruta para que el Frontend escuche el progreso (SSE) --- +app.get('/api/download/progress/:jobId', (req, res) => { + res.setHeader('Content-Type', 'text/event-stream'); + res.setHeader('Cache-Control', 'no-cache'); + res.setHeader('Connection', 'keep-alive'); + + const { jobId } = req.params; + + // Enviamos un latido cada 500ms + const interval = setInterval(() => { + const p = progresoDescargas[jobId] || 0; + res.write(`data: ${JSON.stringify({ progress: p })}\n\n`); + if (p >= 100 || p === 'error') { + clearInterval(interval); + if (p >= 100) delete progresoDescargas[jobId]; // Limpiar memoria + } + }, 500); + + req.on('close', () => clearInterval(interval)); +}); + +// --- Firebase Fetch Helper --- +async function getAllChapters(mangaId) { + process.stdout.write(`[FIREBASE] Searching chapters: ${mangaId}\n`); + + // HACKER FIX: Consultamos solo por 'where' para evitar el error de "Index Required". + // Ordenamos los datos nosotros mismos en la memoria RAM del servidor. + const q = query( + collection(db, "chapters"), + where("manga_id", "==", mangaId) + ); + + const querySnapshot = await getDocs(q); + + if (querySnapshot.empty) { + // Fallback: Try with 'mangaId' just in case the field name varies + console.log("[FIREBASE] Intento secundario con campo 'mangaId'..."); + const q2 = query(collection(db, "chapters"), where("mangaId", "==", mangaId)); + const snapshot2 = await getDocs(q2); + + if (snapshot2.empty) { + throw new Error('No se encontraron capítulos para este mangaId (ni por manga_id ni mangaId).'); + } + return processSnapshot(snapshot2); + } + + return processSnapshot(querySnapshot); +} + +function processSnapshot(snapshot) { + process.stdout.write(`[FIREBASE] Found ${snapshot.size} chapters. Sorting...\n`); + + const chapters = snapshot.docs.map(doc => { + const data = doc.data(); + return { + id: doc.id, + number: Number(data.number) || 0, // Ensure number for sorting + original_pages: data.original_pages || [], + pages: data.pages || [] + }; + }); + + // Ordenamiento manual (Bypass del índice compuesto) + return chapters.sort((a, b) => a.number - b.number); +} + + + +// --- Image Proxy & Optimization --- +app.get('/api/image-proxy', async (req, res) => { + const { url, width, height, quality, format } = req.query; + + if (!url) { + return res.status(400).send('URL is required'); + } + + try { + // 1. Fetch the original image + const response = await axios({ + url: url, + method: 'GET', + responseType: 'arraybuffer', + headers: { + 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36', + 'Referer': 'https://google.com' + } + }); + + let imageBuffer = response.data; + + // 2. Set aggressive cache headers (1 day) + res.setHeader('Cache-Control', 'public, max-age=86400, mutable'); + + // 3. Resize if requested (Sharp) + if (width || height || (format && format !== 'original')) { + const pipeline = sharp(imageBuffer); + + if (width || height) { + pipeline.resize( + width ? parseInt(width) : null, + height ? parseInt(height) : null, + { + fit: 'inside', + withoutEnlargement: true + } + ); + } + + // Format conversion (default to webp for performance check) + const outFormat = format || 'webp'; + const outQuality = quality ? parseInt(quality) : 85; + + if (outFormat === 'webp') { + pipeline.webp({ quality: outQuality }); + res.setHeader('Content-Type', 'image/webp'); + } else if (outFormat === 'jpeg' || outFormat === 'jpg') { + pipeline.jpeg({ quality: outQuality }); + res.setHeader('Content-Type', 'image/jpeg'); + } else if (outFormat === 'png') { + pipeline.png({ quality: outQuality }); + res.setHeader('Content-Type', 'image/png'); + } + + imageBuffer = await pipeline.toBuffer(); + } else { + // Pass-through original content type if not converting + res.setHeader('Content-Type', response.headers['content-type']); + } + + res.send(imageBuffer); + + } catch (error) { + console.error(`[PROXY ERROR] ${url}: ${error.message}`); + // Fallback: Redirect to original URL if proxy fails + res.redirect(url); + } +}); + +// --- Routes --- + +app.get('/api/progress/:jobId', (req, res) => { + const { jobId } = req.params; + res.writeHead(200, { + 'Content-Type': 'text/event-stream', + 'Cache-Control': 'no-cache', + 'Connection': 'keep-alive' + }); + jobs[jobId] = { res, progress: 0 }; + console.log(`[SERVIDOR] Cliente conectado (Job: ${jobId})`); + req.on('close', () => { + if (jobs[jobId]) delete jobs[jobId]; + }); +}); + +app.post('/api/download/zip', async (req, res) => { + console.log("[DEBUG] Body recibido ZIP:", JSON.stringify(req.body).substring(0, 500)); + const { mangaTitle, format } = req.body; // format: 'png', 'jpg', 'webp', 'original' + const mangaId = req.body.mangaId || req.body.manga_id; + + if (!mangaId || mangaId === 'undefined') { + console.error("[SERVIDOR] ❌ Error: MangaId indefinido"); + return res.status(400).json({ error: "ID requerido" }); + } + + process.stdout.write(`\n[ZIP] Generating stream for: ${mangaTitle} (${format})\n`); + + try { + const chapters = await getAllChapters(mangaId); + + // Set headers for download + res.setHeader('Content-Type', 'application/zip'); + res.setHeader('Content-Disposition', `attachment; filename="${sanitizeFilename(mangaTitle)}.zip"`); + + // OPTIMIZATION: Use level 1 (Fastest) instead of 9 (Best) to avoid CPU bottleneck + const archive = archiver('zip', { zlib: { level: 1 } }); + + archive.on('error', (err) => { + console.error('[SERVIDOR] ❌ Error ZIP:', err); + if (!res.headersSent) res.status(500).send({ error: err.message }); + }); + + archive.pipe(res); + + // Collect all pages + let totalPagesToDownload = 0; + const chaptersToProcess = []; + for (const chap of chapters) { + let pages = []; + if (format === 'original') { + pages = (chap.original_pages && chap.original_pages.length > 0) ? chap.original_pages : chap.pages; + } else { + pages = (chap.pages && chap.pages.length > 0) ? chap.pages : chap.original_pages; + } + + if (pages && pages.length > 0) { + chaptersToProcess.push({ number: chap.number, pages }); + totalPagesToDownload += pages.length; + } + } + + // Process chapters in parallel (limit parallelism to avoid memory exploded with sharp) + let processedTotal = 0; + + // Helper for sequential processing within chapters to manage concurrency better + for (const chap of chaptersToProcess) { + console.log(`[STREAM] Procesando Cap ${chap.number}`); + + // OPTIMIZATION: Increased batch size from 20 to 50 for faster downloads + const chunkSize = 50; + for (let i = 0; i < chap.pages.length; i += chunkSize) { + const batch = chap.pages.slice(i, i + chunkSize); + + await Promise.all(batch.map(async (pageUrl, batchIndex) => { + const pageIndex = i + batchIndex; + try { + let buffer = await downloadImage(pageUrl); + + // --- CONVERSION LOGIC --- + let ext = 'jpg'; + let finalBuffer = buffer; + + // Usar sharp para leer de los headers del buffer el formato real + try { + const metadata = await sharp(buffer).metadata(); + if (metadata.format) { + ext = metadata.format === 'jpeg' ? 'jpg' : metadata.format; + } + } catch (err) { + // Fallback si no es imagen o falla leer metadata + if (pageUrl.toLowerCase().includes('.png') || pageUrl.toLowerCase().includes('.png?')) ext = 'png'; + else if (pageUrl.toLowerCase().includes('.webp') || pageUrl.toLowerCase().includes('.webp?')) ext = 'webp'; + } + + // IF format is NOT original, we convert (except GIFs to preserve animation) + if (ext === 'gif') { + // Si es un GIF, omitimos la conversión para no perder la animación + } else if (format && format !== 'original') { + try { + // Format mappings for sharp + let sharpFormat = format; + if (format === 'jpg') sharpFormat = 'jpeg'; + + // Perform conversion + finalBuffer = await sharp(buffer) + .toFormat(sharpFormat, { quality: 90 }) + .toBuffer(); + + ext = format; // Update extension to requested format + } catch (sharpErr) { + console.warn(`[WARN] Falló conversión a ${format}, usanda original.`, sharpErr.message); + } + } + + const cleanChapterNum = String(chap.number).padStart(2, '0'); + const archivePath = `Capitulo_${cleanChapterNum}/pagina_${String(pageIndex + 1).padStart(3, '0')}.${ext}`; + + archive.append(finalBuffer, { name: archivePath }); + + // --- UPDATE PROGRESS --- + processedTotal++; + const porcentaje = Math.round((processedTotal / totalPagesToDownload) * 100); + progresoDescargas[mangaId] = porcentaje; + + } catch (e) { + console.error(`[!] Error Cap ${chap.number} pág ${pageIndex}: ${e.message}`); + } + })); + } + } + + // Force 100% on complete + progresoDescargas[mangaId] = 100; + await archive.finalize(); + + } catch (error) { + console.error(`[SERVIDOR] ❌ Error Global: ${error.message}`); + fs.writeFileSync(path.join(__dirname, 'server_error.log'), `[${new Date().toISOString()}] Error ZIP: ${error.stack}\n`, { flag: 'a' }); + progresoDescargas[mangaId] = 'error'; + if (!res.headersSent) res.status(500).json({ error: error.message }); + } +}); + +// const { spawn } = require('child_process'); // Removed: using import at top + +app.post('/api/download/pdf', async (req, res) => { + console.log("[DEBUG] Body recibido PDF:", JSON.stringify(req.body).substring(0, 500)); + const { mangaTitle, format, jobId } = req.body; + const mangaId = req.body.mangaId || req.body.manga_id; + + if (!mangaId || mangaId === 'undefined') { + console.error("[SERVIDOR] ❌ Error: Se recibió un mangaId indefinido para PDF"); + return res.status(400).json({ error: "El ID del manga es obligatorio" }); + } + + console.log(`\n[SERVIDOR] Solicitud PDF (Python Bridge) para: ${mangaTitle} (ID: ${mangaId})`); + + // Notify client PDF is starting (optional, but good if we kept SSE) + // sendProgress(jobId, 10, 'starting'); // We might not be able to track detailed progress easily w/o advanced python ipc + + try { + // 1. Fetch URLs using existing helper + const chapters = await getAllChapters(mangaId); + let allUrls = []; + + // Sort chapters just to be safe, though getAllChapters does it + chapters.sort((a, b) => a.number - b.number); + + for (const chap of chapters) { + let pages = []; + if (format === 'original') pages = (chap.original_pages && chap.original_pages.length > 0) ? chap.original_pages : chap.pages; + else pages = (chap.pages && chap.pages.length > 0) ? chap.pages : chap.original_pages; + + if (pages && pages.length > 0) { + allUrls = allUrls.concat(pages); + } + } + + if (allUrls.length === 0) { + throw new Error("No extracted pages found to convert."); + } + + console.log(`[PYTHON] Delegando ${allUrls.length} páginas al script converter.py...`); + + const safeTitle = sanitizeFilename(mangaTitle); + const timestamp = new Date().toISOString().replace(/[:.]/g, '-'); + const pdfName = `${safeTitle}_HackerMode_${timestamp}.pdf`; + const pdfPath = path.join(downloadsDir, pdfName); // Use full path + + // 2. Call Python Script in Unbuffered mode + // HACKER FIX: En Docker/Linux a menudo es 'python3', en Windows 'python' + const pythonCmd = process.env.PYTHON_CMD || (process.platform === 'win32' ? 'python' : 'python3'); + console.log(`[SERVIDOR] Usando comando Python: ${pythonCmd}`); + + const scriptPath = path.join(__dirname, 'converter.py'); + const pythonProcess = spawn(pythonCmd, ['-u', scriptPath]); + + // Send data to Python via STDIN + pythonProcess.stdin.write(JSON.stringify({ + urls: allUrls, + output: pdfPath + })); + pythonProcess.stdin.end(); + + // 🚩 Logic to sync progress with SSE + let imagenesTerminadas = 0; + const totalPaginasTarget = allUrls.length; + + pythonProcess.stdout.on('data', (data) => { + const lineas = data.toString().split('\n'); + + lineas.forEach(line => { + const mensaje = line.trim(); + if (mensaje.includes("PROGRESS:IMAGE_DONE")) { + imagenesTerminadas++; + const porcentaje = Math.round((imagenesTerminadas / totalPaginasTarget) * 100); + + // Update global store for SSE + progresoDescargas[mangaId] = porcentaje; + process.stdout.write(`\r[PYTHON] ⚡ Descarga Paralela: ${imagenesTerminadas}/${totalPaginasTarget} (${porcentaje}%)`); + + } else if (mensaje === "STATUS:SUCCESS") { + console.log("\n[PYTHON] ✅ PDF Creado con éxito."); + progresoDescargas[mangaId] = 100; // Ensure 100% + } else if (mensaje.startsWith("DEBUG:")) { + // console.log(`\n[PYTHON] ${mensaje}`); + } + }); + }); + + pythonProcess.stderr.on('data', (data) => { + console.error(`[PYTHON STDERR]: ${data}`); + }); + + pythonProcess.on('close', (code) => { + if (code === 0) { + console.log(`[SERVIDOR] ✅ PDF creado por Python: ${pdfPath}`); + // 3. Send file to client + res.download(pdfPath, (err) => { + if (err) { + console.error("Error sending file:", err); + if (!res.headersSent) res.status(500).send("Error downloading file"); + } + // Cleanup temp file after sending + if (fs.existsSync(pdfPath)) { + // small timeout to ensure stream closed + setTimeout(() => fs.unlinkSync(pdfPath), 1000); + } + }); + } else { + console.error(`[SERVIDOR] ❌ Python exited with code ${code}`); + if (!res.headersSent) res.status(500).send("Error en la conversión a PDF (Python Code " + code + ")"); + } + }); + + } catch (error) { + console.error(`[SERVIDOR] ❌ Error Global PDF: ${error.message}`); + if (!res.headersSent) res.status(500).send({ error: error.message }); + } +}); + +// --- Image Processing Endpoint --- +app.post('/api/process-image', async (req, res) => { + const startTime = Date.now(); + const { name, index, total } = req.body; // Extraemos metadatos + + try { + const { image } = req.body; + if (!image) { + return res.status(400).json({ error: 'Image data is required' }); + } + + // Log inicial del lote (solo si es la primera imagen y viene la info) + if (index === 1 && total) { + console.log(`\n[PROCESAMIENTO] � Iniciando lote: procesando ${total} imagenes`); + } + + // Extract base64 + const base64Data = image.replace(/^data:image\/\w+;base64,/, ""); + const buffer = Buffer.from(base64Data, 'base64'); + + // Procesamiento en Paralelo + const [webpBuffer, thumbnailBuffer] = await Promise.all([ + sharp(buffer) + .resize(1200, null, { fit: 'inside', withoutEnlargement: true }) + .webp({ quality: 90 }) + .toBuffer(), + sharp(buffer) + .resize(400, null, { fit: 'inside', withoutEnlargement: true }) + .jpeg({ quality: 80, leaflet: true }) + .toBuffer() + ]); + + // Log de finalización estilo solicitado + if (index && total) { + console.log(`finalizado ${index} paginas`); // "finalizado 1 paginas", "finalizado 2 paginas"... + if (index === total) { + console.log(`\n[PROCESAMIENTO] ✅ Lote de ${total} imágenes completado.`); + } + } else { + // Fallback para subidas individuales (portada, etc) + const duration = Date.now() - startTime; + console.log(`[PROCESAMIENTO] 🟢 Completado: ${name} (${duration}ms)`); + } + + res.json({ + success: true, + data: { + webp: `data:image/webp;base64,${webpBuffer.toString('base64')}`, + thumbnail: `data:image/jpeg;base64,${thumbnailBuffer.toString('base64')}` + } + }); + + } catch (error) { + console.error(`[PROCESAMIENTO] 🔴 Error con ${name}:`, error.message); + res.status(500).json({ error: 'Failed to process image', details: error.message }); + } +}); + +// --- Health Check --- +app.get('/health', (req, res) => { + res.status(200).send('OK'); +}); + +// --- Catch-all to serve index.html for client-side routing (Express 5 fix) --- +app.get(/.*/, (req, res) => { + if (req.path.startsWith('/api')) { + return res.status(404).json({ error: 'Not Found' }); + } + + const indexPath = path.join(__dirname, 'dist', 'index.html'); + + if (fs.existsSync(indexPath)) { + res.sendFile(indexPath); + } else { + // Fallback si no existe el build del frontend + res.status(200).send(` + + Server Running + +

✅ Server Status: ONLINE (Hacker Mode)

+

El servidor Backend está funcionando correctamente.

+
+

⚠️ Frontend no encontrado: No se encontró el archivo dist/index.html.

+

Posibles causas:

+
    +
  • El proceso de build (npm run build) falló o no se ejecutó en el Dockerfile.
  • +
  • La carpeta dist está en .dockerignore pero no se generó dentro de la imagen.
  • +
+

Revisa los logs de "Build" en Hugging Face.

+ + + `); + } +}); + +app.listen(PORT, '0.0.0.0', () => { + console.log(`\n ${c.gray}────────────────────────────────────────────────────${c.reset}`); + console.log(` ${c.bold}MANGAFLOW${c.reset} ${c.gray}v2.5.0${c.reset} ${c.green}ONLINE${c.reset}`); + console.log(` ${c.gray}────────────────────────────────────────────────────${c.reset}`); + console.log(` ${c.cyan}➜ Visualizador: ${c.reset}${c.green}http://localhost:3000/${c.reset}`); + console.log(` ${c.cyan}➜ Administrador: ${c.reset}${c.magenta}http://localhost:3000/?admin=true${c.reset}`); + console.log(` ${c.gray}────────────────────────────────────────────────────${c.reset}\n`); +}); diff --git a/service_account.json b/service_account.json new file mode 100644 index 0000000000000000000000000000000000000000..41156e59c0ca5bb2a36431b45366a22fc2f55e8e --- /dev/null +++ b/service_account.json @@ -0,0 +1,13 @@ +{ + "type": "service_account", + "project_id": "twisted-streaming-brody", + "private_key_id": "753abc9ce75318cad25a789dec9cb2c8fa0ec1a4", + "private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDAsZEhO9FCcdua\nN9SjOzR4qsVcIDnvqpp6HGLwIYSuuybT/ua4gbpdp1twiVXtvYxbYIAT4iKrT/mH\ngKY841HAGdZJc32cLQcjly6ZObT80HofmH+y8F0Qru2WSKwKWBw5lLNdocs0GKHB\nBWkhEL7NRInVH794iXDuOqwP1B5uhHqS0l7ztAMovqARDcZGbIw5H1kdhALiYrWW\nCQ8ClIZqY9l3Vn2NA7KYIkgPSLRDH6xKV3170h9MBC2fwYSbXCyJgATA7acMMGkt\nTYqTGTdgu1Rr1v4NSB1heMujDJtmAShyGghmXZviYSU7QZV77Fuvh9b97d+Akcpj\nJ5CvhG8RAgMBAAECggEAB4PBP/tbBsEllhkCa5N48VIBGH23/rIPvE6AOALJn64U\nJoE2xpgmEEYRH4VWltr9Ftjvg77+WMGZnsyARyh7ER+c0xBcRB+AK1XXcxGsXo3j\njlkCVWRQ79AvmyxWO8DKCH+VY2PWdq+Ves9jBT9nvn3zVV67pwfuodbDTCp6vZbv\nC3bAQdXzN2q05/O1wFk7VddOScA+EU+sD/+ZJBg9P/WIw/CD2lQooLVs2uKsrEbM\n2rvfqZqbYe/uh4A1qDHkUSFJvrJOZIleI/d5JdojPE8H3MuEmRD/YqMAi5ry3I5E\nIlZmzqJNTzmvRv4h7wMZELX+2UyykVdNcwxZs1gJwQKBgQDtXTwqbFw7+Y7lrs6f\n4kClLwE9ZQ58KM9jI5wE5ejVBV5619nb542aDvFHetrAqSF5SZtEDNij6QPJ6FI/\nQup96SGz7F/sQaRMA1EkF63hTXUctz+rADdWm1EMkkgiqzSCTgmpGgk2hVtkgzj2\niruA/5ME57He7hLqLJg7H68ZUQKBgQDP0oBXUH0aRv1DYsExPZ3KBbPYt7+lm4ia\nysEc8tIIoUW6Obei3sXMn/+YqPXK/XCHhnTHxMAaGruuM40hAhKpvCjdplEPGeBD\n3m6ml4lm0g9KuQQ9ABJ9hz6vNcdSxf4RLKFx8aBrchHqi2g9qyeEzBVxav/pNIYL\nx9LjexaJwQKBgByRrDwu7qsJTnm2oIf942n+TlflYejvwIZeMtkkEvIQw15lvIML\nS6/PPJst3kZyFOVURqvaH/kagqo6nCuhEjg1ZykQujrla7D6dTmy3+rON9pM9AzQ\n6dgyuX6Z3LTPhnJokiEYUSOOyYE/iguihw7vs/JTMMV0QjKNS4VSOvEBAoGBALt6\nCP87g+/dlIFiqCd0j1B8/nYFpSSPf5csSzODNchFPDK3+Jo73zIuMBSWb01Uflw0\nBktkiWvDLAYFSU46oX1vWWpCrCM0U6TGFwm/8FrKKrNc3p7s3sFQ7VJ/8DUSmZUC\nrw2sTOxAtjrg0gO3z+mzdbCgNwY4tKgR9oPyOS3BAoGBAK7uA6v90QS0mpl0kbNr\n121l5/m7T3zoJf0fbwh4W2tHmmogPgDQp7t27CL48nCxWcKsj5CDWVF8QqoBUhfH\nKnKmuPkNj4DQ0dgAggEXyJCMVp7skgJ8SXi3E/ZtWXIdmR9J1SSCpGYUmMPONp3G\nTFE9AEaOPy0JPYeNLbiVidGU\n-----END PRIVATE KEY-----\n", + "client_email": "firebase-adminsdk-fbsvc@twisted-streaming-brody.iam.gserviceaccount.com", + "client_id": "114809841591755230406", + "auth_uri": "https://accounts.google.com/o/oauth2/auth", + "token_uri": "https://oauth2.googleapis.com/token", + "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", + "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-fbsvc%40twisted-streaming-brody.iam.gserviceaccount.com", + "universe_domain": "googleapis.com" +} diff --git a/src/App.tsx b/src/App.tsx new file mode 100644 index 0000000000000000000000000000000000000000..40cc20747898291a30462e1bfd0e13e508555639 --- /dev/null +++ b/src/App.tsx @@ -0,0 +1,1361 @@ +import { Plus, Settings, Layers, User, Copy, Edit3, Tag, BookOpen, Folder, ArrowLeft, Menu, X, ExternalLink, Link, Play, ChevronRight, Send } from 'lucide-react'; +import { useState, useEffect, useMemo } from 'react'; +import { HDComicViewer } from './components/HDComicViewer'; +import { NewMangaModal } from './components/NewMangaModal'; +import { SettingsModal } from './components/SettingsModal'; +import { AnnouncementBanner } from './components/AnnouncementBanner'; +import { ComicDetail } from './components/ComicDetail'; +import { ChapterReader } from './components/ChapterReader'; +import { InfoPage } from './components/InfoPage'; +import { BulkCategoryModal } from './components/BulkCategoryModal'; +import { BulkRemoveCategoryModal } from './components/BulkRemoveCategoryModal'; +import { CategoryFilterModal } from './components/CategoryFilterModal'; +import { TitleManagerModal } from './components/TitleManagerModal'; +import { BulkEditTitleModal } from './components/BulkEditTitleModal'; +import { EtiquetadoraModal } from './components/EtiquetadoraModal'; +import { CreateFolderModal } from './components/CreateFolderModal'; +import { MoveToFolderModal } from './components/MoveToFolderModal'; +import { MoveSectionModal } from './components/MoveSectionModal'; +import { FolderMentalMapModal } from './components/FolderMentalMapModal'; +import { TrashModal } from './components/TrashModal'; +import { ConfirmModal } from './components/ConfirmModal'; +import { TransferPagesModal } from './components/TransferPagesModal'; +import { Category } from './types/manga'; +import { PatreonIcon } from './components/PatreonIcon'; +import { NavigationDrawer } from './components/NavigationDrawer'; + +import { SearchBar } from './components/SearchBar'; +import { SearchResults } from './components/SearchResults'; +import { Toaster, toast } from 'sonner'; +import { deleteManga, getAllMangas, updateMangaTitles, restoreManga, permanentDeleteManga, mergeMangas, moveToFolder, createCollectionFromVideos } from './services/manga'; +import { Manga, Chapter } from './types/manga'; +import { searchItems } from './utils/searchUtils'; +import { GlobalFooter } from './components/GlobalFooter'; + +type SortType = 'random' | 'name' | 'date' | 'pages' | 'modified' | 'views'; +type SortDirection = 'asc' | 'desc'; + +function App() { + const [showModal, setShowModal] = useState(false); + const [showSettingsModal, setShowSettingsModal] = useState(false); + const [showFilterModal, setShowFilterModal] = useState(false); + const [isAdmin, setIsAdmin] = useState(false); + const [editingManga, setEditingManga] = useState(null); + const [isCategoryPlusEnabled, setIsCategoryPlusEnabled] = useState(false); + const [isCopyIdsEnabled, setIsCopyIdsEnabled] = useState(false); + const [isDeletePlusEnabled, setIsDeletePlusEnabled] = useState(false); + const [selectedMangaIds, setSelectedMangaIds] = useState([]); + const [showBulkModal, setShowBulkModal] = useState(false); + const [showBulkRemoveModal, setShowBulkRemoveModal] = useState(false); + const [showBulkEditTitleModal, setShowBulkEditTitleModal] = useState(false); + const [showEtiquetadoraModal, setShowEtiquetadoraModal] = useState(false); + const [showTitleManagerModal, setShowTitleManagerModal] = useState(false); + const [showFolderMapModal, setShowFolderMapModal] = useState(false); + const [showTrashModal, setShowTrashModal] = useState(false); + const [showTransferPagesModal, setShowTransferPagesModal] = useState(false); + const [showKemonoCleanConfirm, setShowKemonoCleanConfirm] = useState(false); + const [confirmModal, setConfirmModal] = useState<{ + isOpen: boolean; + title: string; + message: string; + onConfirm: () => void; + variant: 'danger' | 'warning' | 'info'; + }>({ + isOpen: false, + title: '', + message: '', + onConfirm: () => {}, + variant: 'info' + }); + const [isFolderAnimationEnabled, setIsFolderAnimationEnabled] = useState(() => { + return localStorage.getItem('isFolderAnimationEnabled') === 'true'; + }); + const [isCategoryMinusEnabled, setIsCategoryMinusEnabled] = useState(false); + const [isEditTitlePlusEnabled, setIsEditTitlePlusEnabled] = useState(false); + const [isEtiquetadoraEnabled, setIsEtiquetadoraEnabled] = useState(false); + const [isFolderPlusEnabled, setIsFolderPlusEnabled] = useState(false); + const [isPortalPlusEnabled, setIsPortalPlusEnabled] = useState(false); + const [isMergePlusEnabled, setIsMergePlusEnabled] = useState(false); + const [isTransferPlusEnabled, setIsTransferPlusEnabled] = useState(false); + const [currentFolderId, setCurrentFolderId] = useState(null); + const [showCreateFolderModal, setShowCreateFolderModal] = useState(false); + const [showMoveToFolderModal, setShowMoveToFolderModal] = useState(false); + const [showMoveSectionModal, setShowMoveSectionModal] = useState(false); + const [selectedComicId, setSelectedComicId] = useState(null); + const [navigationHistory, setNavigationHistory] = useState([]); + const [selectedChapter, setSelectedChapter] = useState<{ manga: Manga; chapter: Chapter } | null>(null); + const [mangas, setMangas] = useState([]); + const [currentSection, setCurrentSection] = useState<'peliculas' | 'flow' | 'series'>(() => { + const params = new URLSearchParams(window.location.search); + const sec = params.get('section'); + if (sec === 'peliculas' || sec === 'flow' || sec === 'series') return sec as 'peliculas' | 'flow' | 'series'; + return (localStorage.getItem('currentSection') as 'peliculas' | 'flow' | 'series') || 'flow'; + }); + const [showHD, setShowHD] = useState(false); + const [showInfo, setShowInfo] = useState(false); + const [loading, setLoading] = useState(true); + const [searchTerm, setSearchTerm] = useState(''); + const [viewFilter, setViewFilter] = useState<'all' | 'mangas' | 'folders'>('all'); + const [selectedCategories, setSelectedCategories] = useState([]); + const [selectedAuthors, setSelectedAuthors] = useState([]); + const [filterDecensored, setFilterDecensored] = useState(false); + const [filterBN, setFilterBN] = useState(false); + const [filterColor, setFilterColor] = useState(false); + const [sortType, setSortType] = useState(() => + (localStorage.getItem('sortType') as SortType) || 'modified' + ); + const [sortDirection, setSortDirection] = useState(() => + (localStorage.getItem('sortDirection') as SortDirection) || 'desc' + ); + + useEffect(() => { + const searchParams = new URLSearchParams(window.location.search); + const isAdminMode = searchParams.get('admin') === 'true'; + setIsAdmin(isAdminMode); + }, []); + + useEffect(() => { + localStorage.setItem('sortType', sortType); + }, [sortType]); + + useEffect(() => { + localStorage.setItem('isFolderAnimationEnabled', String(isFolderAnimationEnabled)); + }, [isFolderAnimationEnabled]); + + useEffect(() => { + localStorage.setItem('sortDirection', sortDirection); + }, [sortDirection]); + + useEffect(() => { + localStorage.setItem('currentSection', currentSection); + const url = new URL(window.location.href); + if (currentSection === 'peliculas' || currentSection === 'series') { + url.searchParams.set('section', currentSection); + } else { + url.searchParams.delete('section'); + } + window.history.replaceState({}, '', url.toString()); + }, [currentSection]); + + useEffect(() => { + // @ts-expect-error Window interface is extended in vite-env.d.ts + if (window.Telegram?.WebApp) { + // @ts-expect-error Window interface is extended in vite-env.d.ts + window.Telegram.WebApp.ready(); + } + loadMangas(); + + const hash = window.location.hash.slice(1); + if (hash && hash.startsWith('video/')) { + if (hash.endsWith('/hd')) { + const mangaId = hash.replace('video/', '').replace('/hd', ''); + setSelectedComicId(mangaId); + setShowHD(true); + } else { + const mangaId = hash.replace('video/', ''); + setSelectedComicId(mangaId); + setShowHD(false); + } + } else if (hash && hash.startsWith('folder/')) { + const folderId = hash.replace('folder/', ''); + setCurrentFolderId(folderId); + } else if (hash === 'info') { + setShowInfo(true); + } + + const handleHashChange = () => { + const hash = window.location.hash.slice(1); + if (!hash || hash === 'series' || hash === 'peliculas' || hash === 'flow') { + setSelectedComicId(null); + setSelectedChapter(null); + setShowInfo(false); + setShowHD(false); + setCurrentFolderId(null); + if (hash === 'series' || hash === 'peliculas' || hash === 'flow') { + setCurrentSection(hash as 'series' | 'peliculas' | 'flow'); + } + } else if (hash.startsWith('video/')) { + if (hash.endsWith('/hd')) { + const mangaId = hash.replace('video/', '').replace('/hd', ''); + setSelectedComicId(mangaId); + setShowHD(true); + } else { + const mangaId = hash.replace('video/', ''); + setSelectedComicId(mangaId); + setShowHD(false); + } + setSelectedChapter(null); + setShowInfo(false); + setCurrentFolderId(null); + } else if (hash.startsWith('folder/')) { + setCurrentFolderId(hash.replace('folder/', '')); + setSelectedComicId(null); + setSelectedChapter(null); + setShowInfo(false); + setShowHD(false); + } else if (hash === 'info') { + setShowInfo(true); + setSelectedComicId(null); + setSelectedChapter(null); + setCurrentFolderId(null); + } else { + // Fallback for any other unknown hashes to clear folder view + setCurrentFolderId(null); + } + }; + + window.addEventListener('hashchange', handleHashChange); + return () => window.removeEventListener('hashchange', handleHashChange); + }, []); + + useEffect(() => { + // Ya no limpiamos selectedMangaIds basado en los toggles porque los usuarios pueden seleccionar mangas directamente. + }, []); + + async function loadMangas() { + try { + setLoading(true); + const data = await getAllMangas(); + setMangas(data); + } catch (error) { + console.error('Error loading mangas:', error); + } finally { + setLoading(false); + } + } + + const sectionMangas = useMemo(() => { + if (currentSection === 'flow') { + return mangas.filter(m => !m.is_deleted); + } + return mangas.filter(m => !m.is_deleted && m.section === currentSection); + }, [mangas, currentSection]); + + const deletedMangas = useMemo(() => { + return mangas.filter(m => { + if (!m.is_deleted) return false; + // If it's a child and its parent is also in the trash, hide it from the trash view + if (m.folder_id) { + const parentFolder = mangas.find(parent => parent.id === m.folder_id); + if (parentFolder && parentFolder.is_deleted) { + return false; + } + } + return true; + }); + }, [mangas]); + + const allCategories = useMemo(() => { + const categoriesMap = new Map(); + sectionMangas.forEach(manga => { + manga.categories?.forEach(cat => { + if (!categoriesMap.has(cat.id)) { + categoriesMap.set(cat.id, cat); + } + }); + }); + return Array.from(categoriesMap.values()); + }, [sectionMangas]); + + const searchResult = useMemo(() => { + if (!searchTerm.trim()) { + return { items: sectionMangas, query: '', resultCount: sectionMangas.length }; + } + return searchItems( + sectionMangas + .filter(m => !m.is_folder) + .map(m => ({ + id: m.id, + title: m.title, + author: m.author, + categories: m.categories ? m.categories.map(c => c.name) : [] + })), + searchTerm, + { fuzzyMatch: true, minChars: 1 } + ); + }, [sectionMangas, searchTerm]); + + const filteredMangas = useMemo(() => { + let items = searchResult.items.length > 0 + ? searchResult.items.map(item => sectionMangas.find(m => m.id === item.id)).filter(Boolean) as Manga[] + : []; + + if (selectedCategories.length > 0) { + items = items.filter(m => + selectedCategories.some(selCat => m.categories?.some(c => c.name === selCat)) + ); + } + + if (selectedAuthors.length > 0) { + items = items.filter(m => + selectedAuthors.includes(m.author) + ); + } + + if (filterDecensored) items = items.filter(m => m.is_decensored); + if (filterBN) items = items.filter(m => m.is_bn); + if (filterColor) items = items.filter(m => m.is_color); + + const sorted = [...items]; + + const isFiltering = selectedCategories.length > 0 || selectedAuthors.length > 0 || filterDecensored || filterBN || filterColor; + const isTextSearching = searchTerm.trim().length > 0; + + let filteredByFolder: Manga[]; + + if (isFiltering) { + filteredByFolder = sorted; + } else if (isTextSearching) { + const matchedIds = new Set(sorted.map(m => m.id)); + const matchedFolderIds = new Set(); + + for (const m of sorted) { + let current = m.folder_id; + let depth = 0; + while (current && depth < 20) { + matchedFolderIds.add(current); + const parent = sectionMangas.find(p => p.id === current); + if (parent) { + current = parent.folder_id; + } else { + break; + } + depth++; + } + } + + filteredByFolder = sectionMangas.filter(m => { + const effectiveFolderId = (m.folder_id && m.folder_id !== m.id && sectionMangas.some(sm => sm.id === m.folder_id)) ? m.folder_id : null; + if (effectiveFolderId !== (currentFolderId || null)) return false; + + if (m.is_folder) { + return matchedIds.has(m.id) || matchedFolderIds.has(m.id); + } + + return matchedIds.has(m.id); + }); + } else { + filteredByFolder = sorted.filter(m => { + const effectiveFolderId = (m.folder_id && m.folder_id !== m.id && sectionMangas.some(sm => sm.id === m.folder_id)) ? m.folder_id : null; + return effectiveFolderId === (currentFolderId || null); + }); + } + + let filteredByView = filteredByFolder; + if (viewFilter === 'mangas') { + filteredByView = filteredByView.filter(m => !m.is_folder); + } else if (viewFilter === 'folders') { + filteredByView = filteredByView.filter(m => m.is_folder); + } + + if (sortType === 'random') { + return filteredByView.sort(() => Math.random() - 0.5); + } + + filteredByView.sort((a, b) => { + let compareValue = 0; + + if (sortType === 'name') { + compareValue = a.title.localeCompare(b.title); + } else if (sortType === 'date') { + const dateA = new Date(a.created_at || 0).getTime(); + const dateB = new Date(b.created_at || 0).getTime(); + compareValue = dateA - dateB; + } else if (sortType === 'modified') { + const dateA = new Date(a.updated_at || a.created_at || 0).getTime(); + const dateB = new Date(b.updated_at || b.created_at || 0).getTime(); + compareValue = dateA - dateB; + } else if (sortType === 'pages') { + const pagesA = a.chapters?.reduce((sum: number, ch: any) => sum + (ch.pages?.length || 0), 0) || 0; + const pagesB = b.chapters?.reduce((sum: number, ch: any) => sum + (ch.pages?.length || 0), 0) || 0; + compareValue = pagesA - pagesB; + } else if (sortType === 'views') { + compareValue = (a.views || 0) - (b.views || 0); + } + + return sortDirection === 'asc' ? compareValue : -compareValue; + }); + + return filteredByView; + }, [sectionMangas, searchTerm, searchResult.items, sortType, sortDirection, selectedCategories, selectedAuthors, currentFolderId, viewFilter, filterDecensored, filterBN, filterColor]); + + const handleEditManga = (manga: Manga) => { + setEditingManga(manga); + setShowModal(true); + }; + + const handleDeleteManga = async (mangaId: string) => { + try { + await deleteManga(mangaId); + await loadMangas(); + } catch (error) { + console.error('Error deleting manga:', error); + toast.error('Error al eliminar el manga. Por favor intenta de nuevo.'); + } + }; + + const handleCleanKemonoTitles = async () => { + const pattern = /\s*\[\d+\]\s*$/; + const updates = mangas + .filter(m => pattern.test(m.title)) + .map(m => { + let newTitle = m.title.replace(pattern, '').trim(); + if (!newTitle) newTitle = m.title; + return { id: m.id, title: newTitle }; + }) + .filter(u => u.title !== mangas.find(m => m.id === u.id)?.title); + + if (updates.length === 0) { + toast.info('No hay nombres con formato [ID] que requieran limpieza.'); + return; + } + + try { + await updateMangaTitles(updates); + toast.success(`Se limpiaron ${updates.length} nombres correctamente.`); + loadMangas(); + } catch (err) { + console.error(err); + toast.error('Ocurrió un error al intentar limpiar los nombres.'); + } + }; + + const handleSelectAll = () => { + let allIds: string[] = []; + + const getItemsInFolder = (folderId: string): string[] => { + let result: string[] = []; + const children = sectionMangas.filter(m => m.folder_id === folderId); + for (const child of children) { + result.push(child.id); + if (child.is_folder) { + result = result.concat(getItemsInFolder(child.id)); + } + } + return result; + }; + + filteredMangas.forEach(target => { + allIds.push(target.id); + if (target.is_folder) { + allIds = allIds.concat(getItemsInFolder(target.id)); + } + }); + + const uniqueIds = Array.from(new Set(allIds)); + const allSelected = uniqueIds.length > 0 && uniqueIds.every(id => selectedMangaIds.includes(id)); + + if (allSelected) { + setSelectedMangaIds([]); + } else { + setSelectedMangaIds(uniqueIds); + } + }; + + const toggleSelectManga = (id: string) => { + const target = sectionMangas.find(m => m.id === id); + if (!target) return; + + if (target.is_folder) { + const getItemsInFolder = (folderId: string): string[] => { + let result: string[] = []; + const children = sectionMangas.filter(m => m.folder_id === folderId); + for (const child of children) { + result.push(child.id); + if (child.is_folder) { + result = result.concat(getItemsInFolder(child.id)); + } + } + return result; + }; + + const itemsInFolder = getItemsInFolder(id); + const idsToToggle = [id, ...itemsInFolder]; + + setSelectedMangaIds(prev => { + const isSelected = prev.includes(id); + if (isSelected) { + return prev.filter(mId => !idsToToggle.includes(mId)); + } else { + const newSelection = [...prev]; + idsToToggle.forEach(mId => { + if (!newSelection.includes(mId)) { + newSelection.push(mId); + } + }); + return newSelection; + } + }); + return; + } + + setSelectedMangaIds(prev => { + if (prev.includes(id)) { + return prev.filter(mId => mId !== id); + } else { + return [...prev, id]; + } + }); + }; + + const handleSelectComic = (mangaId: string) => { + if (isCategoryPlusEnabled || isCopyIdsEnabled || isDeletePlusEnabled || isCategoryMinusEnabled || isEditTitlePlusEnabled || isEtiquetadoraEnabled || isFolderPlusEnabled || isPortalPlusEnabled || isMergePlusEnabled || isTransferPlusEnabled) { + toggleSelectManga(mangaId); + return; + } + const manga = sectionMangas.find(m => m.id === mangaId); + if (manga?.is_folder) { + window.location.hash = `folder/${mangaId}`; + return; + } + window.location.hash = `video/${mangaId}`; + setSelectedComicId(mangaId); + setShowHD(false); + }; + + const handleBackToHome = () => { + window.location.hash = ''; + setSelectedComicId(null); + setShowInfo(false); + }; + + const handleSearchFromDetail = (value: string) => { + setSearchTerm(value); + }; + + const handleNavigateToManga = (newMangaId: string) => { + if (selectedComicId) { + setNavigationHistory([...navigationHistory, selectedComicId]); + } + window.location.hash = `video/${newMangaId}`; + setSelectedComicId(newMangaId); + }; + + const handleSelectCategory = (category: string) => { + setSelectedCategories(prev => { + if (prev.includes(category)) { + return prev.filter(c => c !== category); + } + return [...prev, category]; + }); + handleBackToHome(); + }; + + const handleRemoveCategory = (category: string) => { + setSelectedCategories(prev => prev.filter(c => c !== category)); + }; + + const handleSelectAuthor = (author: string) => { + setSelectedAuthors(prev => { + if (prev.includes(author)) { + return prev.filter(c => c !== author); + } + return [...prev, author]; + }); + handleBackToHome(); + }; + + const handleRemoveAuthor = (author: string) => { + setSelectedAuthors(prev => prev.filter(c => c !== author)); + }; + + const mangaItems = useMemo(() => filteredMangas.map(manga => { + const chapterCount = manga.chapters?.length || 0; + const totalPages = manga.chapters?.reduce((sum: number, ch: any) => sum + (ch.pages?.length || 0), 0) || 0; + return { + id: manga.id, + title: manga.title, + author: manga.author, + chapterCount, + pageCount: totalPages, + thumbnail: manga.cover_url ?? manga.thumbnail_url ?? undefined, + manga, + }; + }), [filteredMangas]); + + if (selectedChapter) { + return ( + setSelectedChapter(null)} + /> + ); + } + + if (showInfo) { + return ; + } + + if (selectedComicId !== null) { + let currentManga = mangas.find(m => m.id === selectedComicId); + + if (showHD && currentManga) { + return ( + { + if (currentManga) { + window.location.hash = `video/${currentManga.id}`; + } + setShowHD(false); + }} + /> + ); + } + + return ( + { + if (navigationHistory.length > 0) { + const previousId = navigationHistory[navigationHistory.length - 1]; + setNavigationHistory(navigationHistory.slice(0, -1)); + window.location.hash = `video/${previousId}`; + setSelectedComicId(previousId); + } else if (currentManga?.folder_id) { + const parent = mangas.find(m => m.id === currentManga.folder_id); + if (parent?.is_folder) { + window.location.hash = `folder/${currentManga.folder_id}`; + setCurrentFolderId(currentManga.folder_id); + setSelectedComicId(null); + } else { + handleBackToHome(); + } + } else { + handleBackToHome(); + } + }} + onReadChapter={(chapter) => { + if (currentManga) { + setSelectedChapter({ manga: currentManga, chapter }); + } + }} + onMangaLoaded={(loadedManga) => { + if (!currentManga) { + currentManga = loadedManga; + } + }} + onNavigateToManga={handleNavigateToManga} + onSelectCategory={handleSelectCategory} + onSelectAuthor={handleSelectAuthor} + isAdmin={isAdmin} + searchTerm={searchTerm} + onSearchChange={handleSearchFromDetail} + /> + ); + } + + return ( +
+
+
+
+ +
+ Twisted Brody Logo +
+

+ Twisted Streaming Brody +

+
+
+
+
+ {(isCategoryPlusEnabled || isCopyIdsEnabled || isDeletePlusEnabled || isCategoryMinusEnabled || isEditTitlePlusEnabled || isEtiquetadoraEnabled || isFolderPlusEnabled || isPortalPlusEnabled || isTransferPlusEnabled) && ( +
+ + + {isEtiquetadoraEnabled ? 'Modo Etiquetar Activo' : isPortalPlusEnabled ? 'Portal Plus Activo' : isFolderPlusEnabled ? 'Colecciones Plus Activo' : isEditTitlePlusEnabled ? 'Modo Nombres Activo' : isCopyIdsEnabled ? 'Modo Copiar Activo' : isDeletePlusEnabled ? 'Modo Eliminar Activo' : isCategoryMinusEnabled ? 'Modo Minus Activo' : isTransferPlusEnabled ? 'Transferencia Activa' : 'Modo Plus Activo'} + + + {selectedMangaIds.length} + +
+ )} + {isAdmin && ( + <> + + + + )} +
+
+
+ +
+ + +
+ + {searchTerm && ( +
+ {searchResult.resultCount} resultado{searchResult.resultCount !== 1 ? 's' : ''} encontrado{searchResult.resultCount !== 1 ? 's' : ''} +
+ )} + + {(selectedCategories.length > 0 || selectedAuthors.length > 0 || filterDecensored || filterBN || filterColor) && ( +
+ Filtrado por: + {selectedCategories.map(cat => ( + + ))} + {selectedAuthors.map(auth => ( + + ))} + {filterDecensored && ( + + )} + {filterBN && ( + + )} + {filterColor && ( + + )} + {(selectedCategories.length > 0 || selectedAuthors.length > 0 || filterDecensored || filterBN || filterColor) && ( + + )} +
+ )} +
+ +
+ {currentFolderId && (() => { + const folder = mangas.find(m => m.id === currentFolderId); + if (!folder || !folder.is_folder) return null; + return ( +
+ +
{folder.cover_url || folder.thumbnail_url ? (Cover) : !folder.folder_id && folder.title.toLowerCase().includes('patreon') ? () : ()}
+
+

{folder.title}

+

+ {folder.section === 'series' ? 'Serie' : 'Colección'} • {sectionMangas.filter(m => m.folder_id === folder.id && m.id !== folder.id).length} {folder.section === 'series' ? 'capítulos' : 'elementos'} +

+
+
+ ); + })()} + {(() => { + const folder = sectionMangas.find(m => m.id === currentFolderId); + if (folder?.section === 'series') { + return ( +
+ {mangaItems.map((item) => ( +
handleSelectComic(item.id)} + className="bg-[#1a1a1a]/80 hover:bg-[#242424] p-3 rounded-xl cursor-pointer flex items-center justify-between border border-gray-800/50 transition-all duration-300 hover:border-purple-500/50 group hover:shadow-lg hover:shadow-purple-500/10" + > +
+
+ {item.thumbnail_url || item.cover_url ? ( + {item.title} + ) : ( +
+ +
+ )} +
+
+
+ +
+
+
+
+ {item.title} + {item.description || (item.author && item.author !== 'Anónimo' ? item.author : 'Capítulo de la serie')} +
+
+
+ +
+
+ ))} + {mangaItems.length === 0 && ( +
+ No hay capítulos en esta serie. +
+ )} +
+ ); + } + + return ( + + ); + })()} +
+
+ + {/* Bulk Action Bar */} + {(selectedMangaIds.length > 0 || isFolderPlusEnabled) && ( +
+
+
+ + {(() => { + const selectedFolders = selectedMangaIds.filter(id => mangas.find(m => m.id === id)?.is_folder).length; + const selectedMangas = selectedMangaIds.length - selectedFolders; + const parts = []; + if (selectedMangas > 0) parts.push(`${selectedMangas} manga${selectedMangas !== 1 ? 's' : ''}`); + if (selectedFolders > 0) parts.push(`${selectedFolders} ${selectedFolders !== 1 ? 'colecciones' : 'colección'}`); + return parts.length > 0 ? parts.join(' y ') + ' seleccionad' + (selectedFolders > 0 && selectedMangas === 0 ? 'as' : 'os') : '0 seleccionados'; + })()} + + +
+
+ +
+ {(isFolderPlusEnabled || currentFolderId) ? ( +
+ +
+ ) : isPortalPlusEnabled ? ( + + ) : isCategoryPlusEnabled ? ( + + ) : isEtiquetadoraEnabled ? ( + + ) : isCategoryMinusEnabled ? ( + + ) : isEditTitlePlusEnabled ? ( + + ) : isCopyIdsEnabled ? ( + + ) : isDeletePlusEnabled ? ( + + ) : isMergePlusEnabled ? ( + + ) : isTransferPlusEnabled ? ( + + ) : true ? ( + // En modo normal y no estamos dentro de un folder, mostramos Transferir o Unir si son 2 o más. + <> + {selectedMangaIds.filter(id => !mangas.find(m => m.id === id)?.is_folder).length === 2 && ( + + )} + {selectedMangaIds.filter(id => !mangas.find(m => m.id === id)?.is_folder).length > 1 && ( + + )} + + ) : null} + {selectedMangaIds.length > 0 && ( + + )} +
+
+
+ )} + + setShowTrashModal(true)} + /> + + { + setShowModal(false); + setEditingManga(null); + }} + editingManga={editingManga} + onMangaCreated={(mangaId) => { + loadMangas(); + setEditingManga(null); + if (mangaId && !editingManga) { + setTimeout(() => { + handleSelectComic(mangaId); + }, 500); + } + }} + onDelete={isAdmin ? handleDeleteManga : undefined} + /> + + setShowBulkModal(false)} + selectedMangaIds={selectedMangaIds} + onSaveComplete={() => { + loadMangas(); + setSelectedMangaIds([]); + }} + /> + + setShowBulkRemoveModal(false)} + selectedMangaIds={selectedMangaIds} + onSaveComplete={() => { + loadMangas(); + setSelectedMangaIds([]); + }} + /> + + setShowBulkEditTitleModal(false)} + mangas={mangas} + selectedMangaIds={selectedMangaIds} + onSaveComplete={() => { + loadMangas(); + setSelectedMangaIds([]); + }} + /> + + setShowEtiquetadoraModal(false)} + selectedMangaIds={selectedMangaIds} + onSaveComplete={() => { + loadMangas(); + setSelectedMangaIds([]); + }} + /> + setShowCreateFolderModal(false)} + selectedMangaIds={selectedMangaIds} + onSaveComplete={() => { + loadMangas(); + setSelectedMangaIds([]); + }} + currentFolderId={currentFolderId} + currentSection={currentSection} + /> + setShowMoveToFolderModal(false)} + selectedMangaIds={selectedMangaIds} + mangas={sectionMangas} + onSaveComplete={() => { + loadMangas(); + setSelectedMangaIds([]); + }} + /> + setShowMoveSectionModal(false)} + selectedMangaIds={selectedMangaIds} + currentSection={currentSection} + onSaveComplete={() => { + loadMangas(); + setSelectedMangaIds([]); + }} + /> + + setShowSettingsModal(false)} + isAdmin={isAdmin} + onAdminChange={setIsAdmin} + isCategoryPlusEnabled={isCategoryPlusEnabled} + onCategoryPlusChange={setIsCategoryPlusEnabled} + isCopyIdsEnabled={isCopyIdsEnabled} + onCopyIdsChange={setIsCopyIdsEnabled} + isDeletePlusEnabled={isDeletePlusEnabled} + onDeletePlusChange={setIsDeletePlusEnabled} + isCategoryMinusEnabled={isCategoryMinusEnabled} + onCategoryMinusChange={setIsCategoryMinusEnabled} + isEditTitlePlusEnabled={isEditTitlePlusEnabled} + onEditTitlePlusChange={setIsEditTitlePlusEnabled} + isEtiquetadoraEnabled={isEtiquetadoraEnabled} + onEtiquetadoraChange={setIsEtiquetadoraEnabled} + isFolderPlusEnabled={isFolderPlusEnabled} + onFolderPlusChange={(enabled) => { + setIsFolderPlusEnabled(enabled); + if (!enabled) setSelectedMangaIds([]); + }} + isPortalPlusEnabled={isPortalPlusEnabled} + onPortalPlusChange={(enabled) => { + setIsPortalPlusEnabled(enabled); + if (!enabled) setSelectedMangaIds([]); + }} + isMergePlusEnabled={isMergePlusEnabled} + onMergePlusChange={(enabled) => { + setIsMergePlusEnabled(enabled); + if (!enabled) setSelectedMangaIds([]); + }} + isTransferPlusEnabled={isTransferPlusEnabled} + onTransferPlusChange={(enabled) => { + setIsTransferPlusEnabled(enabled); + if (!enabled) setSelectedMangaIds([]); + }} + isFolderAnimationEnabled={isFolderAnimationEnabled} + onFolderAnimationChange={setIsFolderAnimationEnabled} + onOpenTitleManager={() => setShowTitleManagerModal(true)} + onOpenFolderMap={() => setShowFolderMapModal(true)} + onCleanKemonoTitles={() => setShowKemonoCleanConfirm(true)} + /> + + setShowTitleManagerModal(false)} + mangas={mangas} + onSaveComplete={() => loadMangas()} + /> + + setShowFilterModal(false)} + categories={allCategories} + selectedCategories={selectedCategories} + onToggleCategory={handleSelectCategory} + onClearFilters={() => { + setSelectedCategories([]); + setFilterDecensored(false); + setFilterBN(false); + setFilterColor(false); + handleBackToHome(); + }} + filterDecensored={filterDecensored} + setFilterDecensored={(val) => { setFilterDecensored(val); handleBackToHome(); }} + filterBN={filterBN} + setFilterBN={(val) => { setFilterBN(val); handleBackToHome(); }} + filterColor={filterColor} + setFilterColor={(val) => { setFilterColor(val); handleBackToHome(); }} + /> + setShowFolderMapModal(false)} + mangas={sectionMangas} + /> + + setShowKemonoCleanConfirm(false)} + onConfirm={handleCleanKemonoTitles} + title="Limpiar IDs de Kemono" + message="¿Seguro que quieres eliminar las etiquetas [Numeros] del final de todos los mangas y colecciones? Esta acción se aplicará automáticamente a toda la base de datos." + confirmText="Sí, limpiar nombres" + cancelText="Cancelar" + variant="warning" + /> + + setShowTrashModal(false)} + deletedMangas={deletedMangas} + onRestore={async (id) => { + await restoreManga(id); + await loadMangas(); + }} + onPermanentDelete={async (id) => { + await permanentDeleteManga(id); + await loadMangas(); + }} + onEmptyTrash={async () => { + const ids = deletedMangas.map(m => m.id); + await Promise.all(ids.map(id => permanentDeleteManga(id))); + await loadMangas(); + }} + /> + + { + setShowTransferPagesModal(false); + setSelectedMangaIds([]); + }} + mangaIds={selectedMangaIds.filter(id => !mangas.find(m => m.id === id)?.is_folder).slice(0, 2)} + onSaveComplete={() => { + loadMangas(); + setSelectedMangaIds([]); + }} + /> + + setConfirmModal(prev => ({ ...prev, isOpen: false }))} + onConfirm={confirmModal.onConfirm} + title={confirmModal.title} + message={confirmModal.message} + variant={confirmModal.variant} + /> + + +
+ ); +} + +export default App; + + + diff --git a/src/components/AnnouncementBanner.tsx b/src/components/AnnouncementBanner.tsx new file mode 100644 index 0000000000000000000000000000000000000000..16b7866311c67a3b727cf5cc2087ecaddb062cf8 --- /dev/null +++ b/src/components/AnnouncementBanner.tsx @@ -0,0 +1,91 @@ +import { useState, useEffect } from 'react'; +import { Megaphone, Timer } from 'lucide-react'; +import { subscribeToAnnouncement } from '../services/announcement'; + +interface AnnouncementBannerProps { + isAdmin?: boolean; +} + +export function AnnouncementBanner({ isAdmin }: AnnouncementBannerProps) { + const [announcement, setAnnouncement] = useState(''); + const [expiresAt, setExpiresAt] = useState(null); + const [timeLeft, setTimeLeft] = useState(''); + const [isLoading, setIsLoading] = useState(true); + + useEffect(() => { + const unsubscribe = subscribeToAnnouncement((data) => { + if (data) { + setAnnouncement(data.text); + setExpiresAt(data.expiresAt); + } else { + setAnnouncement(''); + setExpiresAt(null); + } + setIsLoading(false); + }); + + return () => unsubscribe(); + }, []); + + useEffect(() => { + if (!expiresAt) { + setTimeLeft(''); + return; + } + + const interval = setInterval(() => { + const now = new Date().getTime(); + const expiration = new Date(expiresAt).getTime(); + const difference = expiration - now; + + if (difference <= 0) { + setAnnouncement(''); + setExpiresAt(null); + clearInterval(interval); + } else { + const days = Math.floor(difference / (1000 * 60 * 60 * 24)); + const hours = Math.floor((difference % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); + const minutes = Math.floor((difference % (1000 * 60 * 60)) / (1000 * 60)); + const seconds = Math.floor((difference % (1000 * 60)) / 1000); + + let timeString = ''; + if (days > 0) timeString += `${days}d `; + timeString += `${hours.toString().padStart(2, '0')}h ${minutes.toString().padStart(2, '0')}m ${seconds.toString().padStart(2, '0')}s`; + setTimeLeft(timeString); + } + }, 1000); + + return () => clearInterval(interval); + }, [expiresAt]); + + if (!announcement && !isLoading) return null; + if (!announcement) return null; + + return ( +
+
+ +
+
+ +
+

+ Información Importante + +

+
+ +
+ {announcement} +
+ + {timeLeft && ( +
+ + Expira en: {timeLeft} +
+ )} +
+
+ ); +} diff --git a/src/components/AuthorSelector.tsx b/src/components/AuthorSelector.tsx new file mode 100644 index 0000000000000000000000000000000000000000..22b1d0276d0361fd79281656af9854e23b5410df --- /dev/null +++ b/src/components/AuthorSelector.tsx @@ -0,0 +1,191 @@ +import { useState, useRef, useEffect, useMemo } from 'react'; +import { X, Check, User, Trash2, Plus } from 'lucide-react'; + +interface AuthorSelectorProps { + label: string; + authors: string[]; + value: string[]; + onChange: (authors: string[]) => void; + onDelete?: (author: string) => void; + placeholder?: string; + colorClass?: string; +} + +export function AuthorSelector({ + label, + authors, + value, + onChange, + onDelete, + placeholder = 'Añadir autor...', + colorClass = 'text-gray-400' +}: AuthorSelectorProps) { + const [inputValue, setInputValue] = useState(''); + const [isOpen, setIsOpen] = useState(false); + const containerRef = useRef(null); + + // Filter suggestions based on input + const suggestions = useMemo(() => { + if (!inputValue.trim()) return authors; + return authors.filter(author => + author.toLowerCase().includes(inputValue.toLowerCase()) + ); + }, [authors, inputValue]); + + // Handle click outside to close dropdown + useEffect(() => { + const handleClickOutside = (event: MouseEvent) => { + if (containerRef.current && !containerRef.current.contains(event.target as Node)) { + setIsOpen(false); + } + }; + + document.addEventListener('mousedown', handleClickOutside); + return () => document.removeEventListener('mousedown', handleClickOutside); + }, []); + + const handleKeyDown = (e: React.KeyboardEvent) => { + if (e.key === 'Enter') { + e.preventDefault(); + handleAction(); + } + }; + + const handleAction = () => { + const _val = inputValue.trim(); + if (!_val) return; + + if (!value.includes(_val)) { + onChange([...value, _val]); + } + + setInputValue(''); + setIsOpen(false); + }; + + const handleSelect = (authorName: string) => { + const trimmed = authorName.trim(); + if (trimmed && !value.includes(trimmed)) { + onChange([...value, trimmed]); + } + setInputValue(''); + setIsOpen(false); + }; + + const handleRemove = (authorName: string) => { + onChange(value.filter(a => a !== authorName)); + }; + + const handleDeleteClick = (e: React.MouseEvent, author: string) => { + e.stopPropagation(); + e.preventDefault(); + if (onDelete) { + onDelete(author); + } + }; + + return ( +
+ + +
+
+
+
+ +
+ { + setInputValue(e.target.value); + setIsOpen(true); + }} + onFocus={() => setIsOpen(true)} + onKeyDown={handleKeyDown} + placeholder={placeholder} + className="w-full bg-[#1a1a1a] border border-gray-600/50 rounded-lg pl-10 pr-10 py-2.5 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-[#bb86fc] transition-all" + /> + {inputValue && ( + + )} +
+ +
+ + {/* Dropdown Suggestions */} + {isOpen && (suggestions.length > 0 || inputValue) && ( +
+ {suggestions.length > 0 ? ( + suggestions.map((author, index) => { + const isSelected = value.includes(author); + return ( +
{ + e.preventDefault(); + handleSelect(author); + }} + > + + {author} + +
+ {isSelected && } + {onDelete && ( + + )} +
+
+ ); + }) + ) : ( +
+

No encontrado.

+ +
+ )} +
+ )} +
+ + {/* Selected Tags */} +
+ {value.map((author, idx) => ( + + {author} + + + ))} +
+ + {/* Helper text */} +

+ {value.length > 0 ? `Autores seleccionados: ${value.join(', ')}` : 'Deja en blanco para no modificar el autor.'} +

+
+ ); +} diff --git a/src/components/BulkCategoryModal.tsx b/src/components/BulkCategoryModal.tsx new file mode 100644 index 0000000000000000000000000000000000000000..f86fe6a901888a398dfbf06a9ce274664bec4d1b --- /dev/null +++ b/src/components/BulkCategoryModal.tsx @@ -0,0 +1,409 @@ +import { X, Save } from 'lucide-react'; +import { toast } from 'sonner'; +import { useState, useEffect } from 'react'; +import { Category } from '../types/manga'; +import { createCategory, getAllCategories, updateManga, getMangaById, deleteCategory, getAllAuthors, deleteAuthorByName } from '../services/manga'; +import { LoadingSpinner } from './LoadingSpinner'; +import { CategorySelector } from './CategorySelector'; +import { AuthorSelector } from './AuthorSelector'; + +interface BulkCategoryModalProps { + isOpen: boolean; + onClose: () => void; + selectedMangaIds: string[]; + onSaveComplete: () => void; +} + +export function BulkCategoryModal({ isOpen, onClose, selectedMangaIds, onSaveComplete }: BulkCategoryModalProps) { + const [categories, setCategories] = useState([]); + const [selectedCategories, setSelectedCategories] = useState([]); + + // Author state + const [authors, setAuthors] = useState([]); + const [selectedAuthors, setSelectedAuthors] = useState([]); + + const [applyDecensored, setApplyDecensored] = useState(false); + const [applyBn, setApplyBn] = useState(false); + const [applyColor, setApplyColor] = useState(false); + + const [isSaving, setIsSaving] = useState(false); + const [isLoading, setIsLoading] = useState(false); + + useEffect(() => { + if (isOpen) { + loadCategories(); + setSelectedCategories([]); // Reset selection on open + setSelectedAuthors([]); // Reset author on open + setApplyDecensored(false); + setApplyBn(false); + setApplyColor(false); + } + }, [isOpen]); + + const loadCategories = async () => { + try { + setIsLoading(true); + const data = await getAllCategories(); + setCategories(data); + + // Load authors - Optimized call + const uniqueAuthors = await getAllAuthors(); + setAuthors(uniqueAuthors); + } catch (error) { + console.error('Error loading categories:', error); + } finally { + setIsLoading(false); + } + }; + + const handleCreateCategory = async (name: string, type: 'character' | 'series' | 'genre' | 'tag') => { + if (!name.trim()) return; + + // Special handling for tags: split by space + if (type === 'tag') { + const tagNames = name.split(' ').map(t => t.trim()).filter(t => t.length > 0); + + // Allow multiple creations in parallel or sequential. + for (const tagName of tagNames) { + await processSingleCategory(tagName, type); + } + return; + } + + await processSingleCategory(name, type); + }; + + const processSingleCategory = async (name: string, type: 'character' | 'series' | 'genre' | 'tag') => { + try { + const existingCategory = categories.find( + cat => cat.name.toLowerCase() === name.trim().toLowerCase() && cat.type === type + ); + + if (existingCategory) { + setSelectedCategories(prev => { + if (!prev.includes(existingCategory.id)) return [...prev, existingCategory.id]; + return prev; + }); + } else { + const newCategory = await createCategory(name.trim(), type); + setCategories(prev => { + if (prev.find(c => c.id === newCategory.id)) return prev; + return [...prev, newCategory]; + }); + setSelectedCategories(prev => { + if (!prev.includes(newCategory.id)) return [...prev, newCategory.id]; + return prev; + }); + } + } catch (error) { + console.error('Error creating category:', error); + } + }; + + const handleRemoveCategory = (categoryId: string) => { + setSelectedCategories(prev => prev.filter(id => id !== categoryId)); + }; + + const handleDeleteCategory = async (id: string) => { + try { + await deleteCategory(id); + setCategories(prev => prev.filter(c => c.id !== id)); + // Also remove from selection if selected + setSelectedCategories(prev => prev.filter(catId => catId !== id)); + } catch (error) { + console.error('Error deleting category:', error); + toast.error('Error al eliminar la categoría'); + } + }; + + const handleDeleteAuthor = (authorName: string) => { + toast(`¿Eliminar al autor "${authorName}" permanentemente?`, { + description: 'Se eliminará este autor de TODOS los mangas. Esta acción no se puede deshacer.', + action: { + label: 'Eliminar', + onClick: async () => { + try { + setIsLoading(true); // Show loading state + await deleteAuthorByName(authorName); + toast.success(`Autor "${authorName}" eliminado correctamente.`); + + // Refresh authors list + setAuthors(prev => prev.filter(a => a !== authorName)); + if (selectedAuthors.includes(authorName)) { + setSelectedAuthors(prev => prev.filter(a => a !== authorName)); + } + + } catch (error) { + console.error('Error deleting author:', error); + toast.error('Error al eliminar el autor.'); + } finally { + setIsLoading(false); + } + }, + }, + cancel: { + label: 'Cancelar', + onClick: () => { }, + }, + duration: 5000, + }); + }; + + const handleSave = async () => { + if (selectedCategories.length === 0 && selectedAuthors.length === 0 && !applyDecensored && !applyBn && !applyColor) { + toast.error('Selecciona al menos una categoría, autor o clasificación para aplicar.'); + return; + } + + setIsSaving(true); + try { + // Process all mangas + // Strategy: Fetch current manga data (to get existing categories), append new ones unique, update. + // This ensures we don't overwrite existing categories that are NOT in the selection. + + const updatePromises = selectedMangaIds.map(async (mangaId) => { + try { + const manga = await getMangaById(mangaId); + if (!manga) return; + + const existingIds = manga.categories?.map(c => c.id) || []; + // Merge existing with selected, avoid duplicates + const mergedIds = Array.from(new Set([...existingIds, ...selectedCategories])); + + const updateData: any = { + title: manga.title, + author: manga.author, + categoryIds: mergedIds + }; + + // Update author if selected + if (selectedAuthors.length > 0) { + updateData.author = selectedAuthors.join(', '); + } + + if (applyDecensored) updateData.is_decensored = true; + if (applyBn) { + updateData.is_bn = true; + updateData.is_color = false; + } + if (applyColor) { + updateData.is_color = true; + updateData.is_bn = false; + } + + await updateManga(mangaId, updateData); + } catch (err) { + console.error(`Error updating manga ${mangaId}`, err); + } + }); + + await Promise.all(updatePromises); + toast.success('Categorías aplicadas correctamente.'); + onSaveComplete(); + onClose(); + + } catch (error) { + console.error('Error bulk updating mangas:', error); + toast.error('Error al aplicar cambios.'); + } finally { + setIsSaving(false); + } + }; + + if (!isOpen) return null; + + return ( +
+
+ + {/* Header */} +
+

+ Aplicar Categorías a {selectedMangaIds.length} Mangas +

+ +
+ +
+ {isLoading ? ( +
+ +
+ ) : ( +
+ {/* Autores */} +
+ +
+ + {/* Clasificaciones */} +
+
+
+

Sin censura

+

Marcar todos como sin censura

+
+ +
+ +
+
+

B/N

+

Marcar todos como Blanco y Negro

+
+ +
+ +
+
+

a color

+

Marcar todos como a color

+
+ +
+
+ + {/* Personajes */} + { + if (!selectedCategories.includes(id)) { + setSelectedCategories(prev => [...prev, id]); + } + }} + onRemove={handleRemoveCategory} + onCreate={(name) => handleCreateCategory(name, 'character')} + onDeleteCategory={handleDeleteCategory} + colorClass="text-blue-400" + placeholder="Añadir personaje..." + /> + + {/* Series */} + { + if (!selectedCategories.includes(id)) { + setSelectedCategories(prev => [...prev, id]); + } + }} + onRemove={handleRemoveCategory} + onCreate={(name) => handleCreateCategory(name, 'series')} + onDeleteCategory={handleDeleteCategory} + colorClass="text-green-400" + placeholder="Añadir serie..." + /> + + {/* Géneros */} + { + if (!selectedCategories.includes(id)) { + setSelectedCategories(prev => [...prev, id]); + } + }} + onRemove={handleRemoveCategory} + onCreate={(name) => handleCreateCategory(name, 'genre')} + onDeleteCategory={handleDeleteCategory} + colorClass="text-purple-400" + placeholder="Añadir género..." + /> + + {/* Etiquetas */} + { + if (!selectedCategories.includes(id)) { + setSelectedCategories(prev => [...prev, id]); + } + }} + onRemove={handleRemoveCategory} + onCreate={(name) => handleCreateCategory(name, 'tag')} + onDeleteCategory={handleDeleteCategory} + colorClass="text-pink-400" + placeholder="Añadir etiqueta..." + /> +
+ )} +
+ +
+ + +
+ +
+
+ ); +} diff --git a/src/components/BulkEditTitleModal.tsx b/src/components/BulkEditTitleModal.tsx new file mode 100644 index 0000000000000000000000000000000000000000..8543cd39816062c563d6592068dc2446b0db0476 --- /dev/null +++ b/src/components/BulkEditTitleModal.tsx @@ -0,0 +1,204 @@ +import { useState, useMemo, useEffect } from 'react'; +import { X, Search, Save, Edit3 } from 'lucide-react'; +import { Manga } from '../types/manga'; +import { toast } from 'sonner'; +import { updateMangaTitles } from '../services/manga'; +import { getThumbnailUrl } from '../utils/imageUtils'; + +interface BulkEditTitleModalProps { + isOpen: boolean; + onClose: () => void; + mangas: Manga[]; + selectedMangaIds: string[]; + onSaveComplete: () => void; +} + +export function BulkEditTitleModal({ isOpen, onClose, mangas, selectedMangaIds, onSaveComplete }: BulkEditTitleModalProps) { + const [searchTerm, setSearchTerm] = useState(''); + const [bulkName, setBulkName] = useState(''); + const [edits, setEdits] = useState>({}); + const [isSaving, setIsSaving] = useState(false); + + useEffect(() => { + if (isOpen) { + setSearchTerm(''); + setBulkName(''); + setEdits({}); + } + }, [isOpen]); + + const handleApplyBulkName = () => { + if (!bulkName.trim()) return; + const newEdits = { ...edits }; + mangas.filter(m => selectedMangaIds.includes(m.id)).forEach(m => { + newEdits[m.id] = bulkName; + }); + setEdits(newEdits); + toast.success(`Nombre aplicado a ${selectedMangaIds.length} mangas localmente`); + }; + + const sortedAndFilteredMangas = useMemo(() => { + let result = mangas.filter(m => selectedMangaIds.includes(m.id)); + if (searchTerm) { + const lowerQuery = searchTerm.toLowerCase(); + result = result.filter(m => m.title.toLowerCase().includes(lowerQuery)); + } + return result.sort((a, b) => a.title.localeCompare(b.title)); + }, [mangas, selectedMangaIds, searchTerm]); + + const handleTitleChange = (id: string, newTitle: string) => { + setEdits(prev => ({ + ...prev, + [id]: newTitle + })); + }; + + const handleSave = async () => { + const modifications = Object.entries(edits).filter(([id, newTitle]) => { + const originalManga = mangas.find(m => m.id === id); + return originalManga && originalManga.title !== newTitle.trim() && newTitle.trim() !== ''; + }); + + if (modifications.length === 0) { + toast.info('No hay cambios para guardar'); + return; + } + + try { + setIsSaving(true); + const updates = modifications.map(([id, title]) => ({ id, title: title.trim() })); + await updateMangaTitles(updates); + toast.success(`Se actualizaron ${updates.length} nombres correctamente`); + onSaveComplete(); + onClose(); + } catch (error) { + console.error('Error saving titles:', error); + toast.error('Error al guardar los cambios'); + } finally { + setIsSaving(false); + } + }; + + if (!isOpen) return null; + + return ( +
+
+
+
+
+ +
+
+

Editar Nombres

+

Edita los títulos de los {selectedMangaIds.length} mangas seleccionados

+
+
+ +
+ +
+
+ + setSearchTerm(e.target.value)} + placeholder="Filtrar manga por título..." + className="w-full bg-[#1a1a1a] border border-gray-700 rounded-xl pl-10 pr-4 py-3 text-sm text-white focus:outline-none focus:border-pink-500 transition-colors" + /> +
+
+ setBulkName(e.target.value)} + placeholder="Pon un nombre para aplicar a todos los seleccionados (Opcional)" + className="flex-1 bg-[#1a1a1a] border border-gray-700 rounded-xl px-4 py-3 text-sm text-white focus:outline-none focus:border-pink-500 transition-colors" + /> + +
+
+ +
+ {sortedAndFilteredMangas.map((manga) => { + const originalSrc = manga.cover_url || manga.thumbnail_url; + const optimizedSrc = originalSrc ? getThumbnailUrl(originalSrc) : undefined; + return ( +
+ {optimizedSrc ? ( + + ) : ( +
+ Sin img +
+ )} +
+ handleTitleChange(manga.id, e.target.value)} + className={`w-full bg-transparent border-b pl-2 py-1 text-sm focus:outline-none transition-colors ${ + edits[manga.id] !== undefined && edits[manga.id].trim() !== manga.title + ? 'border-pink-500 text-pink-300' + : 'border-transparent hover:border-gray-700 text-white focus:border-gray-600' + }`} + placeholder="Título del manga" + /> +
+
+ ); + })} + {sortedAndFilteredMangas.length === 0 && ( +
+ No se encontraron mangas con ese nombre en la selección +
+ )} +
+ +
+ + {Object.keys(edits).filter(id => edits[id].trim() !== mangas.find(m => m.id === id)?.title).length} cambios pendientes + +
+ + +
+
+
+
+ ); +} diff --git a/src/components/BulkRemoveCategoryModal.tsx b/src/components/BulkRemoveCategoryModal.tsx new file mode 100644 index 0000000000000000000000000000000000000000..7cd6e84fb5aa372200f76f85d99b52cf2083f872 --- /dev/null +++ b/src/components/BulkRemoveCategoryModal.tsx @@ -0,0 +1,265 @@ +import { X, Save, Trash2 } from 'lucide-react'; +import { toast } from 'sonner'; +import { useState, useEffect } from 'react'; +import { Category, Manga } from '../types/manga'; +import { updateManga, getMangaById } from '../services/manga'; +import { LoadingSpinner } from './LoadingSpinner'; + +interface BulkRemoveCategoryModalProps { + isOpen: boolean; + onClose: () => void; + selectedMangaIds: string[]; + onSaveComplete: () => void; +} + +export function BulkRemoveCategoryModal({ isOpen, onClose, selectedMangaIds, onSaveComplete }: BulkRemoveCategoryModalProps) { + const [availableCategories, setAvailableCategories] = useState([]); + const [availableAuthors, setAvailableAuthors] = useState([]); + + // The items the user selects TO REMOVE + const [selectedCategoryIdsToRemove, setSelectedCategoryIdsToRemove] = useState([]); + const [selectedAuthorsToRemove, setSelectedAuthorsToRemove] = useState([]); + + const [isSaving, setIsSaving] = useState(false); + const [isLoading, setIsLoading] = useState(false); + + useEffect(() => { + if (isOpen) { + loadMangasData(); + setSelectedCategoryIdsToRemove([]); + setSelectedAuthorsToRemove([]); + } + }, [isOpen]); + + const loadMangasData = async () => { + try { + setIsLoading(true); + const mangasData: (Manga | null)[] = await Promise.all( + selectedMangaIds.map(id => getMangaById(id).catch(() => null)) + ); + + const validMangas = mangasData.filter(Boolean) as Manga[]; + + const catMap = new Map(); + const authorSet = new Set(); + + validMangas.forEach(manga => { + if (manga.author) authorSet.add(manga.author); + if (manga.categories) { + manga.categories.forEach(cat => catMap.set(cat.id, cat)); + } + }); + + setAvailableCategories(Array.from(catMap.values())); + setAvailableAuthors(Array.from(authorSet)); + + } catch (error) { + console.error('Error loading mangas data:', error); + toast.error('Error al cargar datos de los mangas'); + } finally { + setIsLoading(false); + } + }; + + const toggleCategoryRemove = (id: string) => { + setSelectedCategoryIdsToRemove(prev => + prev.includes(id) ? prev.filter(c => c !== id) : [...prev, id] + ); + }; + + const toggleAuthorRemove = (author: string) => { + setSelectedAuthorsToRemove(prev => + prev.includes(author) ? prev.filter(a => a !== author) : [...prev, author] + ); + }; + + const handleSave = async () => { + if (selectedCategoryIdsToRemove.length === 0 && selectedAuthorsToRemove.length === 0) { + toast.error('Selecciona al menos una categoría o autor para eliminar.'); + return; + } + + setIsSaving(true); + try { + const updatePromises = selectedMangaIds.map(async (mangaId) => { + try { + const manga = await getMangaById(mangaId); + if (!manga) return; + + let needsUpdate = false; + const updateData: any = { + title: manga.title, + author: manga.author + }; + + if (selectedAuthorsToRemove.includes(manga.author)) { + updateData.author = 'Desconocido'; + needsUpdate = true; + } + + if (manga.categories && manga.categories.length > 0) { + const existingIds = manga.categories.map(c => c.id); + const newIds = existingIds.filter(id => !selectedCategoryIdsToRemove.includes(id)); + + if (newIds.length !== existingIds.length) { + updateData.categoryIds = newIds; + needsUpdate = true; + } else { + updateData.categoryIds = existingIds; + } + } else { + updateData.categoryIds = []; + } + + if (needsUpdate) { + await updateManga(mangaId, updateData); + } + } catch (err) { + console.error(`Error updating manga ${mangaId}`, err); + } + }); + + await Promise.all(updatePromises); + toast.success('Categorías eliminadas de los mangas correctamente.'); + onSaveComplete(); + onClose(); + + } catch (error) { + console.error('Error bulk updating mangas:', error); + toast.error('Error al aplicar cambios.'); + } finally { + setIsSaving(false); + } + }; + + if (!isOpen) return null; + + const renderCategorySection = (type: 'character' | 'series' | 'genre' | 'tag', title: string, colorClass: string) => { + const typeCategories = availableCategories.filter(c => c.type === type); + if (typeCategories.length === 0) return null; + + return ( +
+ {title} +
+ {typeCategories.map(cat => { + const isSelected = selectedCategoryIdsToRemove.includes(cat.id); + return ( + + ); + })} +
+
+ ); + }; + + return ( +
+
+ + {/* Header */} +
+

+ + Remover Categorías en {selectedMangaIds.length} Mangas +

+ +
+ +
+ {isLoading ? ( +
+ +

Escaneando mangas seleccionados...

+
+ ) : availableCategories.length === 0 && availableAuthors.length === 0 ? ( +
+ +

Sin categorías

+

Los mangas seleccionados no tienen autores ni categorías para remover.

+
+ ) : ( +
+

+ Selecciona los autores y categorías que deseas eliminar de los mangas seleccionados. +

+ + {/* Autores */} + {availableAuthors.length > 0 && ( +
+ Autor +
+ {availableAuthors.map(author => { + const isSelected = selectedAuthorsToRemove.includes(author); + return ( + + ); + })} +
+

* Remover al autor lo dejará como "Desconocido".

+
+ )} + + {/* Categorías */} + {renderCategorySection('character', 'Personajes', 'text-blue-400')} + {renderCategorySection('series', 'Series', 'text-green-400')} + {renderCategorySection('genre', 'Géneros', 'text-purple-400')} + {renderCategorySection('tag', 'Etiquetas', 'text-pink-400')} +
+ )} +
+ +
+ + +
+ +
+
+ ); +} diff --git a/src/components/CategoryFilterModal.tsx b/src/components/CategoryFilterModal.tsx new file mode 100644 index 0000000000000000000000000000000000000000..bfde526b4835a5d62b29035ad9159845eceeac51 --- /dev/null +++ b/src/components/CategoryFilterModal.tsx @@ -0,0 +1,227 @@ +import { X, Search, Check, Filter } from 'lucide-react'; +import { useState, useMemo } from 'react'; +import { Category } from '../types/manga'; + +interface CategoryFilterModalProps { + isOpen: boolean; + onClose: () => void; + categories: Category[]; + selectedCategories: string[]; + onToggleCategory: (categoryName: string) => void; + onClearFilters: () => void; + filterDecensored: boolean; + setFilterDecensored: (val: boolean) => void; + filterBN: boolean; + setFilterBN: (val: boolean) => void; + filterColor: boolean; + setFilterColor: (val: boolean) => void; +} + +const CATEGORY_TYPE_ORDER = ['series', 'character', 'genre', 'tag', 'other']; +const TYPE_LABELS: Record = { + series: 'Series', + character: 'Personajes', + genre: 'Géneros', + tag: 'Etiquetas', + other: 'Otros', +}; + +export function CategoryFilterModal({ + isOpen, + onClose, + categories, + selectedCategories, + onToggleCategory, + onClearFilters, + filterDecensored, + setFilterDecensored, + filterBN, + setFilterBN, + filterColor, + setFilterColor, +}: CategoryFilterModalProps) { + const [searchTerm, setSearchTerm] = useState(''); + + const groupedCategories = useMemo(() => { + const filtered = categories.filter(c => + c.name.toLowerCase().includes(searchTerm.toLowerCase()) + ); + + const groups: Record = {}; + + // Initialize groups + CATEGORY_TYPE_ORDER.forEach(type => { + groups[type] = []; + }); + groups['other'] = []; // Ensure 'other' exists + + filtered.forEach(cat => { + const type = cat.type || 'other'; + if (!groups[type]) { + groups[type] = []; + } + groups[type].push(cat); + }); + + return groups; + }, [categories, searchTerm]); + + if (!isOpen) return null; + + return ( +
+
e.stopPropagation()} + > + {/* Header */} +
+
+
+ +
+
+

Filtrar por Categorías

+

Selecciona múltiples opciones para refinar tu búsqueda

+
+
+ +
+ + {/* Search Bar */} +
+
+ + setSearchTerm(e.target.value)} + className="w-full bg-[#0f0f0f] border border-gray-700/50 rounded-lg pl-10 pr-4 py-2.5 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-purple-500/50 focus:ring-1 focus:ring-purple-500/50 transition-all" + /> +
+
+ + {/* Categories Content */} +
+ {/* Special Filters */} +
+

+ + Propiedades Especiales +

+
+ + + + + +
+
+ + {CATEGORY_TYPE_ORDER.map((type) => { + const groupCategories = groupedCategories[type]; + if (!groupCategories || groupCategories.length === 0) return null; + + return ( +
+

+ + {TYPE_LABELS[type] || type} +

+
+ {groupCategories.sort((a, b) => a.name.localeCompare(b.name)).map((category) => { + const isSelected = selectedCategories.includes(category.name); + return ( + + ); + })} +
+
+ ); + })} + + {/* Show message if no results logic could be added here if needed */} +
+ + {/* Footer */} +
+
+ {selectedCategories.length + (filterDecensored ? 1 : 0) + (filterBN ? 1 : 0) + (filterColor ? 1 : 0)} filtros activos +
+
+ {(selectedCategories.length > 0 || filterDecensored || filterBN || filterColor) && ( + + )} + +
+
+
+
+ ); +} diff --git a/src/components/CategorySelector.tsx b/src/components/CategorySelector.tsx new file mode 100644 index 0000000000000000000000000000000000000000..573ef34cefd9d40242693d68d5f97f83a6ca4ae0 --- /dev/null +++ b/src/components/CategorySelector.tsx @@ -0,0 +1,216 @@ +import { useState, useRef, useEffect, useMemo } from 'react'; +import { toast } from 'sonner'; +import { X, Plus, Trash2, Check } from 'lucide-react'; +import { Category } from '../types/manga'; + +interface CategorySelectorProps { + label: string; + type: 'character' | 'series' | 'genre' | 'tag'; + categories: Category[]; + selectedIds: string[]; + onSelect: (id: string) => void; + onRemove: (id: string) => void; + onCreate: (name: string) => void; + onDeleteCategory: (id: string) => void; + colorClass: string; // e.g., 'text-blue-400', 'bg-blue-500' + placeholder?: string; +} + +export function CategorySelector({ + label, + type, + categories, + selectedIds, + onSelect, + onRemove, + onCreate, + onDeleteCategory, + colorClass, + placeholder = 'Añadir...' +}: CategorySelectorProps) { + const [inputValue, setInputValue] = useState(''); + const [isOpen, setIsOpen] = useState(false); + const containerRef = useRef(null); + + // Filter categories by type + const typeCategories = useMemo(() => + categories.filter(c => c.type === type || (!c.type && type === 'genre')), + [categories, type]); + + // Filter suggestions based on input + const suggestions = useMemo(() => { + if (!inputValue.trim()) return typeCategories; + return typeCategories.filter(c => + c.name.toLowerCase().includes(inputValue.toLowerCase()) + ); + }, [typeCategories, inputValue]); + + // Handle click outside to close dropdown + useEffect(() => { + const handleClickOutside = (event: MouseEvent) => { + if (containerRef.current && !containerRef.current.contains(event.target as Node)) { + setIsOpen(false); + } + }; + + document.addEventListener('mousedown', handleClickOutside); + return () => document.removeEventListener('mousedown', handleClickOutside); + }, []); + + const handleKeyDown = (e: React.KeyboardEvent) => { + if (e.key === 'Enter') { + e.preventDefault(); + handleAction(); + } + }; + + const handleAction = () => { + if (!inputValue.trim()) return; + + // Check for exact match (case insensitive) + const existing = typeCategories.find( + c => c.name.toLowerCase() === inputValue.trim().toLowerCase() + ); + + if (existing) { + if (!selectedIds.includes(existing.id)) { + onSelect(existing.id); + } + } else { + onCreate(inputValue.trim()); + } + setInputValue(''); + setIsOpen(false); + }; + + const handleDeleteClick = (e: React.MouseEvent, catId: string) => { + e.stopPropagation(); + toast('¿Eliminar esta categoría permanentemente?', { + description: 'Esta acción no se puede deshacer.', + action: { + label: 'Eliminar', + onClick: () => onDeleteCategory(catId), + }, + cancel: { + label: 'Cancelar', + onClick: () => { }, + }, + duration: 5000, + }); + }; + + // Get color classes + const getColors = () => { + if (colorClass.includes('blue')) return { bg: 'bg-blue-500/20', text: 'text-blue-300', border: 'border-blue-500/30' }; + if (colorClass.includes('green')) return { bg: 'bg-green-500/20', text: 'text-green-300', border: 'border-green-500/30' }; + if (colorClass.includes('purple')) return { bg: 'bg-purple-500/20', text: 'text-purple-300', border: 'border-purple-500/30' }; + if (colorClass.includes('pink')) return { bg: 'bg-pink-500/20', text: 'text-pink-300', border: 'border-pink-500/30' }; + return { bg: 'bg-gray-500/20', text: 'text-gray-300', border: 'border-gray-500/30' }; + }; + + const colors = getColors(); + + return ( +
+ + +
+
+
+ { + setInputValue(e.target.value); + setIsOpen(true); + }} + onFocus={() => setIsOpen(true)} + onKeyDown={handleKeyDown} + placeholder={placeholder} + className="w-full bg-[#1a1a1a] border border-gray-600/50 rounded-lg px-4 py-2 text-sm text-white placeholder-gray-500 focus:outline-none focus:border-[#bb86fc] transition-all" + /> + {inputValue && ( + + )} +
+ +
+ + {/* Dropdown Suggestions */} + {isOpen && (suggestions.length > 0 || inputValue) && ( +
+ {suggestions.length > 0 ? ( + suggestions.map(cat => { + const isSelected = selectedIds.includes(cat.id); + return ( +
{ + if (!isSelected) { + onSelect(cat.id); + setInputValue(''); + setIsOpen(false); + } + }} + > + + {cat.name} + +
+ {isSelected && } + +
+
+ ); + }) + ) : ( +
+

No encontrado.

+ +
+ )} +
+ )} +
+ + {/* Selected Tags */} +
+ {selectedIds.map(catId => { + const category = categories.find(c => c.id === catId); + // Only show if it matches the current selector type + if (!category || (category.type !== type && !(type === 'genre' && !category.type))) return null; + + return ( + + {category.name} + + + ); + })} +
+
+ ); +} diff --git a/src/components/ChapterReader.tsx b/src/components/ChapterReader.tsx new file mode 100644 index 0000000000000000000000000000000000000000..70c1712887f5ff2b85c938f0c3a3270a6a5fa493 --- /dev/null +++ b/src/components/ChapterReader.tsx @@ -0,0 +1,129 @@ +import { ArrowLeft, ChevronLeft, ChevronRight } from 'lucide-react'; +import { useState } from 'react'; +import { Chapter, Manga } from '../types/manga'; +import { ImageLoader } from './ImageLoader'; +import { GlobalFooter } from './GlobalFooter'; + +import { getReaderUrl } from '../utils/imageUtils'; + +interface ChapterReaderProps { + manga: Manga; + chapter: Chapter; + onBack: () => void; +} + +export function ChapterReader({ manga, chapter, onBack }: ChapterReaderProps) { + const [currentPageIndex, setCurrentPageIndex] = useState(0); + + if (!chapter.pages || chapter.pages.length === 0) { + return ( +
+ +
No hay páginas disponibles
+
+ ); + } + + const handlePrevPage = () => { + if (currentPageIndex > 0) setCurrentPageIndex(currentPageIndex - 1); + }; + + const handleNextPage = () => { + if (currentPageIndex < chapter.pages.length - 1) setCurrentPageIndex(currentPageIndex + 1); + }; + + + return ( +
+
+
+
+ +
+

{manga.title}

+

{chapter.title}

+
+
+
+ {currentPageIndex + 1} / {chapter.pages.length} +
+
+
+ +
+
+ {chapter.pages.map((page, index) => { + // Smart Loading Strategy: + // - Eager load the first 2 pages so they appear instantly. + // - Lazy load the rest so we don't choke the network. + const isPriority = index < 2; + const optimizedSrc = getReaderUrl(page); + + return ( +
+ 0} + /> +
+ ); + })} +
+ +
+
+
+ +
+
+ + +
+ setCurrentPageIndex(parseInt(e.target.value))} + className="w-64 h-2 bg-gray-700 rounded-lg appearance-none cursor-pointer accent-[#bb86fc]" + /> + + {currentPageIndex + 1}/{chapter.pages.length} + +
+ + +
+
+
+ ); +} diff --git a/src/components/ComicDetail.tsx b/src/components/ComicDetail.tsx new file mode 100644 index 0000000000000000000000000000000000000000..ec38a236a367fecfa3988b0d0e5d193aa9cef92e --- /dev/null +++ b/src/components/ComicDetail.tsx @@ -0,0 +1,677 @@ +import { ArrowLeft, PlayCircle, Eye, Tag, Folder, Calendar, PlaySquare, ChevronRight, Send, Video, Server, Search, X } from 'lucide-react'; +import { GlobalFooter } from './GlobalFooter'; +import { toast } from 'sonner'; +import { useState, useEffect } from 'react'; +import { getRecommendations, subscribeToManga, getAllMangas } from '../services/manga'; +import { Manga } from '../types/manga'; +import { LoadingSpinner } from './LoadingSpinner'; +import { ImageLoader } from './ImageLoader'; + +interface ComicDetailProps { + id: string; + onBack: () => void; + onReadChapter?: (chapter: any) => void; + onMangaLoaded?: (manga: Manga) => void; + onNavigateToManga?: (mangaId: string) => void; + onSelectCategory?: (category: string) => void; + onSelectAuthor?: (author: string) => void; + isAdmin?: boolean; + allMangas?: Manga[]; + searchTerm?: string; + onSearchChange?: (value: string) => void; +} + +export function ComicDetail({ id, onBack, onNavigateToManga, onMangaLoaded, onSelectCategory, onSelectAuthor, isAdmin = false, allMangas = [], searchTerm = '', onSearchChange }: ComicDetailProps) { + const [manga, setManga] = useState(null); + const [loading, setLoading] = useState(true); + const [recommendations, setRecommendations] = useState([]); + const [loadingRecommendations, setLoadingRecommendations] = useState(false); + const [collectionItems, setCollectionItems] = useState([]); + const [loadingCollection, setLoadingCollection] = useState(false); + const [activeServerIndex, setActiveServerIndex] = useState(0); + const [playerLoading, setPlayerLoading] = useState(true); + const [isSearchFocused, setIsSearchFocused] = useState(false); + const [localSearchTerm, setLocalSearchTerm] = useState(searchTerm); + + // Update local search term when prop changes (e.g. from global clear) + useEffect(() => { + setLocalSearchTerm(searchTerm); + }, [searchTerm]); + + // Debounce search to home page + useEffect(() => { + if (localSearchTerm !== searchTerm && localSearchTerm.trim() !== '') { + const timer = setTimeout(() => { + onSearchChange?.(localSearchTerm); + }, 800); + return () => clearTimeout(timer); + } + }, [localSearchTerm, searchTerm, onSearchChange]); + + // Reset loading state when server changes + useEffect(() => { + setPlayerLoading(true); + if (!manga) return; + + const available = manga.servers && manga.servers.length > 0 ? manga.servers : (manga.video_url ? [manga.video_url] : []); + const url = available[activeServerIndex] || manga.video_url || ''; + + const isYt = /^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/.test(url); + const isVm = /(?:vimeo\.com\/|player\.vimeo\.com\/video\/)([0-9]+)/.test(url); + const isDr = /\/file\/d\/([a-zA-Z0-9_\-]+)/.test(url); + const isDb = url.includes('dropbox.com'); + const isPh = /viewkey=([a-zA-Z0-9]+)/.test(url); + const isXv = /video\.([a-z0-9]+)/.test(url); + const isSl = url.includes('hf.space') || url.includes('/stream/') || url.includes('player') || url.includes('embed'); + + if (!isYt && !isVm && !isDr && !isDb && !isPh && !isXv && !isSl) { + setPlayerLoading(false); + } + }, [activeServerIndex, id, manga]); + + useEffect(() => { + async function loadCollection() { + setLoadingCollection(true); + try { + const all = allMangas.length > 0 ? allMangas : await getAllMangas(); + let items: Manga[] = []; + + if (manga?.is_folder) { + items = all.filter(m => !m.is_deleted && m.folder_id === manga.id && m.id !== manga.id); + } else if (manga?.folder_id) { + items = all.filter(m => !m.is_deleted && m.folder_id === manga.folder_id && m.id !== manga.folder_id); + } else if (manga) { + const children = all.filter(m => !m.is_deleted && m.folder_id === manga.id); + if (children.length > 0) { + items = [manga, ...children]; + } + } + + if (items.length > 0) { + items.sort((a, b) => { + const sA = a.season ?? 0; + const sB = b.season ?? 0; + if (sA !== sB) return sA - sB; + const eA = Number(a.episode) || 0; + const eB = Number(b.episode) || 0; + if (eA !== eB) return eA - eB; + return a.title.localeCompare(b.title); + }); + } + setCollectionItems(items); + } catch (error) { + console.error('Error loading collection:', error); + } finally { + setLoadingCollection(false); + } + } + + if (manga) { + loadCollection(); + } + }, [manga?.id, manga?.folder_id, manga?.is_folder]); + + useEffect(() => { + let unsubscribe: () => void; + setLoading(true); + + unsubscribe = subscribeToManga(id, (updatedManga) => { + setManga(updatedManga); + if (updatedManga && onMangaLoaded) { + onMangaLoaded(updatedManga); + } + if (updatedManga) { + loadRecommendations(updatedManga); + } + setLoading(false); + }); + + return () => { + if (unsubscribe) unsubscribe(); + }; + }, [id]); + + async function loadRecommendations(currentManga: Manga) { + try { + setLoadingRecommendations(true); + const categoryIds = currentManga.categories?.map(cat => cat.id) || []; + const recs = await getRecommendations(currentManga.id, categoryIds, currentManga.title); + setRecommendations(recs); + } catch (error) { + console.error('Error loading recommendations:', error); + } finally { + setLoadingRecommendations(false); + } + } + + const extractYouTubeId = (url: string) => { + if (!url) return null; + const regExp = /^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/; + const match = url.match(regExp); + return (match && match[2].length === 11) ? match[2] : null; + }; + + const extractVimeoId = (url: string) => { + if (!url) return null; + const match = url.match(/(?:vimeo\.com\/|player\.vimeo\.com\/video\/)([0-9]+)/); + return match ? match[1] : null; + }; + + const extractDriveId = (url: string) => { + if (!url) return null; + const match = url.match(/\/file\/d\/([a-zA-Z0-9_\-]+)/); + return match ? match[1] : null; + }; + + const extractDropboxUrl = (url: string) => { + if (!url) return null; + if (url.includes('dropbox.com')) { + // Reemplaza dl=0 por raw=1 + if (url.includes('dl=0')) { + return url.replace('dl=0', 'raw=1'); + } + return url.includes('?') ? url + '&raw=1' : url + '?raw=1'; + } + return null; + }; + + const extractPornhubId = (url: string) => { + if (!url) return null; + const match = url.match(/viewkey=([a-zA-Z0-9]+)/); + return match ? match[1] : null; + }; + + const extractXvideosId = (url: string) => { + if (!url) return null; + const match = url.match(/video\.([a-z0-9]+)/); + return match ? match[1] : null; + }; + + if (loading) { + return ( +
+ +

Cargando video...

+
+ ); + } + + if (!manga) { + return ( +
+ Video no encontrado + +
+ ); + } + + + const availableServers = manga.servers && manga.servers.length > 0 ? manga.servers : (manga.video_url ? [manga.video_url] : []); + const currentVideoUrl = availableServers[activeServerIndex] || manga.video_url || ''; + + const youtubeId = extractYouTubeId(currentVideoUrl); + const vimeoId = extractVimeoId(currentVideoUrl); + const driveId = extractDriveId(currentVideoUrl); + const dropboxUrl = extractDropboxUrl(currentVideoUrl); + const phId = extractPornhubId(currentVideoUrl); + const xvId = extractXvideosId(currentVideoUrl); + const isStreamLink = currentVideoUrl.includes('hf.space') || currentVideoUrl.includes('/stream/') || currentVideoUrl.includes('player') || currentVideoUrl.includes('embed'); + + const computedThumbnail = manga.thumbnail_url || manga.cover_url || (youtubeId ? `https://img.youtube.com/vi/${youtubeId}/maxresdefault.jpg` : driveId ? `https://drive.google.com/thumbnail?id=${driveId}&sz=w1280-h720` : ''); + + return ( +
+
+
+ + +
+ + setLocalSearchTerm(e.target.value)} + onKeyDown={(e) => { + if (e.key === 'Enter') { + onSearchChange?.(localSearchTerm); + } + }} + onFocus={() => setIsSearchFocused(true)} + onBlur={() => setIsSearchFocused(false)} + className={`w-full bg-[#161616] text-white rounded-xl pl-10 pr-10 py-2.5 text-sm placeholder-gray-500 border transition-all duration-300 ${isSearchFocused ? 'border-[#bb86fc] ring-1 ring-[#bb86fc]/20 bg-[#1a1a1a]' : 'border-gray-800 hover:border-gray-700'} focus:outline-none`} + /> + {localSearchTerm && ( + + )} +
+
+ +
+ {/* SECCIÓN HERO: Portada e Info a la izquierda/derecha */} +
+ {/* Portada Vertical */} +
+
+ {computedThumbnail ? ( + + ) : ( +
+ +
+ )} +
+
+ + {/* Información y Botones */} +
+

+ {manga.title} +

+ + {manga.description && ( +

+ {manga.description} +

+ )} + + {manga.section && ( +
+ + Catálogo: {manga.section === 'peliculas' ? 'Película' : manga.section === 'series' ? 'Serie' : manga.section} +
+ )} + +
+ + + {manga.views || 0} vistas + + + {manga.created_at && ( + + + {new Date(manga.created_at).toLocaleDateString()} + + )} + + {manga.author && manga.author !== 'Anónimo' && manga.author !== 'Anonimo' && ( + + • {manga.author} + + )} +
+ + + + +
+
+ +
+ {/* Columna Principal - Video */} +
+ {/* Selector de Servidores */} + {availableServers.length > 0 && ( +
+ {availableServers.map((_, idx) => ( + + ))} +
+ )} + + {/* Player Container Premium */} +
+ {/* Capa de carga estándar (igual que las portadas) */} + {playerLoading && ( +
+
+
+ )} + +
+ {youtubeId ? ( + + ) : vimeoId ? ( + + ) : driveId ? ( + + ) : phId ? ( + + ) : xvId ? ( + + ) : isStreamLink ? ( +
+ +
+ ) : dropboxUrl ? ( +
+
+ + {/* Información debajo del video */} +
+

+ {manga.title} +

+ + {manga.description && ( +

+ {manga.description} +

+ )} + + {manga.section && ( +
+ + Catálogo: {manga.section === 'peliculas' ? 'Película' : manga.section === 'series' ? 'Serie' : manga.section} +
+ )} + +
+ + + {manga.views || 0} vistas + + + {manga.created_at && ( + + + {new Date(manga.created_at).toLocaleDateString()} + + )} +
+ +
+ + {/* Colección */} + {!loadingCollection && collectionItems.length > 1 && ( +
+
+
+ +
+

Colección

+
+ + {(() => { + const currentIndex = collectionItems.findIndex(m => m.id === manga.id); + const prevItem = currentIndex > 0 ? collectionItems[currentIndex - 1] : null; + const nextItem = currentIndex !== -1 && currentIndex + 1 < collectionItems.length ? collectionItems[currentIndex + 1] : null; + const isSeriesContext = collectionItems.some(m => m.section === 'series' || m.season !== undefined || m.episode !== undefined); + + return ( +
+
+ {prevItem && ( +
{ + window.scrollTo({ top: 0, behavior: 'smooth' }); + if (onNavigateToManga) onNavigateToManga(prevItem.id); + }} + className="flex-1 bg-black/20 hover:bg-[#bb86fc]/5 border border-gray-800/50 hover:border-[#bb86fc]/30 transition-all rounded-xl p-2.5 flex items-center gap-3 cursor-pointer group/prev" + > + +
+ Anterior + {prevItem.title} +
+
+ )} + + {nextItem && ( +
{ + window.scrollTo({ top: 0, behavior: 'smooth' }); + if (onNavigateToManga) onNavigateToManga(nextItem.id); + }} + className="flex-1 bg-black/20 hover:bg-[#bb86fc]/5 border border-gray-800/50 hover:border-[#bb86fc]/30 transition-all rounded-xl p-2.5 flex items-center justify-between cursor-pointer group/next" + > +
+ Siguiente + {nextItem.title} +
+ +
+ )} +
+ +
+ {collectionItems.map((item, idx) => { + const isCurrent = item.id === manga.id; + return ( +
{ + if (!isCurrent && onNavigateToManga) { + window.scrollTo({ top: 0, behavior: 'smooth' }); + onNavigateToManga(item.id); + } + }} + className={`flex-shrink-0 flex items-center gap-2 p-1.5 rounded-lg transition-all snap-start ${isCurrent ? 'bg-[#bb86fc]/10 border border-[#bb86fc]/30 cursor-default' : 'bg-[#1a1a1a]/50 border border-gray-800/50 hover:bg-white/5 hover:border-gray-700 cursor-pointer'} w-[250px] max-w-[80vw]`} + > +
+ {item.thumbnail_url || item.cover_url ? ( + + ) : ( + + )} +
+
+ + {isSeriesContext + ? (((item.season ?? 0) > 0 && (item.episode ?? 0) > 0) ? `T${item.season} • C${item.episode}` : `Cap. ${idx + 1}`) + : `Vid. ${idx + 1}`} + + {item.title} +
+
+ ); + })} +
+
+ ); + })()} + +
+
+ )} +
+ +
+
+
+ +
+ ); +} diff --git a/src/components/ConfirmModal.tsx b/src/components/ConfirmModal.tsx new file mode 100644 index 0000000000000000000000000000000000000000..426a862a2c4ef76900c3bfc9482ea11c4ea0dbe3 --- /dev/null +++ b/src/components/ConfirmModal.tsx @@ -0,0 +1,82 @@ +import { AlertTriangle, X } from 'lucide-react'; + +interface ConfirmModalProps { + isOpen: boolean; + onClose: () => void; + onConfirm: () => void; + title: string; + message: string; + confirmText?: string; + cancelText?: string; + variant?: 'danger' | 'warning' | 'info'; +} + +export function ConfirmModal({ + isOpen, + onClose, + onConfirm, + title, + message, + confirmText = 'Confirmar', + cancelText = 'Cancelar', + variant = 'warning', +}: ConfirmModalProps) { + if (!isOpen) return null; + + const colorClasses = { + danger: 'from-red-500 to-red-600 shadow-red-500/20', + warning: 'from-[#bb86fc] to-[#9966dd] shadow-[#bb86fc]/30', + info: 'from-blue-500 to-blue-600 shadow-blue-500/20', + }; + + const iconClasses = { + danger: 'bg-red-500/10 text-red-500', + warning: 'bg-[#bb86fc]/10 text-[#bb86fc]', + info: 'bg-blue-500/10 text-blue-500', + }; + + return ( +
+
+
+
+
+ +
+

{title}

+
+ +
+ +
+

+ {message} +

+ +
+ + +
+
+
+
+ ); +} diff --git a/src/components/CreateFolderModal.tsx b/src/components/CreateFolderModal.tsx new file mode 100644 index 0000000000000000000000000000000000000000..ac337d166ad8f53ed2dab1dbbd65555e740d8fd1 --- /dev/null +++ b/src/components/CreateFolderModal.tsx @@ -0,0 +1,90 @@ +import { useState } from 'react'; +import { X, FolderPlus } from 'lucide-react'; +import { toast } from 'sonner'; +import { createFolderAndMove } from '../services/manga'; + +interface CreateFolderModalProps { + isOpen: boolean; + onClose: () => void; + selectedMangaIds: string[]; + onSaveComplete: () => void; + currentFolderId?: string | null; + currentSection: 'flow' | 'patreon' | 'onlyfans' | 'grok'; +} + +export function CreateFolderModal({ isOpen, onClose, selectedMangaIds, onSaveComplete, currentFolderId, currentSection }: CreateFolderModalProps) { + const [folderName, setFolderName] = useState(''); + const [isSaving, setIsSaving] = useState(false); + + const handleSave = async () => { + if (!folderName.trim()) { + toast.error('Gamba: Escribe un nombre para la colección'); + return; + } + + try { + setIsSaving(true); + await createFolderAndMove(folderName.trim(), selectedMangaIds, currentFolderId, currentSection); + toast.success(`Colección "${folderName}" creada exitosamente.`); + onSaveComplete(); + onClose(); + setFolderName(''); + } catch (error) { + console.error('Error creating folder:', error); + toast.error('Error al crear la colección'); + } finally { + setIsSaving(false); + } + }; + + if (!isOpen) return null; + + return ( +
+
+
+
+
+ +
+
+

Crear Colección

+

{selectedMangaIds.length} elementos seleccionados

+
+
+ +
+ +
+ setFolderName(e.target.value)} + placeholder="Nombre de la nueva colección" + className="w-full bg-[#1a1a1a] border border-gray-700 rounded-xl px-4 py-3 text-sm text-white focus:outline-none focus:border-purple-500 transition-colors" + autoFocus + /> +
+ +
+ + +
+
+
+ ); +} diff --git a/src/components/EtiquetadoraModal.tsx b/src/components/EtiquetadoraModal.tsx new file mode 100644 index 0000000000000000000000000000000000000000..3cf6f922d3e12add0b57904173598e06cd3fc4ad --- /dev/null +++ b/src/components/EtiquetadoraModal.tsx @@ -0,0 +1,312 @@ +import { X, Save, Tag } from 'lucide-react'; +import { toast } from 'sonner'; +import { useState, useEffect } from 'react'; +import { getMangaById, updateManga } from '../services/manga'; +import { LoadingSpinner } from './LoadingSpinner'; + +interface MangaToggles { + id: string; + title: string; + is_decensored: boolean; + is_bn: boolean; + is_color: boolean; + hasChanged: boolean; +} + +interface EtiquetadoraModalProps { + isOpen: boolean; + onClose: () => void; + selectedMangaIds: string[]; + onSaveComplete: () => void; +} + +export function EtiquetadoraModal({ isOpen, onClose, selectedMangaIds, onSaveComplete }: EtiquetadoraModalProps) { + const [mangas, setMangas] = useState([]); + const [isLoading, setIsLoading] = useState(false); + const [isSaving, setIsSaving] = useState(false); + + // Global toggle states + const [globalDecensored, setGlobalDecensored] = useState(false); + const [globalBn, setGlobalBn] = useState(false); + const [globalColor, setGlobalColor] = useState(false); + + useEffect(() => { + if (isOpen) { + loadMangas(); + setGlobalDecensored(false); + setGlobalBn(false); + setGlobalColor(false); + } + }, [isOpen, selectedMangaIds]); + + const loadMangas = async () => { + setIsLoading(true); + try { + const loaded = await Promise.all( + selectedMangaIds.map(async (id) => { + const manga = await getMangaById(id); + if (!manga) return null; + return { + id: manga.id, + title: manga.title, + is_decensored: !!manga.is_decensored, + is_bn: !!manga.is_bn, + is_color: !!manga.is_color, + hasChanged: false, + } as MangaToggles; + }) + ); + setMangas(loaded.filter(m => m !== null) as MangaToggles[]); + } catch (error) { + console.error('Error loading mangas:', error); + toast.error('Error al cargar la información de los mangas'); + } finally { + setIsLoading(false); + } + }; + + const handleGlobalDecensored = (checked: boolean) => { + setGlobalDecensored(checked); + setMangas(prev => prev.map(m => ({ ...m, is_decensored: checked, hasChanged: true }))); + }; + + const handleGlobalBn = (checked: boolean) => { + setGlobalBn(checked); + if (checked) setGlobalColor(false); + setMangas(prev => prev.map(m => ({ + ...m, + is_bn: checked, + is_color: checked ? false : m.is_color, + hasChanged: true + }))); + }; + + const handleGlobalColor = (checked: boolean) => { + setGlobalColor(checked); + if (checked) setGlobalBn(false); + setMangas(prev => prev.map(m => ({ + ...m, + is_color: checked, + is_bn: checked ? false : m.is_bn, + hasChanged: true + }))); + }; + + const handleIndividualToggle = (id: string, field: 'is_decensored' | 'is_bn' | 'is_color', value: boolean) => { + setMangas(prev => prev.map(m => { + if (m.id !== id) return m; + + const newM = { ...m, [field]: value, hasChanged: true }; + + if (field === 'is_bn' && value) newM.is_color = false; + if (field === 'is_color' && value) newM.is_bn = false; + + return newM; + })); + }; + + const handleSave = async () => { + const changedMangas = mangas.filter(m => m.hasChanged); + + if (changedMangas.length === 0) { + toast.info('No hay cambios para guardar'); + onClose(); + return; + } + + setIsSaving(true); + try { + const promises = changedMangas.map(manga => + updateManga(manga.id, { + is_decensored: manga.is_decensored, + is_bn: manga.is_bn, + is_color: manga.is_color + }) + ); + + await Promise.all(promises); + toast.success(`Se actualizaron las etiquetas de ${changedMangas.length} mangas`); + onSaveComplete(); + onClose(); + } catch (error) { + console.error('Error updating mangas:', error); + toast.error('Ocurrió un error al guardar los cambios'); + } finally { + setIsSaving(false); + } + }; + + if (!isOpen) return null; + + return ( +
+
+ {/* Header */} +
+
+
+ +
+

+ Etiquetadora ({selectedMangaIds.length} mangas) +

+
+ +
+ +
+ {isLoading ? ( +
+ +
+ ) : ( + <> + {/* Global Toggles */} +
+

+ Opciones Generales +

+
+
+ +
+ Sin censura (Todos) +
+
+ +
+ +
+ B/N (Todos) +
+
+ +
+ +
+ a color (Todos) +
+
+
+
+ + {/* Individual Manga List */} +
+

+ Mangas Individuales ({mangas.length}) +

+
+ {mangas.map((manga) => ( +
+
+

+ {manga.title} +

+ {manga.hasChanged && ( + Modificado + )} +
+ +
+
+ + Sin censura +
+ +
+ + B/N +
+ +
+ + a color +
+
+
+ ))} +
+
+ + )} +
+ +
+ + +
+
+
+ ); +} diff --git a/src/components/FolderMentalMapModal.tsx b/src/components/FolderMentalMapModal.tsx new file mode 100644 index 0000000000000000000000000000000000000000..aae2520ea9bff3395081a3aca13d578709c6ad62 --- /dev/null +++ b/src/components/FolderMentalMapModal.tsx @@ -0,0 +1,134 @@ +import { X, Network, Folder, Image as ImageIcon } from 'lucide-react'; +import { useMemo } from 'react'; +import { Manga } from '../types/manga'; + +interface FolderMentalMapModalProps { + isOpen: boolean; + onClose: () => void; + mangas: Manga[]; +} + +interface TreeNode { + item: Manga; + children: TreeNode[]; +} + +export function FolderMentalMapModal({ isOpen, onClose, mangas }: FolderMentalMapModalProps) { + const tree = useMemo(() => { + // Both folders and comics so we get a full map + const nodeMap = new Map(); + + // Initialize nodes + mangas.forEach(m => { + nodeMap.set(m.id, { item: m, children: [] }); + }); + + const roots: TreeNode[] = []; + + // Build hierarchy + mangas.forEach(m => { + const node = nodeMap.get(m.id)!; + if (m.folder_id && nodeMap.has(m.folder_id)) { + nodeMap.get(m.folder_id)!.children.push(node); + } else { + roots.push(node); + } + }); + + return roots; + }, [mangas]); + + if (!isOpen) return null; + + const renderTree = (nodes: TreeNode[], level: number = 0) => { + if (nodes.length === 0) return null; + + // Sort: Folders first, then alphabetically + const sortedNodes = [...nodes].sort((a, b) => { + if (a.item.is_folder && !b.item.is_folder) return -1; + if (!a.item.is_folder && b.item.is_folder) return 1; + return a.item.title.localeCompare(b.item.title); + }); + + return ( +
0 ? '2.5rem' : '0' }}> + {level > 0 && ( +
+ )} + {sortedNodes.map((node, index) => { + const isLast = index === sortedNodes.length - 1; + const isRootLevelFolder = level === 0 && node.item.is_folder; + + return ( +
+ {level > 0 && ( +
+ )} + {level > 0 && isLast && ( +
+ )} +
+
+
+ {node.item.is_folder ? : } +
+
+

{node.item.title}

+ + {node.item.is_folder + ? `Colección (${node.children.length} elementos)` + : `Manga (${node.item.chapters?.length || 0} caps)`} + +
+
+ + {node.children.length > 0 && ( +
+ {renderTree(node.children, level + 1)} +
+ )} +
+
+ ); + })} +
+ ); + }; + + return ( +
+
+
+
+
+ +
+
+

Mapa Mental de Organización

+

Vista general de toda tu estructura de colecciones y mangas

+
+
+ +
+ +
+
+ {renderTree(tree)} +
+
+
+
+ ); +} diff --git a/src/components/GlobalFooter.tsx b/src/components/GlobalFooter.tsx new file mode 100644 index 0000000000000000000000000000000000000000..d329784a908ac9dfdf06f9e2ad329bccea68d8fa --- /dev/null +++ b/src/components/GlobalFooter.tsx @@ -0,0 +1,87 @@ +import { Info, Trash2 } from 'lucide-react'; + +interface GlobalFooterProps { + isAdmin?: boolean; + onOpenTrash?: () => void; +} + +export function GlobalFooter({ isAdmin, onOpenTrash }: GlobalFooterProps) { + return ( +
+ + {/* Left: Live Counter */} + + + {/* Center: Social Links */} +
+ + + + + Twisted Streaming Brody + + + + + + Canal Hub + + + + + + X + + + + + + Patreon + + + {isAdmin && onOpenTrash && ( + + )} +
+ + {/* Right: Copyright (visible only on md screens and up, or pushed down on mobile) */} +
+ Twisted Streaming Brody © {new Date().getFullYear()} +
+
+ ); +} diff --git a/src/components/GrokIcon.tsx b/src/components/GrokIcon.tsx new file mode 100644 index 0000000000000000000000000000000000000000..bcab25defd7c230287bf600209d5707800225a3e --- /dev/null +++ b/src/components/GrokIcon.tsx @@ -0,0 +1,16 @@ +export function GrokIcon({ className = '' }: { className?: string }) { + return ( + + + + ); +} diff --git a/src/components/HDComicViewer.tsx b/src/components/HDComicViewer.tsx new file mode 100644 index 0000000000000000000000000000000000000000..6827a32068ca58e7f02e3e3787f1185648d9ac23 --- /dev/null +++ b/src/components/HDComicViewer.tsx @@ -0,0 +1,207 @@ + +import { ArrowLeft, Rows, Grid2X2, Grid3X3, ZoomIn, ZoomOut, RotateCcw } from 'lucide-react'; +import { useState } from 'react'; +import { Manga } from '../types/manga'; +import { ImageLoader } from './ImageLoader'; +import { ImageLightbox } from './ImageLightbox'; +import { GlobalFooter } from './GlobalFooter'; +import { LazyImageWrapper } from './LazyImageWrapper'; + + +interface HDComicViewerProps { + manga: Manga; + onBack: () => void; +} + +export function HDComicViewer({ manga, onBack }: HDComicViewerProps) { + // Assuming the first chapter contains the full comic pages for "Graphic Novels" / "Doujins" style + // If there are multiple chapters, we might default to the first one or need a selector. + // Given the context of "Ver HD" implies seeing the "book" in full quality. + const chapter = manga.chapters && manga.chapters.length > 0 ? manga.chapters[0] : null; + const pages = chapter ? (chapter.original_pages && chapter.original_pages.length > 0 ? chapter.original_pages : chapter.pages) : []; + + const [viewMode, setViewMode] = useState<'vertical' | 'gallery' | 'grid'>('vertical'); + const [zoomLevel, setZoomLevel] = useState(1); // 1 = 100% + const [lightboxOpen, setLightboxOpen] = useState(false); + const [lightboxIndex, setLightboxIndex] = useState(0); + + if (!pages || pages.length === 0) { + return ( +
+ +
No hay páginas disponibles
+
+ ); + } + + const handleZoomIn = () => setZoomLevel(prev => Math.min(prev + 0.25, 3)); + const handleZoomOut = () => setZoomLevel(prev => Math.max(prev - 0.25, 0.5)); + const handleResetZoom = () => setZoomLevel(1); + + return ( +
+ {/* Sticky Header */} +
+
+ +
+ +
+

+ {manga.title} HD +

+
+ +
+ {/* View Modes */} +
+ + + +
+ + {/* Zoom Controls (Only for Vertical) */} + {viewMode === 'vertical' && ( +
+ + {Math.round(zoomLevel * 100)}% + + +
+ )} +
+
+ + {/* Mobile View Mode Selector (if screen is small) */} +
+
+ + + +
+
+ +
+
+ {pages.map((pageUrl, index) => { + // Use the direct URL to avoid proxy issues, matching ComicDetail behavior. + const src = pageUrl; + + if (viewMode === 'vertical') { + // Calculate width style based on zoom + // Default max-w-5xl is roughly 64rem (1024px). + // We can apply transform or width. Width is safer for layout flow. + // Let's use inline style for width percentage relative to "normal" max-width, or just set max-width. + // Actually, simpler: Wrapper width. + // Better approach: Control the wrapper width directly. + return ( +
1 ? 'none' : '80rem' }}> +
+ + {() => ( + + )} + +
+
+ ); + } + + // Gallery / Grid + return ( +
{ + setLightboxIndex(index); + setLightboxOpen(true); + }} + > + +
+ ); + })} +
+
+ + + + {lightboxOpen && ( + setLightboxOpen(false)} + /> + )} +
+ ); +} diff --git a/src/components/ImageLightbox.tsx b/src/components/ImageLightbox.tsx new file mode 100644 index 0000000000000000000000000000000000000000..e86cb702e0b011785a551949bdbb416c676a0bd3 --- /dev/null +++ b/src/components/ImageLightbox.tsx @@ -0,0 +1,356 @@ +import { ChevronLeft, ChevronRight, X, ZoomIn, ZoomOut, BookOpen, Book } from 'lucide-react'; +import { useState, useEffect, useRef } from 'react'; +import { ImageLoader } from './ImageLoader'; + +interface ImageLightboxProps { + images: string[]; + initialIndex: number; + onClose: () => void; +} + +export function ImageLightbox({ images, initialIndex, onClose }: ImageLightboxProps) { + const [currentIndex, setCurrentIndex] = useState(initialIndex); + const [isBookMode, setIsBookMode] = useState(false); + + // -- Carousel State -- + const [dragOffset, setDragOffset] = useState(0); // Pixels + + + // -- Zoom & Pan -- + const [scale, setScale] = useState(1); + const [position, setPosition] = useState({ x: 0, y: 0 }); + + // -- Interaction State -- + const [isDragging, setIsDragging] = useState(false); + const [dragStart, setDragStart] = useState({ x: 0, y: 0 }); + const [startPinchDist, setStartPinchDist] = useState(null); + const [startScale, setStartScale] = useState(1); + + const containerRef = useRef(null); + + useEffect(() => { + document.body.style.overflow = 'hidden'; + return () => { document.body.style.overflow = 'unset'; }; + }, []); + + // -- Helpers -- + const getWrappedIndex = (index: number) => { + const len = images.length; + return ((index % len) + len) % len; + }; + + const getDistance = (touches: React.TouchList) => { + return Math.hypot( + touches[0].clientX - touches[1].clientX, + touches[0].clientY - touches[1].clientY + ); + }; + + const clampPosition = (pos: { x: number, y: number }, s: number) => { + const width = window.innerWidth; + const height = window.innerHeight; + + // Bounds: (Dimension * Scale - Dimension) / 2 + // If scale < 1, limits are 0 (or negative, but we clamp to 0) + const maxX = (width * s - width) / 2; + const maxY = (height * s - height) / 2; + + return { + x: Math.min(Math.max(pos.x, -maxX), maxX), + y: Math.min(Math.max(pos.y, -maxY), maxY) + }; + }; + + // -- Navigation -- + const stride = isBookMode ? 2 : 1; + + const handlePrevious = () => { + // if (scale > 1) return; // Allow navigation even if zoomed, just reset. + setCurrentIndex(prev => getWrappedIndex(prev - stride)); + setDragOffset(0); + setScale(1); // Reset zoom + setPosition({ x: 0, y: 0 }); // Reset position + }; + + const handleNext = () => { + // if (scale > 1) return; // Allow navigation even if zoomed, just reset. + setCurrentIndex(prev => getWrappedIndex(prev + stride)); + setDragOffset(0); + setScale(1); // Reset zoom + setPosition({ x: 0, y: 0 }); // Reset position + }; + + // -- Interaction Handlers -- + const handleStart = (clientX: number, clientY: number) => { + // if (isAnimating) return; // Removed + setIsDragging(true); + setDragStart({ x: clientX, y: clientY }); + }; + + const handleMove = (clientX: number, clientY: number) => { + if (!isDragging) return; + + if (scale > 1) { + const deltaX = clientX - dragStart.x; + const deltaY = clientY - dragStart.y; + setPosition(prev => ({ x: prev.x + deltaX, y: prev.y + deltaY })); + setDragStart({ x: clientX, y: clientY }); + } else { + const deltaX = clientX - dragStart.x; + setDragOffset(deltaX); + } + }; + + const handleEnd = () => { + setIsDragging(false); + setStartPinchDist(null); + + if (scale > 1) return; + + const width = containerRef.current?.clientWidth || window.innerWidth; + const threshold = width * 0.25; + + if (Math.abs(dragOffset) > threshold) { + if (dragOffset > 0) handlePrevious(); + else handleNext(); + } else { + setDragOffset(0); + } + }; + + // -- Event Listeners -- + const onMouseDown = (e: React.MouseEvent) => { e.preventDefault(); handleStart(e.clientX, e.clientY); }; + const onMouseMove = (e: React.MouseEvent) => { e.preventDefault(); handleMove(e.clientX, e.clientY); }; + const onMouseUp = () => handleEnd(); + + const onTouchStart = (e: React.TouchEvent) => { + if (e.touches.length === 2) { + const dist = getDistance(e.touches); + setStartPinchDist(dist); + setStartScale(scale); + setIsDragging(false); + } else if (e.touches.length === 1) { + handleStart(e.touches[0].clientX, e.touches[0].clientY); + } + }; + + const onTouchMove = (e: React.TouchEvent) => { + if (e.touches.length === 2 && startPinchDist !== null) { + const dist = getDistance(e.touches); + const zoomFactor = dist / startPinchDist; + const newScale = Math.min(Math.max(startScale * zoomFactor, 1), 4); + + setScale(newScale); + setPosition(prev => clampPosition(prev, newScale)); + + } else if (e.touches.length === 1) { + handleMove(e.touches[0].clientX, e.touches[0].clientY); + } + }; + + const onTouchEnd = (e: React.TouchEvent) => { + if (startPinchDist !== null && e.touches.length < 2) { + setStartPinchDist(null); + return; + } + handleEnd(); + }; + + // -- Keyboard -- + useEffect(() => { + function handleKeyDown(e: KeyboardEvent) { + if (e.key === 'Escape') onClose(); + else if (e.key === 'ArrowLeft') handlePrevious(); + else if (e.key === 'ArrowRight') handleNext(); + else if (e.key === '+' || e.key === '=') setScale(p => { const newS = Math.min(p + 0.5, 4); setPosition(prev => clampPosition(prev, newS)); return newS; }); + else if (e.key === '-') setScale(p => { const newS = Math.max(p - 0.5, 1); setPosition(prev => clampPosition(prev, newS)); return newS; }); + } + window.addEventListener('keydown', handleKeyDown); + return () => window.removeEventListener('keydown', handleKeyDown); + }, [scale, isBookMode]); // Removed isAnimating dependency + + // -- Render -- + let transform = `translateX(calc(-33.333333% + ${dragOffset}px))`; + let transition = isDragging ? 'none' : 'transform 0.1s ease-out'; + // If not dragging, we want a tiny snap transition for the dragOffset reset, but NOT for page change. + // Since handlePrevious reset dragOffset to 0 instantly and change index, we might not need transition at all for page change. + // But if we just released a drag and it didn't change page, we want it to snap back. + // Actually, simplest is no transition if we want INSTANT page change. + // But for "snap back" (cancel drag), a small transition is nice. + // Given user wants "no slide on change", we prioritize that. + // Let's set transition only if dragOffset is being animated back to 0 without index change? + // For simplicity and robustness of "no animation", let's use 'none' whenever dragOffset is 0. + + if (dragOffset === 0) { + transition = 'none'; + } + + // Pre-calculate indices for slots + // Slot 1 (Prev): currentIndex - stride + // Slot 2 (Current): currentIndex + // Slot 3 (Next): currentIndex + stride + + const renderSlot = (baseIndex: number) => { + // If Book Mode: render baseIndex and baseIndex+1 + // If Single Mode: render baseIndex + + const img1Index = getWrappedIndex(baseIndex); + + if (!isBookMode) { + return ( + + ); + } else { + const img2Index = getWrappedIndex(baseIndex + 1); + return ( +
+ {/* Page 1 (Left) */} +
+ +
+ {/* Page 2 (Right) */} +
+ +
+
+ ); + } + }; + + return ( +
{ + e.stopPropagation(); + const delta = e.deltaY < 0 ? 0.5 : -0.5; + setScale(p => { + const newS = Math.min(Math.max(p + delta, 1), 4); + setPosition(prev => clampPosition(prev, newS)); + return newS; + }); + }} + onMouseDown={onMouseDown} + onMouseMove={onMouseMove} + onMouseUp={onMouseUp} + onMouseLeave={() => { setIsDragging(false); if (scale === 1) setDragOffset(0); }} + onTouchStart={onTouchStart} + onTouchMove={onTouchMove} + onTouchEnd={onTouchEnd} + > + {/* Controls */} +
+
+ {/* Book Mode Toggle */} + +
+ + + {Math.round(scale * 100)}% + +
+ +
+ + {/* TRACK */} +
+ {/* PREV Slot */} +
+ {renderSlot(currentIndex - stride)} +
+ + {/* CURRENT Slot (Zoomable Container) */} +
+
1 ? (isDragging ? 'grabbing' : 'grab') : 'default', + }} + onDoubleClick={(e) => { e.stopPropagation(); setScale(p => p > 1 ? 1 : 2.5); setPosition({ x: 0, y: 0 }); }} + > + {renderSlot(currentIndex)} +
+
+ + {/* NEXT Slot */} +
+ {renderSlot(currentIndex + stride)} +
+
+ + {/* Navigation Arrows */} + {scale === 1 && ( + <> + + + + )} + +
+ {isBookMode + ? `${currentIndex + 1}-${Math.min(currentIndex + 2, images.length)} / ${images.length}` + : `${currentIndex + 1} / ${images.length}` + } +
+
+ ); +} diff --git a/src/components/ImageLoader.tsx b/src/components/ImageLoader.tsx new file mode 100644 index 0000000000000000000000000000000000000000..e1682d9f71bbba4213d2a6c2fbaa859015f54491 --- /dev/null +++ b/src/components/ImageLoader.tsx @@ -0,0 +1,148 @@ +import { useState, useEffect } from 'react'; +import { RotateCcw, AlertCircle } from 'lucide-react'; + +// Caché global en memoria para recordar qué URLs absolutas ya se cargaron exitosamente +// durante esta sesión del navegador. +const loadedImagesCache = new Set(); + +interface ImageLoaderProps { + src: string; + alt: string; + className?: string; + imgClassName?: string; + objectFit?: 'cover' | 'contain' | 'fill' | 'none' | 'scale-down'; + aspectRatio?: string; + loading?: 'lazy' | 'eager'; + showPlaceholder?: boolean; + draggable?: boolean; + showControls?: boolean; + objectPosition?: string; +} + +export function ImageLoader({ + src, + alt, + className = '', + imgClassName = '', + objectFit = 'contain', + aspectRatio, + loading, + draggable, + showControls = false, + objectPosition +}: ImageLoaderProps) { + // Si la imagen ya está en caché, inicializamos isLoaded en true instantáneamente + const isAlreadyLoaded = loadedImagesCache.has(src); + + // 1. Estados para controlar qué mostrar + const [isLoaded, setIsLoaded] = useState(isAlreadyLoaded); + const [hasError, setHasError] = useState(false); + const [retryCount, setRetryCount] = useState(0); + + // Reiniciar estados si cambia la fuente (por ejemplo, al cambiar de capítulo) + useEffect(() => { + if (loadedImagesCache.has(src)) { + setIsLoaded(true); + setHasError(false); + } else { + setIsLoaded(false); + setHasError(false); + } + setRetryCount(0); + }, [src]); + + const handleRetry = () => { + setHasError(false); + setIsLoaded(false); + setRetryCount(prev => prev + 1); + }; + + const handleLoadSuccess = () => { + setIsLoaded(true); + setHasError(false); + // Añadimos a la caché global + loadedImagesCache.add(src); + }; + + // Añadimos un timestamp o contador falso a la query string para esquivar el caché del navegador + // si es que ya hay reintentos. + const currentSrc = retryCount > 0 + ? `${src}${src.includes('?') ? '&' : '?'}retry=${retryCount}` + : src; + + const isVideo = currentSrc.includes('format=mp4') || currentSrc.toLowerCase().endsWith('.mp4') || currentSrc.toLowerCase().endsWith('.webm'); + + + return ( +
+ + {/* 2. EL SPINNER (Círculo de carga) o ESTADO DE ERROR + Se muestra solo si NO ha terminado de cargar (!isLoaded). + Cuando carga, se vuelve invisible (opacity-0). + */} +
+ {hasError ? ( +
+
+ +
+

La imagen no cargó. El servidor podría tener problemas.

+ +
+ ) : ( +
+ )} +
+ + {/* 3. LA IMAGEN REAL + Empieza invisible (opacity-0). + Cuando se dispara onLoad, pasa a 'opacity-100' creando la animación de aparición. + */} + {!hasError && ( + isVideo ? ( +
+ ); +} diff --git a/src/components/InfoPage.tsx b/src/components/InfoPage.tsx new file mode 100644 index 0000000000000000000000000000000000000000..49a1af77a8ac44dee92780d4ffcb4528e56a09cb --- /dev/null +++ b/src/components/InfoPage.tsx @@ -0,0 +1,184 @@ +import { ArrowLeft, Info, Edit2, Save, X } from 'lucide-react'; +import { useState, useEffect } from 'react'; +import { subscribeToInfo, saveInfo } from '../services/info'; +import ReactMarkdown from 'react-markdown'; +import { toast } from 'sonner'; + +interface InfoPageProps { + onBack: () => void; + isAdmin: boolean; +} + +export function InfoPage({ onBack, isAdmin }: InfoPageProps) { + const [content, setContent] = useState(''); + const [isEditing, setIsEditing] = useState(false); + const [editContent, setEditContent] = useState(''); + const [isLoading, setIsLoading] = useState(true); + + useEffect(() => { + const unsubscribe = subscribeToInfo((data) => { + if (data) { + setContent(data.content); + } + setIsLoading(false); + }); + return () => unsubscribe(); + }, []); + + const handleSave = async () => { + try { + await saveInfo(editContent); + setIsEditing(false); + } catch (error) { + console.error('Error saving info:', error); + toast.error('Error al guardar la información.'); + } + }; + + const startEditing = () => { + setEditContent(content); + setIsEditing(true); + }; + + return ( +
+
+ + +
+ + {isAdmin && !isEditing && ( + + )} + +
+
+ +
+
+

+ Información +

+

+ Sobre Twisted Streaming Brody +

+
+
+ + {isEditing ? ( +
+